Nebula
Loading...
Searching...
No Matches
shader.h File Reference

Detailed Description

A shader represents an entire shader resource, containing several stages and programs.

ShaderId - A shader resource handle. It cannot be used for anything other than quering the shader file (usually suffixed with .fx) for reflection information.

ShaderStateId - An instantiation of either all or a subset of the variables in that shader. The state contains the, well, state of all resources (constant buffers, textures, read/write buffers) as well as the constant values.

ShaderProgramId - The shader will most likely have a set of shader permutations, and those permutations are called programs. The ShaderProgramId binds both the shader, and an associated permutation in one call.

ShaderConstantId - The resources applied with the ShaderStateId are more atomically defined as constants, and serves both as individual shader constants (variables in CPU time, constant in GPU time) as well as the resource binds to that state. They are bound to a inherently bound to a state, and such modifying a constant requires both the state and constant id for that state.

#include "ids/id.h"
#include "ids/idpool.h"
#include "resources/resourceid.h"
#include "coregraphics/shaderfeature.h"
#include "coregraphics/buffer.h"
#include "util/variant.h"
#include "util/dictionary.h"
#include "api/loader.h"

Go to the source code of this file.

Classes

struct  CoreGraphics::ShaderId
struct  CoreGraphics::DerivativeStateId
struct  CoreGraphics::GPULangShaderCreateInfo
union  CoreGraphics::RayTracingBits
 Get shader program raytracing bits. More...

Namespaces

namespace  CoreGraphics
 Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.

Enumerations

enum  CoreGraphics::ShaderConstantType {
  CoreGraphics::UnknownVariableType , CoreGraphics::IntVariableType , CoreGraphics::FloatVariableType , CoreGraphics::VectorVariableType ,
  CoreGraphics::Vector2VariableType , CoreGraphics::MatrixVariableType , CoreGraphics::BoolVariableType , CoreGraphics::TextureVariableType ,
  CoreGraphics::SamplerVariableType , CoreGraphics::ConstantBufferVariableType , CoreGraphics::ImageReadWriteVariableType , CoreGraphics::BufferReadWriteVariableType ,
  CoreGraphics::TextureHandleType , CoreGraphics::ImageHandleType , CoreGraphics::SamplerHandleType
}

Functions

 CoreGraphics::ID_24_8_24_8_NAMED_TYPE (ShaderProgramId, programId, programGeneration, shaderId, shaderGeneration, program, shader)
const Util::String CoreGraphics::ConstantTypeToString (const ShaderConstantType &type)
 Get constant type as string.
const ShaderId CoreGraphics::CreateShader (const GPULangShaderCreateInfo &info)
 Create new shader.
void CoreGraphics::DestroyShader (const ShaderId id)
 Destroy shader.
const ShaderId CoreGraphics::ShaderGet (const Resources::ResourceName &name)
 get shader by name
CoreGraphics::ShaderFeature::Mask CoreGraphics::ShaderFeatureMask (const Util::String &mask)
 Get shader feature mask from string.
const ResourceTableId CoreGraphics::ShaderCreateResourceTable (const ShaderId id, const IndexT group, const uint overallocationSize=1, const char *name=nullptr)
 create resource table from shader
ResourceTableSet CoreGraphics::ShaderCreateResourceTableSet (const ShaderId id, const IndexT group, const uint overallocationSize=1, const char *name=nullptr)
 create resource table set from shader
const bool CoreGraphics::ShaderHasResourceTable (const ShaderId id, const IndexT group)
 Returns true if there is a resource table for the given group in the shader.
