Fix: Metal: Error caused by missing const_cast

Error introduced by 7dc43b7dd2
This commit is contained in:
Clément Foucault
2024-10-29 23:55:17 +01:00
parent e247c358db
commit 7c979d6d40

View File

@@ -3029,8 +3029,25 @@ std::string MSLGeneratorInterface::generate_msl_texture_vars(ShaderStage shader_
if (tex_buf_id != -1) {
MSLBufferBlock &ssbo = this->storage_blocks[tex_buf_id];
out << "\t" << get_shader_stage_instance_name(shader_stage) << "."
<< this->texture_samplers[i].name << ".atomic.buffer = " << ssbo.name << ";"
<< std::endl;
<< this->texture_samplers[i].name << ".atomic.buffer = ";
if (bool(shader_stage & ShaderStage::VERTEX)) {
bool writeable = bool(ssbo.qualifiers & shader::Qualifier::WRITE);
const char *memory_scope = ((writeable) ? "device " : "constant ");
out << "const_cast<" << memory_scope;
if (!is_builtin_type(ssbo.type_name)) {
out << get_stage_class_name(shader_stage) << "::";
}
out << ssbo.type_name << "*>(";
}
out << ssbo.name;
if (bool(shader_stage & ShaderStage::VERTEX)) {
out << ")";
}
out << ";" << std::endl;
out << "\t" << get_shader_stage_instance_name(shader_stage) << "."
<< this->texture_samplers[i].name << ".atomic.aligned_width = uniforms->"
<< this->texture_samplers[i].name << "_metadata.w;" << std::endl;