Rename and expand shader variable init feature.

This feature now forces both output and unitialized locals to be
initialized by the shader translator. This feature is needed by the
trace validator to ensure we get deterministic behaviour in traces
that exhibit some undefined results.

Bug: angleproject:5133
Change-Id: Id1242cd077a57e891eed217f7671976ce1631a58
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140216
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill
2021-09-02 13:47:34 -04:00
committed by Angle LUCI CQ
parent 9c05f55aa4
commit b6e99bb382
11 changed files with 36 additions and 41 deletions

View File

@@ -82,11 +82,11 @@ struct FrontendFeatures : angle::FeatureSetBase
"forceRobustResourceInit", angle::FeatureCategory::FrontendFeatures,
"Force-enable robust resource init", &members, "http://anglebug.com/6041"};
// Forces on shader output initialization to avoid undefined values in tests. Normally this
// feature is only enabled for WebGL.
angle::Feature forceInitShaderOutputVariables = {
"forceInitShaderOutputVariables", angle::FeatureCategory::FrontendFeatures,
"Force-enable shader output variable initialization", &members};
// Forces on shader variable init to avoid undefined values in tests. This feature is enabled
// for WebGL and frame capture, which both require deterministic results.
angle::Feature forceInitShaderVariables = {
"forceInitShaderVariables", angle::FeatureCategory::FrontendFeatures,
"Force-enable shader variable initialization", &members};
angle::Feature enableProgramBinaryForCapture = {
"enableProgramBinaryForCapture", angle::FeatureCategory::FrontendFeatures,

View File

@@ -369,9 +369,10 @@ void Shader::compile(const Context *context)
options |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
}
if (context->getFrontendFeatures().forceInitShaderOutputVariables.enabled)
if (context->getFrontendFeatures().forceInitShaderVariables.enabled)
{
options |= SH_INIT_OUTPUT_VARIABLES;
options |= SH_INITIALIZE_UNINITIALIZED_LOCALS;
}
mCurrentMaxComputeWorkGroupInvocations =

View File

