summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-11 16:03:03 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-11 16:03:03 +0000
commit854fb9130b8030bc9ff94304285eacaa3120cd14 (patch)
tree16d9f0eecd88d9f1aec3ef57d268db48ccaa631b /Graphics
parentUpdated readme (diff)
downloadDiligentCore-854fb9130b8030bc9ff94304285eacaa3120cd14.tar.gz
DiligentCore-854fb9130b8030bc9ff94304285eacaa3120cd14.zip
Fixed https://github.com/DiligentGraphics/DiligentCore/issues/2 (make '_sampler' suffix configurable through shader creation attributes)
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GLSLTools/src/GLSLSourceBuilder.cpp1
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h5
-rw-r--r--Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h5
-rw-r--r--Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp2
-rwxr-xr-xGraphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp11
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.h2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp9
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/ShaderResources.h4
-rw-r--r--Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp5
-rw-r--r--Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.h7
-rw-r--r--Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h2
-rw-r--r--Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp17
14 files changed, 45 insertions, 29 deletions
diff --git a/Graphics/GLSLTools/src/GLSLSourceBuilder.cpp b/Graphics/GLSLTools/src/GLSLSourceBuilder.cpp
index d5a8ee09..d08eafb8 100644
--- a/Graphics/GLSLTools/src/GLSLSourceBuilder.cpp
+++ b/Graphics/GLSLTools/src/GLSLSourceBuilder.cpp
@@ -241,6 +241,7 @@ String BuildGLSLSourceString(const ShaderCreationAttribs& CreationAttribs, Targe
Attribs.ShaderType = CreationAttribs.Desc.ShaderType;
Attribs.IncludeDefinitions = true;
Attribs.InputFileName = CreationAttribs.FilePath;
+ Attribs.SamplerSuffix = CreationAttribs.CombinedSamplerSuffix;
auto ConvertedSource = Converter.Convert(Attribs);
GLSLSource.append(ConvertedSource);
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index 2dcf65c5..06914040 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -256,6 +256,11 @@ 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".
+ const Char* CombinedSamplerSuffix = "_sampler";
+
/// Shader description. See Diligent::ShaderDesc.
ShaderDesc Desc;
diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h
index da6809e4..ce8cb8ad 100644
--- a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h
@@ -84,7 +84,10 @@ class ShaderResourcesD3D11 : public ShaderResources
{
public:
// Loads shader resources from the compiled shader bytecode
- ShaderResourcesD3D11(class RenderDeviceD3D11Impl* pDeviceD3D11Impl, ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc);
+ ShaderResourcesD3D11(class RenderDeviceD3D11Impl* pDeviceD3D11Impl,
+ ID3DBlob* pShaderBytecode,
+ const ShaderDesc& ShdrDesc,
+ const char* CombinedSamplerSuffix);
~ShaderResourcesD3D11();
__forceinline Int32 GetMaxCBBindPoint() const{return m_MaxCBBindPoint; }
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
index ebdf0d23..1549c962 100644
--- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
@@ -78,7 +78,7 @@ ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters,
// Load shader resources
auto &Allocator = GetRawAllocator();
auto *pRawMem = ALLOCATE(Allocator, "Allocator for ShaderResources", sizeof(ShaderResourcesD3D11));
- auto *pResources = new (pRawMem) ShaderResourcesD3D11(pRenderDeviceD3D11, m_pShaderByteCode, m_Desc);
+ auto *pResources = new (pRawMem) ShaderResourcesD3D11(pRenderDeviceD3D11, m_pShaderByteCode, m_Desc, CreationAttribs.CombinedSamplerSuffix);
m_pShaderResources.reset(pResources, STDDeleterRawMem<ShaderResourcesD3D11>(Allocator));
// Clone only static resources that will be set directly in the shader
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp
index 1cf52f39..562dc54d 100755
--- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp
@@ -34,7 +34,10 @@ namespace Diligent
{
-ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Impl, ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc) :
+ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Impl,
+ ID3DBlob* pShaderBytecode,
+ const ShaderDesc& ShdrDesc,
+ const char* CombinedSamplerSuffix) :
ShaderResources(ShdrDesc.ShaderType),
m_ShaderName(ShdrDesc.Name),
m_StaticSamplers(nullptr, STDDeleterRawMem< void >(GetRawAllocator()))
@@ -96,12 +99,12 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Im
VERIFY( TexAttribs.BindPoint + TexAttribs.BindCount-1 <= MaxAllowedBindPoint, "Tex SRV bind point exceeds supported range" );
m_MaxSRVBindPoint = std::max(m_MaxSRVBindPoint, static_cast<MaxBindPointType>(TexAttribs.BindPoint + TexAttribs.BindCount-1));
- auto SamplerId = FindAssignedSamplerId(TexAttribs);
+ auto SamplerId = CombinedSamplerSuffix != nullptr ? FindAssignedSamplerId(TexAttribs, CombinedSamplerSuffix) : D3DShaderResourceAttribs::InvalidSamplerId;
new (&GetTexSRV(CurrTexSRV++)) D3DShaderResourceAttribs(m_ResourceNames, TexAttribs, SamplerId);
},
ShdrDesc,
- D3DSamplerSuffix);
+ CombinedSamplerSuffix);
VERIFY_EXPR(m_ResourceNames.GetRemainingSize() == 0);
VERIFY(CurrCB == GetNumCBs(), "Not all CBs are initialized, which will result in a crash when ~D3DShaderResourceAttribs() is called");
@@ -131,7 +134,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Im
for (; ssd < ShdrDesc.NumStaticSamplers; ++ssd)
{
const auto& StaticSamplerDesc = ShdrDesc.StaticSamplers[ssd];
- if (StrCmpSuff(Sam.Name, StaticSamplerDesc.TextureName, D3DSamplerSuffix))
+ if (StrCmpSuff(Sam.Name, StaticSamplerDesc.TextureName, CombinedSamplerSuffix))
{
auto &StaticSamplerAttrs = GetStaticSampler(CurrStaticSam++);
StaticSamplerAttrs.first = &Sam;
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.h b/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.h
index c5b2e0d9..ba2036de 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.h
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.h
@@ -88,7 +88,7 @@ class ShaderResourcesD3D12 final : public ShaderResources
{
public:
// Loads shader resources from the compiled shader bytecode
- ShaderResourcesD3D12(ID3DBlob *pShaderBytecode, const ShaderDesc &ShdrDesc);
+ ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc, const char* CombinedSamplerSuffix);
};
}
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
index af353150..0c98369c 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
@@ -45,7 +45,7 @@ ShaderD3D12Impl::ShaderD3D12Impl(IReferenceCounters* pRefCounters,
// Load shader resources
auto& Allocator = GetRawAllocator();
auto* pRawMem = ALLOCATE(Allocator, "Allocator for ShaderResources", sizeof(ShaderResourcesD3D12));
- auto* pResources = new (pRawMem) ShaderResourcesD3D12(m_pShaderByteCode, m_Desc);
+ auto* pResources = new (pRawMem) ShaderResourcesD3D12(m_pShaderByteCode, m_Desc, ShaderCreationAttribs.CombinedSamplerSuffix);
m_pShaderResources.reset(pResources, STDDeleterRawMem<ShaderResourcesD3D12>(Allocator));
// Clone only static resources that will be set directly in the shader
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
index 73cb334d..9c48cb76 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
@@ -525,7 +525,7 @@ const ShaderResourceLayoutD3D12::D3D12Resource& ShaderResourceLayoutD3D12::GetAs
VERIFY(TexSrv.IsValidSampler(), "Texture SRV has no associated sampler");
const auto& SamInfo = GetSampler(TexSrv.Attribs.GetVariableType(), TexSrv.SamplerId);
VERIFY(SamInfo.Attribs.GetVariableType() == TexSrv.Attribs.GetVariableType(), "Inconsistent texture and sampler variable types");
- VERIFY(StrCmpSuff(SamInfo.Attribs.Name, TexSrv.Attribs.Name, D3DSamplerSuffix), "Sampler name \"", SamInfo.Attribs.Name, "\" does not match texture name \"", TexSrv.Attribs.Name, '\"');
+ //VERIFY(StrCmpSuff(SamInfo.Attribs.Name, TexSrv.Attribs.Name, SamplerSuffix), "Sampler name \"", SamInfo.Attribs.Name, "\" does not match texture name \"", TexSrv.Attribs.Name, '\"');
return SamInfo;
}
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp
index d77793ed..d61668bf 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp
@@ -34,7 +34,7 @@ namespace Diligent
{
-ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob *pShaderBytecode, const ShaderDesc &ShdrDesc) :
+ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc, const char* CombinedSamplerSuffix) :
ShaderResources(ShdrDesc.ShaderType)
{
Uint32 CurrCB = 0, CurrTexSRV = 0, CurrTexUAV = 0, CurrBufSRV = 0, CurrBufUAV = 0, CurrSampler = 0;
@@ -75,12 +75,15 @@ ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob *pShaderBytecode, const Shad
{
VERIFY(CurrSampler == GetNumSamplers(), "All samplers must be initialized before texture SRVs" );
- auto SamplerId = FindAssignedSamplerId(TexAttribs);
+ auto SamplerId =
+ CombinedSamplerSuffix != nullptr ?
+ FindAssignedSamplerId(TexAttribs, CombinedSamplerSuffix) :
+ D3DShaderResourceAttribs::InvalidSamplerId;
new (&GetTexSRV(CurrTexSRV++)) D3DShaderResourceAttribs(m_ResourceNames, TexAttribs, SamplerId);
},
ShdrDesc,
- D3DSamplerSuffix);
+ CombinedSamplerSuffix);
VERIFY_EXPR(m_ResourceNames.GetRemainingSize() == 0);
VERIFY(CurrCB == GetNumCBs(), "Not all CBs are initialized, which will result in a crash when ~D3DShaderResourceAttribs() is called");
diff --git a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h
index c468eebd..b49069dd 100644
--- a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h
+++ b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h
@@ -64,8 +64,6 @@
namespace Diligent
{
-static const Char* D3DSamplerSuffix = "_sampler";
-
inline bool IsAllowedType(SHADER_VARIABLE_TYPE VarType, Uint32 AllowedTypeBits)noexcept
{
return ((1 << VarType) & AllowedTypeBits) != 0;
@@ -390,7 +388,7 @@ protected:
D3DShaderResourceAttribs& GetBufUAV (Uint32 n)noexcept{ return GetResAttribs(n, GetNumBufUAV(), m_BufUAVOffset); }
D3DShaderResourceAttribs& GetSampler(Uint32 n)noexcept{ return GetResAttribs(n, GetNumSamplers(), m_SamplersOffset); }
- Uint32 FindAssignedSamplerId(const D3DShaderResourceAttribs& TexSRV)const;
+ Uint32 FindAssignedSamplerId(const D3DShaderResourceAttribs& TexSRV, const char* SamplerSuffix)const;
private:
// Memory buffer that holds all resources as continuous chunk of memory:
diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp
index f3045121..3ad2dc76 100644
--- a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp
+++ b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp
@@ -153,14 +153,15 @@ void ShaderResources::CountResources(const SHADER_VARIABLE_TYPE *AllowedVarTypes
}
-Uint32 ShaderResources::FindAssignedSamplerId(const D3DShaderResourceAttribs& TexSRV)const
+Uint32 ShaderResources::FindAssignedSamplerId(const D3DShaderResourceAttribs& TexSRV, const char* SamplerSuffix)const
{
+ VERIFY_EXPR(SamplerSuffix != nullptr && *SamplerSuffix != 0);
VERIFY_EXPR(TexSRV.GetInputType() == D3D_SIT_TEXTURE);
auto NumSamplers = GetNumSamplers();
for (Uint32 s = 0; s < NumSamplers; ++s)
{
const auto &Sampler = GetSampler(s);
- if( StrCmpSuff(Sampler.Name, TexSRV.Name, D3DSamplerSuffix) )
+ if( StrCmpSuff(Sampler.Name, TexSRV.Name, SamplerSuffix) )
{
VERIFY(Sampler.GetVariableType() == TexSRV.GetVariableType(), "Inconsistent texture and sampler variable types");
VERIFY(Sampler.BindCount == TexSRV.BindCount || Sampler.BindCount == 1, "Sampler assigned to array \"", TexSRV.Name, "\" is expected to be scalar or have the same dimension (",TexSRV.BindCount,"). Actual sampler array dimension : ", Sampler.BindCount);
diff --git a/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.h b/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.h
index 1c30c6f2..43d3bdc9 100644
--- a/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.h
+++ b/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.h
@@ -100,6 +100,7 @@ namespace Diligent
SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN;
bool IncludeDefinitions = false;
const Char* InputFileName = nullptr;
+ const Char* SamplerSuffix = "_sampler";
};
String Convert(ConversionAttribs &Attribs)const;
@@ -223,8 +224,8 @@ namespace Diligent
size_t NumSymbols,
bool bPreserveTokens);
- String Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions);
- virtual void Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, IDataBlob **ppGLSLSource)override;
+ String Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, const char* SamplerSuffix);
+ virtual void Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, const char* SamplerSuffix, IDataBlob **ppGLSLSource)override;
IMPLEMENT_QUERY_INTERFACE_IN_PLACE( IID_HLSL2GLSLConversionStream, TBase )
@@ -251,7 +252,7 @@ namespace Diligent
void ProcessConstantBuffer(TokenListType::iterator &Token);
void ProcessStructuredBuffer(TokenListType::iterator &Token);
void ParseSamplers(TokenListType::iterator &ScopeStart, SamplerHashType &SamplersHash);
- void ProcessTextureDeclaration(TokenListType::iterator &Token, const std::vector<SamplerHashType> &SamplersHash, ObjectsTypeHashType &Objects);
+ void ProcessTextureDeclaration(TokenListType::iterator &Token, const std::vector<SamplerHashType> &SamplersHash, ObjectsTypeHashType &Objects, const char* SamplerSuffix);
bool ProcessObjectMethod(TokenListType::iterator &Token, const TokenListType::iterator &ScopeStart, const TokenListType::iterator &ScopeEnd);
Uint32 CountFunctionArguments(TokenListType::iterator &Token, const TokenListType::iterator &ScopeEnd);
bool ProcessRWTextureStore(TokenListType::iterator &Token, const TokenListType::iterator &ScopeEnd);
diff --git a/Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h b/Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h
index 3b4d64c0..0b37ae02 100644
--- a/Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h
+++ b/Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h
@@ -39,7 +39,7 @@ static constexpr INTERFACE_ID IID_HLSL2GLSLConversionStream =
class IHLSL2GLSLConversionStream : public IObject
{
public:
- virtual void Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, IDataBlob **ppGLSLSource) = 0;
+ virtual void Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, const char* SamplerSuffix, IDataBlob **ppGLSLSource) = 0;
};
diff --git a/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp b/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp
index bd032a06..5e53bd4e 100644
--- a/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp
+++ b/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp
@@ -1727,7 +1727,8 @@ void ParseImageFormat(const String &Comment, String& ImageFormat)
//
void HLSL2GLSLConverterImpl::ConversionStream::ProcessTextureDeclaration( TokenListType::iterator &Token,
const std::vector<SamplerHashType> &Samplers,
- ObjectsTypeHashType &Objects )
+ ObjectsTypeHashType &Objects,
+ const char* SamplerSuffix )
{
auto TexDeclToken = Token;
auto TextureDim = TexDeclToken->Type;
@@ -1908,7 +1909,7 @@ void HLSL2GLSLConverterImpl::ConversionStream::ProcessTextureDeclaration( TokenL
if( !IsRWTexture )
{
// Try to find matching sampler
- auto SamplerName = TextureName + "_sampler";
+ auto SamplerName = TextureName + SamplerSuffix;
// Search all scopes starting with the innermost
for( auto ScopeIt = Samplers.rbegin(); ScopeIt != Samplers.rend(); ++ScopeIt )
{
@@ -4372,7 +4373,7 @@ String HLSL2GLSLConverterImpl::Convert(ConversionAttribs &Attribs)const
if(Attribs.ppConversionStream == nullptr)
{
ConversionStream Stream(nullptr, *this, Attribs.InputFileName, Attribs.pSourceStreamFactory, Attribs.HLSLSource, Attribs.NumSymbols, false);
- return Stream.Convert(Attribs.EntryPoint, Attribs.ShaderType, Attribs.IncludeDefinitions);
+ return Stream.Convert(Attribs.EntryPoint, Attribs.ShaderType, Attribs.IncludeDefinitions, Attribs.SamplerSuffix);
}
else
{
@@ -4395,7 +4396,7 @@ String HLSL2GLSLConverterImpl::Convert(ConversionAttribs &Attribs)const
pStream = ValidatedCast<ConversionStream>(*Attribs.ppConversionStream);
}
- return pStream->Convert(Attribs.EntryPoint, Attribs.ShaderType, Attribs.IncludeDefinitions);
+ return pStream->Convert(Attribs.EntryPoint, Attribs.ShaderType, Attribs.IncludeDefinitions, Attribs.SamplerSuffix);
}
}
@@ -4416,11 +4417,11 @@ void HLSL2GLSLConverterImpl::CreateStream(const Char* InputFileName,
}
}
-void HLSL2GLSLConverterImpl::ConversionStream::Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, IDataBlob **ppGLSLSource)
+void HLSL2GLSLConverterImpl::ConversionStream::Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, const char* SamplerSuffix, IDataBlob **ppGLSLSource)
{
try
{
- auto GLSLSource = Convert(EntryPoint, ShaderType, IncludeDefintions);
+ auto GLSLSource = Convert(EntryPoint, ShaderType, IncludeDefintions, SamplerSuffix);
StringDataBlobImpl *pDataBlob = MakeNewRCObj<StringDataBlobImpl>()( std::move(GLSLSource) );
pDataBlob->QueryInterface( IID_DataBlob, reinterpret_cast<IObject**>(ppGLSLSource) );
}
@@ -4430,7 +4431,7 @@ void HLSL2GLSLConverterImpl::ConversionStream::Convert(const Char* EntryPoint, S
}
}
-String HLSL2GLSLConverterImpl::ConversionStream::Convert( const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions )
+String HLSL2GLSLConverterImpl::ConversionStream::Convert( const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, const char* SamplerSuffix )
{
TokenListType TokensCopy(m_bPreserveTokens ? m_Tokens : TokenListType());
@@ -4629,7 +4630,7 @@ String HLSL2GLSLConverterImpl::ConversionStream::Convert( const Char* EntryPoint
{
// Process texture declaration, and add it to the top of the
// object stack
- ProcessTextureDeclaration( Token, Samplers, m_Objects.back() );
+ ProcessTextureDeclaration( Token, Samplers, m_Objects.back(), SamplerSuffix );
}
else
++Token;