git.s-ol.nu ~forks/DiligentTools / a63e7f5
Added support for combined texture samplers Egor Yusov 3 years ago
3 changed file(s) with 11 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
170170 RefCntAutoPtr<IHLSL2GLSLConversionStream> pStream;
171171 Converter.CreateStream(InputPath.c_str(), &BasicSSSFactory, HLSLSource, SourceLen, &pStream);
172172 RefCntAutoPtr<Diligent::IDataBlob> pGLSLSourceBlob;
173 pStream->Convert(EntryPoint.c_str(), ShaderType, IncludeGLSLDefintions, &pGLSLSourceBlob);
173 pStream->Convert(EntryPoint.c_str(), ShaderType, IncludeGLSLDefintions, "_sampler", &pGLSLSourceBlob);
174174 if(!pGLSLSourceBlob)return -1;
175175
176176 LOG_INFO_MESSAGE("Done");
232232 Attrs.Desc.Name = "Test shader";
233233 Attrs.Source = reinterpret_cast<char*>(pGLSLSourceBlob->GetDataPtr());
234234 Attrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_GLSL;
235 Attrs.UseCombinedTextureSamplers = true;
235236 RefCntAutoPtr<IShader> pTestShader;
236237 pDevice->CreateShader(Attrs, &pTestShader);
237238 if(!pTestShader)
5151 String FilePathBuffer;
5252 String EntryPointBuffer;
5353 String SearchDirectoriesBuffer;
54 String CombinedSamplerSuffixBuffer;
5455 const char *SearchDirectories = nullptr;
5556 std::vector<ShaderVariableDesc> m_VarDescBuffer;
5657 std::vector<String> m_VarNamesBuffer;
182182 // Push the table from the top into the parent table
183183 lua_settable( L, -3 ); // Stack: +1
184184
185 // Push "TextureName" field
186 lua_pushstring( L, "TextureName" ); // Stack: +2
187 lua_pushstring( L, SamDesc.TextureName); // Stack: +3
185 // Push "SamplerOrTextureName" field
186 lua_pushstring( L, "SamplerOrTextureName" ); // Stack: +2
187 lua_pushstring( L, SamDesc.SamplerOrTextureName); // Stack: +3
188188 lua_settable( L, -3 ); // Stack: +1
189189 }
190190 );
232232 }
233233 );
234234 }
235 else if (strcmp(Key, "TextureName") == 0)
235 else if (strcmp(Key, "SamplerOrTextureName") == 0)
236236 {
237237 auto Name = ReadValueFromLua<const Char*>(L, TblStackInd);
238238 StaticSamplerTexNamesBuffer[CurrIndex] = Name;
251251
252252 for(size_t v=0; v < StaticSamplersBuffer.size(); ++v)
253253 {
254 StaticSamplersBuffer[v].TextureName = StaticSamplerTexNamesBuffer[v].c_str();
254 StaticSamplersBuffer[v].SamplerOrTextureName = StaticSamplerTexNamesBuffer[v].c_str();
255255 }
256256
257257 auto &StaticSamplers = GetMemberByOffest<StaticSamplerDesc*>( pBasePointer, m_MemberOffset);
338338 DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, Source, SourceBuffer )
339339 DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, EntryPoint, EntryPointBuffer )
340340 DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, SearchDirectories, SearchDirectoriesBuffer )
341 DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, CombinedSamplerSuffix, CombinedSamplerSuffixBuffer )
342
343 DEFINE_BINDER(m_Bindings, ShaderCreationAttribsWrapper, UseCombinedTextureSamplers);
341344
342345 DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_DEFAULT );
343346 DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_HLSL );