summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-10-19 17:21:30 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-10-19 17:21:30 +0000
commita520bf4f9748d20e432bcf7994be3148d0b75d54 (patch)
tree73e69ab1f7eb2f1844ed7c834f80837947dd50bb /Graphics/GraphicsEngine
parentUpdated third-party modules; fixed compiler warnings (diff)
downloadDiligentCore-a520bf4f9748d20e432bcf7994be3148d0b75d54.tar.gz
DiligentCore-a520bf4f9748d20e432bcf7994be3148d0b75d54.zip
Renamed static sampler to immutable sampler (API240076)
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/PipelineStateBase.hpp26
-rw-r--r--Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp14
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h4
-rw-r--r--Graphics/GraphicsEngine/interface/PipelineState.h46
-rw-r--r--Graphics/GraphicsEngine/src/APIInfo.cpp2
5 files changed, 48 insertions, 44 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
index cda2247e..c108f663 100644
--- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
+++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
@@ -460,13 +460,13 @@ private:
}
}
- if (SrcLayout.StaticSamplers != nullptr)
+ if (SrcLayout.ImmutableSamplers != nullptr)
{
- MemPool.AddSpace<StaticSamplerDesc>(SrcLayout.NumStaticSamplers);
- for (Uint32 i = 0; i < SrcLayout.NumStaticSamplers; ++i)
+ MemPool.AddSpace<ImmutableSamplerDesc>(SrcLayout.NumImmutableSamplers);
+ for (Uint32 i = 0; i < SrcLayout.NumImmutableSamplers; ++i)
{
- VERIFY(SrcLayout.StaticSamplers[i].SamplerOrTextureName != nullptr, "Static sampler or texture name can't be null");
- MemPool.AddSpaceForString(SrcLayout.StaticSamplers[i].SamplerOrTextureName);
+ VERIFY(SrcLayout.ImmutableSamplers[i].SamplerOrTextureName != nullptr, "Immutable sampler or texture name can't be null");
+ MemPool.AddSpaceForString(SrcLayout.ImmutableSamplers[i].SamplerOrTextureName);
}
}
}
@@ -485,13 +485,13 @@ private:
}
}
- if (SrcLayout.StaticSamplers != nullptr)
+ if (SrcLayout.ImmutableSamplers != nullptr)
{
- auto* StaticSamplers = MemPool.Allocate<StaticSamplerDesc>(SrcLayout.NumStaticSamplers);
- DstLayout.StaticSamplers = StaticSamplers;
- for (Uint32 i = 0; i < SrcLayout.NumStaticSamplers; ++i)
+ auto* ImmutableSamplers = MemPool.Allocate<ImmutableSamplerDesc>(SrcLayout.NumImmutableSamplers);
+ DstLayout.ImmutableSamplers = ImmutableSamplers;
+ for (Uint32 i = 0; i < SrcLayout.NumImmutableSamplers; ++i)
{
- const auto& SrcSmplr = SrcLayout.StaticSamplers[i];
+ const auto& SrcSmplr = SrcLayout.ImmutableSamplers[i];
#ifdef DILIGENT_DEVELOPMENT
{
const auto& BorderColor = SrcSmplr.Desc.BorderColor;
@@ -499,15 +499,15 @@ private:
(BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 1) ||
(BorderColor[0] == 1 && BorderColor[1] == 1 && BorderColor[2] == 1 && BorderColor[3] == 1)))
{
- LOG_WARNING_MESSAGE("Static sampler for variable \"", SrcSmplr.SamplerOrTextureName, "\" specifies border color (",
+ LOG_WARNING_MESSAGE("Immutable sampler for variable \"", SrcSmplr.SamplerOrTextureName, "\" specifies border color (",
BorderColor[0], ", ", BorderColor[1], ", ", BorderColor[2], ", ", BorderColor[3],
"). D3D12 static samplers only allow transparent black (0,0,0,0), opaque black (0,0,0,1) or opaque white (1,1,1,1) as border colors");
}
}
#endif
- StaticSamplers[i] = SrcSmplr;
- StaticSamplers[i].SamplerOrTextureName = MemPool.CopyString(SrcSmplr.SamplerOrTextureName);
+ ImmutableSamplers[i] = SrcSmplr;
+ ImmutableSamplers[i].SamplerOrTextureName = MemPool.CopyString(SrcSmplr.SamplerOrTextureName);
}
}
}
diff --git a/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp b/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp
index 78c1832d..1130fbff 100644
--- a/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp
+++ b/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp
@@ -115,15 +115,15 @@ inline Uint32 GetAllowedTypeBits(const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVar
return AllowedTypeBits;
}
-inline Int32 FindStaticSampler(const StaticSamplerDesc* StaticSamplers,
- Uint32 NumStaticSamplers,
- SHADER_TYPE ShaderType,
- const char* ResourceName,
- const char* SamplerSuffix)
+inline Int32 FindImmutableSampler(const ImmutableSamplerDesc* ImtblSamplers,
+ Uint32 NumImtblSamplers,
+ SHADER_TYPE ShaderType,
+ const char* ResourceName,
+ const char* SamplerSuffix)
{
- for (Uint32 s = 0; s < NumStaticSamplers; ++s)
+ for (Uint32 s = 0; s < NumImtblSamplers; ++s)
{
- const auto& StSam = StaticSamplers[s];
+ const auto& StSam = ImtblSamplers[s];
if (((StSam.ShaderStages & ShaderType) != 0) && StreqSuff(ResourceName, StSam.SamplerOrTextureName, SamplerSuffix))
return s;
}
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 10cf096e..a32511d2 100644
--- a/Graphics/GraphicsEngine/interface/APIInfo.h
+++ b/Graphics/GraphicsEngine/interface/APIInfo.h
@@ -30,7 +30,7 @@
/// \file
/// Diligent API information
-#define DILIGENT_API_VERSION 240075
+#define DILIGENT_API_VERSION 240076
#include "../../../Primitives/interface/BasicTypes.h"
@@ -77,7 +77,7 @@ struct APIInfo
size_t InputLayoutDescSize DEFAULT_INITIALIZER(0);
size_t SampleDescSize DEFAULT_INITIALIZER(0);
size_t ShaderResourceVariableDescSize DEFAULT_INITIALIZER(0);
- size_t StaticSamplerDescSize DEFAULT_INITIALIZER(0);
+ size_t ImmutableSamplerDescSize DEFAULT_INITIALIZER(0);
size_t PipelineResourceLayoutDescSize DEFAULT_INITIALIZER(0);
size_t GraphicsPipelineDescSize DEFAULT_INITIALIZER(0);
size_t GraphicsPipelineStateCreateInfoSize DEFAULT_INITIALIZER(0);
diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h
index cef07c66..2d889c61 100644
--- a/Graphics/GraphicsEngine/interface/PipelineState.h
+++ b/Graphics/GraphicsEngine/interface/PipelineState.h
@@ -96,32 +96,36 @@ struct ShaderResourceVariableDesc
typedef struct ShaderResourceVariableDesc ShaderResourceVariableDesc;
-/// Static sampler description
-struct StaticSamplerDesc
+/// Immutable sampler description.
+
+/// An immutable sampler is compiled into the pipeline state and can't be changed.
+/// It is generally more efficient than a regular sampler and should be used
+/// whenever possible.
+struct ImmutableSamplerDesc
{
- /// Shader stages that this static sampler applies to. More than one shader stage can be specified.
+ /// Shader stages that this immutable sampler applies to. More than one shader stage can be specified.
SHADER_TYPE ShaderStages DEFAULT_INITIALIZER(SHADER_TYPE_UNKNOWN);
/// 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.
+ /// this immutable sampler is assigned to if combined texture samplers are used.
const Char* SamplerOrTextureName DEFAULT_INITIALIZER(nullptr);
/// Sampler description
struct SamplerDesc Desc;
#if DILIGENT_CPP_INTERFACE
- StaticSamplerDesc()noexcept{}
+ ImmutableSamplerDesc()noexcept{}
- StaticSamplerDesc(SHADER_TYPE _ShaderStages,
- const Char* _SamplerOrTextureName,
- const SamplerDesc& _Desc)noexcept :
+ ImmutableSamplerDesc(SHADER_TYPE _ShaderStages,
+ const Char* _SamplerOrTextureName,
+ const SamplerDesc& _Desc)noexcept :
ShaderStages {_ShaderStages },
SamplerOrTextureName{_SamplerOrTextureName},
Desc {_Desc }
{}
#endif
};
-typedef struct StaticSamplerDesc StaticSamplerDesc;
+typedef struct ImmutableSamplerDesc ImmutableSamplerDesc;
/// Pipeline layout description
struct PipelineResourceLayoutDesc
@@ -129,19 +133,19 @@ struct PipelineResourceLayoutDesc
/// Default shader resource variable type. This type will be used if shader
/// variable description is not found in the Variables array
/// or if Variables == nullptr
- SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType DEFAULT_INITIALIZER(SHADER_RESOURCE_VARIABLE_TYPE_STATIC);
+ SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType DEFAULT_INITIALIZER(SHADER_RESOURCE_VARIABLE_TYPE_STATIC);
/// Number of elements in Variables array
- Uint32 NumVariables DEFAULT_INITIALIZER(0);
+ Uint32 NumVariables DEFAULT_INITIALIZER(0);
/// Array of shader resource variable descriptions
- const ShaderResourceVariableDesc* Variables DEFAULT_INITIALIZER(nullptr);
+ const ShaderResourceVariableDesc* Variables DEFAULT_INITIALIZER(nullptr);
- /// Number of static samplers in StaticSamplers array
- Uint32 NumStaticSamplers DEFAULT_INITIALIZER(0);
+ /// Number of immutable samplers in ImmutableSamplers array
+ Uint32 NumImmutableSamplers DEFAULT_INITIALIZER(0);
- /// Array of static sampler descriptions
- const StaticSamplerDesc* StaticSamplers DEFAULT_INITIALIZER(nullptr);
+ /// Array of immutable sampler descriptions
+ const ImmutableSamplerDesc* ImmutableSamplers DEFAULT_INITIALIZER(nullptr);
};
typedef struct PipelineResourceLayoutDesc PipelineResourceLayoutDesc;
@@ -256,7 +260,7 @@ typedef struct PipelineStateDesc PipelineStateDesc;
DILIGENT_TYPED_ENUM(PSO_CREATE_FLAGS, Uint32)
{
/// Null flag.
- PSO_CREATE_FLAG_NONE = 0x00,
+ PSO_CREATE_FLAG_NONE = 0x00,
/// Ignore missing variables.
@@ -264,15 +268,15 @@ DILIGENT_TYPED_ENUM(PSO_CREATE_FLAGS, Uint32)
/// provided as part of the pipeline resource layout description
/// that is not found in any of the designated shader stages.
/// Use this flag to silence these warnings.
- PSO_CREATE_FLAG_IGNORE_MISSING_VARIABLES = 0x01,
+ PSO_CREATE_FLAG_IGNORE_MISSING_VARIABLES = 0x01,
- /// Ignore missing static samplers.
+ /// Ignore missing immutable samplers.
- /// By default, the engine outputs a warning for every static sampler
+ /// By default, the engine outputs a warning for every immutable sampler
/// provided as part of the pipeline resource layout description
/// that is not found in any of the designated shader stages.
/// Use this flag to silence these warnings.
- PSO_CREATE_FLAG_IGNORE_MISSING_STATIC_SAMPLERS = 0x02,
+ PSO_CREATE_FLAG_IGNORE_MISSING_IMMUTABLE_SAMPLERS = 0x02,
};
DEFINE_FLAG_ENUM_OPERATORS(PSO_CREATE_FLAGS);
diff --git a/Graphics/GraphicsEngine/src/APIInfo.cpp b/Graphics/GraphicsEngine/src/APIInfo.cpp
index aa2fb3d9..e4111327 100644
--- a/Graphics/GraphicsEngine/src/APIInfo.cpp
+++ b/Graphics/GraphicsEngine/src/APIInfo.cpp
@@ -87,7 +87,7 @@ static APIInfo InitAPIInfo()
INIT_STRUCTURE_SIZE(InputLayoutDesc);
INIT_STRUCTURE_SIZE(SampleDesc);
INIT_STRUCTURE_SIZE(ShaderResourceVariableDesc);
- INIT_STRUCTURE_SIZE(StaticSamplerDesc);
+ INIT_STRUCTURE_SIZE(ImmutableSamplerDesc);
INIT_STRUCTURE_SIZE(PipelineResourceLayoutDesc);
INIT_STRUCTURE_SIZE(GraphicsPipelineDesc);
INIT_STRUCTURE_SIZE(GraphicsPipelineStateCreateInfo);