3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Graphics.IShader Class Referenceabstract

Represents a shader program that can be used in the rendering pipeline. More...

#include <IShader.hpp>

Inheritance diagram for Engine3DRadSpace.Graphics.IShader:
Collaboration diagram for Engine3DRadSpace.Graphics.IShader:

Public Member Functions

void SetData (uint index, IntPtr data, ulong dataSize)
void SetTexture (uint index, ITexture2D texture)
void SetTextures (Span< ITexture2D > textures)
void SetSampler (uint index, ISamplerState samplerState)
void SetShader ()
Reflection.IReflectedField[] GetVariables ()
virtual void SetData (unsigned index, const void *data, size_t dataSize)=0
 Sets an entire uniform buffer to the shader.
virtual void SetTexture (unsigned index, ITexture1D *texture)=0
 Sets the specified texture to a given index.
virtual void SetTextures (std::span< ITexture1D * > textures)=0
 Sets multiple textures to the shader using a span of ITexture1D pointers.
virtual void SetTexture (unsigned index, ITexture2D *texture)=0
 Sets an 2D texture to the shader at the specified index.
virtual void SetTextures (std::span< ITexture2D * > textures)=0
 Sets multiple 2D textures to the shader using a span of ITexture2D pointers.
virtual void SetTexture (unsigned index, ITextureCube *texture)=0
 Sets an cube texture to the shader at the specified index.
virtual void SetTextures (std::span< ITextureCube * > textures)=0
 Sets multiple cube textures to the shader using a span of ITextureCube pointers.
virtual void SetSampler (unsigned index, ISamplerState *samplerState)=0
 Sets an texture sampler state at the specified index.
virtual void SetShader ()=0
 Sets the constant buffers and the shader to the rendering pipeline.
virtual std::vector< Reflection::IReflectedField * > GetVariables () const =0
 Gets the exposed variables of the shader, which can be used to set values for the shader's uniform buffers.
virtual void Set (const std::string &name, const void *data, size_t dataSize)=0
 Sets a value for a shader variable by name. The data is copied into the shader's uniform buffer.
template<typename T>
void Set (const std::string &name, const T &data)
 Sets a value for a shader variable by name. The data is copied into the shader's uniform buffer.
template<typename T>
void SetData (const T *data, unsigned index)
 Sets an entire uniform buffer to the shader.
virtual std::string_view GetEntryName () const noexcept=0
 Gets the name of the entry point function for this shader.
virtual const char * GetCompilationErrorsAndWarnings () const noexcept=0
 Gets the compilation results for this shader.
 ~IShader () override=default
Public Member Functions inherited from Engine3DRadSpace.Graphics.IGPUResource
virtual void * GetHandle () const noexcept=0
 Gets an opaque handle to the underlying GPU resource.
virtual IGraphicsDevice * GetGraphicsDevice () const noexcept=0
 Gets the GraphicsDevice that created this resource.
virtual ~IGPUResource ()=default

Protected Member Functions

 IShader ()=default
 IShader (const IShader &)=delete
 IShader (IShader &&) noexcept=default
