From ab236520f301243eefbd17977ff7b57f6af2fac9 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 6 Mar 2019 23:08:56 -0800 Subject: Added GetShaderResourceTypeLiteralName accessory function plus fixed issue with GL resource type reflection. Fixed https://github.com/DiligentGraphics/DiligentCore/issues/8 --- Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp index 21a2ac5d..ff21c609 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp @@ -415,13 +415,18 @@ namespace Diligent // glGetProgramResourceLocation( program, GL_UNIFORM, name ); // The latter is only available in GL 4.4 and GLES 3.1 + auto ResourceType = dataType == GL_SAMPLER_BUFFER || + dataType == GL_INT_SAMPLER_BUFFER || + dataType == GL_UNSIGNED_INT_SAMPLER_BUFFER ? + SHADER_RESOURCE_TYPE_BUFFER_SRV : SHADER_RESOURCE_TYPE_TEXTURE_SRV; + RemoveArrayBrackets(Name.data()); Samplers.emplace_back( Owner, NamesPool.emplace(Name.data()).first->c_str(), SHADER_RESOURCE_VARIABLE_TYPE_STATIC, - SHADER_RESOURCE_TYPE_TEXTURE_SRV, + ResourceType, Uint16{0xFFFF}, // Variable index is assigned by AllocateResources static_cast(size), nullptr, // pResources -- cgit v1.2.3