Commit ed9213bc by Le Hoang Quyen Committed by Commit Bot

Metal: explicitly convert XFB vertex shader to void function

Previously, spirv-cross would automatically do this (converting to void function) if shader writes to XFB buffers, however this behavior is changed in latest spirv-cross version. So the rasterization disable must be explicitly specified via spirv-cross’s options now. Bug: chromium:1159974 Change-Id: I9f34e1cd9d2f1386e8a8d030a800fbd7341eb68f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2596914 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 0322fc1a
......@@ -278,6 +278,7 @@ class SpirvToMslCompiler : public spirv_cross::CompilerMSL
const angle::HashMap<std::string, uint32_t> &uboOriginalBindings,
const angle::HashMap<uint32_t, uint32_t> &xfbOriginalBindings,
const OriginalSamplerBindingMap &originalSamplerBindings,
bool disableRasterization,
TranslatedShaderInfo *mslShaderInfoOut)
{
spirv_cross::CompilerMSL::Options compOpt;
......@@ -300,6 +301,7 @@ class SpirvToMslCompiler : public spirv_cross::CompilerMSL
}
compOpt.pad_fragment_output_components = true;
compOpt.disable_rasterization = disableRasterization;
// Tell spirv-cross to map default & driver uniform & storage blocks as we want
spirv_cross::ShaderResources mslRes = spirv_cross::CompilerMSL::get_shader_resources();
......@@ -355,6 +357,7 @@ angle::Result ConvertSpirvToMsl(Context *context,
const angle::HashMap<std::string, uint32_t> &uboOriginalBindings,
const angle::HashMap<uint32_t, uint32_t> &xfbOriginalBindings,
const OriginalSamplerBindingMap &originalSamplerBindings,
bool disableRasterization,
std::vector<uint32_t> *sprivCode,
TranslatedShaderInfo *translatedShaderInfoOut)
{
......@@ -368,7 +371,7 @@ angle::Result ConvertSpirvToMsl(Context *context,
// NOTE(hqle): spirv-cross uses exceptions to report error, what should we do here
// in case of error?
compilerMsl.compileEx(shaderType, uboOriginalBindings, xfbOriginalBindings,
originalSamplerBindings, translatedShaderInfoOut);
originalSamplerBindings, disableRasterization, translatedShaderInfoOut);
if (translatedShaderInfoOut->metalShaderSource.size() == 0)
{
ANGLE_MTL_CHECK(context, false, GL_INVALID_OPERATION);
......@@ -519,15 +522,16 @@ angle::Result SpirvCodeToMsl(Context *context,
{
std::vector<uint32_t> &sprivCode = spirvShaderCode->at(shaderType);
ANGLE_TRY(ConvertSpirvToMsl(context, shaderType, uboOriginalBindings, xfbOriginalBindings,
originalSamplerBindings, &sprivCode,
&mslShaderInfoOut->at(shaderType)));
originalSamplerBindings, /* disableRasterization */ false,
&sprivCode, &mslShaderInfoOut->at(shaderType)));
} // for (gl::ShaderType shaderType
// Special version of XFB only
if (xfbOnlySpirvCode && !programState.getLinkedTransformFeedbackVaryings().empty())
{
ANGLE_TRY(ConvertSpirvToMsl(context, gl::ShaderType::Vertex, uboOriginalBindings,
xfbOriginalBindings, originalSamplerBindings, xfbOnlySpirvCode,
xfbOriginalBindings, originalSamplerBindings,
/* disableRasterization */ true, xfbOnlySpirvCode,
mslXfbOnlyShaderInfoOut));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment