diff --git a/extensions/EGL_ANGLE_feature_control.txt b/extensions/EGL_ANGLE_feature_control.txt index 6a85b3dee..3a3256f3b 100644 --- a/extensions/EGL_ANGLE_feature_control.txt +++ b/extensions/EGL_ANGLE_feature_control.txt @@ -89,20 +89,17 @@ New Behavior The attribute following EGL_FEATURE_OVERRIDES_ENABLED_ANGLE or EGL_FEATURE_OVERRIDES_DISABLED_ANGLE should be of type char**, - which should contain an array of strings naming the features to - be enabled or disabled upon display creation. Any features - unspecified by these arrays will be initialized with an internal - heuristic. Any features specified in one of the arrays will be - initialized to "enabled" or "disabled" dependent on in which - array it can be found. Any features specified in both arrays - will be initialized with undefined behavior. + which should contain a null-terminated array of C strings naming + the features to be enabled or disabled upon display creation. + Any features unspecified in one of these arrays will be + initialized with an internal heuristic. Add the following to the end of section 3.3 "EGL Queries": const char *eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index); - eGLQueryStringiANGLE returns a pointer to a static, zero- + eGLQueryStringiANGLE returns a pointer to a static, null- terminated string describing some aspect of the EGL implementation running on the specified display, from an array of strings. name may be one of EGL_FEATURE_NAME_ANGLE, diff --git a/include/platform/WorkaroundsD3D.h b/include/platform/FeaturesD3D.h similarity index 96% rename from include/platform/WorkaroundsD3D.h rename to include/platform/FeaturesD3D.h index 9b76a6db3..b3d61c70e 100644 --- a/include/platform/WorkaroundsD3D.h +++ b/include/platform/FeaturesD3D.h @@ -4,10 +4,10 @@ // found in the LICENSE file. // -// WorkaroundsD3D.h: Workarounds for D3D driver bugs and other issues. +// FeaturesD3D.h: Features and workarounds for D3D driver bugs and other issues. -#ifndef ANGLE_PLATFORM_WORKAROUNDSD3D_H_ -#define ANGLE_PLATFORM_WORKAROUNDSD3D_H_ +#ifndef ANGLE_PLATFORM_FEATURESD3D_H_ +#define ANGLE_PLATFORM_FEATURESD3D_H_ #include "platform/Feature.h" @@ -26,10 +26,10 @@ struct CompilerWorkaroundsD3D bool enableIEEEStrictness = false; }; -struct WorkaroundsD3D : FeatureSetBase +struct FeaturesD3D : FeatureSetBase { - WorkaroundsD3D(); - ~WorkaroundsD3D(); + FeaturesD3D(); + ~FeaturesD3D(); // On some systems, having extra rendertargets than necessary slows down the shader. // We can fix this by optimizing those out of the shader. At the same time, we can @@ -206,9 +206,9 @@ struct WorkaroundsD3D : FeatureSetBase &members, "http://anglebug.com/3246"}; }; -inline WorkaroundsD3D::WorkaroundsD3D() = default; -inline WorkaroundsD3D::~WorkaroundsD3D() = default; +inline FeaturesD3D::FeaturesD3D() = default; +inline FeaturesD3D::~FeaturesD3D() = default; } // namespace angle -#endif // ANGLE_PLATFORM_WORKAROUNDSD3D_H_ +#endif // ANGLE_PLATFORM_FEATURESD3D_H_ diff --git a/src/libANGLE/renderer/gl/WorkaroundsGL.h b/include/platform/FeaturesGL.h similarity index 67% rename from src/libANGLE/renderer/gl/WorkaroundsGL.h rename to include/platform/FeaturesGL.h index 74820afad..e18130303 100644 --- a/src/libANGLE/renderer/gl/WorkaroundsGL.h +++ b/include/platform/FeaturesGL.h @@ -4,20 +4,20 @@ // found in the LICENSE file. // -// WorkaroundsGL.h: Workarounds for GL driver bugs and other issues. +// FeaturesGL.h: Features and workarounds for GL driver bugs and other issues. -#ifndef LIBANGLE_RENDERER_GL_WORKAROUNDSGL_H_ -#define LIBANGLE_RENDERER_GL_WORKAROUNDSGL_H_ +#ifndef ANGLE_PLATFORM_FEATURESGL_H_ +#define ANGLE_PLATFORM_FEATURESGL_H_ #include "platform/Feature.h" -namespace rx +namespace angle { -struct WorkaroundsGL : angle::FeatureSetBase +struct FeaturesGL : FeatureSetBase { - WorkaroundsGL(); - ~WorkaroundsGL(); + FeaturesGL(); + ~FeaturesGL(); // When writing a float to a normalized integer framebuffer, desktop OpenGL is allowed to write // one of the two closest normalized integer representations (although round to nearest is @@ -26,24 +26,23 @@ struct WorkaroundsGL : angle::FeatureSetBase // section 2.1.2 of the OpenGL ES 2.0.25 spec). This issue only shows up on Intel and AMD // drivers on framebuffer formats that have 1-bit alpha, work around this by using higher // precision formats instead. - angle::Feature avoid1BitAlphaTextureFormats = { - "avoid_1_bit_alpha_texture_formats", angle::FeatureCategory::OpenGLWorkarounds, + Feature avoid1BitAlphaTextureFormats = { + "avoid_1_bit_alpha_texture_formats", FeatureCategory::OpenGLWorkarounds, "Issue on Intel and AMD drivers with 1-bit alpha framebuffer formats", &members}; // On some older Intel drivers, GL_RGBA4 is not color renderable, glCheckFramebufferStatus // returns GL_FRAMEBUFFER_UNSUPPORTED. Work around this by using a known color-renderable // format. - angle::Feature rgba4IsNotSupportedForColorRendering = { - "rgba4_is_not_supported_for_color_rendering", angle::FeatureCategory::OpenGLWorkarounds, + Feature rgba4IsNotSupportedForColorRendering = { + "rgba4_is_not_supported_for_color_rendering", FeatureCategory::OpenGLWorkarounds, "Issue on older Intel drivers, GL_RGBA4 is not color renderable", &members}; // When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the // driver clears to the linearized clear color despite the framebuffer not supporting SRGB // blending. It only seems to do this when the framebuffer has only linear attachments, mixed // attachments appear to get the correct clear color. - angle::Feature doesSRGBClearsOnLinearFramebufferAttachments = { - "does_srgb_clears_on_linear_framebuffer_attachments", - angle::FeatureCategory::OpenGLWorkarounds, + Feature doesSRGBClearsOnLinearFramebufferAttachments = { + "does_srgb_clears_on_linear_framebuffer_attachments", FeatureCategory::OpenGLWorkarounds, "Issue clearing framebuffers with linear attachments on Intel or AMD " "drivers when GL_FRAMEBUFFER_SRGB is enabled", &members}; @@ -55,15 +54,15 @@ struct WorkaroundsGL : angle::FeatureSetBase // continue; // } while (i > 0) // Work around this by rewriting the do-while to use another GLSL construct (block + while) - angle::Feature doWhileGLSLCausesGPUHang = { - "do_while_glsl_causes_gpu_hang", angle::FeatureCategory::OpenGLWorkarounds, + Feature doWhileGLSLCausesGPUHang = { + "do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds, "On Mac, some GLSL constructs involving do-while loops cause GPU hangs", &members}; // Calling glFinish doesn't cause all queries to report that the result is available on some // (NVIDIA) drivers. It was found that enabling GL_DEBUG_OUTPUT_SYNCHRONOUS before the finish // causes it to fully finish. - angle::Feature finishDoesNotCauseQueriesToBeAvailable = { - "finish_does_not_cause_queries_to_be_available", angle::FeatureCategory::OpenGLWorkarounds, + Feature finishDoesNotCauseQueriesToBeAvailable = { + "finish_does_not_cause_queries_to_be_available", FeatureCategory::OpenGLWorkarounds, "On some NVIDIA drivers, glFinish doesn't cause all queries to report available result", &members}; @@ -71,39 +70,38 @@ struct WorkaroundsGL : angle::FeatureSetBase // This workaround is meant to reproduce the use_current_program_after_successful_link // workaround in Chromium (http://crbug.com/110263). It has been shown that this workaround is // not necessary for MacOSX 10.9 and higher (http://crrev.com/39eb535b). - angle::Feature alwaysCallUseProgramAfterLink = { - "always_call_use_program_after_link", angle::FeatureCategory::OpenGLWorkarounds, + Feature alwaysCallUseProgramAfterLink = { + "always_call_use_program_after_link", FeatureCategory::OpenGLWorkarounds, "Always call useProgram after a successful link to avoid a driver bug", &members}; // In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row. - angle::Feature unpackOverlappingRowsSeparatelyUnpackBuffer = { - "unpack_overlapping_rows_separately_unpack_buffer", - angle::FeatureCategory::OpenGLWorkarounds, + Feature unpackOverlappingRowsSeparatelyUnpackBuffer = { + "unpack_overlapping_rows_separately_unpack_buffer", FeatureCategory::OpenGLWorkarounds, "In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row", &members}; // In the case of packing to a pixel pack buffer, pack overlapping rows row by row. - angle::Feature packOverlappingRowsSeparatelyPackBuffer = { - "pack_overlapping_rows_separately_pack_buffer", angle::FeatureCategory::OpenGLWorkarounds, + Feature packOverlappingRowsSeparatelyPackBuffer = { + "pack_overlapping_rows_separately_pack_buffer", FeatureCategory::OpenGLWorkarounds, "In the case of packing to a pixel pack buffer, pack overlapping rows row by row", &members}; // During initialization, assign the current vertex attributes to the spec-mandated defaults. - angle::Feature initializeCurrentVertexAttributes = { - "initialize_current_vertex_attributes", angle::FeatureCategory::OpenGLWorkarounds, + Feature initializeCurrentVertexAttributes = { + "initialize_current_vertex_attributes", FeatureCategory::OpenGLWorkarounds, "During initialization, assign the current vertex attributes to the spec-mandated defaults", &members}; // abs(i) where i is an integer returns unexpected result on Intel Mac. // Emulate abs(i) with i * sign(i). - angle::Feature emulateAbsIntFunction = { - "emulate_abs_int_function", angle::FeatureCategory::OpenGLWorkarounds, + Feature emulateAbsIntFunction = { + "emulate_abs_int_function", FeatureCategory::OpenGLWorkarounds, "On Intel Mac, abs(i) where i is an integer returns unexpected result", &members}; // On Intel Mac, calculation of loop conditions in for and while loop has bug. // Add "&& true" to the end of the condition expression to work around the bug. - angle::Feature addAndTrueToLoopCondition = { - "add_and_true_to_loop_condition", angle::FeatureCategory::OpenGLWorkarounds, + Feature addAndTrueToLoopCondition = { + "add_and_true_to_loop_condition", FeatureCategory::OpenGLWorkarounds, "On Intel Mac, calculation of loop conditions in for and while loop has bug", &members}; // When uploading textures from an unpack buffer, some drivers count an extra row padding when @@ -118,63 +116,59 @@ struct WorkaroundsGL : angle::FeatureSetBase // +-------A--B // The last pixel read will be A, but the driver will think it is B, causing it to generate an // error when the pixel buffer is just big enough. - angle::Feature unpackLastRowSeparatelyForPaddingInclusion = { - "unpack_last_row_separately_for_padding_inclusion", - angle::FeatureCategory::OpenGLWorkarounds, + Feature unpackLastRowSeparatelyForPaddingInclusion = { + "unpack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds, "When uploading textures from an unpack buffer, some drivers count an extra row padding", &members}; // Equivalent workaround when uploading data from a pixel pack buffer. - angle::Feature packLastRowSeparatelyForPaddingInclusion = { - "pack_last_row_separately_for_padding_inclusion", angle::FeatureCategory::OpenGLWorkarounds, + Feature packLastRowSeparatelyForPaddingInclusion = { + "pack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds, "When uploading textures from an pack buffer, some drivers count an extra row padding", &members}; // On some Intel drivers, using isnan() on highp float will get wrong answer. To work around // this bug, we use an expression to emulate function isnan(). // Tracking bug: http://crbug.com/650547 - angle::Feature emulateIsnanFloat = { - "emulate_isnan_float", angle::FeatureCategory::OpenGLWorkarounds, + Feature emulateIsnanFloat = { + "emulate_isnan_float", FeatureCategory::OpenGLWorkarounds, "On some Intel drivers, using isnan() on highp float will get wrong answer", &members}; // On Mac with OpenGL version 4.1, unused std140 or shared uniform blocks will be // treated as inactive which is not consistent with WebGL2.0 spec. Reference all members in a // unused std140 or shared uniform block at the beginning of main to work around it. // Also used on Linux AMD. - angle::Feature useUnusedBlocksWithStandardOrSharedLayout = { - "use_unused_blocks_with_standard_or_shared_layout", - angle::FeatureCategory::OpenGLWorkarounds, + Feature useUnusedBlocksWithStandardOrSharedLayout = { + "use_unused_blocks_with_standard_or_shared_layout", FeatureCategory::OpenGLWorkarounds, "On Mac with OpenGL version 4.1 and Linux AMD, unused std140 or shared uniform blocks " "will be treated as inactive", &members}; // This flag is used to fix spec difference between GLSL 4.1 or lower and ESSL3. - angle::Feature removeInvariantAndCentroidForESSL3 = { - "remove_invarient_and_centroid_for_essl3", angle::FeatureCategory::OpenGLWorkarounds, + Feature removeInvariantAndCentroidForESSL3 = { + "remove_invarient_and_centroid_for_essl3", FeatureCategory::OpenGLWorkarounds, "Fix spec difference between GLSL 4.1 or lower and ESSL3", &members}; // On Intel Mac OSX 10.11 driver, using "-float" will get wrong answer. Use "0.0 - float" to // replace "-float". // Tracking bug: http://crbug.com/308366 - angle::Feature rewriteFloatUnaryMinusOperator = { - "rewrite_float_unary_minus_operator", angle::FeatureCategory::OpenGLWorkarounds, + Feature rewriteFloatUnaryMinusOperator = { + "rewrite_float_unary_minus_operator", FeatureCategory::OpenGLWorkarounds, "On Intel Mac OSX 10.11 driver, using '-' will get wrong answer", &members, "http://crbug.com/308366"}; // On NVIDIA drivers, atan(y, x) may return a wrong answer. // Tracking bug: http://crbug.com/672380 - angle::Feature emulateAtan2Float = {"emulate_atan_2_float", - angle::FeatureCategory::OpenGLWorkarounds, - "On NVIDIA drivers, atan(y, x) may return a wrong answer", - &members, "http://crbug.com/672380"}; + Feature emulateAtan2Float = {"emulate_atan_2_float", FeatureCategory::OpenGLWorkarounds, + "On NVIDIA drivers, atan(y, x) may return a wrong answer", + &members, "http://crbug.com/672380"}; // Some drivers seem to forget about UBO bindings when using program binaries. Work around // this by re-applying the bindings after the program binary is loaded or saved. // This only seems to affect AMD OpenGL drivers, and some Android devices. // http://anglebug.com/1637 - angle::Feature reapplyUBOBindingsAfterUsingBinaryProgram = { - "reapply_ubo_bindings_after_using_binary_program", - angle::FeatureCategory::OpenGLWorkarounds, + Feature reapplyUBOBindingsAfterUsingBinaryProgram = { + "reapply_ubo_bindings_after_using_binary_program", FeatureCategory::OpenGLWorkarounds, "Some AMD OpenGL drivers and Android devices forget about UBO bindings " "when using program binaries", &members, "http://anglebug.com/1637"}; @@ -183,22 +177,22 @@ struct WorkaroundsGL : angle::FeatureSetBase // higher context. // This only seems to affect AMD OpenGL drivers. // Tracking bug: http://anglebug.com/1936 - angle::Feature emulateMaxVertexAttribStride = { - "emulate_max_vertex_attrib_stride", angle::FeatureCategory::OpenGLWorkarounds, + Feature emulateMaxVertexAttribStride = { + "emulate_max_vertex_attrib_stride", FeatureCategory::OpenGLWorkarounds, "Some AMD OpenGL >= 4.4 drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members, "http://anglebug.com/1936"}; // Initializing uninitialized locals caused odd behavior on Mac in a few WebGL 2 tests. // Tracking bug: http://anglebug/2041 - angle::Feature dontInitializeUninitializedLocals = { - "dont_initialize_uninitialized_locals", angle::FeatureCategory::OpenGLWorkarounds, + Feature dontInitializeUninitializedLocals = { + "dont_initialize_uninitialized_locals", FeatureCategory::OpenGLWorkarounds, "On Mac initializing uninitialized locals caused odd behavior in a few WebGL 2 tests", &members, "http://anglebug.com/2041"}; // On some NVIDIA drivers the point size range reported from the API is inconsistent with the // actual behavior. Clamp the point size to the value from the API to fix this. - angle::Feature clampPointSize = { - "clamp_point_size", angle::FeatureCategory::OpenGLWorkarounds, + Feature clampPointSize = { + "clamp_point_size", FeatureCategory::OpenGLWorkarounds, "On some NVIDIA drivers the point size range reported from the API is " "inconsistent with the actual behavior", &members}; @@ -206,32 +200,31 @@ struct WorkaroundsGL : angle::FeatureSetBase // On some NVIDIA drivers certain types of GLSL arithmetic ops mixing vectors and scalars may be // executed incorrectly. Change them in the shader translator. Tracking bug: // http://crbug.com/772651 - angle::Feature rewriteVectorScalarArithmetic = { - "rewrite_vector_scalar_arithmetic", angle::FeatureCategory::OpenGLWorkarounds, + Feature rewriteVectorScalarArithmetic = { + "rewrite_vector_scalar_arithmetic", FeatureCategory::OpenGLWorkarounds, "On some NVIDIA drivers certain types of GLSL arithmetic ops mixing " "vectors and scalars may be executed incorrectly", &members, "http://crbug.com/772651"}; // On some Android devices for loops used to initialize variables hit native GLSL compiler bugs. - angle::Feature dontUseLoopsToInitializeVariables = { - "dont_use_loops_to_initialize_variables", angle::FeatureCategory::OpenGLWorkarounds, + Feature dontUseLoopsToInitializeVariables = { + "dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds, "On some Android devices for loops used to initialize variables hit " "native GLSL compiler bugs", &members}; // On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating // point depth buffer. Clamp it in the translated shader to fix this. - angle::Feature clampFragDepth = { - "clamp_frag_depth", angle::FeatureCategory::OpenGLWorkarounds, - "On some NVIDIA drivers gl_FragDepth is not clamped correctly when " - "rendering to a floating point depth buffer", - &members}; + Feature clampFragDepth = {"clamp_frag_depth", FeatureCategory::OpenGLWorkarounds, + "On some NVIDIA drivers gl_FragDepth is not clamped correctly when " + "rendering to a floating point depth buffer", + &members}; // On some NVIDIA drivers before version 397.31 repeated assignment to swizzled values inside a // GLSL user-defined function have incorrect results. Rewrite this type of statements to fix // this. - angle::Feature rewriteRepeatedAssignToSwizzled = { - "rewrite_repeated_assign_to_swizzled", angle::FeatureCategory::OpenGLWorkarounds, + Feature rewriteRepeatedAssignToSwizzled = { + "rewrite_repeated_assign_to_swizzled", FeatureCategory::OpenGLWorkarounds, "On some NVIDIA drivers < v397.31, repeated assignment to swizzled " "values inside a GLSL user-defined function have incorrect results", &members}; @@ -239,47 +232,46 @@ struct WorkaroundsGL : angle::FeatureSetBase // It might be possible to work around the Intel bug by rewriting *FragData to *FragColor // instead of disabling the functionality entirely. The AMD bug looked like incorrect blending, // not sure if a workaround is feasible. http://anglebug.com/1085 - angle::Feature disableBlendFuncExtended = { - "disable_blend_func_extended", angle::FeatureCategory::OpenGLWorkarounds, + Feature disableBlendFuncExtended = { + "disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds, "On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests", &members, "http://anglebug.com/1085"}; // Qualcomm drivers returns raw sRGB values instead of linearized values when calling // glReadPixels on unsized sRGB texture formats. http://crbug.com/550292 and // http://crbug.com/565179 - angle::Feature unsizedsRGBReadPixelsDoesntTransform = { - "unsized_srgb_read_pixels_doesnt_transform", angle::FeatureCategory::OpenGLWorkarounds, + Feature unsizedsRGBReadPixelsDoesntTransform = { + "unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds, "Qualcomm drivers returns raw sRGB values instead of linearized values " "when calling glReadPixels on unsized sRGB texture formats", &members, "http://crbug.com/565179"}; // Older Qualcomm drivers generate errors when querying the number of bits in timer queries, ex: // GetQueryivEXT(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS). http://anglebug.com/3027 - angle::Feature queryCounterBitsGeneratesErrors = { - "query_counter_bits_generates_errors", angle::FeatureCategory::OpenGLWorkarounds, + Feature queryCounterBitsGeneratesErrors = { + "query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds, "Older Qualcomm drivers generate errors when querying the number of bits in timer queries", &members, "http://anglebug.com/3027"}; // Re-linking a program in parallel is buggy on some Intel Windows OpenGL drivers and Android // platforms. // http://anglebug.com/3045 - angle::Feature dontRelinkProgramsInParallel = { - "dont_relink_programs_in_parallel", angle::FeatureCategory::OpenGLWorkarounds, + Feature dontRelinkProgramsInParallel = { + "dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds, "On some Intel Windows OpenGL drivers and Android, relinking a program " "in parallel is buggy", &members, "http://anglebug.com/3045"}; // Some tests have been seen to fail using worker contexts, this switch allows worker contexts // to be disabled for some platforms. http://crbug.com/849576 - angle::Feature disableWorkerContexts = { - "disable_worker_contexts", angle::FeatureCategory::OpenGLWorkarounds, - "Some tests have been seen to fail using worker contexts", &members, - "http://crbug.com/849576"}; + Feature disableWorkerContexts = {"disable_worker_contexts", FeatureCategory::OpenGLWorkarounds, + "Some tests have been seen to fail using worker contexts", + &members, "http://crbug.com/849576"}; }; -inline WorkaroundsGL::WorkaroundsGL() = default; -inline WorkaroundsGL::~WorkaroundsGL() = default; +inline FeaturesGL::FeaturesGL() = default; +inline FeaturesGL::~FeaturesGL() = default; -} // namespace rx +} // namespace angle -#endif // LIBANGLE_RENDERER_GL_WORKAROUNDSGL_H_ +#endif // ANGLE_PLATFORM_FEATURESGL_H_ diff --git a/src/libANGLE/FrontendFeatures.h b/include/platform/FrontendFeatures.h similarity index 88% rename from src/libANGLE/FrontendFeatures.h rename to include/platform/FrontendFeatures.h index 0627e48dc..d9eec66bc 100644 --- a/src/libANGLE/FrontendFeatures.h +++ b/include/platform/FrontendFeatures.h @@ -4,15 +4,15 @@ // found in the LICENSE file. // -// Workarounds.h: Workarounds for driver bugs and other behaviors seen +// FrontendFeatures.h: Features/workarounds for driver bugs and other behaviors seen // on all platforms. -#ifndef LIBANGLE_WORKAROUNDS_H_ -#define LIBANGLE_WORKAROUNDS_H_ +#ifndef ANGLE_PLATFORM_FRONTENDFEATURES_H_ +#define ANGLE_PLATFORM_FRONTENDFEATURES_H_ #include "platform/Feature.h" -namespace gl +namespace angle { struct FrontendFeatures : angle::FeatureSetBase @@ -49,6 +49,6 @@ struct FrontendFeatures : angle::FeatureSetBase inline FrontendFeatures::FrontendFeatures() = default; inline FrontendFeatures::~FrontendFeatures() = default; -} // namespace gl +} // namespace angle -#endif // LIBANGLE_WORKAROUNDS_H_ +#endif // ANGLE_PLATFORM_FRONTENDFEATURES_H_ diff --git a/include/platform/Platform.h b/include/platform/Platform.h index 837892f73..bb3c68fd3 100644 --- a/include/platform/Platform.h +++ b/include/platform/Platform.h @@ -35,7 +35,7 @@ namespace angle { -struct WorkaroundsD3D; +struct FeaturesD3D; struct FeaturesVk; using TraceEventHandle = uint64_t; using EGLDisplayType = void *; @@ -214,16 +214,14 @@ using HistogramBooleanFunc = void (*)(PlatformMethods *platform, const char *nam inline void DefaultHistogramBoolean(PlatformMethods *platform, const char *name, bool sample) {} // Allows us to programatically override ANGLE's default workarounds for testing purposes. -using OverrideWorkaroundsD3DFunc = void (*)(PlatformMethods *platform, - angle::WorkaroundsD3D *workaroundsD3D); -inline void DefaultOverrideWorkaroundsD3D(PlatformMethods *platform, - angle::WorkaroundsD3D *workaroundsD3D) +using OverrideFeaturesD3DFunc = void (*)(PlatformMethods *platform, + angle::FeaturesD3D *featuresD3D); +inline void DefaultOverrideFeaturesD3D(PlatformMethods *platform, angle::FeaturesD3D *featuresD3D) {} using OverrideFeaturesVkFunc = void (*)(PlatformMethods *platform, - angle::FeaturesVk *workaroundsVulkan); -inline void DefaultOverrideFeaturesVk(PlatformMethods *platform, - angle::FeaturesVk *workaroundsVulkan) + angle::FeaturesVk *featuresVulkan); +inline void DefaultOverrideFeaturesVk(PlatformMethods *platform, angle::FeaturesVk *featuresVulkan) {} // Callback on a successful program link with the program binary. Can be used to store @@ -253,7 +251,7 @@ inline void DefaultCacheProgram(PlatformMethods *platform, OP(histogramEnumeration, HistogramEnumeration) \ OP(histogramSparse, HistogramSparse) \ OP(histogramBoolean, HistogramBoolean) \ - OP(overrideWorkaroundsD3D, OverrideWorkaroundsD3D) \ + OP(overrideFeaturesD3D, OverrideFeaturesD3D) \ OP(overrideFeaturesVk, OverrideFeaturesVk) \ OP(cacheProgram, CacheProgram) diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index a9ea0de58..b5345cf23 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -8114,7 +8114,7 @@ Shader *Context::getShader(GLuint handle) const return mState.mShaderProgramManager->getShader(handle); } -const FrontendFeatures &Context::getFrontendFeatures() const +const angle::FrontendFeatures &Context::getFrontendFeatures() const { return mDisplay->getFrontendFeatures(); } diff --git a/src/libANGLE/Context.h b/src/libANGLE/Context.h index 29361a367..f73f4d6bf 100644 --- a/src/libANGLE/Context.h +++ b/src/libANGLE/Context.h @@ -34,6 +34,11 @@ #include "libANGLE/WorkerThread.h" #include "libANGLE/angletypes.h" +namespace angle +{ +struct FrontendFeatures; +} // namespace angle + namespace rx { class ContextImpl; @@ -54,7 +59,6 @@ class Buffer; class Compiler; class FenceNV; class Framebuffer; -struct FrontendFeatures; class GLES1Renderer; class MemoryProgramCache; class MemoryObject; @@ -503,7 +507,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl bool isBufferAccessValidationEnabled() const { return mBufferAccessValidationEnabled; } - const FrontendFeatures &getFrontendFeatures() const; + const angle::FrontendFeatures &getFrontendFeatures() const; private: void initialize(); diff --git a/src/libANGLE/Display.h b/src/libANGLE/Display.h index 1acd174ae..e62e74f2b 100644 --- a/src/libANGLE/Display.h +++ b/src/libANGLE/Display.h @@ -20,11 +20,11 @@ #include "libANGLE/Config.h" #include "libANGLE/Debug.h" #include "libANGLE/Error.h" -#include "libANGLE/FrontendFeatures.h" #include "libANGLE/LoggingAnnotator.h" #include "libANGLE/MemoryProgramCache.h" #include "libANGLE/Version.h" #include "platform/Feature.h" +#include "platform/FrontendFeatures.h" namespace gl { @@ -194,7 +194,7 @@ class Display final : public LabeledObject, angle::NonCopyable typedef std::set ContextSet; const ContextSet &getContextSet() { return mContextSet; } - const gl::FrontendFeatures &getFrontendFeatures() { return mFrontendFeatures; } + const angle::FrontendFeatures &getFrontendFeatures() { return mFrontendFeatures; } const angle::FeatureList &getFeatures() const { return mFeatures; } @@ -251,7 +251,7 @@ class Display final : public LabeledObject, angle::NonCopyable gl::MemoryProgramCache mMemoryProgramCache; size_t mGlobalTextureShareGroupUsers; - gl::FrontendFeatures mFrontendFeatures; + angle::FrontendFeatures mFrontendFeatures; angle::FeatureList mFeatures; }; diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp index 69911f84f..31457f546 100644 --- a/src/libANGLE/Program.cpp +++ b/src/libANGLE/Program.cpp @@ -19,7 +19,6 @@ #include "common/version.h" #include "compiler/translator/blocklayout.h" #include "libANGLE/Context.h" -#include "libANGLE/FrontendFeatures.h" #include "libANGLE/MemoryProgramCache.h" #include "libANGLE/ProgramLinkedResources.h" #include "libANGLE/ResourceManager.h" @@ -31,6 +30,7 @@ #include "libANGLE/queryconversions.h" #include "libANGLE/renderer/GLImplFactory.h" #include "libANGLE/renderer/ProgramImpl.h" +#include "platform/FrontendFeatures.h" #include "platform/Platform.h" namespace gl diff --git a/src/libANGLE/renderer/DisplayImpl.h b/src/libANGLE/renderer/DisplayImpl.h index 7d7f4211f..321eecda1 100644 --- a/src/libANGLE/renderer/DisplayImpl.h +++ b/src/libANGLE/renderer/DisplayImpl.h @@ -21,6 +21,11 @@ #include #include +namespace angle +{ +struct FrontendFeatures; +} // namespace angle + namespace egl { class AttributeMap; @@ -36,8 +41,7 @@ class Thread; namespace gl { class Context; -struct FrontendFeatures; -} +} // namespace gl namespace rx { @@ -91,7 +95,7 @@ class DisplayImpl : public EGLImplFactory void setBlobCache(egl::BlobCache *blobCache) { mBlobCache = blobCache; } egl::BlobCache *getBlobCache() const { return mBlobCache; } - virtual void initializeFrontendFeatures(gl::FrontendFeatures *features) const {} + virtual void initializeFrontendFeatures(angle::FrontendFeatures *features) const {} virtual void populateFeatureList(angle::FeatureList *features) = 0; diff --git a/src/libANGLE/renderer/d3d/DisplayD3D.cpp b/src/libANGLE/renderer/d3d/DisplayD3D.cpp index 224e99d56..9971e9954 100644 --- a/src/libANGLE/renderer/d3d/DisplayD3D.cpp +++ b/src/libANGLE/renderer/d3d/DisplayD3D.cpp @@ -375,7 +375,7 @@ void DisplayD3D::handleResult(HRESULT hr, void DisplayD3D::populateFeatureList(angle::FeatureList *features) { - mRenderer->getWorkarounds().populateFeatureList(features); + mRenderer->getFeatures().populateFeatureList(features); } } // namespace rx diff --git a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp index ccc00694f..4aeacc553 100644 --- a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp +++ b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp @@ -160,7 +160,7 @@ std::string DynamicHLSL::generateVertexShaderForInputLayout( // must be used. bool usesPointSize = sourceShader.find("GL_USES_POINT_SIZE") != std::string::npos; bool useInstancedPointSpriteEmulation = - usesPointSize && mRenderer->getWorkarounds().useInstancedPointSpriteEmulation.enabled; + usesPointSize && mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled; // Instanced PointSprite emulation requires additional entries in the // VS_INPUT structure to support the vertices that make up the quad vertices. @@ -485,7 +485,7 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Caps &caps, bool useInstancedPointSpriteEmulation = programMetadata.usesPointSize() && - mRenderer->getWorkarounds().useInstancedPointSpriteEmulation.enabled; + mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled; // Validation done in the compiler ASSERT(!fragmentShader->usesFragColor() || !fragmentShader->usesFragData()); diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp index a0c3c1335..5b6a27c44 100644 --- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp +++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp @@ -356,7 +356,7 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl: const auto &colorAttachments = mState.getColorAttachments(); const auto &drawBufferStates = mState.getDrawBufferStates(); - const auto &workarounds = mRenderer->getWorkarounds(); + const auto &features = mRenderer->getFeatures(); for (size_t attachmentIndex = 0; attachmentIndex < colorAttachments.size(); ++attachmentIndex) { @@ -370,7 +370,7 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl: drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + attachmentIndex)); colorAttachmentsForRender.push_back(&colorAttachment); } - else if (!workarounds.mrtPerfWorkaround.enabled) + else if (!features.mrtPerfWorkaround.enabled) { colorAttachmentsForRender.push_back(nullptr); } @@ -379,7 +379,7 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl: // When rendering with no render target on D3D, two bugs lead to incorrect behavior on Intel // drivers < 4815. The rendering samples always pass neglecting discard statements in pixel // shader. We add a dummy texture as render target in such case. - if (mRenderer->getWorkarounds().addDummyTextureNoRenderTarget.enabled && + if (mRenderer->getFeatures().addDummyTextureNoRenderTarget.enabled && colorAttachmentsForRender.empty() && activeProgramOutputs.any()) { static_assert(static_cast(activeProgramOutputs.size()) <= 32, diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp index 37dc81608..7d48e7079 100644 --- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp +++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp @@ -386,7 +386,7 @@ ProgramD3DMetadata::ProgramD3DMetadata(RendererD3D *renderer, : mRendererMajorShaderModel(renderer->getMajorShaderModel()), mShaderModelSuffix(renderer->getShaderModelSuffix()), mUsesInstancedPointSpriteEmulation( - renderer->getWorkarounds().useInstancedPointSpriteEmulation.enabled), + renderer->getFeatures().useInstancedPointSpriteEmulation.enabled), mUsesViewScale(renderer->presentPathFastEnabled()), mCanSelectViewInVertexShader(renderer->canSelectViewInVertexShader()), mAttachedShaders(attachedShaders) @@ -696,7 +696,7 @@ bool ProgramD3D::usesGeometryShader(const gl::State &state, const gl::PrimitiveM bool ProgramD3D::usesInstancedPointSpriteEmulation() const { - return mRenderer->getWorkarounds().useInstancedPointSpriteEmulation.enabled; + return mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled; } GLint ProgramD3D::getSamplerMapping(gl::ShaderType type, diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.h b/src/libANGLE/renderer/d3d/ProgramD3D.h index 586320451..5d295ea3d 100644 --- a/src/libANGLE/renderer/d3d/ProgramD3D.h +++ b/src/libANGLE/renderer/d3d/ProgramD3D.h @@ -18,7 +18,7 @@ #include "libANGLE/renderer/ProgramImpl.h" #include "libANGLE/renderer/d3d/DynamicHLSL.h" #include "libANGLE/renderer/d3d/RendererD3D.h" -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" namespace rx { diff --git a/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/libANGLE/renderer/d3d/RendererD3D.cpp index 64c00658c..fa464763c 100644 --- a/src/libANGLE/renderer/d3d/RendererD3D.cpp +++ b/src/libANGLE/renderer/d3d/RendererD3D.cpp @@ -37,7 +37,7 @@ RendererD3D::RendererD3D(egl::Display *display) : mDisplay(display), mPresentPathFastEnabled(false), mCapsInitialized(false), - mWorkaroundsInitialized(false), + mFeaturesInitialized(false), mDisjoint(false), mDeviceLost(false) {} @@ -184,15 +184,15 @@ angle::Result RendererD3D::initRenderTarget(const gl::Context *context, return clearRenderTarget(context, renderTarget, gl::ColorF(0, 0, 0, 0), 1, 0); } -const angle::WorkaroundsD3D &RendererD3D::getWorkarounds() const +const angle::FeaturesD3D &RendererD3D::getFeatures() const { - if (!mWorkaroundsInitialized) + if (!mFeaturesInitialized) { - generateWorkarounds(&mWorkarounds); - mWorkaroundsInitialized = true; + initializeFeatures(&mFeatures); + mFeaturesInitialized = true; } - return mWorkarounds; + return mFeatures; } unsigned int GetBlendSampleMask(const gl::State &glState, int samples) diff --git a/src/libANGLE/renderer/d3d/RendererD3D.h b/src/libANGLE/renderer/d3d/RendererD3D.h index 3fd0ac63f..e8107336f 100644 --- a/src/libANGLE/renderer/d3d/RendererD3D.h +++ b/src/libANGLE/renderer/d3d/RendererD3D.h @@ -22,7 +22,7 @@ #include "libANGLE/renderer/d3d/VertexDataManager.h" #include "libANGLE/renderer/d3d/formatutilsD3D.h" #include "libANGLE/renderer/renderer_utils.h" -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" namespace egl { @@ -189,7 +189,7 @@ class RendererD3D : public BufferFactoryD3D virtual int getMajorShaderModel() const = 0; - const angle::WorkaroundsD3D &getWorkarounds() const; + const angle::FeaturesD3D &getFeatures() const; // Pixel operations virtual angle::Result copyImage2D(const gl::Context *context, @@ -408,7 +408,7 @@ class RendererD3D : public BufferFactoryD3D private: void ensureCapsInitialized() const; - virtual void generateWorkarounds(angle::WorkaroundsD3D *workarounds) const = 0; + virtual void initializeFeatures(angle::FeaturesD3D *features) const = 0; mutable bool mCapsInitialized; mutable gl::Caps mNativeCaps; @@ -416,8 +416,8 @@ class RendererD3D : public BufferFactoryD3D mutable gl::Extensions mNativeExtensions; mutable gl::Limitations mNativeLimitations; - mutable bool mWorkaroundsInitialized; - mutable angle::WorkaroundsD3D mWorkarounds; + mutable bool mFeaturesInitialized; + mutable angle::FeaturesD3D mFeatures; bool mDisjoint; bool mDeviceLost; diff --git a/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/src/libANGLE/renderer/d3d/ShaderD3D.cpp index 78336bed1..5c5373eda 100644 --- a/src/libANGLE/renderer/d3d/ShaderD3D.cpp +++ b/src/libANGLE/renderer/d3d/ShaderD3D.cpp @@ -86,40 +86,40 @@ class WaitableCompileEventD3D final : public WaitableCompileEvent }; ShaderD3D::ShaderD3D(const gl::ShaderState &data, - const angle::WorkaroundsD3D &workarounds, + const angle::FeaturesD3D &features, const gl::Extensions &extensions) : ShaderImpl(data), mAdditionalOptions(0) { uncompile(); - if (workarounds.expandIntegerPowExpressions.enabled) + if (features.expandIntegerPowExpressions.enabled) { mAdditionalOptions |= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS; } - if (workarounds.getDimensionsIgnoresBaseLevel.enabled) + if (features.getDimensionsIgnoresBaseLevel.enabled) { mAdditionalOptions |= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL; } - if (workarounds.preAddTexelFetchOffsets.enabled) + if (features.preAddTexelFetchOffsets.enabled) { mAdditionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH; } - if (workarounds.rewriteUnaryMinusOperator.enabled) + if (features.rewriteUnaryMinusOperator.enabled) { mAdditionalOptions |= SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR; } - if (workarounds.emulateIsnanFloat.enabled) + if (features.emulateIsnanFloat.enabled) { mAdditionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION; } - if (workarounds.skipVSConstantRegisterZero.enabled && + if (features.skipVSConstantRegisterZero.enabled && mData.getShaderType() == gl::ShaderType::Vertex) { mAdditionalOptions |= SH_SKIP_D3D_CONSTANT_REGISTER_ZERO; } - if (workarounds.forceAtomicValueResolution.enabled) + if (features.forceAtomicValueResolution.enabled) { mAdditionalOptions |= SH_FORCE_ATOMIC_VALUE_RESOLUTION; } diff --git a/src/libANGLE/renderer/d3d/ShaderD3D.h b/src/libANGLE/renderer/d3d/ShaderD3D.h index 4162318e6..f1557da39 100644 --- a/src/libANGLE/renderer/d3d/ShaderD3D.h +++ b/src/libANGLE/renderer/d3d/ShaderD3D.h @@ -16,7 +16,7 @@ namespace angle { struct CompilerWorkaroundsD3D; -struct WorkaroundsD3D; +struct FeaturesD3D; } // namespace angle namespace gl @@ -34,7 +34,7 @@ class ShaderD3D : public ShaderImpl { public: ShaderD3D(const gl::ShaderState &data, - const angle::WorkaroundsD3D &workarounds, + const angle::FeaturesD3D &features, const gl::Extensions &extensions); ~ShaderD3D() override; diff --git a/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/libANGLE/renderer/d3d/TextureD3D.cpp index 9d9b45887..e8912d66d 100644 --- a/src/libANGLE/renderer/d3d/TextureD3D.cpp +++ b/src/libANGLE/renderer/d3d/TextureD3D.cpp @@ -198,7 +198,7 @@ angle::Result TextureD3D::setStorageExternalMemory(const gl::Context *context, bool TextureD3D::shouldUseSetData(const ImageD3D *image) const { - if (!mRenderer->getWorkarounds().setDataFasterThanImageUpload.enabled) + if (!mRenderer->getFeatures().setDataFasterThanImageUpload.enabled) { return false; } @@ -438,7 +438,7 @@ angle::Result TextureD3D::generateMipmap(const gl::Context *context) const GLuint maxLevel = mState.getMipmapMaxLevel(); ASSERT(maxLevel > baseLevel); // Should be checked before calling this. - if (mTexStorage && mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mTexStorage && mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { // Switch to using the mipmapped texture. TextureStorage *textureStorage = nullptr; @@ -474,7 +474,7 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context, // When making mipmaps with the setData workaround enabled, the texture storage has // the image data already. For non-render-target storage, we have to pull it out into // an image layer. - if (mRenderer->getWorkarounds().setDataFasterThanImageUpload.enabled && mTexStorage) + if (mRenderer->getFeatures().setDataFasterThanImageUpload.enabled && mTexStorage) { if (!mTexStorage->isRenderTarget()) { @@ -501,7 +501,7 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context, // Blit9::boxFilter). Feature Level 9_3 could do something similar, or it could continue to use // CPU-side mipmap generation, or something else. bool renderableStorage = (mTexStorage && mTexStorage->isRenderTarget() && - !(mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled)); + !(mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)); for (GLint layer = 0; layer < layerCount; ++layer) { @@ -733,7 +733,7 @@ angle::Result TextureD3D::initializeContents(const gl::Context *context, // We don't use the fast path with the zero max lod workaround because it would introduce a race // between the rendertarget and the staging images. if (canCreateRenderTargetForImage(index) && - !mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + !mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(ensureRenderTarget(context)); ASSERT(mTexStorage); @@ -1008,7 +1008,7 @@ angle::Result TextureD3D_2D::copyImage(const gl::Context *context, // If the zero max LOD workaround is active, then we can't sample from individual layers of the // framebuffer in shaders, so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || - mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, destOffset, clippedArea, source)); @@ -1054,7 +1054,7 @@ angle::Result TextureD3D_2D::copySubImage(const gl::Context *context, // If the zero max LOD workaround is active, then we can't sample from individual layers of the // framebuffer in shaders, so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || - mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, clippedOffset, clippedArea, source)); @@ -1434,7 +1434,7 @@ angle::Result TextureD3D_2D::createCompleteStorage(bool renderTarget, GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, 1)); bool hintLevelZeroOnly = false; - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { // If any of the CPU images (levels >= 1) are dirty, then the textureStorage2D should use // the mipped texture to begin with. Otherwise, it should use the level-zero-only texture. @@ -1758,7 +1758,7 @@ angle::Result TextureD3D_Cube::copyImage(const gl::Context *context, // If the zero max LOD workaround is active, then we can't sample from individual layers of the // framebuffer in shaders, so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || - mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(mImageArray[faceIndex][index.getLevelIndex()]->copyFromFramebuffer( context, destOffset, clippedArea, source)); @@ -1802,7 +1802,7 @@ angle::Result TextureD3D_Cube::copySubImage(const gl::Context *context, // If the zero max LOD workaround is active, then we can't sample from individual layers of the // framebuffer in shaders, so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || - mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(mImageArray[faceIndex][index.getLevelIndex()]->copyFromFramebuffer( context, clippedOffset, clippedArea, source)); @@ -2090,7 +2090,7 @@ angle::Result TextureD3D_Cube::createCompleteStorage(bool renderTarget, GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(size, size, 1)); bool hintLevelZeroOnly = false; - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { // If any of the CPU images (levels >= 1) are dirty, then the textureStorage should use the // mipped texture to begin with. Otherwise, it should use the level-zero-only texture. diff --git a/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp index 62da3c87d..e56fb79d5 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp @@ -1310,7 +1310,7 @@ angle::Result Blit11::copyAndConvert(const gl::Context *context, copySize, srcPixelStride, destPixelStride, convertFunction)); // Work around timeouts/TDRs in older NVIDIA drivers. - if (mRenderer->getWorkarounds().depthStencilBlitExtraCopy.enabled) + if (mRenderer->getFeatures().depthStencilBlitExtraCopy.enabled) { D3D11_MAPPED_SUBRESOURCE mapped; ANGLE_TRY( diff --git a/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp index 137cca8fb..079ea737f 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp @@ -391,7 +391,7 @@ angle::Result Buffer11::setSubData(const gl::Context *context, // TODO(jmadill): Use Context caps. if (offset == 0 && size >= mSize && size <= static_cast(mRenderer->getNativeCaps().maxUniformBlockSize) && - !mRenderer->getWorkarounds().useSystemMemoryForConstantBuffers.enabled) + !mRenderer->getFeatures().useSystemMemoryForConstantBuffers.enabled) { ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_UNIFORM, &writeBuffer)); } @@ -605,7 +605,7 @@ angle::Result Buffer11::checkForDeallocation(const gl::Context *context, BufferU bool Buffer11::canDeallocateSystemMemory() const { // Must keep system memory on Intel. - if (mRenderer->getWorkarounds().useSystemMemoryForConstantBuffers.enabled) + if (mRenderer->getFeatures().useSystemMemoryForConstantBuffers.enabled) { return false; } diff --git a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp index 04a37e814..a95bdb0f2 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp @@ -551,7 +551,7 @@ angle::Result Clear11::clearFramebuffer(const gl::Context *context, // We shouldn't reach here if deviceContext1 is unavailable. ASSERT(deviceContext1); deviceContext1->ClearView(framebufferRTV.get(), clearValues, &scissorRect, 1); - if (mRenderer->getWorkarounds().callClearTwice.enabled) + if (mRenderer->getFeatures().callClearTwice.enabled) { deviceContext1->ClearView(framebufferRTV.get(), clearValues, &scissorRect, 1); } @@ -559,7 +559,7 @@ angle::Result Clear11::clearFramebuffer(const gl::Context *context, else { deviceContext->ClearRenderTargetView(framebufferRTV.get(), clearValues); - if (mRenderer->getWorkarounds().callClearTwice.enabled) + if (mRenderer->getFeatures().callClearTwice.enabled) { deviceContext->ClearRenderTargetView(framebufferRTV.get(), clearValues); } diff --git a/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/src/libANGLE/renderer/d3d/d3d11/Context11.cpp index fe064a11c..fc782b780 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Context11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Context11.cpp @@ -141,7 +141,7 @@ CompilerImpl *Context11::createCompiler() ShaderImpl *Context11::createShader(const gl::ShaderState &data) { - return new ShaderD3D(data, mRenderer->getWorkarounds(), mRenderer->getNativeExtensions()); + return new ShaderD3D(data, mRenderer->getFeatures(), mRenderer->getNativeExtensions()); } ProgramImpl *Context11::createProgram(const gl::ProgramState &data) diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp index 356260504..c48dc3726 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp @@ -885,7 +885,7 @@ void Renderer11::populateRenderer11DeviceCaps() mRenderer11DeviceCaps.supportsMultisampledDepthStencilSRVs = mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_10_0; - if (getWorkarounds().disableB5G6R5Support.enabled) + if (getFeatures().disableB5G6R5Support.enabled) { mRenderer11DeviceCaps.B5G6R5support = 0; mRenderer11DeviceCaps.B5G6R5maxSamples = 0; @@ -1463,7 +1463,7 @@ angle::Result Renderer11::drawArrays(const gl::Context *context, return drawTriangleFan(context, clampedVertexCount, gl::DrawElementsType::InvalidEnum, nullptr, 0, adjustedInstanceCount); case gl::PrimitiveMode::Points: - if (getWorkarounds().useInstancedPointSpriteEmulation.enabled) + if (getFeatures().useInstancedPointSpriteEmulation.enabled) { // This code should not be reachable by multi-view programs. ASSERT(programD3D->getState().usesMultiview() == false); @@ -3641,14 +3641,14 @@ void Renderer11::generateCaps(gl::Caps *outCaps, gl::Extensions *outExtensions, gl::Limitations *outLimitations) const { - d3d11_gl::GenerateCaps(mDevice, mDeviceContext, mRenderer11DeviceCaps, getWorkarounds(), - outCaps, outTextureCaps, outExtensions, outLimitations); + d3d11_gl::GenerateCaps(mDevice, mDeviceContext, mRenderer11DeviceCaps, getFeatures(), outCaps, + outTextureCaps, outExtensions, outLimitations); } -void Renderer11::generateWorkarounds(angle::WorkaroundsD3D *workarounds) const +void Renderer11::initializeFeatures(angle::FeaturesD3D *features) const { - d3d11::GenerateWorkarounds(mRenderer11DeviceCaps, mAdapterDescription, workarounds); - OverrideFeaturesWithDisplayState(workarounds, mDisplay->getState()); + d3d11::InitializeFeatures(mRenderer11DeviceCaps, mAdapterDescription, features); + OverrideFeaturesWithDisplayState(features, mDisplay->getState()); } DeviceImpl *Renderer11::createEGLDevice() @@ -3879,7 +3879,7 @@ angle::Result Renderer11::clearRenderTarget(const gl::Context *context, bool Renderer11::canSelectViewInVertexShader() const { - return !getWorkarounds().selectViewInGeometryShader.enabled && + return !getFeatures().selectViewInGeometryShader.enabled && getRenderer11DeviceCaps().supportsVpRtIndexWriteFromVertexShader; } diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/libANGLE/renderer/d3d/d3d11/Renderer11.h index e589dbc30..eb4f0125d 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.h +++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.h @@ -505,7 +505,7 @@ class Renderer11 : public RendererD3D gl::Extensions *outExtensions, gl::Limitations *outLimitations) const override; - void generateWorkarounds(angle::WorkaroundsD3D *workarounds) const override; + void initializeFeatures(angle::FeaturesD3D *features) const override; angle::Result drawLineLoop(const gl::Context *context, GLuint count, diff --git a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp index 79e052ebe..4627715d7 100644 --- a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp @@ -1918,7 +1918,7 @@ angle::Result StateManager11::syncFramebuffer(const gl::Context *context) const auto &colorRTs = mFramebuffer11->getCachedColorRenderTargets(); size_t appliedRTIndex = 0; - bool skipInactiveRTs = mRenderer->getWorkarounds().mrtPerfWorkaround.enabled; + bool skipInactiveRTs = mRenderer->getFeatures().mrtPerfWorkaround.enabled; const auto &drawStates = mFramebuffer11->getState().getDrawBufferStates(); gl::DrawBufferMask activeProgramOutputs = mProgramD3D->getState().getActiveOutputVariables(); UINT maxExistingRT = 0; @@ -3815,8 +3815,7 @@ void StateManager11::syncPrimitiveTopology(const gl::State &glState, // If instanced pointsprites are enabled and the shader uses gl_PointSize, the topology // must be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST. - if (usesPointSize && - mRenderer->getWorkarounds().useInstancedPointSpriteEmulation.enabled) + if (usesPointSize && mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled) { primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; } diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp index eb3b21e09..ce12f03b3 100644 --- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp @@ -228,7 +228,7 @@ angle::Result TextureStorage11::getSRVForSampler(const gl::Context *context, ASSERT(mipLevels == 1 || mipLevels == mMipLevels); } - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { // We must ensure that the level zero texture is in sync with mipped texture. ANGLE_TRY(useLevelZeroWorkaroundTexture(context, mipLevels == 1)); @@ -241,7 +241,8 @@ angle::Result TextureStorage11::getSRVForSampler(const gl::Context *context, // We drop the stencil when sampling from the SRV if three conditions hold: // 1. the drop stencil workaround is enabled. - const bool workaround = mRenderer->getWorkarounds().emulateTinyStencilTextures.enabled; + const bool emulateTinyStencilTextures = + mRenderer->getFeatures().emulateTinyStencilTextures.enabled; // 2. this is a stencil texture. const bool hasStencil = (mFormatInfo.format().stencilBits > 0); // 3. the texture has a 1x1 or 2x2 mip. @@ -249,7 +250,7 @@ angle::Result TextureStorage11::getSRVForSampler(const gl::Context *context, const bool hasSmallMips = (getLevelWidth(effectiveTopLevel) <= 2 || getLevelHeight(effectiveTopLevel) <= 2); - const bool useDropStencil = (workaround && hasStencil && hasSmallMips); + const bool useDropStencil = (emulateTinyStencilTextures && hasStencil && hasSmallMips); const SamplerKey key(effectiveBaseLevel, mipLevels, swizzleRequired, useDropStencil); if (useDropStencil) { @@ -364,7 +365,7 @@ angle::Result TextureStorage11::getSRVLevels(const gl::Context *context, ASSERT(mipLevels == 1 || mipLevels == mMipLevels); } - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { // We must ensure that the level zero texture is in sync with mipped texture. ANGLE_TRY(useLevelZeroWorkaroundTexture(context, mipLevels == 1)); @@ -525,7 +526,7 @@ angle::Result TextureStorage11::updateSubresourceLevel(const gl::Context *contex // If the zero-LOD workaround is active and we want to update a level greater than zero, then we // should update the mipmapped texture, even if mapmaps are currently disabled. - if (level > 0 && mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (level > 0 && mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(getMippedResource(context, &dstTexture)); } @@ -579,7 +580,7 @@ angle::Result TextureStorage11::copySubresourceLevel(const gl::Context *context, // If the zero-LOD workaround is active and we want to update a level greater than zero, then we // should update the mipmapped texture, even if mapmaps are currently disabled. - if (index.getLevelIndex() > 0 && mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (index.getLevelIndex() > 0 && mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ANGLE_TRY(getMippedResource(context, &srcTexture)); } @@ -908,7 +909,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer, mTextureDepth = 1; // The LevelZeroOnly hint should only be true if the zero max LOD workaround is active. - ASSERT(!mUseLevelZeroTexture || mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled); + ASSERT(!mUseLevelZeroTexture || mRenderer->getFeatures().zeroMaxLodWorkaround.enabled); } angle::Result TextureStorage11_2D::onDestroy(const gl::Context *context) @@ -945,7 +946,7 @@ angle::Result TextureStorage11_2D::copyToStorage(const gl::Context *context, TextureStorage11_2D *dest11 = GetAs(destStorage); ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext(); - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { // If either mTexture or mLevelZeroTexture exist, then we need to copy them into the // corresponding textures in destStorage. @@ -1101,7 +1102,7 @@ angle::Result TextureStorage11_2D::getMippedResource(const gl::Context *context, const TextureHelper11 **outResource) { // This shouldn't be called unless the zero max LOD workaround is active. - ASSERT(mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled); + ASSERT(mRenderer->getFeatures().zeroMaxLodWorkaround.enabled); ANGLE_TRY(ensureTextureExists(context, mMipLevels)); @@ -1112,7 +1113,7 @@ angle::Result TextureStorage11_2D::getMippedResource(const gl::Context *context, angle::Result TextureStorage11_2D::ensureTextureExists(const gl::Context *context, int mipLevels) { // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture. - bool useLevelZeroTexture = mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled + bool useLevelZeroTexture = mRenderer->getFeatures().zeroMaxLodWorkaround.enabled ? (mipLevels == 1) && (mMipLevels > 1) : false; TextureHelper11 *outputTexture = useLevelZeroTexture ? &mLevelZeroTexture : &mTexture; @@ -1177,7 +1178,7 @@ angle::Result TextureStorage11_2D::getRenderTarget(const gl::Context *context, return angle::Result::Continue; } - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ASSERT(level == 0); ANGLE_TRY(useLevelZeroWorkaroundTexture(context, true)); @@ -1274,7 +1275,7 @@ angle::Result TextureStorage11_2D::createSRVForSampler(const gl::Context *contex const TextureHelper11 *srvTexture = &texture; - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ASSERT(mTopLevel == 0); ASSERT(baseLevel == 0); @@ -1899,7 +1900,7 @@ TextureStorage11_Cube::TextureStorage11_Cube(Renderer11 *renderer, mTextureDepth = 1; // The LevelZeroOnly hint should only be true if the zero max LOD workaround is active. - ASSERT(!mUseLevelZeroTexture || mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled); + ASSERT(!mUseLevelZeroTexture || mRenderer->getFeatures().zeroMaxLodWorkaround.enabled); } angle::Result TextureStorage11_Cube::onDestroy(const gl::Context *context) @@ -1929,7 +1930,7 @@ angle::Result TextureStorage11_Cube::getSubresourceIndex(const gl::Context *cont UINT *outSubresourceIndex) const { UINT arraySlice = index.cubeMapFaceIndex(); - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled && mUseLevelZeroTexture && + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled && mUseLevelZeroTexture && index.getLevelIndex() == 0) { UINT subresource = D3D11CalcSubresource(0, arraySlice, 1); @@ -1953,7 +1954,7 @@ angle::Result TextureStorage11_Cube::copyToStorage(const gl::Context *context, TextureStorage11_Cube *dest11 = GetAs(destStorage); - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext(); @@ -2139,7 +2140,7 @@ angle::Result TextureStorage11_Cube::getMippedResource(const gl::Context *contex const TextureHelper11 **outResource) { // This shouldn't be called unless the zero max LOD workaround is active. - ASSERT(mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled); + ASSERT(mRenderer->getFeatures().zeroMaxLodWorkaround.enabled); ANGLE_TRY(ensureTextureExists(context, mMipLevels)); *outResource = &mTexture; @@ -2149,7 +2150,7 @@ angle::Result TextureStorage11_Cube::getMippedResource(const gl::Context *contex angle::Result TextureStorage11_Cube::ensureTextureExists(const gl::Context *context, int mipLevels) { // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture. - bool useLevelZeroTexture = mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled + bool useLevelZeroTexture = mRenderer->getFeatures().zeroMaxLodWorkaround.enabled ? (mipLevels == 1) && (mMipLevels > 1) : false; TextureHelper11 *outputTexture = useLevelZeroTexture ? &mLevelZeroTexture : &mTexture; @@ -2223,7 +2224,7 @@ angle::Result TextureStorage11_Cube::getRenderTarget(const gl::Context *context, if (!mRenderTarget[faceIndex][level]) { - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ASSERT(index.getLevelIndex() == 0); ANGLE_TRY(useLevelZeroWorkaroundTexture(context, true)); @@ -2351,7 +2352,7 @@ angle::Result TextureStorage11_Cube::createSRVForSampler(const gl::Context *cont const TextureHelper11 *srvTexture = &texture; - if (mRenderer->getWorkarounds().zeroMaxLodWorkaround.enabled) + if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled) { ASSERT(mTopLevel == 0); ASSERT(baseLevel == 0); diff --git a/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp b/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp index 20c64d9de..1dcd62cd4 100644 --- a/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp @@ -51,7 +51,7 @@ angle::Result TransformFeedback11::begin(const gl::Context *context, angle::Result TransformFeedback11::end(const gl::Context *context) { mRenderer->getStateManager()->invalidateTransformFeedback(); - if (mRenderer->getWorkarounds().flushAfterEndingTransformFeedback.enabled) + if (mRenderer->getFeatures().flushAfterEndingTransformFeedback.enabled) { mRenderer->getDeviceContext()->Flush(); } diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp index baf8d665f..7ed9d6571 100644 --- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp @@ -28,8 +28,8 @@ #include "libANGLE/renderer/d3d/d3d11/formatutils11.h" #include "libANGLE/renderer/d3d/d3d11/texture_format_table.h" #include "libANGLE/renderer/driver_utils.h" +#include "platform/FeaturesD3D.h" #include "platform/Platform.h" -#include "platform/WorkaroundsD3D.h" namespace rx { @@ -1386,7 +1386,7 @@ unsigned int GetMaxSampleMaskWords(D3D_FEATURE_LEVEL featureLevel) void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const Renderer11DeviceCaps &renderer11DeviceCaps, - const angle::WorkaroundsD3D &workarounds, + const angle::FeaturesD3D &features, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, @@ -1467,7 +1467,7 @@ void GenerateCaps(ID3D11Device *device, caps->maxVertexAttributes = static_cast(GetMaximumVertexInputSlots(featureLevel)); caps->maxVertexUniformVectors = static_cast(GetMaximumVertexUniformVectors(featureLevel)); - if (workarounds.skipVSConstantRegisterZero.enabled) + if (features.skipVSConstantRegisterZero.enabled) { caps->maxVertexUniformVectors -= 1; } @@ -2371,16 +2371,16 @@ angle::Result LazyBlendState::resolve(d3d::Context *context, Renderer11 *rendere return resolveImpl(context, renderer, mDesc, nullptr, mDebugName); } -void GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps, - const DXGI_ADAPTER_DESC &adapterDesc, - angle::WorkaroundsD3D *workarounds) +void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps, + const DXGI_ADAPTER_DESC &adapterDesc, + angle::FeaturesD3D *features) { bool is9_3 = (deviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3); - workarounds->mrtPerfWorkaround.enabled = true; - workarounds->setDataFasterThanImageUpload.enabled = true; - workarounds->zeroMaxLodWorkaround.enabled = is9_3; - workarounds->useInstancedPointSpriteEmulation.enabled = is9_3; + features->mrtPerfWorkaround.enabled = true; + features->setDataFasterThanImageUpload.enabled = true; + features->zeroMaxLodWorkaround.enabled = is9_3; + features->useInstancedPointSpriteEmulation.enabled = is9_3; // TODO(jmadill): Narrow problematic driver range. if (IsNvidia(adapterDesc.VendorId)) @@ -2391,48 +2391,48 @@ void GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps, WORD part2 = LOWORD(deviceCaps.driverVersion.value().LowPart); // Disable the workaround to fix a second driver bug on newer NVIDIA. - workarounds->depthStencilBlitExtraCopy.enabled = (part1 <= 13u && part2 < 6881); + features->depthStencilBlitExtraCopy.enabled = (part1 <= 13u && part2 < 6881); } else { - workarounds->depthStencilBlitExtraCopy.enabled = true; + features->depthStencilBlitExtraCopy.enabled = true; } } // TODO(jmadill): Disable workaround when we have a fixed compiler DLL. - workarounds->expandIntegerPowExpressions.enabled = true; + features->expandIntegerPowExpressions.enabled = true; - workarounds->flushAfterEndingTransformFeedback.enabled = IsNvidia(adapterDesc.VendorId); - workarounds->getDimensionsIgnoresBaseLevel.enabled = IsNvidia(adapterDesc.VendorId); - workarounds->skipVSConstantRegisterZero.enabled = IsNvidia(adapterDesc.VendorId); - workarounds->forceAtomicValueResolution.enabled = IsNvidia(adapterDesc.VendorId); + features->flushAfterEndingTransformFeedback.enabled = IsNvidia(adapterDesc.VendorId); + features->getDimensionsIgnoresBaseLevel.enabled = IsNvidia(adapterDesc.VendorId); + features->skipVSConstantRegisterZero.enabled = IsNvidia(adapterDesc.VendorId); + features->forceAtomicValueResolution.enabled = IsNvidia(adapterDesc.VendorId); if (IsIntel(adapterDesc.VendorId)) { IntelDriverVersion capsVersion = d3d11_gl::GetIntelDriverVersion(deviceCaps.driverVersion); - workarounds->preAddTexelFetchOffsets.enabled = true; - workarounds->useSystemMemoryForConstantBuffers.enabled = true; - workarounds->disableB5G6R5Support.enabled = capsVersion < IntelDriverVersion(4539); - workarounds->addDummyTextureNoRenderTarget.enabled = capsVersion < IntelDriverVersion(4815); + features->preAddTexelFetchOffsets.enabled = true; + features->useSystemMemoryForConstantBuffers.enabled = true; + features->disableB5G6R5Support.enabled = capsVersion < IntelDriverVersion(4539); + features->addDummyTextureNoRenderTarget.enabled = capsVersion < IntelDriverVersion(4815); if (IsSkylake(adapterDesc.DeviceId)) { - workarounds->callClearTwice.enabled = capsVersion < IntelDriverVersion(4771); - workarounds->emulateIsnanFloat.enabled = capsVersion < IntelDriverVersion(4542); + features->callClearTwice.enabled = capsVersion < IntelDriverVersion(4771); + features->emulateIsnanFloat.enabled = capsVersion < IntelDriverVersion(4542); } else if (IsBroadwell(adapterDesc.DeviceId) || IsHaswell(adapterDesc.DeviceId)) { - workarounds->rewriteUnaryMinusOperator.enabled = capsVersion < IntelDriverVersion(4624); + features->rewriteUnaryMinusOperator.enabled = capsVersion < IntelDriverVersion(4624); } } if (IsAMD(adapterDesc.VendorId)) { - workarounds->disableB5G6R5Support.enabled = true; + features->disableB5G6R5Support.enabled = true; } // TODO(jmadill): Disable when we have a fixed driver version. - workarounds->emulateTinyStencilTextures.enabled = IsAMD(adapterDesc.VendorId); + features->emulateTinyStencilTextures.enabled = IsAMD(adapterDesc.VendorId); // The tiny stencil texture workaround involves using CopySubresource or UpdateSubresource on a // depth stencil texture. This is not allowed until feature level 10.1 but since it is not @@ -2440,17 +2440,17 @@ void GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps, // (anglebug.com/1572). if (deviceCaps.featureLevel < D3D_FEATURE_LEVEL_10_1) { - workarounds->emulateTinyStencilTextures.enabled = false; + features->emulateTinyStencilTextures.enabled = false; } // If the VPAndRTArrayIndexFromAnyShaderFeedingRasterizer feature is not available, we have to // select the viewport / RT array index in the geometry shader. - workarounds->selectViewInGeometryShader.enabled = + features->selectViewInGeometryShader.enabled = (deviceCaps.supportsVpRtIndexWriteFromVertexShader == false); // Call platform hooks for testing overrides. auto *platform = ANGLEPlatformCurrent(); - platform->overrideWorkaroundsD3D(platform, workarounds); + platform->overrideFeaturesD3D(platform, features); } void InitConstantBufferDesc(D3D11_BUFFER_DESC *constantBufferDescription, size_t byteWidth) diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h index ad22f5fa5..4ce13e2bf 100644 --- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h +++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h @@ -74,7 +74,7 @@ gl::Version GetMaximumClientVersion(D3D_FEATURE_LEVEL featureLevel); void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const Renderer11DeviceCaps &renderer11DeviceCaps, - const angle::WorkaroundsD3D &workarounds, + const angle::FeaturesD3D &features, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, @@ -305,9 +305,9 @@ void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBuffer, c } } -void GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps, - const DXGI_ADAPTER_DESC &adapterDesc, - angle::WorkaroundsD3D *workarounds); +void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps, + const DXGI_ADAPTER_DESC &adapterDesc, + angle::FeaturesD3D *features); enum ReservedConstantBufferSlot { diff --git a/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/src/libANGLE/renderer/d3d/d3d9/Context9.cpp index 4240ff96d..7e97a06ec 100644 --- a/src/libANGLE/renderer/d3d/d3d9/Context9.cpp +++ b/src/libANGLE/renderer/d3d/d3d9/Context9.cpp @@ -50,7 +50,7 @@ CompilerImpl *Context9::createCompiler() ShaderImpl *Context9::createShader(const gl::ShaderState &data) { - return new ShaderD3D(data, mRenderer->getWorkarounds(), mRenderer->getNativeExtensions()); + return new ShaderD3D(data, mRenderer->getFeatures(), mRenderer->getNativeExtensions()); } ProgramImpl *Context9::createProgram(const gl::ProgramState &data) diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp index ffee3cbed..929ef3759 100644 --- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp +++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp @@ -2974,10 +2974,10 @@ void Renderer9::generateCaps(gl::Caps *outCaps, outExtensions, outLimitations); } -void Renderer9::generateWorkarounds(angle::WorkaroundsD3D *workarounds) const +void Renderer9::initializeFeatures(angle::FeaturesD3D *features) const { - d3d9::GenerateWorkarounds(workarounds); - OverrideFeaturesWithDisplayState(workarounds, mDisplay->getState()); + d3d9::InitializeFeatures(features); + OverrideFeaturesWithDisplayState(features, mDisplay->getState()); } DeviceImpl *Renderer9::createEGLDevice() diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h index 0ad6153b1..1fc6e0355 100644 --- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h +++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h @@ -438,7 +438,7 @@ class Renderer9 : public RendererD3D gl::Extensions *outExtensions, gl::Limitations *outLimitations) const override; - void generateWorkarounds(angle::WorkaroundsD3D *workarounds) const override; + void initializeFeatures(angle::FeaturesD3D *features) const override; angle::Result setBlendDepthRasterStates(const gl::Context *context, gl::PrimitiveMode drawMode); diff --git a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp index 15ec09358..99cc6307a 100644 --- a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp +++ b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp @@ -16,8 +16,8 @@ #include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h" #include "libANGLE/renderer/d3d/d3d9/formatutils9.h" #include "libANGLE/renderer/driver_utils.h" +#include "platform/FeaturesD3D.h" #include "platform/Platform.h" -#include "platform/WorkaroundsD3D.h" #include "third_party/systeminfo/SystemInfo.h" @@ -803,18 +803,18 @@ void MakeValidSize(bool isImage, *levelOffset = upsampleCount; } -void GenerateWorkarounds(angle::WorkaroundsD3D *workarounds) +void InitializeFeatures(angle::FeaturesD3D *features) { - workarounds->mrtPerfWorkaround.enabled = true; - workarounds->setDataFasterThanImageUpload.enabled = false; - workarounds->useInstancedPointSpriteEmulation.enabled = false; + features->mrtPerfWorkaround.enabled = true; + features->setDataFasterThanImageUpload.enabled = false; + features->useInstancedPointSpriteEmulation.enabled = false; // TODO(jmadill): Disable workaround when we have a fixed compiler DLL. - workarounds->expandIntegerPowExpressions.enabled = true; + features->expandIntegerPowExpressions.enabled = true; // Call platform hooks for testing overrides. auto *platform = ANGLEPlatformCurrent(); - platform->overrideWorkaroundsD3D(platform, workarounds); + platform->overrideFeaturesD3D(platform, features); } } // namespace d3d9 diff --git a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h index 7e57fd703..5780837fe 100644 --- a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h +++ b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h @@ -13,7 +13,7 @@ #include "common/Color.h" #include "libANGLE/Caps.h" #include "libANGLE/Error.h" -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" namespace gl { @@ -97,7 +97,7 @@ inline bool isDeviceLostError(HRESULT errorCode) } } -void GenerateWorkarounds(angle::WorkaroundsD3D *workarounds); +void InitializeFeatures(angle::FeaturesD3D *features); } // namespace d3d9 } // namespace rx diff --git a/src/libANGLE/renderer/gl/BlitGL.cpp b/src/libANGLE/renderer/gl/BlitGL.cpp index c775ac968..668e19698 100644 --- a/src/libANGLE/renderer/gl/BlitGL.cpp +++ b/src/libANGLE/renderer/gl/BlitGL.cpp @@ -22,10 +22,10 @@ #include "libANGLE/renderer/gl/RenderbufferGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h" #include "libANGLE/renderer/gl/TextureGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/formatutilsgl.h" #include "libANGLE/renderer/gl/renderergl_utils.h" #include "libANGLE/renderer/renderer_utils.h" +#include "platform/FeaturesGL.h" using angle::Vector2; @@ -212,10 +212,10 @@ void UnbindAttachments(const FunctionsGL *functions, } // anonymous namespace BlitGL::BlitGL(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, StateManagerGL *stateManager) : mFunctions(functions), - mWorkarounds(workarounds), + mFeatures(features), mStateManager(stateManager), mScratchFBO(0), mVAO(0), @@ -315,7 +315,7 @@ angle::Result BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *con ANGLE_TRY(source->getImplementationColorReadType(context, &readType)); nativegl::CopyTexImageImageFormat copyTexImageFormat = - nativegl::GetCopyTexImageImageFormat(mFunctions, mWorkarounds, readFormat, readType); + nativegl::GetCopyTexImageImageFormat(mFunctions, mFeatures, readFormat, readType); mStateManager->bindTexture(gl::TextureType::_2D, mScratchTextures[0]); mFunctions->copyTexImage2D(GL_TEXTURE_2D, 0, copyTexImageFormat.internalFormat, sourceArea.x, @@ -682,7 +682,7 @@ angle::Result BlitGL::copySubTextureCPUReadback(const gl::Context *context, mStateManager->setPixelPackBuffer(nullptr); nativegl::TexSubImageFormat texSubImageFormat = - nativegl::GetTexSubImageFormat(mFunctions, mWorkarounds, destFormat, destType); + nativegl::GetTexSubImageFormat(mFunctions, mFeatures, destFormat, destType); mStateManager->bindTexture(dest->getType(), dest->getTextureID()); mFunctions->texSubImage2D(ToGLenum(destTarget), static_cast(destLevel), destOffset.x, diff --git a/src/libANGLE/renderer/gl/BlitGL.h b/src/libANGLE/renderer/gl/BlitGL.h index 60acda5c0..fd349070c 100644 --- a/src/libANGLE/renderer/gl/BlitGL.h +++ b/src/libANGLE/renderer/gl/BlitGL.h @@ -16,6 +16,11 @@ #include +namespace angle +{ +struct FeaturesGL; +} // namespace angle + namespace gl { class Framebuffer; @@ -30,13 +35,12 @@ class FunctionsGL; class RenderbufferGL; class StateManagerGL; class TextureGL; -struct WorkaroundsGL; class BlitGL : angle::NonCopyable { public: BlitGL(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, StateManagerGL *stateManager); ~BlitGL(); @@ -126,7 +130,7 @@ class BlitGL : angle::NonCopyable void setScratchTextureParameter(GLenum param, GLenum value); const FunctionsGL *mFunctions; - const WorkaroundsGL &mWorkarounds; + const angle::FeaturesGL &mFeatures; StateManagerGL *mStateManager; struct BlitProgram diff --git a/src/libANGLE/renderer/gl/ContextGL.cpp b/src/libANGLE/renderer/gl/ContextGL.cpp index b67fa752f..8884ea92a 100644 --- a/src/libANGLE/renderer/gl/ContextGL.cpp +++ b/src/libANGLE/renderer/gl/ContextGL.cpp @@ -60,7 +60,7 @@ ShaderImpl *ContextGL::createShader(const gl::ShaderState &data) ProgramImpl *ContextGL::createProgram(const gl::ProgramState &data) { - return new ProgramGL(data, getFunctions(), getWorkaroundsGL(), getStateManager(), + return new ProgramGL(data, getFunctions(), getFeaturesGL(), getStateManager(), getExtensions().pathRendering, mRenderer); } @@ -88,7 +88,7 @@ TextureImpl *ContextGL::createTexture(const gl::TextureState &state) RenderbufferImpl *ContextGL::createRenderbuffer(const gl::RenderbufferState &state) { - return new RenderbufferGL(state, getFunctions(), getWorkaroundsGL(), getStateManager(), + return new RenderbufferGL(state, getFunctions(), getFeaturesGL(), getStateManager(), mRenderer->getBlitter(), getNativeTextureCaps()); } @@ -576,9 +576,9 @@ StateManagerGL *ContextGL::getStateManager() return mRenderer->getStateManager(); } -const WorkaroundsGL &ContextGL::getWorkaroundsGL() const +const angle::FeaturesGL &ContextGL::getFeaturesGL() const { - return mRenderer->getWorkarounds(); + return mRenderer->getFeatures(); } BlitGL *ContextGL::getBlitter() const diff --git a/src/libANGLE/renderer/gl/ContextGL.h b/src/libANGLE/renderer/gl/ContextGL.h index d76e49240..040c37e5c 100644 --- a/src/libANGLE/renderer/gl/ContextGL.h +++ b/src/libANGLE/renderer/gl/ContextGL.h @@ -13,10 +13,15 @@ #include "libANGLE/renderer/ContextImpl.h" #include "libANGLE/renderer/gl/RendererGL.h" +namespace angle +{ +struct FeaturesGL; +} // namespace angle + namespace sh { struct BlockMemberInfo; -} +} // namespace sh namespace rx { @@ -25,7 +30,6 @@ class ClearMultiviewGL; class FunctionsGL; class RendererGL; class StateManagerGL; -struct WorkaroundsGL; class ContextGL : public ContextImpl { @@ -220,7 +224,7 @@ class ContextGL : public ContextImpl ANGLE_INLINE const FunctionsGL *getFunctions() const { return mRenderer->getFunctions(); } StateManagerGL *getStateManager(); - const WorkaroundsGL &getWorkaroundsGL() const; + const angle::FeaturesGL &getFeaturesGL() const; BlitGL *getBlitter() const; ClearMultiviewGL *getMultiviewClearer() const; diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp index 45c50efb1..a385eab8b 100644 --- a/src/libANGLE/renderer/gl/FramebufferGL.cpp +++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp @@ -23,9 +23,9 @@ #include "libANGLE/renderer/gl/RenderbufferGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h" #include "libANGLE/renderer/gl/TextureGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/formatutilsgl.h" #include "libANGLE/renderer/gl/renderergl_utils.h" +#include "platform/FeaturesGL.h" #include "platform/Platform.h" using namespace gl; @@ -428,7 +428,7 @@ angle::Result FramebufferGL::readPixels(const gl::Context *context, ContextGL *contextGL = GetImplAs(context); const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); // Clip read area to framebuffer. const gl::Extents fbSize = getState().getReadAttachment()->getSize(); @@ -445,15 +445,15 @@ angle::Result FramebufferGL::readPixels(const gl::Context *context, context->getState().getTargetBuffer(gl::BufferBinding::PixelPack); nativegl::ReadPixelsFormat readPixelsFormat = - nativegl::GetReadPixelsFormat(functions, workarounds, format, type); + nativegl::GetReadPixelsFormat(functions, features, format, type); GLenum readFormat = readPixelsFormat.format; GLenum readType = readPixelsFormat.type; stateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, mFramebufferID); - bool useOverlappingRowsWorkaround = - workarounds.packOverlappingRowsSeparatelyPackBuffer.enabled && packBuffer && - packState.rowLength != 0 && packState.rowLength < clippedArea.width; + bool useOverlappingRowsWorkaround = features.packOverlappingRowsSeparatelyPackBuffer.enabled && + packBuffer && packState.rowLength != 0 && + packState.rowLength < clippedArea.width; GLubyte *outPtr = static_cast(pixels); int leftClip = clippedArea.x - area.x; @@ -487,7 +487,7 @@ angle::Result FramebufferGL::readPixels(const gl::Context *context, } bool useLastRowPaddingWorkaround = false; - if (workarounds.packLastRowSeparatelyForPaddingInclusion.enabled) + if (features.packLastRowSeparatelyForPaddingInclusion.enabled) { ANGLE_TRY(ShouldApplyLastRowPaddingWorkaround( contextGL, gl::Extents(clippedArea.width, clippedArea.height, 1), packState, packBuffer, @@ -741,9 +741,9 @@ void FramebufferGL::syncClearState(const gl::Context *context, GLbitfield mask) if (functions->standard == STANDARD_GL_DESKTOP) { StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); - if (workarounds.doesSRGBClearsOnLinearFramebufferAttachments.enabled && + if (features.doesSRGBClearsOnLinearFramebufferAttachments.enabled && (mask & GL_COLOR_BUFFER_BIT) != 0 && !mIsDefault) { bool hasSRGBAttachment = false; @@ -774,10 +774,10 @@ void FramebufferGL::syncClearBufferState(const gl::Context *context, if (functions->standard == STANDARD_GL_DESKTOP) { StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); - if (workarounds.doesSRGBClearsOnLinearFramebufferAttachments.enabled && - buffer == GL_COLOR && !mIsDefault) + if (features.doesSRGBClearsOnLinearFramebufferAttachments.enabled && buffer == GL_COLOR && + !mIsDefault) { // If doing a clear on a color buffer, set SRGB blend enabled only if the color buffer // is an SRGB format. diff --git a/src/libANGLE/renderer/gl/FramebufferGL.h b/src/libANGLE/renderer/gl/FramebufferGL.h index 1c8e8b271..2a9b7b6e3 100644 --- a/src/libANGLE/renderer/gl/FramebufferGL.h +++ b/src/libANGLE/renderer/gl/FramebufferGL.h @@ -19,7 +19,6 @@ class BlitGL; class ClearMultiviewGL; class FunctionsGL; class StateManagerGL; -struct WorkaroundsGL; class FramebufferGL : public FramebufferImpl { diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp index 656b9fbc4..3d0374a04 100644 --- a/src/libANGLE/renderer/gl/ProgramGL.cpp +++ b/src/libANGLE/renderer/gl/ProgramGL.cpp @@ -23,7 +23,7 @@ #include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/ShaderGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" +#include "platform/FeaturesGL.h" #include "platform/Platform.h" namespace rx @@ -31,13 +31,13 @@ namespace rx ProgramGL::ProgramGL(const gl::ProgramState &data, const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, StateManagerGL *stateManager, bool enablePathRendering, const std::shared_ptr &renderer) : ProgramImpl(data), mFunctions(functions), - mWorkarounds(workarounds), + mFeatures(features), mStateManager(stateManager), mEnablePathRendering(enablePathRendering), mMultiviewBaseViewLayerIndexUniformLocation(-1), @@ -104,8 +104,8 @@ void ProgramGL::save(const gl::Context *context, gl::BinaryOutputStream *stream) void ProgramGL::reapplyUBOBindingsIfNeeded(const gl::Context *context) { // Re-apply UBO bindings to work around driver bugs. - const WorkaroundsGL &workaroundsGL = GetImplAs(context)->getWorkaroundsGL(); - if (workaroundsGL.reapplyUBOBindingsAfterUsingBinaryProgram.enabled) + const angle::FeaturesGL &features = GetImplAs(context)->getFeaturesGL(); + if (features.reapplyUBOBindingsAfterUsingBinaryProgram.enabled) { const auto &blocks = mState.getUniformBlocks(); for (size_t blockIndex : mState.getActiveUniformBlockBindingsMask()) @@ -453,7 +453,7 @@ std::unique_ptr ProgramGL::link(const gl::Context *context, return angle::Result::Incomplete; } - if (mWorkarounds.alwaysCallUseProgramAfterLink.enabled) + if (mFeatures.alwaysCallUseProgramAfterLink.enabled) { mStateManager->forceUseProgram(mProgramID); } @@ -470,7 +470,7 @@ std::unique_ptr ProgramGL::link(const gl::Context *context, return std::make_unique(postLinkImplTask, mFunctions, mProgramID); } else if (workerPool->isAsync() && - (!mWorkarounds.dontRelinkProgramsInParallel.enabled || !mLinkedInParallel)) + (!mFeatures.dontRelinkProgramsInParallel.enabled || !mLinkedInParallel)) { mLinkedInParallel = true; return std::make_unique(workerPool, linkTask, postLinkImplTask); diff --git a/src/libANGLE/renderer/gl/ProgramGL.h b/src/libANGLE/renderer/gl/ProgramGL.h index a7b292032..e4a000997 100644 --- a/src/libANGLE/renderer/gl/ProgramGL.h +++ b/src/libANGLE/renderer/gl/ProgramGL.h @@ -13,7 +13,11 @@ #include #include "libANGLE/renderer/ProgramImpl.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" + +namespace angle +{ +struct FeaturesGL; +} // namespace angle namespace rx { @@ -27,7 +31,7 @@ class ProgramGL : public ProgramImpl public: ProgramGL(const gl::ProgramState &data, const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, StateManagerGL *stateManager, bool enablePathRendering, const std::shared_ptr &renderer); @@ -147,7 +151,7 @@ class ProgramGL : public ProgramImpl GLint uniLoc(GLint glLocation) const { return mUniformRealLocationMap[glLocation]; } const FunctionsGL *mFunctions; - const WorkaroundsGL &mWorkarounds; + const angle::FeaturesGL &mFeatures; StateManagerGL *mStateManager; std::vector mUniformRealLocationMap; diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.cpp b/src/libANGLE/renderer/gl/RenderbufferGL.cpp index b272e7b51..1973bab9c 100644 --- a/src/libANGLE/renderer/gl/RenderbufferGL.cpp +++ b/src/libANGLE/renderer/gl/RenderbufferGL.cpp @@ -19,18 +19,19 @@ #include "libANGLE/renderer/gl/StateManagerGL.h" #include "libANGLE/renderer/gl/formatutilsgl.h" #include "libANGLE/renderer/gl/renderergl_utils.h" +#include "platform/FeaturesGL.h" namespace rx { RenderbufferGL::RenderbufferGL(const gl::RenderbufferState &state, const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, StateManagerGL *stateManager, BlitGL *blitter, const gl::TextureCapsMap &textureCaps) : RenderbufferImpl(state), mFunctions(functions), - mWorkarounds(workarounds), + mFeatures(features), mStateManager(stateManager), mBlitter(blitter), mTextureCaps(textureCaps), @@ -54,7 +55,7 @@ angle::Result RenderbufferGL::setStorage(const gl::Context *context, mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID); nativegl::RenderbufferFormat renderbufferFormat = - nativegl::GetRenderbufferFormat(mFunctions, mWorkarounds, internalformat); + nativegl::GetRenderbufferFormat(mFunctions, mFeatures, internalformat); mFunctions->renderbufferStorage(GL_RENDERBUFFER, renderbufferFormat.internalFormat, static_cast(width), static_cast(height)); @@ -72,7 +73,7 @@ angle::Result RenderbufferGL::setStorageMultisample(const gl::Context *context, mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID); nativegl::RenderbufferFormat renderbufferFormat = - nativegl::GetRenderbufferFormat(mFunctions, mWorkarounds, internalformat); + nativegl::GetRenderbufferFormat(mFunctions, mFeatures, internalformat); mFunctions->renderbufferStorageMultisample( GL_RENDERBUFFER, static_cast(samples), renderbufferFormat.internalFormat, static_cast(width), static_cast(height)); diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.h b/src/libANGLE/renderer/gl/RenderbufferGL.h index 3f8e13479..863dba480 100644 --- a/src/libANGLE/renderer/gl/RenderbufferGL.h +++ b/src/libANGLE/renderer/gl/RenderbufferGL.h @@ -11,10 +11,15 @@ #include "libANGLE/renderer/RenderbufferImpl.h" +namespace angle +{ +struct FeaturesGL; +} // namespace angle + namespace gl { class TextureCapsMap; -} +} // namespace gl namespace rx { @@ -22,14 +27,13 @@ namespace rx class BlitGL; class FunctionsGL; class StateManagerGL; -struct WorkaroundsGL; class RenderbufferGL : public RenderbufferImpl { public: RenderbufferGL(const gl::RenderbufferState &state, const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, StateManagerGL *stateManager, BlitGL *blitter, const gl::TextureCapsMap &textureCaps); @@ -54,7 +58,7 @@ class RenderbufferGL : public RenderbufferImpl private: const FunctionsGL *mFunctions; - const WorkaroundsGL &mWorkarounds; + const angle::FeaturesGL &mFeatures; StateManagerGL *mStateManager; BlitGL *mBlitter; const gl::TextureCapsMap &mTextureCaps; diff --git a/src/libANGLE/renderer/gl/RendererGL.cpp b/src/libANGLE/renderer/gl/RendererGL.cpp index cd5c340ce..888bf7d3c 100644 --- a/src/libANGLE/renderer/gl/RendererGL.cpp +++ b/src/libANGLE/renderer/gl/RendererGL.cpp @@ -196,10 +196,10 @@ RendererGL::RendererGL(std::unique_ptr functions, mNativeParallelCompileEnabled(false) { ASSERT(mFunctions); - nativegl_gl::GenerateWorkarounds(mFunctions.get(), &mWorkarounds); - OverrideFeaturesWithDisplayState(&mWorkarounds, display->getState()); + nativegl_gl::InitializeFeatures(mFunctions.get(), &mFeatures); + OverrideFeaturesWithDisplayState(&mFeatures, display->getState()); mStateManager = new StateManagerGL(mFunctions.get(), getNativeCaps(), getNativeExtensions()); - mBlitter = new BlitGL(mFunctions.get(), mWorkarounds, mStateManager); + mBlitter = new BlitGL(mFunctions.get(), mFeatures, mStateManager); mMultiviewClearer = new ClearMultiviewGL(mFunctions.get(), mStateManager); bool hasDebugOutput = mFunctions->isAtLeastGL(gl::Version(4, 3)) || @@ -224,7 +224,7 @@ RendererGL::RendererGL(std::unique_ptr functions, mFunctions->debugMessageCallback(&LogGLDebugMessage, nullptr); } - if (mWorkarounds.initializeCurrentVertexAttributes.enabled) + if (mFeatures.initializeCurrentVertexAttributes.enabled) { GLint maxVertexAttribs = 0; mFunctions->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); @@ -262,14 +262,14 @@ angle::Result RendererGL::flush() angle::Result RendererGL::finish() { - if (mWorkarounds.finishDoesNotCauseQueriesToBeAvailable.enabled && mUseDebugOutput) + if (mFeatures.finishDoesNotCauseQueriesToBeAvailable.enabled && mUseDebugOutput) { mFunctions->enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } mFunctions->finish(); - if (mWorkarounds.finishDoesNotCauseQueriesToBeAvailable.enabled && mUseDebugOutput) + if (mFeatures.finishDoesNotCauseQueriesToBeAvailable.enabled && mUseDebugOutput) { mFunctions->disable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } @@ -500,9 +500,8 @@ void RendererGL::generateCaps(gl::Caps *outCaps, gl::Extensions *outExtensions, gl::Limitations * /* outLimitations */) const { - nativegl_gl::GenerateCaps(mFunctions.get(), mWorkarounds, outCaps, outTextureCaps, - outExtensions, &mMaxSupportedESVersion, - &mMultiviewImplementationType); + nativegl_gl::GenerateCaps(mFunctions.get(), mFeatures, outCaps, outTextureCaps, outExtensions, + &mMaxSupportedESVersion, &mMultiviewImplementationType); } GLint RendererGL::getGPUDisjoint() @@ -557,7 +556,7 @@ MultiviewImplementationTypeGL RendererGL::getMultiviewImplementationType() const return mMultiviewImplementationType; } -void RendererGL::initializeFrontendFeatures(gl::FrontendFeatures *features) const +void RendererGL::initializeFrontendFeatures(angle::FrontendFeatures *features) const { ensureCapsInitialized(); nativegl_gl::InitializeFrontendFeatures(mFunctions.get(), features); @@ -591,7 +590,7 @@ angle::Result RendererGL::memoryBarrierByRegion(GLbitfield barriers) bool RendererGL::bindWorkerContext(std::string *infoLog) { - if (mWorkarounds.disableWorkerContexts.enabled) + if (mFeatures.disableWorkerContexts.enabled) { return false; } diff --git a/src/libANGLE/renderer/gl/RendererGL.h b/src/libANGLE/renderer/gl/RendererGL.h index eadf8b6c4..ced11f4e4 100644 --- a/src/libANGLE/renderer/gl/RendererGL.h +++ b/src/libANGLE/renderer/gl/RendererGL.h @@ -16,26 +16,30 @@ #include "libANGLE/Caps.h" #include "libANGLE/Error.h" #include "libANGLE/Version.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/renderergl_utils.h" +#include "platform/FeaturesGL.h" + +namespace angle +{ +struct FrontendFeatures; +} // namespace angle namespace gl { struct IndexRange; class Path; class State; -struct FrontendFeatures; } // namespace gl namespace egl { class AttributeMap; -} +} // namespace egl namespace sh { struct BlockMemberInfo; -} +} // namespace sh namespace rx { @@ -161,7 +165,7 @@ class RendererGL : angle::NonCopyable const gl::Version &getMaxSupportedESVersion() const; const FunctionsGL *getFunctions() const { return mFunctions.get(); } StateManagerGL *getStateManager() const { return mStateManager; } - const WorkaroundsGL &getWorkarounds() const { return mWorkarounds; } + const angle::FeaturesGL &getFeatures() const { return mFeatures; } BlitGL *getBlitter() const { return mBlitter; } ClearMultiviewGL *getMultiviewClearer() const { return mMultiviewClearer; } @@ -170,7 +174,7 @@ class RendererGL : angle::NonCopyable const gl::TextureCapsMap &getNativeTextureCaps() const; const gl::Extensions &getNativeExtensions() const; const gl::Limitations &getNativeLimitations() const; - void initializeFrontendFeatures(gl::FrontendFeatures *features) const; + void initializeFrontendFeatures(angle::FrontendFeatures *features) const; angle::Result dispatchCompute(const gl::Context *context, GLuint numGroupsX, @@ -226,7 +230,7 @@ class RendererGL : angle::NonCopyable bool mNativeParallelCompileEnabled; - WorkaroundsGL mWorkarounds; + angle::FeaturesGL mFeatures; }; } // namespace rx diff --git a/src/libANGLE/renderer/gl/ShaderGL.cpp b/src/libANGLE/renderer/gl/ShaderGL.cpp index 38e9f60b7..6b2c45f03 100644 --- a/src/libANGLE/renderer/gl/ShaderGL.cpp +++ b/src/libANGLE/renderer/gl/ShaderGL.cpp @@ -13,7 +13,7 @@ #include "libANGLE/Context.h" #include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/RendererGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" +#include "platform/FeaturesGL.h" #include @@ -250,74 +250,74 @@ std::shared_ptr ShaderGL::compile(const gl::Context *conte additionalOptions |= SH_INIT_OUTPUT_VARIABLES; } - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); - if (workarounds.doWhileGLSLCausesGPUHang.enabled) + if (features.doWhileGLSLCausesGPUHang.enabled) { additionalOptions |= SH_REWRITE_DO_WHILE_LOOPS; } - if (workarounds.emulateAbsIntFunction.enabled) + if (features.emulateAbsIntFunction.enabled) { additionalOptions |= SH_EMULATE_ABS_INT_FUNCTION; } - if (workarounds.addAndTrueToLoopCondition.enabled) + if (features.addAndTrueToLoopCondition.enabled) { additionalOptions |= SH_ADD_AND_TRUE_TO_LOOP_CONDITION; } - if (workarounds.emulateIsnanFloat.enabled) + if (features.emulateIsnanFloat.enabled) { additionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION; } - if (workarounds.emulateAtan2Float.enabled) + if (features.emulateAtan2Float.enabled) { additionalOptions |= SH_EMULATE_ATAN2_FLOAT_FUNCTION; } - if (workarounds.useUnusedBlocksWithStandardOrSharedLayout.enabled) + if (features.useUnusedBlocksWithStandardOrSharedLayout.enabled) { additionalOptions |= SH_USE_UNUSED_STANDARD_SHARED_BLOCKS; } - if (workarounds.removeInvariantAndCentroidForESSL3.enabled) + if (features.removeInvariantAndCentroidForESSL3.enabled) { additionalOptions |= SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3; } - if (workarounds.rewriteFloatUnaryMinusOperator.enabled) + if (features.rewriteFloatUnaryMinusOperator.enabled) { additionalOptions |= SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR; } - if (!workarounds.dontInitializeUninitializedLocals.enabled) + if (!features.dontInitializeUninitializedLocals.enabled) { additionalOptions |= SH_INITIALIZE_UNINITIALIZED_LOCALS; } - if (workarounds.clampPointSize.enabled) + if (features.clampPointSize.enabled) { additionalOptions |= SH_CLAMP_POINT_SIZE; } - if (workarounds.rewriteVectorScalarArithmetic.enabled) + if (features.rewriteVectorScalarArithmetic.enabled) { additionalOptions |= SH_REWRITE_VECTOR_SCALAR_ARITHMETIC; } - if (workarounds.dontUseLoopsToInitializeVariables.enabled) + if (features.dontUseLoopsToInitializeVariables.enabled) { additionalOptions |= SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES; } - if (workarounds.clampFragDepth.enabled) + if (features.clampFragDepth.enabled) { additionalOptions |= SH_CLAMP_FRAG_DEPTH; } - if (workarounds.rewriteRepeatedAssignToSwizzled.enabled) + if (features.rewriteRepeatedAssignToSwizzled.enabled) { additionalOptions |= SH_REWRITE_REPEATED_ASSIGN_TO_SWIZZLED; } diff --git a/src/libANGLE/renderer/gl/ShaderGL.h b/src/libANGLE/renderer/gl/ShaderGL.h index b767103ab..9b93884c7 100644 --- a/src/libANGLE/renderer/gl/ShaderGL.h +++ b/src/libANGLE/renderer/gl/ShaderGL.h @@ -14,7 +14,6 @@ namespace rx { class RendererGL; -struct WorkaroundsGL; enum class MultiviewImplementationTypeGL; class ShaderGL : public ShaderImpl diff --git a/src/libANGLE/renderer/gl/TextureGL.cpp b/src/libANGLE/renderer/gl/TextureGL.cpp index ac5b3aefa..ec7b5ac0c 100644 --- a/src/libANGLE/renderer/gl/TextureGL.cpp +++ b/src/libANGLE/renderer/gl/TextureGL.cpp @@ -23,9 +23,9 @@ #include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/ImageGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/formatutilsgl.h" #include "libANGLE/renderer/gl/renderergl_utils.h" +#include "platform/FeaturesGL.h" using angle::CheckedNumeric; @@ -150,7 +150,7 @@ angle::Result TextureGL::setImage(const gl::Context *context, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); const gl::Buffer *unpackBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack); @@ -158,7 +158,7 @@ angle::Result TextureGL::setImage(const gl::Context *context, gl::TextureTarget target = index.getTarget(); size_t level = static_cast(index.getLevelIndex()); - if (workarounds.unpackOverlappingRowsSeparatelyUnpackBuffer.enabled && unpackBuffer && + if (features.unpackOverlappingRowsSeparatelyUnpackBuffer.enabled && unpackBuffer && unpack.rowLength != 0 && unpack.rowLength < size.width) { // The rows overlap in unpack memory. Upload the texture row by row to work around @@ -175,7 +175,7 @@ angle::Result TextureGL::setImage(const gl::Context *context, unpackBuffer, pixels); } - if (workarounds.unpackLastRowSeparatelyForPaddingInclusion.enabled) + if (features.unpackLastRowSeparatelyForPaddingInclusion.enabled) { bool apply = false; ANGLE_TRY(ShouldApplyLastRowPaddingWorkaround( @@ -217,10 +217,10 @@ void TextureGL::setImageHelper(const gl::Context *context, const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); nativegl::TexImageFormat texImageFormat = - nativegl::GetTexImageFormat(functions, workarounds, internalFormat, format, type); + nativegl::GetTexImageFormat(functions, features, internalFormat, format, type); stateManager->bindTexture(getType(), mTextureID); @@ -269,10 +269,10 @@ angle::Result TextureGL::setSubImage(const gl::Context *context, const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); nativegl::TexSubImageFormat texSubImageFormat = - nativegl::GetTexSubImageFormat(functions, workarounds, format, type); + nativegl::GetTexSubImageFormat(functions, features, format, type); gl::TextureTarget target = index.getTarget(); size_t level = static_cast(index.getLevelIndex()); @@ -281,14 +281,14 @@ angle::Result TextureGL::setSubImage(const gl::Context *context, GetLevelInfo(format, texSubImageFormat.format).lumaWorkaround.enabled); stateManager->bindTexture(getType(), mTextureID); - if (workarounds.unpackOverlappingRowsSeparatelyUnpackBuffer.enabled && unpackBuffer && + if (features.unpackOverlappingRowsSeparatelyUnpackBuffer.enabled && unpackBuffer && unpack.rowLength != 0 && unpack.rowLength < area.width) { return setSubImageRowByRowWorkaround(context, target, level, area, format, type, unpack, unpackBuffer, pixels); } - if (workarounds.unpackLastRowSeparatelyForPaddingInclusion.enabled) + if (features.unpackLastRowSeparatelyForPaddingInclusion.enabled) { gl::Extents size(area.width, area.height, area.depth); @@ -484,14 +484,14 @@ angle::Result TextureGL::setCompressedImage(const gl::Context *context, { const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); gl::TextureTarget target = index.getTarget(); size_t level = static_cast(index.getLevelIndex()); ASSERT(TextureTargetToType(target) == getType()); nativegl::CompressedTexImageFormat compressedTexImageFormat = - nativegl::GetCompressedTexImageFormat(functions, workarounds, internalFormat); + nativegl::GetCompressedTexImageFormat(functions, features, internalFormat); stateManager->bindTexture(getType(), mTextureID); if (nativegl::UseTexImage2D(getType())) @@ -526,14 +526,14 @@ angle::Result TextureGL::setCompressedSubImage(const gl::Context *context, { const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); gl::TextureTarget target = index.getTarget(); size_t level = static_cast(index.getLevelIndex()); ASSERT(TextureTargetToType(target) == getType()); nativegl::CompressedTexSubImageFormat compressedTexSubImageFormat = - nativegl::GetCompressedSubTexImageFormat(functions, workarounds, format); + nativegl::GetCompressedSubTexImageFormat(functions, features, format); stateManager->bindTexture(getType(), mTextureID); if (nativegl::UseTexImage2D(getType())) @@ -567,14 +567,14 @@ angle::Result TextureGL::copyImage(const gl::Context *context, ContextGL *contextGL = GetImplAs(context); const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); gl::TextureTarget target = index.getTarget(); size_t level = static_cast(index.getLevelIndex()); GLenum type = GL_NONE; ANGLE_TRY(source->getImplementationColorReadType(context, &type)); nativegl::CopyTexImageImageFormat copyTexImageFormat = - nativegl::GetCopyTexImageImageFormat(functions, workarounds, internalFormat, type); + nativegl::GetCopyTexImageImageFormat(functions, features, internalFormat, type); stateManager->bindTexture(getType(), mTextureID); @@ -845,10 +845,10 @@ angle::Result TextureGL::setStorage(const gl::Context *context, ContextGL *contextGL = GetImplAs(context); const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); nativegl::TexStorageFormat texStorageFormat = - nativegl::GetTexStorageFormat(functions, workarounds, internalFormat); + nativegl::GetTexStorageFormat(functions, features, internalFormat); stateManager->bindTexture(getType(), mTextureID); if (nativegl::UseTexImage2D(getType())) @@ -880,7 +880,7 @@ angle::Result TextureGL::setStorage(const gl::Context *context, if (internalFormatInfo.compressed) { nativegl::CompressedTexSubImageFormat compressedTexImageFormat = - nativegl::GetCompressedSubTexImageFormat(functions, workarounds, + nativegl::GetCompressedSubTexImageFormat(functions, features, internalFormat); GLuint dataSize = 0; @@ -895,7 +895,7 @@ angle::Result TextureGL::setStorage(const gl::Context *context, else { nativegl::TexImageFormat texImageFormat = nativegl::GetTexImageFormat( - functions, workarounds, internalFormat, internalFormatInfo.format, + functions, features, internalFormat, internalFormatInfo.format, internalFormatInfo.type); functions->texImage2D(ToGLenum(type), static_cast(level), @@ -912,7 +912,7 @@ angle::Result TextureGL::setStorage(const gl::Context *context, if (internalFormatInfo.compressed) { nativegl::CompressedTexSubImageFormat compressedTexImageFormat = - nativegl::GetCompressedSubTexImageFormat(functions, workarounds, + nativegl::GetCompressedSubTexImageFormat(functions, features, internalFormat); GLuint dataSize = 0; @@ -927,7 +927,7 @@ angle::Result TextureGL::setStorage(const gl::Context *context, else { nativegl::TexImageFormat texImageFormat = nativegl::GetTexImageFormat( - functions, workarounds, internalFormat, internalFormatInfo.format, + functions, features, internalFormat, internalFormatInfo.format, internalFormatInfo.type); functions->texImage2D(ToGLenum(face), static_cast(level), @@ -969,7 +969,7 @@ angle::Result TextureGL::setStorage(const gl::Context *context, if (internalFormatInfo.compressed) { nativegl::CompressedTexSubImageFormat compressedTexImageFormat = - nativegl::GetCompressedSubTexImageFormat(functions, workarounds, + nativegl::GetCompressedSubTexImageFormat(functions, features, internalFormat); GLuint dataSize = 0; @@ -983,7 +983,7 @@ angle::Result TextureGL::setStorage(const gl::Context *context, else { nativegl::TexImageFormat texImageFormat = nativegl::GetTexImageFormat( - functions, workarounds, internalFormat, internalFormatInfo.format, + functions, features, internalFormat, internalFormatInfo.format, internalFormatInfo.type); functions->texImage3D(ToGLenum(type), i, texImageFormat.internalFormat, @@ -1009,10 +1009,10 @@ angle::Result TextureGL::setStorageMultisample(const gl::Context *context, { const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); nativegl::TexStorageFormat texStorageFormat = - nativegl::GetTexStorageFormat(functions, workarounds, internalformat); + nativegl::GetTexStorageFormat(functions, features, internalformat); stateManager->bindTexture(getType(), mTextureID); @@ -1557,7 +1557,7 @@ angle::Result TextureGL::initializeContents(const gl::Context *context, ContextGL *contextGL = GetImplAs(context); const FunctionsGL *functions = GetFunctionsGL(context); StateManagerGL *stateManager = GetStateManagerGL(context); - const WorkaroundsGL &workarounds = GetWorkaroundsGL(context); + const angle::FeaturesGL &features = GetFeaturesGL(context); GLenum nativeInternalFormat = getLevelInfo(imageIndex.getTarget(), imageIndex.getLevelIndex()).nativeInternalFormat; @@ -1588,7 +1588,7 @@ angle::Result TextureGL::initializeContents(const gl::Context *context, if (internalFormatInfo.compressed) { nativegl::CompressedTexSubImageFormat nativeSubImageFormat = - nativegl::GetCompressedSubTexImageFormat(functions, workarounds, + nativegl::GetCompressedSubTexImageFormat(functions, features, internalFormatInfo.internalFormat); GLuint imageSize = 0; @@ -1618,7 +1618,7 @@ angle::Result TextureGL::initializeContents(const gl::Context *context, else { nativegl::TexSubImageFormat nativeSubImageFormat = nativegl::GetTexSubImageFormat( - functions, workarounds, internalFormatInfo.format, internalFormatInfo.type); + functions, features, internalFormatInfo.format, internalFormatInfo.type); GLuint imageSize = 0; ANGLE_CHECK_GL_MATH(contextGL, internalFormatInfo.computePackUnpackEndByte( diff --git a/src/libANGLE/renderer/gl/TextureGL.h b/src/libANGLE/renderer/gl/TextureGL.h index d5e7caaae..b5809b180 100644 --- a/src/libANGLE/renderer/gl/TextureGL.h +++ b/src/libANGLE/renderer/gl/TextureGL.h @@ -19,7 +19,6 @@ namespace rx class BlitGL; class FunctionsGL; class StateManagerGL; -struct WorkaroundsGL; struct LUMAWorkaroundGL { diff --git a/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp b/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp index 7f59378ff..d47e0d83b 100644 --- a/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp +++ b/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp @@ -15,7 +15,6 @@ #include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/ProgramGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/renderergl_utils.h" namespace rx diff --git a/src/libANGLE/renderer/gl/cgl/DisplayCGL.h b/src/libANGLE/renderer/gl/cgl/DisplayCGL.h index c17d98f4a..6327a8ba2 100644 --- a/src/libANGLE/renderer/gl/cgl/DisplayCGL.h +++ b/src/libANGLE/renderer/gl/cgl/DisplayCGL.h @@ -74,7 +74,7 @@ class DisplayCGL : public DisplayGL WorkerContext *createWorkerContext(std::string *infoLog); - void initializeFrontendFeatures(gl::FrontendFeatures *features) const override; + void initializeFrontendFeatures(angle::FrontendFeatures *features) const override; void populateFeatureList(angle::FeatureList *features) override; diff --git a/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm b/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm index bf02cff28..a240788c5 100644 --- a/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm +++ b/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm @@ -427,13 +427,13 @@ void DisplayCGL::unreferenceDiscreteGPU() } } -void DisplayCGL::initializeFrontendFeatures(gl::FrontendFeatures *features) const +void DisplayCGL::initializeFrontendFeatures(angle::FrontendFeatures *features) const { mRenderer->initializeFrontendFeatures(features); } void DisplayCGL::populateFeatureList(angle::FeatureList *features) { - mRenderer->getWorkarounds().populateFeatureList(features); + mRenderer->getFeatures().populateFeatureList(features); } } diff --git a/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h b/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h index 24e47d2e0..dc71ae6b1 100644 --- a/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h +++ b/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h @@ -18,7 +18,6 @@ namespace rx class FunctionsGL; class RendererGL; class StateManagerGL; -struct WorkaroundsGL; class PbufferSurfaceCGL : public SurfaceGL { diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h index abaa11490..acbedd1b5 100644 --- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h +++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h @@ -27,7 +27,6 @@ class FramebufferGL; class FunctionsGL; class RendererGL; class StateManagerGL; -struct WorkaroundsGL; struct SharedSwapState { diff --git a/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp b/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp index 9dc1c5deb..ff178d81e 100644 --- a/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp +++ b/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp @@ -690,14 +690,14 @@ WorkerContext *DisplayAndroid::createWorkerContext(std::string *infoLog, return new WorkerContextAndroid(context, mEGL, mDummyPbuffer); } -void DisplayAndroid::initializeFrontendFeatures(gl::FrontendFeatures *features) const +void DisplayAndroid::initializeFrontendFeatures(angle::FrontendFeatures *features) const { mRenderer->initializeFrontendFeatures(features); } void DisplayAndroid::populateFeatureList(angle::FeatureList *features) { - mRenderer->getWorkarounds().populateFeatureList(features); + mRenderer->getFeatures().populateFeatureList(features); } } // namespace rx diff --git a/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h b/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h index fca74ce71..7455a90d2 100644 --- a/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h +++ b/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h @@ -82,7 +82,7 @@ class DisplayAndroid : public DisplayEGL EGLContext sharedContext, const native_egl::AttributeVector workerAttribs) override; - void initializeFrontendFeatures(gl::FrontendFeatures *features) const override; + void initializeFrontendFeatures(angle::FrontendFeatures *features) const override; void populateFeatureList(angle::FeatureList *features) override; diff --git a/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp b/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp index a022bb679..a8dbf01b7 100644 --- a/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp +++ b/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp @@ -1073,14 +1073,14 @@ WorkerContext *DisplayOzone::createWorkerContext(std::string *infoLog, return new WorkerContextOzone(context, mEGL); } -void DisplayOzone::initializeFrontendFeatures(gl::FrontendFeatures *features) const +void DisplayOzone::initializeFrontendFeatures(angle::FrontendFeatures *features) const { mRenderer->initializeFrontendFeatures(features); } void DisplayOzone::populateFeatureList(angle::FeatureList *features) { - mRenderer->getWorkarounds().populateFeatureList(features); + mRenderer->getFeatures().populateFeatureList(features); } } // namespace rx diff --git a/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h b/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h index ac42cdc1c..1b254b20d 100644 --- a/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h +++ b/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h @@ -160,7 +160,7 @@ class DisplayOzone final : public DisplayEGL EGLContext sharedContext, const native_egl::AttributeVector workerAttribs) override; - void initializeFrontendFeatures(gl::FrontendFeatures *features) const override; + void initializeFrontendFeatures(angle::FrontendFeatures *features) const override; void populateFeatureList(angle::FeatureList *features) override; diff --git a/src/libANGLE/renderer/gl/formatutilsgl.cpp b/src/libANGLE/renderer/gl/formatutilsgl.cpp index 92c5b9608..fa267c772 100644 --- a/src/libANGLE/renderer/gl/formatutilsgl.cpp +++ b/src/libANGLE/renderer/gl/formatutilsgl.cpp @@ -13,6 +13,7 @@ #include "common/string_utils.h" #include "libANGLE/formatutils.h" +#include "platform/FeaturesGL.h" namespace rx { @@ -343,7 +344,7 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, StandardGL st } static GLenum GetNativeInternalFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, const gl::InternalFormat &internalFormat) { GLenum result = internalFormat.internalFormat; @@ -355,13 +356,13 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, // even if the provided type is GL_FLOAT. result = internalFormat.sizedInternalFormat; - if (workarounds.avoid1BitAlphaTextureFormats.enabled && internalFormat.alphaBits == 1) + if (features.avoid1BitAlphaTextureFormats.enabled && internalFormat.alphaBits == 1) { // Use an 8-bit format instead result = GL_RGBA8; } - if (workarounds.rgba4IsNotSupportedForColorRendering.enabled && + if (features.rgba4IsNotSupportedForColorRendering.enabled && internalFormat.sizedInternalFormat == GL_RGBA4) { // Use an 8-bit format instead @@ -413,7 +414,7 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, // Workaround Adreno driver not supporting unsized EXT_texture_rg formats result = internalFormat.sizedInternalFormat; } - else if (workarounds.unsizedsRGBReadPixelsDoesntTransform.enabled && + else if (features.unsizedsRGBReadPixelsDoesntTransform.enabled && internalFormat.colorEncoding == GL_SRGB) { // Work around some Adreno driver bugs that don't read back SRGB data correctly when @@ -426,7 +427,7 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, } static GLenum GetNativeFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format) { GLenum result = format; @@ -462,7 +463,7 @@ static GLenum GetNativeFormat(const FunctionsGL *functions, } else if (functions->isAtLeastGLES(gl::Version(3, 0))) { - if (workarounds.unsizedsRGBReadPixelsDoesntTransform.enabled) + if (features.unsizedsRGBReadPixelsDoesntTransform.enabled) { if (format == GL_SRGB) { @@ -480,7 +481,7 @@ static GLenum GetNativeFormat(const FunctionsGL *functions, } static GLenum GetNativeCompressedFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format) { GLenum result = format; @@ -509,7 +510,7 @@ static GLenum GetNativeCompressedFormat(const FunctionsGL *functions, } static GLenum GetNativeType(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format, GLenum type) { @@ -558,7 +559,7 @@ static GLenum GetNativeType(const FunctionsGL *functions, } static GLenum GetNativeReadType(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum type) { GLenum result = type; @@ -576,7 +577,7 @@ static GLenum GetNativeReadType(const FunctionsGL *functions, } static GLenum GetNativeReadFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format) { GLenum result = format; @@ -584,86 +585,86 @@ static GLenum GetNativeReadFormat(const FunctionsGL *functions, } TexImageFormat GetTexImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat, GLenum format, GLenum type) { TexImageFormat result; result.internalFormat = GetNativeInternalFormat( - functions, workarounds, gl::GetInternalFormatInfo(internalFormat, type)); - result.format = GetNativeFormat(functions, workarounds, format); - result.type = GetNativeType(functions, workarounds, format, type); + functions, features, gl::GetInternalFormatInfo(internalFormat, type)); + result.format = GetNativeFormat(functions, features, format); + result.type = GetNativeType(functions, features, format, type); return result; } TexSubImageFormat GetTexSubImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format, GLenum type) { TexSubImageFormat result; - result.format = GetNativeFormat(functions, workarounds, format); - result.type = GetNativeType(functions, workarounds, format, type); + result.format = GetNativeFormat(functions, features, format); + result.type = GetNativeType(functions, features, format, type); return result; } CompressedTexImageFormat GetCompressedTexImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat) { CompressedTexImageFormat result; - result.internalFormat = GetNativeCompressedFormat(functions, workarounds, internalFormat); + result.internalFormat = GetNativeCompressedFormat(functions, features, internalFormat); return result; } CompressedTexSubImageFormat GetCompressedSubTexImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format) { CompressedTexSubImageFormat result; - result.format = GetNativeCompressedFormat(functions, workarounds, format); + result.format = GetNativeCompressedFormat(functions, features, format); return result; } CopyTexImageImageFormat GetCopyTexImageImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat, GLenum framebufferType) { CopyTexImageImageFormat result; result.internalFormat = GetNativeInternalFormat( - functions, workarounds, gl::GetInternalFormatInfo(internalFormat, framebufferType)); + functions, features, gl::GetInternalFormatInfo(internalFormat, framebufferType)); return result; } TexStorageFormat GetTexStorageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat) { TexStorageFormat result; - result.internalFormat = GetNativeInternalFormat(functions, workarounds, + result.internalFormat = GetNativeInternalFormat(functions, features, gl::GetSizedInternalFormatInfo(internalFormat)); return result; } RenderbufferFormat GetRenderbufferFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat) { RenderbufferFormat result; - result.internalFormat = GetNativeInternalFormat(functions, workarounds, + result.internalFormat = GetNativeInternalFormat(functions, features, gl::GetSizedInternalFormatInfo(internalFormat)); return result; } ReadPixelsFormat GetReadPixelsFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format, GLenum type) { ReadPixelsFormat result; - result.format = GetNativeReadFormat(functions, workarounds, format); - result.type = GetNativeReadType(functions, workarounds, type); + result.format = GetNativeReadFormat(functions, features, format); + result.type = GetNativeReadType(functions, features, type); return result; } } // namespace nativegl diff --git a/src/libANGLE/renderer/gl/formatutilsgl.h b/src/libANGLE/renderer/gl/formatutilsgl.h index f18e96733..d06c12bc6 100644 --- a/src/libANGLE/renderer/gl/formatutilsgl.h +++ b/src/libANGLE/renderer/gl/formatutilsgl.h @@ -17,7 +17,11 @@ #include "angle_gl.h" #include "libANGLE/Version.h" #include "libANGLE/renderer/gl/FunctionsGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" + +namespace angle +{ +struct FeaturesGL; +} // namespace angle namespace rx { @@ -64,7 +68,7 @@ struct TexImageFormat GLenum type; }; TexImageFormat GetTexImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat, GLenum format, GLenum type); @@ -75,7 +79,7 @@ struct TexSubImageFormat GLenum type; }; TexSubImageFormat GetTexSubImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format, GLenum type); @@ -84,7 +88,7 @@ struct CompressedTexImageFormat GLenum internalFormat; }; CompressedTexImageFormat GetCompressedTexImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat); struct CompressedTexSubImageFormat @@ -92,7 +96,7 @@ struct CompressedTexSubImageFormat GLenum format; }; CompressedTexSubImageFormat GetCompressedSubTexImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format); struct CopyTexImageImageFormat @@ -100,7 +104,7 @@ struct CopyTexImageImageFormat GLenum internalFormat; }; CopyTexImageImageFormat GetCopyTexImageImageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat, GLenum framebufferType); @@ -109,7 +113,7 @@ struct TexStorageFormat GLenum internalFormat; }; TexStorageFormat GetTexStorageFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat); struct RenderbufferFormat @@ -117,7 +121,7 @@ struct RenderbufferFormat GLenum internalFormat; }; RenderbufferFormat GetRenderbufferFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat); struct ReadPixelsFormat @@ -126,7 +130,7 @@ struct ReadPixelsFormat GLenum type; }; ReadPixelsFormat GetReadPixelsFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum format, GLenum type); } // namespace nativegl diff --git a/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp b/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp index ac1374ac4..00a5ac470 100644 --- a/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp +++ b/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp @@ -991,14 +991,14 @@ WorkerContext *DisplayGLX::createWorkerContext(std::string *infoLog) return new WorkerContextGLX(context, &mGLX, workerPbuffer); } -void DisplayGLX::initializeFrontendFeatures(gl::FrontendFeatures *features) const +void DisplayGLX::initializeFrontendFeatures(angle::FrontendFeatures *features) const { mRenderer->initializeFrontendFeatures(features); } void DisplayGLX::populateFeatureList(angle::FeatureList *features) { - mRenderer->getWorkarounds().populateFeatureList(features); + mRenderer->getFeatures().populateFeatureList(features); } } // namespace rx diff --git a/src/libANGLE/renderer/gl/glx/DisplayGLX.h b/src/libANGLE/renderer/gl/glx/DisplayGLX.h index e439f255a..ad8059d5c 100644 --- a/src/libANGLE/renderer/gl/glx/DisplayGLX.h +++ b/src/libANGLE/renderer/gl/glx/DisplayGLX.h @@ -100,7 +100,7 @@ class DisplayGLX : public DisplayGL WorkerContext *createWorkerContext(std::string *infoLog); - void initializeFrontendFeatures(gl::FrontendFeatures *features) const override; + void initializeFrontendFeatures(angle::FrontendFeatures *features) const override; void populateFeatureList(angle::FeatureList *features) override; diff --git a/src/libANGLE/renderer/gl/renderergl_utils.cpp b/src/libANGLE/renderer/gl/renderergl_utils.cpp index ad408a186..5710ff06d 100644 --- a/src/libANGLE/renderer/gl/renderergl_utils.cpp +++ b/src/libANGLE/renderer/gl/renderergl_utils.cpp @@ -16,15 +16,15 @@ #include "libANGLE/Buffer.h" #include "libANGLE/Caps.h" #include "libANGLE/Context.h" -#include "libANGLE/FrontendFeatures.h" #include "libANGLE/formatutils.h" #include "libANGLE/queryconversions.h" #include "libANGLE/renderer/gl/ContextGL.h" #include "libANGLE/renderer/gl/FenceNVGL.h" #include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/QueryGL.h" -#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/formatutilsgl.h" +#include "platform/FeaturesGL.h" +#include "platform/FrontendFeatures.h" #include #include @@ -132,7 +132,7 @@ static bool MeetsRequirements(const FunctionsGL *functions, } static bool CheckSizedInternalFormatTextureRenderability(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat) { const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat); @@ -151,7 +151,7 @@ static bool CheckSizedInternalFormatTextureRenderability(const FunctionsGL *func functions->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); nativegl::TexImageFormat texImageFormat = nativegl::GetTexImageFormat( - functions, workarounds, formatInfo.internalFormat, formatInfo.format, formatInfo.type); + functions, features, formatInfo.internalFormat, formatInfo.format, formatInfo.type); constexpr GLsizei kTextureSize = 16; functions->texImage2D(GL_TEXTURE_2D, 0, texImageFormat.internalFormat, kTextureSize, kTextureSize, 0, texImageFormat.format, texImageFormat.type, nullptr); @@ -181,7 +181,7 @@ static bool CheckSizedInternalFormatTextureRenderability(const FunctionsGL *func } static bool CheckInternalFormatRenderbufferRenderability(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat) { const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat); @@ -197,7 +197,7 @@ static bool CheckInternalFormatRenderbufferRenderability(const FunctionsGL *func functions->bindRenderbuffer(GL_RENDERBUFFER, renderbuffer); nativegl::RenderbufferFormat renderbufferFormat = - nativegl::GetRenderbufferFormat(functions, workarounds, formatInfo.internalFormat); + nativegl::GetRenderbufferFormat(functions, features, formatInfo.internalFormat); constexpr GLsizei kRenderbufferSize = 16; functions->renderbufferStorage(GL_RENDERBUFFER, renderbufferFormat.internalFormat, kRenderbufferSize, kRenderbufferSize); @@ -227,7 +227,7 @@ static bool CheckInternalFormatRenderbufferRenderability(const FunctionsGL *func } static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, GLenum internalFormat) { ASSERT(functions->getError() == GL_NO_ERROR); @@ -249,13 +249,13 @@ static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, { if (textureCaps.textureAttachment) { - textureCaps.textureAttachment = CheckSizedInternalFormatTextureRenderability( - functions, workarounds, internalFormat); + textureCaps.textureAttachment = + CheckSizedInternalFormatTextureRenderability(functions, features, internalFormat); } if (textureCaps.renderbuffer) { - textureCaps.renderbuffer = CheckInternalFormatRenderbufferRenderability( - functions, workarounds, internalFormat); + textureCaps.renderbuffer = + CheckInternalFormatRenderbufferRenderability(functions, features, internalFormat); } } @@ -416,7 +416,7 @@ void CapCombinedLimitToESShaders(GLuint *combinedLimit, gl::ShaderMap &p } void GenerateCaps(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, @@ -428,7 +428,7 @@ void GenerateCaps(const FunctionsGL *functions, for (GLenum internalFormat : allFormats) { gl::TextureCaps textureCaps = - GenerateTextureFormatCaps(functions, workarounds, internalFormat); + GenerateTextureFormatCaps(functions, features, internalFormat); textureCapsMap->insert(internalFormat, textureCaps); if (gl::GetSizedInternalFormatInfo(internalFormat).compressed) @@ -893,7 +893,7 @@ void GenerateCaps(const FunctionsGL *functions, // OpenGL 4.3 has no limit on maximum value of stride. // [OpenGL 4.3 (Core Profile) - February 14, 2013] Chapter 10.3.1 Page 298 - if (workarounds.emulateMaxVertexAttribStride.enabled || + if (features.emulateMaxVertexAttribStride.enabled || (functions->standard == STANDARD_GL_DESKTOP && functions->version == gl::Version(4, 3))) { caps->maxVertexAttribStride = 2048; @@ -1166,7 +1166,7 @@ void GenerateCaps(const FunctionsGL *functions, extensions->disjointTimerQuery = true; // If we can't query the counter bits, leave them at 0. - if (!workarounds.queryCounterBitsGeneratesErrors.enabled) + if (!features.queryCounterBitsGeneratesErrors.enabled) { extensions->queryCounterBitsTimeElapsed = QueryQueryValue(functions, GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS); @@ -1352,7 +1352,7 @@ void GenerateCaps(const FunctionsGL *functions, // EXT_blend_func_extended. // Note that this could be implemented also on top of native EXT_blend_func_extended, but it's // currently not fully implemented. - extensions->blendFuncExtended = !workarounds.disableBlendFuncExtended.enabled && + extensions->blendFuncExtended = !features.disableBlendFuncExtended.enabled && functions->standard == STANDARD_GL_DESKTOP && functions->hasGLExtension("GL_ARB_blend_func_extended"); if (extensions->blendFuncExtended) @@ -1376,7 +1376,7 @@ void GenerateCaps(const FunctionsGL *functions, // To work around broken unsized sRGB textures, sized sRGB textures are used. Disable EXT_sRGB // if those formats are not available. - if (workarounds.unsizedsRGBReadPixelsDoesntTransform.enabled && + if (features.unsizedsRGBReadPixelsDoesntTransform.enabled && !functions->isAtLeastGLES(gl::Version(3, 0))) { extensions->sRGB = false; @@ -1387,97 +1387,97 @@ void GenerateCaps(const FunctionsGL *functions, functions->isAtLeastGL(gl::Version(3, 2)); } -void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds) +void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features) { VendorID vendor = GetVendorID(functions); uint32_t device = GetDeviceID(functions); // Don't use 1-bit alpha formats on desktop GL with AMD or Intel drivers. - workarounds->avoid1BitAlphaTextureFormats.enabled = + features->avoid1BitAlphaTextureFormats.enabled = functions->standard == STANDARD_GL_DESKTOP && (IsAMD(vendor)); - workarounds->rgba4IsNotSupportedForColorRendering.enabled = + features->rgba4IsNotSupportedForColorRendering.enabled = functions->standard == STANDARD_GL_DESKTOP && IsIntel(vendor); - workarounds->emulateAbsIntFunction.enabled = IsIntel(vendor); + features->emulateAbsIntFunction.enabled = IsIntel(vendor); - workarounds->addAndTrueToLoopCondition.enabled = IsIntel(vendor); + features->addAndTrueToLoopCondition.enabled = IsIntel(vendor); - workarounds->emulateIsnanFloat.enabled = IsIntel(vendor); + features->emulateIsnanFloat.enabled = IsIntel(vendor); - workarounds->doesSRGBClearsOnLinearFramebufferAttachments.enabled = + features->doesSRGBClearsOnLinearFramebufferAttachments.enabled = functions->standard == STANDARD_GL_DESKTOP && (IsIntel(vendor) || IsAMD(vendor)); - workarounds->emulateMaxVertexAttribStride.enabled = + features->emulateMaxVertexAttribStride.enabled = IsLinux() && functions->standard == STANDARD_GL_DESKTOP && IsAMD(vendor); - workarounds->useUnusedBlocksWithStandardOrSharedLayout.enabled = IsLinux() && IsAMD(vendor); + features->useUnusedBlocksWithStandardOrSharedLayout.enabled = IsLinux() && IsAMD(vendor); - workarounds->doWhileGLSLCausesGPUHang.enabled = IsApple(); - workarounds->useUnusedBlocksWithStandardOrSharedLayout.enabled = IsApple(); - workarounds->rewriteFloatUnaryMinusOperator.enabled = IsApple() && IsIntel(vendor); + features->doWhileGLSLCausesGPUHang.enabled = IsApple(); + features->useUnusedBlocksWithStandardOrSharedLayout.enabled = IsApple(); + features->rewriteFloatUnaryMinusOperator.enabled = IsApple() && IsIntel(vendor); // Triggers a bug on Marshmallow Adreno (4xx?) driver. // http://anglebug.com/2046 - workarounds->dontInitializeUninitializedLocals.enabled = IsAndroid() && IsQualcomm(vendor); + features->dontInitializeUninitializedLocals.enabled = IsAndroid() && IsQualcomm(vendor); - workarounds->finishDoesNotCauseQueriesToBeAvailable.enabled = + features->finishDoesNotCauseQueriesToBeAvailable.enabled = functions->standard == STANDARD_GL_DESKTOP && IsNvidia(vendor); // TODO(cwallez): Disable this workaround for MacOSX versions 10.9 or later. - workarounds->alwaysCallUseProgramAfterLink.enabled = true; + features->alwaysCallUseProgramAfterLink.enabled = true; - workarounds->unpackOverlappingRowsSeparatelyUnpackBuffer.enabled = IsNvidia(vendor); - workarounds->packOverlappingRowsSeparatelyPackBuffer.enabled = IsNvidia(vendor); + features->unpackOverlappingRowsSeparatelyUnpackBuffer.enabled = IsNvidia(vendor); + features->packOverlappingRowsSeparatelyPackBuffer.enabled = IsNvidia(vendor); - workarounds->initializeCurrentVertexAttributes.enabled = IsNvidia(vendor); + features->initializeCurrentVertexAttributes.enabled = IsNvidia(vendor); - workarounds->unpackLastRowSeparatelyForPaddingInclusion.enabled = IsApple() || IsNvidia(vendor); - workarounds->packLastRowSeparatelyForPaddingInclusion.enabled = IsApple() || IsNvidia(vendor); + features->unpackLastRowSeparatelyForPaddingInclusion.enabled = IsApple() || IsNvidia(vendor); + features->packLastRowSeparatelyForPaddingInclusion.enabled = IsApple() || IsNvidia(vendor); - workarounds->removeInvariantAndCentroidForESSL3.enabled = + features->removeInvariantAndCentroidForESSL3.enabled = functions->isAtMostGL(gl::Version(4, 1)) || (functions->standard == STANDARD_GL_DESKTOP && IsAMD(vendor)); // TODO(oetuaho): Make this specific to the affected driver versions. Versions that came after // 364 are known to be affected, at least up to 375. - workarounds->emulateAtan2Float.enabled = IsNvidia(vendor); + features->emulateAtan2Float.enabled = IsNvidia(vendor); - workarounds->reapplyUBOBindingsAfterUsingBinaryProgram.enabled = IsAMD(vendor); + features->reapplyUBOBindingsAfterUsingBinaryProgram.enabled = IsAMD(vendor); - workarounds->rewriteVectorScalarArithmetic.enabled = IsNvidia(vendor); + features->rewriteVectorScalarArithmetic.enabled = IsNvidia(vendor); // TODO(oetuaho): Make this specific to the affected driver versions. Versions at least up to // 390 are known to be affected. Versions after that are expected not to be affected. - workarounds->clampFragDepth.enabled = IsNvidia(vendor); + features->clampFragDepth.enabled = IsNvidia(vendor); // TODO(oetuaho): Make this specific to the affected driver versions. Versions since 397.31 are // not affected. - workarounds->rewriteRepeatedAssignToSwizzled.enabled = IsNvidia(vendor); + features->rewriteRepeatedAssignToSwizzled.enabled = IsNvidia(vendor); // TODO(jmadill): Narrow workaround range for specific devices. - workarounds->reapplyUBOBindingsAfterUsingBinaryProgram.enabled = IsAndroid(); + features->reapplyUBOBindingsAfterUsingBinaryProgram.enabled = IsAndroid(); - workarounds->clampPointSize.enabled = IsAndroid() || IsNvidia(vendor); + features->clampPointSize.enabled = IsAndroid() || IsNvidia(vendor); - workarounds->dontUseLoopsToInitializeVariables.enabled = IsAndroid() && !IsNvidia(vendor); + features->dontUseLoopsToInitializeVariables.enabled = IsAndroid() && !IsNvidia(vendor); - workarounds->disableBlendFuncExtended.enabled = IsAMD(vendor) || IsIntel(vendor); + features->disableBlendFuncExtended.enabled = IsAMD(vendor) || IsIntel(vendor); - workarounds->unsizedsRGBReadPixelsDoesntTransform.enabled = IsAndroid() && IsQualcomm(vendor); + features->unsizedsRGBReadPixelsDoesntTransform.enabled = IsAndroid() && IsQualcomm(vendor); - workarounds->queryCounterBitsGeneratesErrors.enabled = IsNexus5X(vendor, device); + features->queryCounterBitsGeneratesErrors.enabled = IsNexus5X(vendor, device); - workarounds->dontRelinkProgramsInParallel.enabled = + features->dontRelinkProgramsInParallel.enabled = IsAndroid() || (IsWindows() && IsIntel(vendor)); // TODO(jie.a.chen@intel.com): Clean up the bugs. // anglebug.com/3031 // crbug.com/922936 - workarounds->disableWorkerContexts.enabled = + features->disableWorkerContexts.enabled = (IsWindows() && (IsIntel(vendor) || IsAMD(vendor))) || (IsLinux() && IsNvidia(vendor)); } -void InitializeFrontendFeatures(const FunctionsGL *functions, gl::FrontendFeatures *features) +void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features) { VendorID vendor = GetVendorID(functions); @@ -1567,9 +1567,9 @@ ClearMultiviewGL *GetMultiviewClearer(const gl::Context *context) return GetImplAs(context)->getMultiviewClearer(); } -const WorkaroundsGL &GetWorkaroundsGL(const gl::Context *context) +const angle::FeaturesGL &GetFeaturesGL(const gl::Context *context) { - return GetImplAs(context)->getWorkaroundsGL(); + return GetImplAs(context)->getFeaturesGL(); } bool CanMapBufferForRead(const FunctionsGL *functions) diff --git a/src/libANGLE/renderer/gl/renderergl_utils.h b/src/libANGLE/renderer/gl/renderergl_utils.h index 048f6576f..f31f42097 100644 --- a/src/libANGLE/renderer/gl/renderergl_utils.h +++ b/src/libANGLE/renderer/gl/renderergl_utils.h @@ -19,13 +19,18 @@ #include #include +namespace angle +{ +struct FeaturesGL; +struct FrontendFeatures; +} // namespace angle + namespace gl { struct Caps; class TextureCapsMap; struct Extensions; struct Version; -struct FrontendFeatures; } // namespace gl namespace rx @@ -35,7 +40,6 @@ class ClearMultiviewGL; class ContextGL; class FunctionsGL; class StateManagerGL; -struct WorkaroundsGL; enum class MultiviewImplementationTypeGL { NV_VIEWPORT_ARRAY2, @@ -49,21 +53,21 @@ const FunctionsGL *GetFunctionsGL(const gl::Context *context); StateManagerGL *GetStateManagerGL(const gl::Context *context); BlitGL *GetBlitGL(const gl::Context *context); ClearMultiviewGL *GetMultiviewClearer(const gl::Context *context); -const WorkaroundsGL &GetWorkaroundsGL(const gl::Context *context); +const angle::FeaturesGL &GetFeaturesGL(const gl::Context *context); namespace nativegl_gl { void GenerateCaps(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, + const angle::FeaturesGL &features, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, gl::Version *maxSupportedESVersion, MultiviewImplementationTypeGL *multiviewImplementationType); -void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds); -void InitializeFrontendFeatures(const FunctionsGL *functions, gl::FrontendFeatures *features); +void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features); +void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features); } // namespace nativegl_gl namespace nativegl diff --git a/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h b/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h index 6c38817f8..6e9870060 100644 --- a/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h +++ b/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h @@ -20,7 +20,6 @@ class FunctionsGL; class FunctionsWGL; class DisplayWGL; class StateManagerGL; -struct WorkaroundsGL; class D3DTextureSurfaceWGL : public SurfaceWGL { diff --git a/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h b/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h index ff7f152d0..9bb684059 100644 --- a/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h +++ b/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h @@ -21,7 +21,6 @@ class FunctionsGL; class FunctionsWGL; class DisplayWGL; class StateManagerGL; -struct WorkaroundsGL; class DXGISwapChainWindowSurfaceWGL : public SurfaceWGL { diff --git a/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp b/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp index dfdfcb108..d8000e3ec 100644 --- a/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp +++ b/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp @@ -1058,14 +1058,14 @@ WorkerContext *DisplayWGL::createWorkerContext(std::string *infoLog, return new WorkerContextWGL(mFunctionsWGL, workerPbuffer, workerDeviceContext, workerContext); } -void DisplayWGL::initializeFrontendFeatures(gl::FrontendFeatures *features) const +void DisplayWGL::initializeFrontendFeatures(angle::FrontendFeatures *features) const { mRenderer->initializeFrontendFeatures(features); } void DisplayWGL::populateFeatureList(angle::FeatureList *features) { - mRenderer->getWorkarounds().populateFeatureList(features); + mRenderer->getFeatures().populateFeatureList(features); } } // namespace rx diff --git a/src/libANGLE/renderer/gl/wgl/DisplayWGL.h b/src/libANGLE/renderer/gl/wgl/DisplayWGL.h index f4f28ca2f..2322df0de 100644 --- a/src/libANGLE/renderer/gl/wgl/DisplayWGL.h +++ b/src/libANGLE/renderer/gl/wgl/DisplayWGL.h @@ -85,7 +85,7 @@ class DisplayWGL : public DisplayGL HGLRC sharedContext, const std::vector &workerContextAttribs); - void initializeFrontendFeatures(gl::FrontendFeatures *features) const override; + void initializeFrontendFeatures(angle::FrontendFeatures *features) const override; void populateFeatureList(angle::FeatureList *features) override; diff --git a/src/libGLESv2.gni b/src/libGLESv2.gni index 978b53909..9834b1b4f 100644 --- a/src/libGLESv2.gni +++ b/src/libGLESv2.gni @@ -153,9 +153,11 @@ libangle_includes = [ "include/KHR/khrplatform.h", "include/WGL/wgl.h", "include/platform/Feature.h", + "include/platform/FeaturesD3D.h", + "include/platform/FeaturesGL.h", "include/platform/FeaturesVk.h", + "include/platform/FrontendFeatures.h", "include/platform/Platform.h", - "include/platform/WorkaroundsD3D.h", ] libangle_sources = [ @@ -202,7 +204,6 @@ libangle_sources = [ "src/libANGLE/Framebuffer.h", "src/libANGLE/FramebufferAttachment.cpp", "src/libANGLE/FramebufferAttachment.h", - "src/libANGLE/FrontendFeatures.h", "src/libANGLE/GLES1Renderer.cpp", "src/libANGLE/GLES1Renderer.h", "src/libANGLE/GLES1Shaders.inc", @@ -658,7 +659,6 @@ libangle_gl_sources = [ "src/libANGLE/renderer/gl/TransformFeedbackGL.h", "src/libANGLE/renderer/gl/VertexArrayGL.cpp", "src/libANGLE/renderer/gl/VertexArrayGL.h", - "src/libANGLE/renderer/gl/WorkaroundsGL.h", "src/libANGLE/renderer/gl/formatutilsgl.cpp", "src/libANGLE/renderer/gl/formatutilsgl.h", "src/libANGLE/renderer/gl/functionsgl_enums.h", diff --git a/src/tests/gl_tests/DepthStencilFormatsTest.cpp b/src/tests/gl_tests/DepthStencilFormatsTest.cpp index f3a670562..01f84d7c5 100644 --- a/src/tests/gl_tests/DepthStencilFormatsTest.cpp +++ b/src/tests/gl_tests/DepthStencilFormatsTest.cpp @@ -8,7 +8,7 @@ #include "test_utils/gl_raii.h" #include "common/mathutil.h" -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" using namespace angle; @@ -581,10 +581,10 @@ class TinyDepthStencilWorkaroundTest : public ANGLETest setConfigAlphaBits(8); } - // Override the workarounds to enable "tiny" depth/stencil textures. - void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) override + // Override the features to enable "tiny" depth/stencil textures. + void overrideFeaturesD3D(FeaturesD3D *features) override { - workarounds->overrideFeatures({"emulate_tiny_stencil_textures"}, true); + features->overrideFeatures({"emulate_tiny_stencil_textures"}, true); } }; diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp index 6dc3f4dd7..8ada88055 100644 --- a/src/tests/gl_tests/FramebufferTest.cpp +++ b/src/tests/gl_tests/FramebufferTest.cpp @@ -7,7 +7,7 @@ // Various tests related for Frambuffers. // -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" #include "test_utils/ANGLETest.h" #include "test_utils/gl_raii.h" @@ -924,9 +924,9 @@ class AddDummyTextureNoRenderTargetTest : public ANGLETest setConfigAlphaBits(8); } - void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) override + void overrideFeaturesD3D(FeaturesD3D *features) override { - workarounds->overrideFeatures({"add_dummy_texture_no_render_target"}, true); + features->overrideFeatures({"add_dummy_texture_no_render_target"}, true); } }; diff --git a/src/tests/gl_tests/MultiviewDrawTest.cpp b/src/tests/gl_tests/MultiviewDrawTest.cpp index 6c605aa16..c957bb2b5 100644 --- a/src/tests/gl_tests/MultiviewDrawTest.cpp +++ b/src/tests/gl_tests/MultiviewDrawTest.cpp @@ -7,7 +7,7 @@ // Test issuing multiview Draw* commands. // -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" #include "test_utils/MultiviewTest.h" #include "test_utils/gl_raii.h" @@ -285,10 +285,10 @@ class MultiviewRenderTest : public MultiviewFramebufferTestBase protected: MultiviewRenderTest() : MultiviewFramebufferTestBase(GetParam(), GetParam().mSamples) {} - void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) override + void overrideFeaturesD3D(FeaturesD3D *features) override { - workarounds->overrideFeatures({"select_view_in_geometry_shader"}, - GetParam().mForceUseGeometryShaderOnD3D); + features->overrideFeatures({"select_view_in_geometry_shader"}, + GetParam().mForceUseGeometryShaderOnD3D); } virtual void testSetUp() {} @@ -527,10 +527,10 @@ class MultiviewLayeredRenderTest : public MultiviewFramebufferTestBase MultiviewLayeredRenderTest() : MultiviewFramebufferTestBase(GetParam(), 0) {} void SetUp() final { MultiviewFramebufferTestBase::FramebufferTestSetUp(); } void TearDown() final { MultiviewFramebufferTestBase::FramebufferTestTearDown(); } - void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) final + void overrideFeaturesD3D(FeaturesD3D *features) final { - workarounds->overrideFeatures({"select_view_in_geometry_shader"}, - GetParam().mForceUseGeometryShaderOnD3D); + features->overrideFeatures({"select_view_in_geometry_shader"}, + GetParam().mForceUseGeometryShaderOnD3D); } }; diff --git a/src/tests/perf_tests/ANGLEPerfTest.cpp b/src/tests/perf_tests/ANGLEPerfTest.cpp index ff2a41200..675669400 100644 --- a/src/tests/perf_tests/ANGLEPerfTest.cpp +++ b/src/tests/perf_tests/ANGLEPerfTest.cpp @@ -51,10 +51,10 @@ constexpr TraceCategory gTraceCategories[2] = { void EmptyPlatformMethod(angle::PlatformMethods *, const char *) {} -void OverrideWorkaroundsD3D(angle::PlatformMethods *platform, angle::WorkaroundsD3D *workaroundsD3D) +void OverrideFeaturesD3D(angle::PlatformMethods *platform, angle::FeaturesD3D *featuresD3D) { auto *angleRenderTest = static_cast(platform->context); - angleRenderTest->overrideWorkaroundsD3D(workaroundsD3D); + angleRenderTest->overrideFeaturesD3D(featuresD3D); } angle::TraceEventHandle AddTraceEvent(angle::PlatformMethods *platform, @@ -416,7 +416,7 @@ void ANGLERenderTest::SetUp() return; } - mPlatformMethods.overrideWorkaroundsD3D = OverrideWorkaroundsD3D; + mPlatformMethods.overrideFeaturesD3D = OverrideFeaturesD3D; mPlatformMethods.logError = EmptyPlatformMethod; mPlatformMethods.logWarning = EmptyPlatformMethod; mPlatformMethods.logInfo = EmptyPlatformMethod; diff --git a/src/tests/perf_tests/ANGLEPerfTest.h b/src/tests/perf_tests/ANGLEPerfTest.h index 501d76e46..743009d43 100644 --- a/src/tests/perf_tests/ANGLEPerfTest.h +++ b/src/tests/perf_tests/ANGLEPerfTest.h @@ -136,7 +136,7 @@ class ANGLERenderTest : public ANGLEPerfTest std::vector &getTraceEventBuffer(); - virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {} + virtual void overrideFeaturesD3D(angle::FeaturesD3D *featuresD3D) {} protected: const RenderTestParams &mTestParams; diff --git a/src/tests/perf_tests/MultiviewPerf.cpp b/src/tests/perf_tests/MultiviewPerf.cpp index ad0c2059b..526790b4b 100644 --- a/src/tests/perf_tests/MultiviewPerf.cpp +++ b/src/tests/perf_tests/MultiviewPerf.cpp @@ -12,7 +12,7 @@ #include "ANGLEPerfTest.h" #include "common/vector_utils.h" -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" #include "test_utils/MultiviewTest.h" #include "test_utils/gl_raii.h" #include "util/shader_utils.h" @@ -169,9 +169,9 @@ class MultiviewBenchmark : public ANGLERenderTest, void initializeBenchmark() override; void drawBenchmark() final; - void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) override + void overrideFeaturesD3D(FeaturesD3D *features) override { - workarounds->overrideFeatures( + features->overrideFeatures( {"select_view_in_geometry_shader"}, GetParam().multiviewOption == MultiviewOption::InstancedMultiviewGeometryShader); } diff --git a/src/tests/test_utils/ANGLETest.cpp b/src/tests/test_utils/ANGLETest.cpp index e693879a0..1cad36fd8 100644 --- a/src/tests/test_utils/ANGLETest.cpp +++ b/src/tests/test_utils/ANGLETest.cpp @@ -87,21 +87,21 @@ void TestPlatform_logInfo(PlatformMethods *platform, const char *infoMessage) WriteDebugMessage("%s\n", infoMessage); } -void TestPlatform_overrideWorkaroundsD3D(PlatformMethods *platform, WorkaroundsD3D *workaroundsD3D) +void TestPlatform_overrideFeaturesD3D(PlatformMethods *platform, FeaturesD3D *featuresD3D) { auto *testPlatformContext = static_cast(platform->context); if (testPlatformContext->currentTest) { - testPlatformContext->currentTest->overrideWorkaroundsD3D(workaroundsD3D); + testPlatformContext->currentTest->overrideFeaturesD3D(featuresD3D); } } -void TestPlatform_overrideFeaturesVk(PlatformMethods *platform, FeaturesVk *workaroundsVulkan) +void TestPlatform_overrideFeaturesVk(PlatformMethods *platform, FeaturesVk *featuresVulkan) { auto *testPlatformContext = static_cast(platform->context); if (testPlatformContext->currentTest) { - testPlatformContext->currentTest->overrideFeaturesVk(workaroundsVulkan); + testPlatformContext->currentTest->overrideFeaturesVk(featuresVulkan); } } @@ -497,7 +497,7 @@ void ANGLETestBase::ANGLETestSetUp() InitCrashHandler(); - gDefaultPlatformMethods.overrideWorkaroundsD3D = TestPlatform_overrideWorkaroundsD3D; + gDefaultPlatformMethods.overrideFeaturesD3D = TestPlatform_overrideFeaturesD3D; gDefaultPlatformMethods.overrideFeaturesVk = TestPlatform_overrideFeaturesVk; gDefaultPlatformMethods.logError = TestPlatform_logError; gDefaultPlatformMethods.logWarning = TestPlatform_logWarning; diff --git a/src/tests/test_utils/ANGLETest.h b/src/tests/test_utils/ANGLETest.h index 0859ab0f7..90e488a7f 100644 --- a/src/tests/test_utils/ANGLETest.h +++ b/src/tests/test_utils/ANGLETest.h @@ -287,8 +287,8 @@ class ANGLETestBase public: void setWindowVisible(bool isVisible); - virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {} - virtual void overrideFeaturesVk(angle::FeaturesVk *workaroundsVulkan) {} + virtual void overrideFeaturesD3D(angle::FeaturesD3D *featuresD3D) {} + virtual void overrideFeaturesVk(angle::FeaturesVk *featuresVulkan) {} protected: void ANGLETestSetUp(); diff --git a/src/tests/test_utils/MultiviewTest.cpp b/src/tests/test_utils/MultiviewTest.cpp index 060b307c3..614d856ba 100644 --- a/src/tests/test_utils/MultiviewTest.cpp +++ b/src/tests/test_utils/MultiviewTest.cpp @@ -8,7 +8,7 @@ // #include "test_utils/MultiviewTest.h" -#include "platform/WorkaroundsD3D.h" +#include "platform/FeaturesD3D.h" #include "test_utils/gl_raii.h" namespace angle @@ -263,10 +263,10 @@ MultiviewImplementationParams GeomShaderD3D11(GLint majorVersion, multiviewExtension); } -void MultiviewTest::overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) +void MultiviewTest::overrideFeaturesD3D(FeaturesD3D *features) { - workarounds->overrideFeatures({"select_view_in_geometry_shader"}, - GetParam().mForceUseGeometryShaderOnD3D); + features->overrideFeatures({"select_view_in_geometry_shader"}, + GetParam().mForceUseGeometryShaderOnD3D); } } // namespace angle diff --git a/src/tests/test_utils/MultiviewTest.h b/src/tests/test_utils/MultiviewTest.h index 13cf72769..863079e95 100644 --- a/src/tests/test_utils/MultiviewTest.h +++ b/src/tests/test_utils/MultiviewTest.h @@ -117,7 +117,7 @@ class MultiviewTest : public MultiviewTestBase, protected: MultiviewTest() : MultiviewTestBase(GetParam()) {} - void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) final; + void overrideFeaturesD3D(FeaturesD3D *features) final; virtual void testSetUp() {} virtual void testTearDown() {}