@@ -15,8 +15,8 @@
6142 VULKAN : BlitFramebufferTest.BlitDepthStencilPixelByPixel/* = SKIP
6153 VULKAN WIN INTEL : GLSLTest_ES31.StructAndArrayEqualOperator/ES3_1_Vulkan_DirectSPIRVGen = SKIP
6153 VULKAN PIXEL4ORXL : GLSLTest_ES31.StructAndArrayEqualOperator/ES3_1_Vulkan_DirectSPIRVGen = SKIP
6344 PIXEL4ORXL : GLSLTest_ES31_InitOutputVariables.InitIOBlockWithStruct/ES3_1_Vulkan_InitShaderOutputs = SKIP
6344 PIXEL4ORXL : GLSLTest_ES31_InitOutputVariables.InitIOBlockWithComplexTypes/ES3_1_Vulkan_InitShaderOutputs = SKIP
6344 PIXEL4ORXL : GLSLTest_ES31_InitShaderVariables.InitIOBlockWithStruct/ES3_1_Vulkan_InitShaderVars = SKIP
6344 PIXEL4ORXL : GLSLTest_ES31_InitShaderVariables.InitIOBlockWithComplexTypes/ES3_1_Vulkan_InitShaderVars = SKIP
// Direct SPIR-V generation. The following tests pass on some platforms but not others. Need to investigate.
4889 VULKAN : GeometryShaderTest.LayeredFramebufferPreRenderClear2DArrayColor/ES3_1_Vulkan_DirectSPIRVGen = SKIP

View File

@@ -476,16 +476,11 @@ class TestBatch():
test_exe_path = os.path.join(args.out_dir, 'Capture', args.test_suite)
extra_env = {
'ANGLE_CAPTURE_FRAME_END':
'{}'.format(self.CAPTURE_FRAME_END),
'ANGLE_CAPTURE_SERIALIZE_STATE':
'1',
'ANGLE_FEATURE_OVERRIDES_ENABLED':
'forceRobustResourceInit:forceInitShaderOutputVariables',
'ANGLE_CAPTURE_ENABLED':
'1',
'ANGLE_CAPTURE_OUT_DIR':
self.trace_folder_path,
'ANGLE_CAPTURE_FRAME_END': '{}'.format(self.CAPTURE_FRAME_END),
'ANGLE_CAPTURE_SERIALIZE_STATE': '1',
'ANGLE_FEATURE_OVERRIDES_ENABLED': 'forceRobustResourceInit:forceInitShaderVariables',
'ANGLE_CAPTURE_ENABLED': '1',
'ANGLE_CAPTURE_OUT_DIR': self.trace_folder_path,
}
env = {**os.environ.copy(), **extra_env}

View File

@@ -88,9 +88,9 @@ class CaptureReplayTests
configParams.webGLCompatibility = testTraceInfo.webGLCompatibility;
configParams.robustResourceInit = testTraceInfo.robustResourceInit;
mPlatformParams.renderer = testTraceInfo.replayPlatformType;
mPlatformParams.deviceType = testTraceInfo.replayDeviceType;
mPlatformParams.forceInitShaderOutputVariables = EGL_TRUE;
mPlatformParams.renderer = testTraceInfo.replayPlatformType;
mPlatformParams.deviceType = testTraceInfo.replayDeviceType;
mPlatformParams.forceInitShaderVariables = EGL_TRUE;
if (!mEGLWindow->initializeGL(mOSWindow, mEntryPointsLib.get(),
angle::GLESDriverType::AngleEGL, mPlatformParams,

View File

@@ -516,7 +516,7 @@ class GLSLTest_ES31 : public GLSLTest
{};
// Tests the "init output variables" ANGLE shader translator option.
class GLSLTest_ES31_InitOutputVariables : public GLSLTest
class GLSLTest_ES31_InitShaderVariables : public GLSLTest
{};
std::string BuildBigInitialStackShader(int length)
@@ -13295,7 +13295,7 @@ void main() {
}
// Tests initializing a shader IO block using the shader translator option.
TEST_P(GLSLTest_ES31_InitOutputVariables, InitIOBlock)
TEST_P(GLSLTest_ES31_InitShaderVariables, InitIOBlock)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_shader_io_blocks"));
@@ -13335,7 +13335,7 @@ void main()
}
// Tests initializing a shader IO block with an array using the shader translator option.
TEST_P(GLSLTest_ES31_InitOutputVariables, InitIOBlockWithArray)
TEST_P(GLSLTest_ES31_InitShaderVariables, InitIOBlockWithArray)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_shader_io_blocks"));
@@ -13376,7 +13376,7 @@ void main()
}
// Tests initializing a shader IO block with a struct using the shader translator option.
TEST_P(GLSLTest_ES31_InitOutputVariables, InitIOBlockWithStruct)
TEST_P(GLSLTest_ES31_InitShaderVariables, InitIOBlockWithStruct)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_shader_io_blocks"));
@@ -13425,7 +13425,7 @@ void main()
}
// Tests initializing an IO block with a complicated set of types, using the shader translator.
TEST_P(GLSLTest_ES31_InitOutputVariables, InitIOBlockWithComplexTypes)
TEST_P(GLSLTest_ES31_InitShaderVariables, InitIOBlockWithComplexTypes)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_shader_io_blocks"));
@@ -13501,6 +13501,5 @@ ANGLE_INSTANTIATE_TEST_ES3_AND(WebGL2GLSLTest, WithDirectSPIRVGeneration(ES3_VUL
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GLSLTest_ES31);
ANGLE_INSTANTIATE_TEST_ES31_AND(GLSLTest_ES31, WithDirectSPIRVGeneration(ES31_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GLSLTest_ES31_InitOutputVariables);
ANGLE_INSTANTIATE_TEST(GLSLTest_ES31_InitOutputVariables,
WithInitShaderOutputVariables(ES31_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GLSLTest_ES31_InitShaderVariables);
ANGLE_INSTANTIATE_TEST(GLSLTest_ES31_InitShaderVariables, WithInitShaderVariables(ES31_VULKAN()));

View File

@@ -1876,7 +1876,7 @@ void RegisterTraceTests()
overrideParams.eglParameters.captureLimits = EGL_TRUE;
// This feature should also be enabled in capture to mirror the replay.
overrideParams.eglParameters.forceInitShaderOutputVariables = EGL_TRUE;
overrideParams.eglParameters.forceInitShaderVariables = EGL_TRUE;
}
auto factory = [overrideParams]() { return new TracePerfTest(overrideParams); };

View File

@@ -283,9 +283,9 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
stream << "_DirectMetalGen";
}
if (pp.eglParameters.forceInitShaderOutputVariables == EGL_TRUE)
if (pp.eglParameters.forceInitShaderVariables == EGL_TRUE)
{
stream << "_InitShaderOutputs";
stream << "_InitShaderVars";
}
return stream;

View File

@@ -311,11 +311,11 @@ inline PlatformParameters WithDirectMetalGeneration(const PlatformParameters &pa
return directMetalGeneration;
}
inline PlatformParameters WithInitShaderOutputVariables(const PlatformParameters &params)
inline PlatformParameters WithInitShaderVariables(const PlatformParameters &params)
{
PlatformParameters initShaderOutputVariables = params;
initShaderOutputVariables.eglParameters.forceInitShaderOutputVariables = EGL_TRUE;
return initShaderOutputVariables;
PlatformParameters initShaderVariables = params;
initShaderVariables.eglParameters.forceInitShaderVariables = EGL_TRUE;
return initShaderVariables;
}
} // namespace angle

View File

@@ -19,7 +19,7 @@ struct PlatformMethods;
// The GLES driver type determines what shared object we use to load the GLES entry points.
// AngleEGL loads from ANGLE's version of libEGL, libGLESv2, and libGLESv1_CM.
// SystemEGL uses the system copies of libEGL, libGLESv2, and libGLESv1_CM.
// SystemWGL loads Windows GL with the GLES compatiblity extensions. See util/WGLWindow.h.
// SystemWGL loads Windows GL with the GLES compatibility extensions. See util/WGLWindow.h.
enum class GLESDriverType
{
AngleEGL,
@@ -66,7 +66,7 @@ struct EGLPlatformParameters
hasExplicitMemBarrierFeatureMtl, hasCheapRenderPassFeatureMtl,
forceBufferGPUStorageFeatureMtl, supportsVulkanViewportFlip, emulatedVAOs,
directSPIRVGeneration, captureLimits, forceRobustResourceInit,
directMetalGeneration, forceInitShaderOutputVariables);
directMetalGeneration, forceInitShaderVariables);
}
EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
@@ -93,7 +93,7 @@ struct EGLPlatformParameters
EGLint captureLimits = EGL_DONT_CARE;
EGLint forceRobustResourceInit = EGL_DONT_CARE;
EGLint directMetalGeneration = EGL_DONT_CARE;
EGLint forceInitShaderOutputVariables = EGL_DONT_CARE;
EGLint forceInitShaderVariables = EGL_DONT_CARE;
angle::PlatformMethods *platformMethods = nullptr;
};

View File

@@ -301,9 +301,9 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
enabledFeatureOverrides.push_back("forceRobustResourceInit");
}
if (params.forceInitShaderOutputVariables == EGL_TRUE)
if (params.forceInitShaderVariables == EGL_TRUE)
{
enabledFeatureOverrides.push_back("forceInitShaderOutputVariables");
enabledFeatureOverrides.push_back("forceInitShaderVariables");
}
const bool hasFeatureControlANGLE =