Browse Source

Allow plain arrays of a base type as shader buffer block declarations.

Alex Szpakowski 3 years ago
parent
commit
fb77e64f61
2 changed files with 5 additions and 5 deletions
  1. 4 4
      src/modules/graphics/Shader.cpp
  2. 1 1
      src/modules/graphics/opengl/Shader.h

+ 4 - 4
src/modules/graphics/Shader.cpp

@@ -891,14 +891,14 @@ bool Shader::validateInternal(StrongRef<ShaderStage> stages[], std::string &err,
 			const glslang::TTypeList *structure = type->getStruct();
 			if (structure == nullptr || structure->size() != 1)
 			{
-				err = "Shader validation error:\nStorage Buffer block '" + info.name + "' must contain a single unsized array of structs.";
+				err = "Shader validation error:\nStorage Buffer block '" + info.name + "' must contain a single unsized array of base types or structs.";
 				return false;
 			}
 
-			const glslang::TType* structtype = (*structure)[0].type;
-			if (structtype == nullptr || structtype->getBasicType() != glslang::EbtStruct || !structtype->isUnsizedArray())
+			const glslang::TType* elementtype = (*structure)[0].type;
+			if (elementtype == nullptr || !elementtype->isUnsizedArray())
 			{
-				err = "Shader validation error:\nStorage Buffer block '" + info.name + "' must contain a single unsized array of structs.";
+				err = "Shader validation error:\nStorage Buffer block '" + info.name + "' must contain a single unsized array of base types or structs.";
 				return false;
 			}
 

+ 1 - 1
src/modules/graphics/opengl/Shader.h

@@ -45,7 +45,7 @@ public:
 
 	struct StorageTextureBinding
 	{
-		Texture *texture = nullptr;
+		love::graphics::Texture *texture = nullptr;
 		GLuint gltexture = 0;
 		TextureType type = TEXTURE_2D;
 		GLenum access = GL_READ_ONLY;