From e02b402a14bd6bb8defca223b8ff1e242e80af6c Mon Sep 17 00:00:00 2001 From: vladislavbelov Date: Sun, 17 Apr 2022 08:00:10 +0000 Subject: [PATCH] Uses vertex attribute name only for GLSL. Fixes #6500 This was SVN commit r26799. --- source/renderer/backend/gl/ShaderProgram.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/renderer/backend/gl/ShaderProgram.cpp b/source/renderer/backend/gl/ShaderProgram.cpp index e3d98484f9..49f8ded508 100644 --- a/source/renderer/backend/gl/ShaderProgram.cpp +++ b/source/renderer/backend/gl/ShaderProgram.cpp @@ -902,6 +902,8 @@ std::unique_ptr CShaderProgram::Create(CDevice* device, const CS XMBElement root = XeroFile.GetRoot(); + const bool isGLSL = root.GetAttributes().GetNamedItem(at_type) == "glsl"; + VfsPath vertexFile; VfsPath fragmentFile; CShaderDefines defines = baseDefines; @@ -936,7 +938,7 @@ std::unique_ptr CShaderProgram::Create(CDevice* device, const CS { const CStr streamName = attributes.GetNamedItem(at_name); const CStr attributeName = attributes.GetNamedItem(at_attribute); - if (attributeName.empty()) + if (attributeName.empty() && isGLSL) LOGERROR("Empty attribute name in vertex shader description '%s'", vertexFile.string8().c_str()); int stream = 0; @@ -965,8 +967,11 @@ std::unique_ptr CShaderProgram::Create(CDevice* device, const CS else LOGERROR("Unknown stream '%s' in vertex shader description '%s'", streamName.c_str(), vertexFile.string8().c_str()); - const int attributeLocation = GetAttributeLocationFromStream(device, stream); - vertexAttribs[CStrIntern(attributeName)] = attributeLocation; + if (isGLSL) + { + const int attributeLocation = GetAttributeLocationFromStream(device, stream); + vertexAttribs[CStrIntern(attributeName)] = attributeLocation; + } streamFlags |= stream; } } @@ -1014,7 +1019,7 @@ std::unique_ptr CShaderProgram::Create(CDevice* device, const CS } } - if (root.GetAttributes().GetNamedItem(at_type) == "glsl") + if (isGLSL) return CShaderProgram::ConstructGLSL(device, name, vertexFile, fragmentFile, defines, vertexAttribs, streamFlags); else return CShaderProgram::ConstructARB(device, vertexFile, fragmentFile, defines, vertexUniforms, fragmentUniforms, streamFlags);