Hash :
6c5b766b
Author :
Date :
2021-01-16T11:33:00
Reland "Vulkan: Generate xfb support code in SPIR-V for extension path" This reverts commit d090627616641f7524655627bfd415de6f8af942. Reason for revert: Fixed parent CL Original change's description: > Revert "Vulkan: Generate xfb support code in SPIR-V for extension path" > > This reverts commit d06feeac1e79d6102e01c123a360bc9099d5bba3. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Vulkan: Generate xfb support code in SPIR-V for extension path > > > > The only piece of code that's needed to be generated for the extension > > path is the following, at the right spot (right before depth correction > > and pre-rotation): > > > > ANGLEXfbPosition = gl_Position; > > > > The SPIR-V transformer already has gl_Position loaded for depth > > correction and pre-rotation, so this change simply adds an OpStore to > > ANGLEXfbPosition. > > > > As a result of this change, @@ XFB-OUT @@ is no longer emitted if > > the transform feedback extension is supported. With the above code now > > placed correctly for geometry shaders, transform feedback tests for > > geometry shaders are enabled. > > > > Bug: angleproject:3606 > > Change-Id: I13a7956ab62a1a6b4196ff999442b99b50226c0f > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617659 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I74fa9fafe3c922cdb7cd09ee6351534e38528da9 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:3606 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634048 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: angleproject:3606 Change-Id: Ic49a0be10cdb58e2b47896554f272093e24f93b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633711 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ShaderVk.cpp:
// Implements the class methods for ShaderVk.
//
#include "libANGLE/renderer/vulkan/ShaderVk.h"
#include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "platform/FeaturesVk.h"
namespace rx
{
ShaderVk::ShaderVk(const gl::ShaderState &state) : ShaderImpl(state) {}
ShaderVk::~ShaderVk() {}
std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *context,
gl::ShCompilerInstance *compilerInstance,
ShCompileOptions options)
{
ShCompileOptions compileOptions = 0;
ContextVk *contextVk = vk::GetImpl(context);
bool isWebGL = context->getExtensions().webglCompatibility;
if (isWebGL)
{
// Only webgl requires initialization of local variables, others don't.
// Extra initialization in spirv shader may affect performance.
compileOptions |= SH_INITIALIZE_UNINITIALIZED_LOCALS;
if (mState.getShaderType() != gl::ShaderType::Compute)
{
compileOptions |= SH_INIT_OUTPUT_VARIABLES;
}
}
if (contextVk->getFeatures().clampPointSize.enabled)
{
compileOptions |= SH_CLAMP_POINT_SIZE;
}
if (contextVk->getFeatures().basicGLLineRasterization.enabled)
{
compileOptions |= SH_ADD_BRESENHAM_LINE_RASTER_EMULATION;
}
if (contextVk->emulateSeamfulCubeMapSampling())
{
compileOptions |= SH_EMULATE_SEAMFUL_CUBE_MAP_SAMPLING;
}
if (!contextVk->getFeatures().enablePrecisionQualifiers.enabled)
{
compileOptions |= SH_IGNORE_PRECISION_QUALIFIERS;
}
// Let compiler detect and emit early fragment test execution mode. We will remove it if
// context state does not allow it
compileOptions |= SH_EARLY_FRAGMENT_TESTS_OPTIMIZATION;
// Let compiler use specialized constant for pre-rotation.
if (!contextVk->getFeatures().forceDriverUniformOverSpecConst.enabled)
{
compileOptions |= SH_USE_SPECIALIZATION_CONSTANT;
}
if (contextVk->getFeatures().enablePreRotateSurfaces.enabled ||
contextVk->getFeatures().emulatedPrerotation90.enabled ||
contextVk->getFeatures().emulatedPrerotation180.enabled ||
contextVk->getFeatures().emulatedPrerotation270.enabled)
{
// Let compiler insert pre-rotation code.
compileOptions |= SH_ADD_PRE_ROTATION;
}
if (contextVk->getFeatures().supportsTransformFeedbackExtension.enabled)
{
compileOptions |= SH_ADD_VULKAN_XFB_EXTENSION_SUPPORT_CODE;
}
else if (mState.getShaderType() == gl::ShaderType::Vertex &&
contextVk->getFeatures().emulateTransformFeedback.enabled)
{
compileOptions |= SH_ADD_VULKAN_XFB_EMULATION_SUPPORT_CODE;
}
return compileImpl(context, compilerInstance, mState.getSource(), compileOptions | options);
}
std::string ShaderVk::getDebugInfo() const
{
return mState.getTranslatedSource();
}
} // namespace rx