IShader & operator= (const IShader &)=delete
IShader & operator= (IShader &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.Graphics.IGPUResource
 IGPUResource ()=default
 IGPUResource (const IGPUResource &)=delete
IGPUResource & operator= (const IGPUResource &)=delete
 IGPUResource (IGPUResource &&) noexcept=default
IGPUResource & operator= (IGPUResource &&) noexcept=default

Properties

string EntryName [get]
string CompilationErrorsAndWarnings [get]
Properties inherited from Engine3DRadSpace.IPtrWrapper
IntPtr Handle [get]
Properties inherited from Engine3DRadSpace.Graphics.IGPUResource
IGraphicsDevice GraphicsDevice [get]
IntPtr GPUHandle [get]

Detailed Description

Represents a shader program that can be used in the rendering pipeline.

Constructor & Destructor Documentation

◆ IShader() [1/3]

Engine3DRadSpace.Graphics.IShader.IShader ( )
protecteddefault

◆ IShader() [2/3]

Engine3DRadSpace.Graphics.IShader.IShader ( const IShader & )
protecteddelete

◆ IShader() [3/3]

Engine3DRadSpace.Graphics.IShader.IShader ( IShader && )
protecteddefaultnoexcept

◆ ~IShader()

Engine3DRadSpace.Graphics.IShader.~IShader ( )
overridedefault

Member Function Documentation

◆ GetCompilationErrorsAndWarnings()

virtual const char * Engine3DRadSpace.Graphics.IShader.GetCompilationErrorsAndWarnings ( ) const
pure virtualnoexcept

Gets the compilation results for this shader.

Returns
A string containing any compilation errors or warnings, or an empty string if the shader compiled successfully.

Implemented in Engine3DRadSpace.Graphics.Rendering.PostProcessEffect, Engine3DRadSpace.Graphics::DirectX11::ShaderBase, and Engine3DRadSpace.Graphics::NullShader.

◆ GetEntryName()

virtual std::string_view Engine3DRadSpace.Graphics.IShader.GetEntryName ( ) const
pure virtualnoexcept

Gets the name of the entry point function for this shader.

Returns
The name of the entry point function

Implemented in Engine3DRadSpace.Graphics.Rendering.PostProcessEffect, Engine3DRadSpace.Graphics::DirectX11::ShaderBase, and Engine3DRadSpace.Graphics::NullShader.

◆ GetVariables() [1/2]

Reflection.IReflectedField[] Engine3DRadSpace.Graphics.IShader.GetVariables ( )

◆ GetVariables() [2/2]

virtual std::vector< Reflection::IReflectedField * > Engine3DRadSpace.Graphics.IShader.GetVariables ( ) const
pure virtual

Gets the exposed variables of the shader, which can be used to set values for the shader's uniform buffers.

Returns
Shader reflection data for variables in constant buffers.

Implemented in Engine3DRadSpace.Graphics.Rendering.PostProcessEffect, Engine3DRadSpace.Graphics::DirectX11::ShaderBase, and Engine3DRadSpace.Graphics::NullShader.

◆ operator=() [1/2]

IShader & Engine3DRadSpace.Graphics.IShader.operator= ( const IShader & )
protecteddelete

◆ operator=() [2/2]

IShader & Engine3DRadSpace.Graphics.IShader.operator= ( IShader && )
protecteddefaultnoexcept

◆ Set() [1/2]

template<typename T>
void Engine3DRadSpace.Graphics.IShader.Set ( const std::string & name,
const T & data )
inline

Sets a value for a shader variable by name. The data is copied into the shader's uniform buffer.

Template Parameters
TThe type of the data to set.
Parameters
nameThe name of the shader variable to set.
dataThe data to set.

◆ Set() [2/2]

virtual void Engine3DRadSpace.Graphics.IShader.Set ( const std::string & name,
const void * data,
size_t dataSize )
pure virtual

Sets a value for a shader variable by name. The data is copied into the shader's uniform buffer.

Prefer setting the data drectly using the SetData<T> method for better performance.

Parameters
nameThe name of the shader variable to set.
dataA pointer to the data to set.
dataSizeThe size of the data in bytes.

Implemented in Engine3DRadSpace.Graphics.Rendering.PostProcessEffect, Engine3DRadSpace.Graphics::DirectX11::ShaderBase, and Engine3DRadSpace.Graphics::NullShader.

◆ SetData() [1/3]

void Engine3DRadSpace.Graphics.IShader.SetData ( uint index,
IntPtr data,
ulong dataSize )

◆ SetData() [2/3]

template<typename T>
void Engine3DRadSpace.Graphics.IShader.SetData ( const T * data,
unsigned index )
inline

Sets an entire uniform buffer to the shader.

Template Parameters
TThe type of the data to set.
Parameters
dataA pointer to the data to set.
indexThe index of the uniform buffer to set.

◆ SetData() [3/3]

virtual void Engine3DRadSpace.Graphics.IShader.SetData ( unsigned index,
const void * data,
size_t dataSize )
pure virtual

◆ SetSampler() [1/2]

void Engine3DRadSpace.Graphics.IShader.SetSampler ( uint index,
ISamplerState samplerState )

◆ SetSampler() [2/2]

◆ SetShader() [1/2]

void Engine3DRadSpace.Graphics.IShader.SetShader ( )

◆ SetShader() [2/2]

◆ SetTexture() [1/4]

void Engine3DRadSpace.Graphics.IShader.SetTexture ( uint index,
ITexture2D texture )

◆ SetTexture() [2/4]

◆ SetTexture() [3/4]

◆ SetTexture() [4/4]

◆ SetTextures() [1/4]

void Engine3DRadSpace.Graphics.IShader.SetTextures ( Span< ITexture2D > textures)

◆ SetTextures() [2/4]

◆ SetTextures() [3/4]

◆ SetTextures() [4/4]

Property Documentation

◆ CompilationErrorsAndWarnings

string Engine3DRadSpace.Graphics.IShader.CompilationErrorsAndWarnings
get

◆ EntryName

string Engine3DRadSpace.Graphics.IShader.EntryName
get

The documentation for this class was generated from the following files:
  • E:/3DRadSpace/3DRadSpace_CSharp/Graphics/IShader.cs
  • E:/3DRadSpace/Engine3DRadSpace/Graphics/IShader.hpp