Fix #106672: MacOS/OpenGL doesn't draw anything Eevee related.
This PR reverts the breaking part of the #106535. This part doesn't seem to be required to fix the HD4400-HD5500 issue. Might also fix #106844. Pull Request: https://projects.blender.org/blender/blender/pulls/106887
This commit is contained in:
parent
a899d57e57
commit
34739f6a6d
@ -405,7 +405,7 @@ static void print_resource(std::ostream &os,
|
|||||||
array_offset = res.uniformbuf.name.find_first_of("[");
|
array_offset = res.uniformbuf.name.find_first_of("[");
|
||||||
name_no_array = (array_offset == -1) ? res.uniformbuf.name :
|
name_no_array = (array_offset == -1) ? res.uniformbuf.name :
|
||||||
StringRef(res.uniformbuf.name.c_str(), array_offset);
|
StringRef(res.uniformbuf.name.c_str(), array_offset);
|
||||||
os << "uniform _" << name_no_array << " { " << res.uniformbuf.type_name << " "
|
os << "uniform " << name_no_array << " { " << res.uniformbuf.type_name << " _"
|
||||||
<< res.uniformbuf.name << "; };\n";
|
<< res.uniformbuf.name << "; };\n";
|
||||||
break;
|
break;
|
||||||
case ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER:
|
case ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER:
|
||||||
@ -413,13 +413,36 @@ static void print_resource(std::ostream &os,
|
|||||||
name_no_array = (array_offset == -1) ? res.storagebuf.name :
|
name_no_array = (array_offset == -1) ? res.storagebuf.name :
|
||||||
StringRef(res.storagebuf.name.c_str(), array_offset);
|
StringRef(res.storagebuf.name.c_str(), array_offset);
|
||||||
print_qualifier(os, res.storagebuf.qualifiers);
|
print_qualifier(os, res.storagebuf.qualifiers);
|
||||||
os << "buffer _";
|
os << "buffer ";
|
||||||
os << name_no_array << " { " << res.storagebuf.type_name << " " << res.storagebuf.name
|
os << name_no_array << " { " << res.storagebuf.type_name << " _" << res.storagebuf.name
|
||||||
<< "; };\n";
|
<< "; };\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_resource_alias(std::ostream &os, const ShaderCreateInfo::Resource &res)
|
||||||
|
{
|
||||||
|
int64_t array_offset;
|
||||||
|
StringRef name_no_array;
|
||||||
|
|
||||||
|
switch (res.bind_type) {
|
||||||
|
case ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER:
|
||||||
|
array_offset = res.uniformbuf.name.find_first_of("[");
|
||||||
|
name_no_array = (array_offset == -1) ? res.uniformbuf.name :
|
||||||
|
StringRef(res.uniformbuf.name.c_str(), array_offset);
|
||||||
|
os << "#define " << name_no_array << " (_" << name_no_array << ")\n";
|
||||||
|
break;
|
||||||
|
case ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER:
|
||||||
|
array_offset = res.storagebuf.name.find_first_of("[");
|
||||||
|
name_no_array = (array_offset == -1) ? res.storagebuf.name :
|
||||||
|
StringRef(res.storagebuf.name.c_str(), array_offset);
|
||||||
|
os << "#define " << name_no_array << " (_" << name_no_array << ")\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void print_interface(std::ostream &os,
|
static void print_interface(std::ostream &os,
|
||||||
const StringRefNull &prefix,
|
const StringRefNull &prefix,
|
||||||
const StageInterfaceInfo &iface,
|
const StageInterfaceInfo &iface,
|
||||||
@ -452,10 +475,16 @@ std::string GLShader::resources_declare(const ShaderCreateInfo &info) const
|
|||||||
for (const ShaderCreateInfo::Resource &res : info.pass_resources_) {
|
for (const ShaderCreateInfo::Resource &res : info.pass_resources_) {
|
||||||
print_resource(ss, res, info.auto_resource_location_);
|
print_resource(ss, res, info.auto_resource_location_);
|
||||||
}
|
}
|
||||||
|
for (const ShaderCreateInfo::Resource &res : info.pass_resources_) {
|
||||||
|
print_resource_alias(ss, res);
|
||||||
|
}
|
||||||
ss << "\n/* Batch Resources. */\n";
|
ss << "\n/* Batch Resources. */\n";
|
||||||
for (const ShaderCreateInfo::Resource &res : info.batch_resources_) {
|
for (const ShaderCreateInfo::Resource &res : info.batch_resources_) {
|
||||||
print_resource(ss, res, info.auto_resource_location_);
|
print_resource(ss, res, info.auto_resource_location_);
|
||||||
}
|
}
|
||||||
|
for (const ShaderCreateInfo::Resource &res : info.batch_resources_) {
|
||||||
|
print_resource_alias(ss, res);
|
||||||
|
}
|
||||||
ss << "\n/* Push Constants. */\n";
|
ss << "\n/* Push Constants. */\n";
|
||||||
for (const ShaderCreateInfo::PushConst &uniform : info.push_constants_) {
|
for (const ShaderCreateInfo::PushConst &uniform : info.push_constants_) {
|
||||||
ss << "uniform " << to_string(uniform.type) << " " << uniform.name;
|
ss << "uniform " << to_string(uniform.type) << " " << uniform.name;
|
||||||
|
@ -469,8 +469,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
|
|||||||
if (res.bind_type == ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER) {
|
if (res.bind_type == ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER) {
|
||||||
copy_input_name(input, res.uniformbuf.name, name_buffer_, name_buffer_offset);
|
copy_input_name(input, res.uniformbuf.name, name_buffer_, name_buffer_offset);
|
||||||
if (true || !GLContext::explicit_location_support) {
|
if (true || !GLContext::explicit_location_support) {
|
||||||
std::string prefixed_name = "_" + res.uniformbuf.name;
|
input->location = glGetUniformBlockIndex(program, name_buffer_ + input->name_offset);
|
||||||
input->location = glGetUniformBlockIndex(program, prefixed_name.c_str());
|
|
||||||
glUniformBlockBinding(program, input->location, res.slot);
|
glUniformBlockBinding(program, input->location, res.slot);
|
||||||
}
|
}
|
||||||
input->binding = res.slot;
|
input->binding = res.slot;
|
||||||
|
Loading…
Reference in New Issue
Block a user