[Bf-blender-cvs] [71386c08f11] master: Fix T95039, T94998: Shaders compilation errors on Mac.
Jeroen Bakker
noreply at git.blender.org
Wed Jan 19 10:32:16 CET 2022
Commit: 71386c08f110d402a7b4f5fbd5a7629829d8364f
Author: Jeroen Bakker
Date: Wed Jan 19 10:28:19 2022 +0100
Branches: master
https://developer.blender.org/rB71386c08f110d402a7b4f5fbd5a7629829d8364f
Fix T95039,T94998: Shaders compilation errors on Mac.
Cause was incorrect logic when generating the resource layout. It the
explicit_location_support setting was ignored and the binding were
generated for image, uniform buffers and storage buffers.
===================================================================
M source/blender/gpu/opengl/gl_shader.cc
===================================================================
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index fe5ffe5a2ad..9af5aeb3582 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -285,8 +285,7 @@ static std::ostream &print_qualifier(std::ostream &os, const Qualifier &qualifie
static void print_resource(std::ostream &os, const ShaderCreateInfo::Resource &res)
{
- if (res.bind_type != ShaderCreateInfo::Resource::BindType::SAMPLER ||
- GLContext::explicit_location_support) {
+ if (GLContext::explicit_location_support) {
os << "layout(binding = " << res.slot;
if (res.bind_type == ShaderCreateInfo::Resource::BindType::IMAGE) {
os << ", " << res.image.format;
@@ -299,6 +298,9 @@ static void print_resource(std::ostream &os, const ShaderCreateInfo::Resource &r
}
os << ") ";
}
+ else if (res.bind_type == ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER) {
+ os << "layout(std140) ";
+ }
int64_t array_offset;
StringRef name_no_array;
More information about the Bf-blender-cvs
mailing list