mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 22:00:05 +00:00
MSL: Make rw texture fences optional
This commit is contained in:
parent
4405dd6b28
commit
894113f55b
@ -8686,7 +8686,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction)
|
||||
}
|
||||
|
||||
// Metal requires explicit fences to break up RAW hazards, even within the same shader invocation
|
||||
if (p_var && !has_decoration(p_var->self, DecorationNonWritable))
|
||||
if (msl_options.readwrite_texture_fences && p_var && !has_decoration(p_var->self, DecorationNonWritable))
|
||||
statement(to_expression(img_id), ".fence();");
|
||||
|
||||
emit_texture_op(instruction, false);
|
||||
|
@ -496,6 +496,12 @@ public:
|
||||
// so it can be enabled only when the bug is present.
|
||||
bool sample_dref_lod_array_as_grad = false;
|
||||
|
||||
// MSL doesn't guarantee coherence between writes and subsequent reads of read_write textures.
|
||||
// This inserts fences before each read of a read_write texture to ensure coherency.
|
||||
// If you're sure you never rely on this, you can set this to false for a possible performance improvement.
|
||||
// Note: Only Apple's GPU compiler takes advantage of the lack of coherency, so make sure to test on Apple GPUs if you disable this.
|
||||
bool readwrite_texture_fences = true;
|
||||
|
||||
bool is_ios() const
|
||||
{
|
||||
return platform == iOS;
|
||||
|
Loading…
Reference in New Issue
Block a user