diff --git a/HLSL2GLSLConverter/src/HLSL2GLSLConverterApp.cpp b/HLSL2GLSLConverter/src/HLSL2GLSLConverterApp.cpp index 635ec8d..550569f 100644 --- a/HLSL2GLSLConverter/src/HLSL2GLSLConverterApp.cpp +++ b/HLSL2GLSLConverter/src/HLSL2GLSLConverterApp.cpp @@ -171,7 +171,7 @@ RefCntAutoPtr pStream; Converter.CreateStream(InputPath.c_str(), &BasicSSSFactory, HLSLSource, SourceLen, &pStream); RefCntAutoPtr pGLSLSourceBlob; - pStream->Convert(EntryPoint.c_str(), ShaderType, IncludeGLSLDefintions, &pGLSLSourceBlob); + pStream->Convert(EntryPoint.c_str(), ShaderType, IncludeGLSLDefintions, "_sampler", &pGLSLSourceBlob); if(!pGLSLSourceBlob)return -1; LOG_INFO_MESSAGE("Done"); @@ -233,6 +233,7 @@ Attrs.Desc.Name = "Test shader"; Attrs.Source = reinterpret_cast(pGLSLSourceBlob->GetDataPtr()); Attrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_GLSL; + Attrs.UseCombinedTextureSamplers = true; RefCntAutoPtr pTestShader; pDevice->CreateShader(Attrs, &pTestShader); if(!pTestShader) diff --git a/RenderScript/include/ShaderParser.h b/RenderScript/include/ShaderParser.h index e69239a..4af5f98 100644 --- a/RenderScript/include/ShaderParser.h +++ b/RenderScript/include/ShaderParser.h @@ -52,6 +52,7 @@ String FilePathBuffer; String EntryPointBuffer; String SearchDirectoriesBuffer; + String CombinedSamplerSuffixBuffer; const char *SearchDirectories = nullptr; std::vector m_VarDescBuffer; std::vector m_VarNamesBuffer; diff --git a/RenderScript/src/ShaderParser.cpp b/RenderScript/src/ShaderParser.cpp index fb3e8ff..487efb4 100644 --- a/RenderScript/src/ShaderParser.cpp +++ b/RenderScript/src/ShaderParser.cpp @@ -183,9 +183,9 @@ // Push the table from the top into the parent table lua_settable( L, -3 ); // Stack: +1 - // Push "TextureName" field - lua_pushstring( L, "TextureName" ); // Stack: +2 - lua_pushstring( L, SamDesc.TextureName); // Stack: +3 + // Push "SamplerOrTextureName" field + lua_pushstring( L, "SamplerOrTextureName" ); // Stack: +2 + lua_pushstring( L, SamDesc.SamplerOrTextureName); // Stack: +3 lua_settable( L, -3 ); // Stack: +1 } ); @@ -233,7 +233,7 @@ } ); } - else if (strcmp(Key, "TextureName") == 0) + else if (strcmp(Key, "SamplerOrTextureName") == 0) { auto Name = ReadValueFromLua(L, TblStackInd); StaticSamplerTexNamesBuffer[CurrIndex] = Name; @@ -252,7 +252,7 @@ for(size_t v=0; v < StaticSamplersBuffer.size(); ++v) { - StaticSamplersBuffer[v].TextureName = StaticSamplerTexNamesBuffer[v].c_str(); + StaticSamplersBuffer[v].SamplerOrTextureName = StaticSamplerTexNamesBuffer[v].c_str(); } auto &StaticSamplers = GetMemberByOffest( pBasePointer, m_MemberOffset); @@ -339,6 +339,9 @@ DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, Source, SourceBuffer ) DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, EntryPoint, EntryPointBuffer ) DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, SearchDirectories, SearchDirectoriesBuffer ) + DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, CombinedSamplerSuffix, CombinedSamplerSuffixBuffer ) + + DEFINE_BINDER(m_Bindings, ShaderCreationAttribsWrapper, UseCombinedTextureSamplers); DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_DEFAULT ); DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_HLSL );