MSL: Simplify framebuffer fetch implementation.

This commit is contained in:
Hans-Kristian Arntzen 2019-10-24 11:48:29 +02:00
parent 2ca725a78d
commit b433836b08

View File

@ -6136,12 +6136,10 @@ void CompilerMSL::emit_texture_op(const Instruction &i)
// Use Metal's native frame-buffer fetch API for subpass inputs. // Use Metal's native frame-buffer fetch API for subpass inputs.
if (imgtype.image.dim == DimSubpassData) if (imgtype.image.dim == DimSubpassData)
{ {
SmallVector<uint32_t> inherited_expressions; // Subpass inputs cannot be invalidated,
bool forward = false; // so just forward the expression directly.
to_texture_op(i, &forward, inherited_expressions);
string expr = to_expression(img); string expr = to_expression(img);
emit_op(result_type_id, id, expr, forward); emit_op(result_type_id, id, expr, true);
return; return;
} }
} }
@ -7159,14 +7157,12 @@ string CompilerMSL::to_function_args(VariableID img, const SPIRType &imgtype, bo
break; break;
case DimSubpassData: case DimSubpassData:
// Use Metal's native frame-buffer fetch API for subpass inputs. // If we're using Metal's native frame-buffer fetch API for subpass inputs,
if (!msl_options.is_ios() || !msl_options.ios_use_framebuffer_fetch_subpasses) // this path will not be hit.
{ if (imgtype.image.ms)
if (imgtype.image.ms) tex_coords = "uint2(gl_FragCoord.xy)";
tex_coords = "uint2(gl_FragCoord.xy)"; else
else tex_coords = join("uint2(gl_FragCoord.xy), 0");
tex_coords = join("uint2(gl_FragCoord.xy), 0");
}
break; break;
case Dim2D: case Dim2D: