diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-05-01 21:54:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-05-01 21:54:33 +0300 |
commit | a330b9b0eac6ad1a71ee1cad974f673f26ec0cd3 (patch) | |
tree | 160ce8d706006df30fd6d657992b14bf8af39bfe /source/blender | |
parent | 631506d9c38932cf7c4fa8cb0e96d348efb82b6c (diff) |
GL: Add attribute-less shader workaround for MacOS to the backend
This workaround and the issue was described in D4490. This makes sure
any shader using `shaderCreateInfo` will benefit from the same workaround.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/opengl/gl_shader.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 51d470ef0c1..957bc8b24be 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -530,6 +530,11 @@ std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) con } ss << "in " << to_string(attr.type) << " " << attr.name << ";\n"; } + /* NOTE(D4490): Fix a bug where shader without any vertex attributes do not behave correctly. */ + if (GPU_type_matches_ex(GPU_DEVICE_APPLE, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_OPENGL) && + info.vertex_inputs_.is_empty()) { + ss << "in float gpu_dummy_workaround;\n"; + } ss << "\n/* Interfaces. */\n"; for (const StageInterfaceInfo *iface : info.vertex_out_interfaces_) { print_interface(ss, "out", *iface); |