diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-10-17 16:26:27 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-10-17 16:26:27 +0000 |
| commit | 435f70be7aebd9a669d6a276df67e8eb814a45e3 (patch) | |
| tree | 040377c1ac3201fef75c01e9e3535a172babbcb1 /Graphics/GraphicsEngine | |
| parent | Improved StrCmpSuff() to allow optional suffix (diff) | |
| download | DiligentCore-435f70be7aebd9a669d6a276df67e8eb814a45e3.tar.gz DiligentCore-435f70be7aebd9a669d6a276df67e8eb814a45e3.zip | |
Implemented separate samplers in D3D11
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/ShaderBase.h | 6 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/Shader.h | 29 |
2 files changed, 23 insertions, 12 deletions
diff --git a/Graphics/GraphicsEngine/include/ShaderBase.h b/Graphics/GraphicsEngine/include/ShaderBase.h index 9b2d634b..de772250 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.h +++ b/Graphics/GraphicsEngine/include/ShaderBase.h @@ -205,9 +205,9 @@ public: for (Uint32 s = 0; s < this->m_Desc.NumStaticSamplers; ++s, ++Str) { m_StaticSamplers[s] = this->m_Desc.StaticSamplers[s]; - VERIFY(m_StaticSamplers[s].TextureName != nullptr, "Static sampler texture name not provided"); - *Str = m_StaticSamplers[s].TextureName; - m_StaticSamplers[s].TextureName = Str->c_str(); + VERIFY(m_StaticSamplers[s].SamplerOrTextureName != nullptr, "Static sampler or texture name is not provided"); + *Str = m_StaticSamplers[s].SamplerOrTextureName; + m_StaticSamplers[s].SamplerOrTextureName = Str->c_str(); #ifdef DEVELOPMENT const auto &BorderColor = m_StaticSamplers[s].Desc.BorderColor; if( !( (BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 0) || diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 06914040..01d7155b 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -135,16 +135,17 @@ struct ShaderVariableDesc /// Static sampler description struct StaticSamplerDesc { - /// Name of the texture variable that static sampler will be assigned to - const Char* TextureName = nullptr; + /// The name of the sampler itself or the name of the texture variable that + /// this static sampler is assigned to if combined texture samplers are used. + const Char* SamplerOrTextureName = nullptr; /// Sampler description SamplerDesc Desc; - StaticSamplerDesc(){}; - StaticSamplerDesc(const Char* _TexName, const SamplerDesc &_Desc) : - TextureName(_TexName), - Desc(_Desc) + StaticSamplerDesc(){} + StaticSamplerDesc(const Char* _SamplerOrTextureName, const SamplerDesc& _Desc) : + SamplerOrTextureName(_SamplerOrTextureName), + Desc (_Desc) {} }; @@ -256,9 +257,19 @@ struct ShaderCreationAttribs /// This member is ignored if ByteCode is not null const ShaderMacro *Macros = nullptr; - /// Defines the suffix added to the texture variable name to get corresponding - /// sampler name. For example, for default value "_sampler", a texture named - /// "tex" will be combined with sampler named "tex_sampler". + /// If set to true, textures will be combined with texture samplers. + /// The CombinedSamplerSuffix member defines the suffix added to the texture variable + /// name to get corresponding sampler name. When using combined samplers, + /// the sampler assigned to the shader resource view is automatically set when + /// the view is bound. Otherwise samplers need to be explicitly set similar to other + /// shader variables. + bool UseCombinedTextureSamplers = false; + + /// If UseCombinedTextureSamplers is true, defines the suffix added to the + /// texture variable name to get corresponding sampler name. For example, + /// for default value "_sampler", a texture named "tex" will be combined + /// with sampler named "tex_sampler". + /// If UseCombinedTextureSamplers is false, this member is ignored. const Char* CombinedSamplerSuffix = "_sampler"; /// Shader description. See Diligent::ShaderDesc. |
