Foundation
Loading...
Searching...
No Matches
Shader.hpp
Go to the documentation of this file.
1#pragma once
2#include <RHICore/Common.hpp>
3#include <Core/Allocator.hpp>
4
5using namespace Foundation;
6using namespace RHI;
8 using namespace Core;
12 class Shader {
23 void ParseSPIRV(Span<const char> bytecode);
24 void Sort();
25 public:
26 struct Entrypoint {
28 RHIShaderStage stage{};
29 // Applies to Compute, Task and Mesh shaders
31 };
33 struct Binding {
35 uint32_t descriptorSet;
36 uint32_t binding;
37 };
39 struct PushConstant {
41 // TODO: add size, offset, type info?
42 // This would require us to parse all OpType.. instructions however.
43 // Caller is also expected to know the layout of push constants - TODO for now.
44 };
47 {
48 uint32_t id;
50 };
52 Shader(Span<const char> bytecode, Allocator* alloc);
53
54 [[nodiscard]] String DbgDumpShaderInfo() const;
55 };
56}
Allocator interface (noexcept)
Definition Allocator.hpp:29
Runtime reflection data for a shader module.
Definition Shader.hpp:12
Vector< SpecializationConstant > mSpecializationConstants
Definition Shader.hpp:51
Vector< Binding > mBindings
Definition Shader.hpp:38
Allocator * mAllocator
Definition Shader.hpp:13
Vector< PushConstant > mPushConstants
Definition Shader.hpp:45
void ParseSPIRV(Span< const char > bytecode)
Parse SPIR-V shader code and populate reflection data.
Definition Shader.cpp:3
String DbgDumpShaderInfo() const
Definition Shader.cpp:187
Vector< Entrypoint > mEntrypoints
Definition Shader.hpp:32
void Sort()
Definition Shader.cpp:173
std::vector< T, StlAllocator< T > > Vector
std::vector with explicit Foundation::Core::StlAllocator constructor
Definition Container.hpp:149
std::tuple< Args... > Tuple
Alias for std::tuple
Definition Container.hpp:39
std::basic_string< char, std::char_traits< char >, StlDefaultAllocator< char > > String
Alias for std::basic_string<char>, without an explicit allocator constructor.
Definition Container.hpp:120
std::span< T > Span
Alias for std::span
Definition Container.hpp:62
Core functionalities for rendering, including the Frame Graph implementation.
Definition Bindless.cpp:2
Definition Allocator.hpp:6
uint32_t binding
Definition Shader.hpp:36
uint32_t descriptorSet
Definition Shader.hpp:35
String name
Definition Shader.hpp:34
Tuple< uint32_t, uint32_t, uint32_t > groupLocalSize
Definition Shader.hpp:30
RHIShaderStage stage
Definition Shader.hpp:28
String name
Definition Shader.hpp:27
String name
Definition Shader.hpp:40