LCOV - code coverage report
Current view: top level - source/renderer/backend - IShaderProgram.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 4 6 66.7 %
Date: 2023-01-19 00:18:29 Functions: 1 7 14.3 %

          Line data    Source code
       1             : /* Copyright (C) 2023 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #ifndef INCLUDED_RENDERER_BACKEND_ISHADERPROGRAM
      19             : #define INCLUDED_RENDERER_BACKEND_ISHADERPROGRAM
      20             : 
      21             : #include "lib/file/vfs/vfs_path.h"
      22             : #include "ps/CStrIntern.h"
      23             : #include "renderer/backend/Format.h"
      24             : #include "renderer/backend/IDeviceObject.h"
      25             : 
      26             : namespace Renderer
      27             : {
      28             : 
      29             : namespace Backend
      30             : {
      31             : 
      32             : enum class VertexAttributeStream : uint32_t
      33             : {
      34             :     POSITION,
      35             :     NORMAL,
      36             :     COLOR,
      37             :     UV0,
      38             :     UV1,
      39             :     UV2,
      40             :     UV3,
      41             :     UV4,
      42             :     UV5,
      43             :     UV6,
      44             :     UV7,
      45             : };
      46             : 
      47             : enum class VertexAttributeRate : uint32_t
      48             : {
      49             :     PER_VERTEX,
      50             :     PER_INSTANCE
      51             : };
      52             : 
      53             : struct SVertexAttributeFormat
      54             : {
      55             :     VertexAttributeStream stream;
      56             :     Format format;
      57             :     uint32_t offset;
      58             :     uint32_t stride;
      59             :     VertexAttributeRate rate;
      60             :     uint32_t bindingSlot;
      61             : 
      62          24 :     constexpr bool operator==(const SVertexAttributeFormat& other) const noexcept
      63             :     {
      64          72 :         return stream == other.stream && format == other.format &&
      65          72 :             offset == other.offset && stride == other.stride &&
      66          72 :             rate == other.rate && bindingSlot == other.bindingSlot;
      67             :     }
      68             : };
      69             : 
      70             : /**
      71             :  * IVertexInputLayout stores precompiled list of vertex attributes.
      72             :  */
      73           0 : class IVertexInputLayout : public IDeviceObject<IVertexInputLayout>
      74             : {
      75             : };
      76             : 
      77             : /**
      78             :  * IShaderProgram is a container for multiple shaders of different types.
      79             :  */
      80           0 : class IShaderProgram : public IDeviceObject<IShaderProgram>
      81             : {
      82             : public:
      83             :     virtual int32_t GetBindingSlot(const CStrIntern name) const = 0;
      84             : 
      85             :     virtual std::vector<VfsPath> GetFileDependencies() const = 0;
      86             : };
      87             : 
      88             : } // namespace Backend
      89             : 
      90             : } // namespace Renderer
      91             : 
      92             : #endif // INCLUDED_RENDERER_BACKEND_ISHADERPROGRAM

Generated by: LCOV version 1.13