Commit b4b59726 by Tim Van Patten Committed by Commit Bot

Revert "Vulkan: Move xfb position decl to translator in extension path"

This reverts commit 8f5ca266. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Vulkan: Move xfb position decl to translator in extension path > > This change removes the @@ XFB-DECL @@ marker. The ANGLEXfbPosition > output is unconditionally emitted in VS, TES and GS by the translator, > and is appropriately decorated or removed by the SPIR-V transformer. > > Bug: angleproject:3606 > Change-Id: Ia76224f5a6d147362eeb2d288f05e333aaf75481 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617658 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Ia03988b9c17639513576e82e8f11cd4c7b52640b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3606 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634202Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
parent d0906276
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented every time the API changes. // It is incremented every time the API changes.
#define ANGLE_SH_VERSION 250 #define ANGLE_SH_VERSION 249
enum ShShaderSpec enum ShShaderSpec
{ {
...@@ -348,13 +348,9 @@ const ShCompileOptions SH_FORCE_SHADER_PRECISION_HIGHP_TO_MEDIUMP = UINT64_C(1) ...@@ -348,13 +348,9 @@ const ShCompileOptions SH_FORCE_SHADER_PRECISION_HIGHP_TO_MEDIUMP = UINT64_C(1)
// Allow compiler to use specialization constant to do pre-rotation and y flip. // Allow compiler to use specialization constant to do pre-rotation and y flip.
const ShCompileOptions SH_USE_SPECIALIZATION_CONSTANT = UINT64_C(1) << 58; const ShCompileOptions SH_USE_SPECIALIZATION_CONSTANT = UINT64_C(1) << 58;
// Ask compiler to generate Vulkan transform feedback emulation support code. // Ask compiler to generate transform feedback emulation support code.
const ShCompileOptions SH_ADD_VULKAN_XFB_EMULATION_SUPPORT_CODE = UINT64_C(1) << 59; const ShCompileOptions SH_ADD_VULKAN_XFB_EMULATION_SUPPORT_CODE = UINT64_C(1) << 59;
// Ask compiler to generate Vulkan transform feedback support code when using the
// VK_EXT_transform_feedback extension.
const ShCompileOptions SH_ADD_VULKAN_XFB_EXTENSION_SUPPORT_CODE = UINT64_C(1) << 60;
// Defines alternate strategies for implementing array index clamping. // Defines alternate strategies for implementing array index clamping.
enum ShArrayIndexClampingStrategy enum ShArrayIndexClampingStrategy
{ {
...@@ -877,15 +873,12 @@ extern const char kAtomicCountersBlockName[]; ...@@ -877,15 +873,12 @@ extern const char kAtomicCountersBlockName[];
// Line raster emulation varying // Line raster emulation varying
extern const char kLineRasterEmulationPosition[]; extern const char kLineRasterEmulationPosition[];
// Transform feedback emulation support // Transform feedback emulation helper function
extern const char kXfbEmulationGetOffsetsFunctionName[]; extern const char kXfbEmulationGetOffsetsFunctionName[];
extern const char kXfbEmulationBufferBlockName[]; extern const char kXfbEmulationBufferBlockName[];
extern const char kXfbEmulationBufferName[]; extern const char kXfbEmulationBufferName[];
extern const char kXfbEmulationBufferFieldName[]; extern const char kXfbEmulationBufferFieldName[];
// Transform feedback extension support
extern const char kXfbExtensionPositionOutName[];
} // namespace vk } // namespace vk
namespace mtl namespace mtl
......
...@@ -800,8 +800,6 @@ const char kXfbEmulationBufferBlockName[] = "ANGLEXfbBuffer"; ...@@ -800,8 +800,6 @@ const char kXfbEmulationBufferBlockName[] = "ANGLEXfbBuffer";
const char kXfbEmulationBufferName[] = "ANGLEXfb"; const char kXfbEmulationBufferName[] = "ANGLEXfb";
const char kXfbEmulationBufferFieldName[] = "xfbOut"; const char kXfbEmulationBufferFieldName[] = "xfbOut";
const char kXfbExtensionPositionOutName[] = "ANGLEXfbPosition";
} // namespace vk } // namespace vk
} // namespace sh } // namespace sh
...@@ -479,48 +479,6 @@ ANGLE_NO_DISCARD bool AddXfbEmulationSupport(TCompiler *compiler, ...@@ -479,48 +479,6 @@ ANGLE_NO_DISCARD bool AddXfbEmulationSupport(TCompiler *compiler,
return compiler->validateAST(root); return compiler->validateAST(root);
} }
ANGLE_NO_DISCARD bool AddXfbExtensionSupport(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable,
const DriverUniform *driverUniforms)
{
// Generate the following output varying declaration used to capture transform feedback output
// from gl_Position, as it can't be captured directly due to changes that are applied to it for
// clip-space correction and pre-rotation.
//
// out vec4 ANGLEXfbPosition;
const TType *vec4Type = nullptr;
switch (compiler->getShaderType())
{
case GL_VERTEX_SHADER:
vec4Type = StaticType::Get<EbtFloat, EbpHigh, EvqVertexOut, 4, 1>();
break;
case GL_TESS_EVALUATION_SHADER_EXT:
vec4Type = StaticType::Get<EbtFloat, EbpHigh, EvqTessEvaluationOut, 4, 1>();
break;
case GL_GEOMETRY_SHADER_EXT:
vec4Type = StaticType::Get<EbtFloat, EbpHigh, EvqGeometryOut, 4, 1>();
break;
default:
UNREACHABLE();
}
TVariable *varyingVar =
new TVariable(symbolTable, ImmutableString(vk::kXfbExtensionPositionOutName), vec4Type,
SymbolType::AngleInternal);
TIntermDeclaration *varyingDecl = new TIntermDeclaration();
varyingDecl->appendDeclarator(new TIntermSymbol(varyingVar));
// Insert the varying declaration before the first function.
const size_t firstFunctionIndex = FindFirstFunctionDefinitionIndex(root);
root->insertChildNodes(firstFunctionIndex, {varyingDecl});
return compiler->validateAST(root);
}
ANGLE_NO_DISCARD bool InsertFragCoordCorrection(TCompiler *compiler, ANGLE_NO_DISCARD bool InsertFragCoordCorrection(TCompiler *compiler,
ShCompileOptions compileOptions, ShCompileOptions compileOptions,
TIntermBlock *root, TIntermBlock *root,
...@@ -925,14 +883,8 @@ bool TranslatorVulkan::translateImpl(TIntermBlock *root, ...@@ -925,14 +883,8 @@ bool TranslatorVulkan::translateImpl(TIntermBlock *root,
if (gl::ShaderTypeSupportsTransformFeedback(packedShaderType)) if (gl::ShaderTypeSupportsTransformFeedback(packedShaderType))
{ {
if (compileOptions & SH_ADD_VULKAN_XFB_EXTENSION_SUPPORT_CODE) // Add a macro to declare transform feedback buffers.
{ sink << "@@ XFB-DECL @@\n\n";
// Add support code for transform feedback extension.
if (!AddXfbExtensionSupport(this, root, &getSymbolTable(), driverUniforms))
{
return false;
}
}
// Append a macro for transform feedback substitution prior to modifying depth. // Append a macro for transform feedback substitution prior to modifying depth.
if (!AppendTransformFeedbackOutputToMain(this, root, &getSymbolTable())) if (!AppendTransformFeedbackOutputToMain(this, root, &getSymbolTable()))
......
...@@ -87,11 +87,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *conte ...@@ -87,11 +87,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *conte
compileOptions |= SH_ADD_PRE_ROTATION; compileOptions |= SH_ADD_PRE_ROTATION;
} }
if (contextVk->getFeatures().supportsTransformFeedbackExtension.enabled) if (contextVk->getFeatures().emulateTransformFeedback.enabled)
{
compileOptions |= SH_ADD_VULKAN_XFB_EXTENSION_SUPPORT_CODE;
}
else if (contextVk->getFeatures().emulateTransformFeedback.enabled)
{ {
compileOptions |= SH_ADD_VULKAN_XFB_EMULATION_SUPPORT_CODE; compileOptions |= SH_ADD_VULKAN_XFB_EMULATION_SUPPORT_CODE;
} }
......
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