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: 2026-12-03 01:19:39 Functions: 0 0 -

          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 "renderer/backend/IDeviceObject.h"
      23             : 
      24             : #include <cstdint>
      25             : #include <vector>
      26             : 
      27             : class CStrIntern;
      28             : namespace Renderer::Backend { enum class Format; }
      29             : 
      30             : namespace Renderer
      31             : {
      32             : 
      33             : namespace Backend
      34             : {
      35             : 
      36             : enum class VertexAttributeStream : uint32_t
      37             : {
      38             :     POSITION,
      39             :     NORMAL,
      40             :     COLOR,
      41             :     UV0,
      42             :     UV1,
      43             :     UV2,
      44             :     UV3,
      45             :     UV4,
      46             :     UV5,
      47             :     UV6,
      48             :     UV7,
      49             : };
      50             : 
      51             : enum class VertexAttributeRate : uint32_t
      52             : {
      53             :     PER_VERTEX,
      54             :     PER_INSTANCE
      55             : };
      56             : 
      57             : struct SVertexAttributeFormat
      58             : {
      59             :     VertexAttributeStream stream;
      60             :     Format format;
      61             :     uint32_t offset;
      62             :     uint32_t stride;
      63             :     VertexAttributeRate rate;
      64             :     uint32_t bindingSlot;
      65             : 
      66          40 :     constexpr bool operator==(const SVertexAttributeFormat& other) const noexcept
      67             :     {
      68          40 :         return stream == other.stream && format == other.format &&
      69          40 :             offset == other.offset && stride == other.stride &&
      70          80 :             rate == other.rate && bindingSlot == other.bindingSlot;
      71             :     }
      72             : };
      73             : 
      74             : /**
      75             :  * IVertexInputLayout stores precompiled list of vertex attributes.
      76             :  */
      77           0 : class IVertexInputLayout : public IDeviceObject<IVertexInputLayout>
      78             : {
      79             : };
      80             : 
      81             : /**
      82             :  * IShaderProgram is a container for multiple shaders of different types.
      83             :  */
      84           0 : class IShaderProgram : public IDeviceObject<IShaderProgram>
      85             : {
      86             : public:
      87             :     virtual int32_t GetBindingSlot(const CStrIntern name) const = 0;
      88             : 
      89             :     virtual std::vector<VfsPath> GetFileDependencies() const = 0;
      90             : };
      91             : 
      92             : } // namespace Backend
      93             : 
      94             : } // namespace Renderer
      95             : 
      96             : #endif // INCLUDED_RENDERER_BACKEND_ISHADERPROGRAM

Generated by: LCOV version 1.16