const BufferId CoreGraphics::ShaderCreateConstantBuffer (const ShaderId id, const Util::StringAtom &name, BufferAccessMode mode=BufferAccessMode::HostCached)
 create constant buffer from shader using name (don't use too frequently)
const BufferId CoreGraphics::ShaderCreateConstantBuffer (const ShaderId id, const IndexT cbIndex, BufferAccessMode mode=BufferAccessMode::HostCached)
 create constant buffer from index
const BufferId CoreGraphics::ShaderCreateConstantBuffer (const ShaderId id, const IndexT group, const IndexT cbIndex, BufferAccessMode mode=BufferAccessMode::HostCached)
 create constant buffer from index
const uint CoreGraphics::ShaderCalculateConstantBufferIndex (const uint64_t bindingMask, const IndexT slot)
 Calculate buffer index using binding mask and slot.
const Resources::ResourceName CoreGraphics::ShaderGetName (const ShaderId id)
 Get name of shader.
const SizeT CoreGraphics::ShaderGetConstantCount (const ShaderId id)
 get the number of constants from shader
const ShaderConstantType CoreGraphics::ShaderGetConstantType (const ShaderId id, const IndexT i)
 get type of variable by index
const ShaderConstantType CoreGraphics::ShaderGetConstantType (const ShaderId id, const Util::StringAtom &name)
 get type of variable by index
const Util::StringAtom CoreGraphics::ShaderGetConstantName (const ShaderId id, const IndexT i)
 get name of variable by index
const Util::StringAtom CoreGraphics::ShaderGetConstantBlockName (const ShaderId id, const Util::StringAtom &name)
 get name of constant buffer wherein constant with name resides
const Util::StringAtom CoreGraphics::ShaderGetConstantBlockName (const ShaderId id, const IndexT cIndex)
 get name of constant buffer where in constant with index resides
const IndexT CoreGraphics::ShaderGetConstantGroup (const ShaderId id, const Util::StringAtom &name)
 get group to which constant is bound (the constant buffer which it resides in)
const IndexT CoreGraphics::ShaderGetConstantSlot (const ShaderId id, const Util::StringAtom &name)
 get binding inside group of the constant buffer the constant lies in
CoreGraphics::ResourceTableLayoutId CoreGraphics::ShaderGetResourceTableLayout (const ShaderId id, const IndexT group)
 get resource table layout
CoreGraphics::ResourcePipelineId CoreGraphics::ShaderGetResourcePipeline (const ShaderId id)
 get pipeline layout for shader
const SizeT CoreGraphics::ShaderGetConstantBufferCount (const ShaderId id)
 get the number of constant buffers from shader
const SizeT CoreGraphics::ShaderGetConstantBufferSize (const ShaderId id, const IndexT i)
 get size of constant buffer
const Util::StringAtom CoreGraphics::ShaderGetConstantBufferName (const ShaderId id, const IndexT i)
 get name of constant buffer
const IndexT CoreGraphics::ShaderGetConstantBufferResourceSlot (const ShaderId id, const IndexT i)
 get binding inside group of constant buffer
const IndexT CoreGraphics::ShaderGetConstantBufferResourceGroup (const ShaderId id, const IndexT i)
 get group of constant buffer
const uint64_t CoreGraphics::ShaderGetConstantBufferBindingMask (const ShaderId id, const IndexT group)
 Get mask of constant buffers.
const uint64_t CoreGraphics::ShaderGetConstantBufferSize (const ShaderId id, const IndexT group, const IndexT i)
 Get size of constant buffer at binding point.
const IndexT CoreGraphics::ShaderGetResourceSlot (const ShaderId id, const Util::StringAtom &name)
 get slot of any shader resource
const Util::Dictionary< ShaderFeature::Mask, ShaderProgramId > & CoreGraphics::ShaderGetPrograms (const ShaderId id)
 get programs
const Util::StringCoreGraphics::ShaderProgramGetName (const ShaderProgramId id)
 get name of program
const CoreGraphics::ShaderProgramId CoreGraphics::ShaderGetProgram (const ShaderId id, const CoreGraphics::ShaderFeature::Mask mask)
 get shader program id from masks, this allows us to apply a shader program directly in the future
RayTracingBits CoreGraphics::ShaderProgramGetRaytracingBits (const ShaderProgramId id)