diff options
author | android-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com> | 2022-04-20 21:55:20 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-04-20 21:55:20 +0000 |
commit | eb59faf3a7cc28f6c05b260618e4b7eb755c6800 (patch) | |
tree | f9d43e658bf5d11374c92dfa148ba65ae2563f5f | |
parent | c051a5b411f25c1a0c42e7f6de31165729c8fa04 (diff) | |
parent | 0bed77c9cd03e237254bab3c421c999d5ed5cc7c (diff) | |
download | angle-eb59faf3a7cc28f6c05b260618e4b7eb755c6800.tar.gz |
Roll ANGLE from f4fc8e1688f5 to 3f800e5c8d68 (12 revisions) am: 5b1f32fab8 am: 0bed77c9cd
Original change: https://android-review.googlesource.com/c/platform/external/angle/+/2069907
Change-Id: Ia35803d736ced655fe97358cc8919e19452e9ad7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
98 files changed, 2234 insertions, 1151 deletions
@@ -153,6 +153,15 @@ config("internal_config") { if (!angle_use_x11) { defines += [ "EGL_NO_X11" ] } + + # These two are needed here to correctly select OSWindow::New + if (angle_use_x11) { + defines += [ "ANGLE_USE_X11" ] + } + if (angle_use_wayland) { + defines += [ "ANGLE_USE_WAYLAND" ] + } + if (angle_vulkan_display_mode == "simple") { defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ] } else if (angle_vulkan_display_mode == "headless") { @@ -513,6 +522,10 @@ angle_static_library("angle_gpu_info_util") { "Xext", ] } + + if (angle_use_wayland && angle_has_build) { + public_deps += [ ":angle_wayland" ] + } } if (use_libpci) { @@ -824,6 +837,10 @@ config("libANGLE_config") { defines += [ "ANGLE_USE_X11" ] } + if (angle_use_wayland) { + defines += [ "ANGLE_USE_WAYLAND" ] + } + if (angle_enable_overlay) { defines += [ "ANGLE_ENABLE_OVERLAY=1" ] } @@ -1018,6 +1035,38 @@ angle_source_set("angle_gl_enum_utils") { ] } +if (angle_use_wayland) { + config("angle_wayland_config") { + if (!defined(use_system_libwayland) || use_system_libwayland) { + libs = [ + "wayland-client", + "wayland-egl", + ] + } + + include_dirs = [ + "$angle_wayland_dir/egl", + "$angle_wayland_dir/src", + + # In case we are building with chromium, we need to take into account the case + # where wayland-egl-backend.h is not installed in the system include directories + "//third_party/wayland/src/egl", + ] + } + + group("angle_wayland") { + public_configs = [ ":angle_wayland_config" ] + + if (defined(use_system_libwayland) && !use_system_libwayland) { + # Use chromium third-party targets + public_deps = [ + "//third_party/wayland:wayland_client", + "//third_party/wayland:wayland_egl", + ] + } + } +} + if (!defined(angle_abseil_cpp_dir)) { angle_abseil_cpp_dir = "//third_party/abseil-cpp" } @@ -34,7 +34,7 @@ vars = { 'checkout_android_native_support': 'checkout_android or checkout_chromeos', # Version of Chromium our Chromium-based DEPS are mirrored from. - 'chromium_revision': 'e1b5a693bbfe7aa10c629797365770749dd90dcd', + 'chromium_revision': 'a434f1de24838943fad8968bb0034fa863ac3617', # We never want to checkout chromium, # but need a dummy DEPS entry for the autoroller 'dummy_checkout_chromium': False, @@ -79,7 +79,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '28b8ede735b79253b8689d5e270f4783e8413649', + 'catapult_revision': 'e356f14bf028802d749d7ca504a26461f087b87f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling luci-go @@ -119,7 +119,7 @@ vars = { deps = { 'build': { - 'url': '{chromium_git}/chromium/src/build.git@7aeed11a9ec1ee0818210ea49573d0008a9df2bb', + 'url': '{chromium_git}/chromium/src/build.git@a64c9ec653eef7e25ca77a97663ec59fd04f6293', 'condition': 'not build_with_chromium', }, @@ -182,7 +182,7 @@ deps = { }, 'testing': { - 'url': '{chromium_git}/chromium/src/testing@e895c544f6a584dbb48f85f43bd4e117c550b3e4', + 'url': '{chromium_git}/chromium/src/testing@4ba61a876b689e3cf0a5bf711a11e1202e823d2e', 'condition': 'not build_with_chromium', }, @@ -332,7 +332,7 @@ deps = { }, 'third_party/depot_tools': { - 'url': '{chromium_git}/chromium/tools/depot_tools.git@7d2693ad8d9d304391b1c1fee9f88f258af5a211', + 'url': '{chromium_git}/chromium/tools/depot_tools.git@89ccf4a8054906ad20ac112306e511246c90cb81', 'condition': 'not build_with_chromium', }, @@ -496,7 +496,7 @@ deps = { }, 'third_party/SwiftShader': { - 'url': '{swiftshader_git}/SwiftShader@103a69bd6c82980c967c2f4002c9a302ea67c716', + 'url': '{swiftshader_git}/SwiftShader@ea5f37f391931f7f39402ae1b8d6d5984380794d', 'condition': 'not build_with_chromium', }, @@ -516,7 +516,7 @@ deps = { }, 'third_party/vulkan-deps': { - 'url': '{chromium_git}/vulkan-deps@00e1ddd4230c7804ee732092af6dd0a79a7d9bfe', + 'url': '{chromium_git}/vulkan-deps@158676f39f3b0800c8a3c3e17af98c89c2613d8c', 'condition': 'not build_with_chromium', }, @@ -572,7 +572,7 @@ deps = { }, 'tools/mb': { - 'url': '{chromium_git}/chromium/src/tools/mb@36b318c3885b77de69cccaa2b88eaa8b3309dbd9', + 'url': '{chromium_git}/chromium/src/tools/mb@26dc6e420ec1b39b50dbe0faa28f8114a925cf29', 'condition': 'not build_with_chromium', }, @@ -587,7 +587,7 @@ deps = { }, 'tools/perf': { - 'url': '{chromium_git}/chromium/src/tools/perf@25916f0211676eabd25ed9949f7e4625981522a5', + 'url': '{chromium_git}/chromium/src/tools/perf@d9016aa3c694e4ced7447aabafb71b0fa9eb90f3', 'condition': 'not build_with_chromium', }, diff --git a/include/platform/Feature.h b/include/platform/Feature.h index a026d1126f..c31b09345d 100644 --- a/include/platform/Feature.h +++ b/include/platform/Feature.h @@ -176,24 +176,8 @@ struct FeatureSetBase FeatureMap members = FeatureMap(); public: - void overrideFeatures(const std::vector<std::string> &featureNames, bool enabled) - { - for (const std::string &name : featureNames) - { - if (members.find(name) != members.end()) - { - members[name]->enabled = enabled; - } - } - } - - void populateFeatureList(FeatureList *features) const - { - for (FeatureMap::const_iterator it = members.begin(); it != members.end(); it++) - { - features->push_back(it->second); - } - } + void overrideFeatures(const std::vector<std::string> &featureNames, bool enabled); + void populateFeatureList(FeatureList *features) const; const FeatureMap &getFeatures() const { return members; } }; diff --git a/include/platform/FeaturesD3D.h b/include/platform/FeaturesD3D.h index 67c29201d5..c546e8dd13 100644 --- a/include/platform/FeaturesD3D.h +++ b/include/platform/FeaturesD3D.h @@ -21,48 +21,48 @@ struct FeaturesD3D : FeatureSetBase ~FeaturesD3D(); FeatureInfo mrtPerfWorkaround = { - "mrt_perf_workaround", + "mrtPerfWorkaround", FeatureCategory::D3DWorkarounds, "Some drivers have a bug where they ignore null render targets", &members, }; FeatureInfo setDataFasterThanImageUpload = { - "set_data_faster_than_image_upload", + "setDataFasterThanImageUpload", FeatureCategory::D3DWorkarounds, "Set data faster than image upload", &members, }; FeatureInfo zeroMaxLodWorkaround = { - "zero_max_lod", + "zeroMaxLodWorkaround", FeatureCategory::D3DWorkarounds, "Missing an option to disable mipmaps on a mipmapped texture", &members, }; FeatureInfo useInstancedPointSpriteEmulation = { - "use_instanced_point_sprite_emulation", + "useInstancedPointSpriteEmulation", FeatureCategory::D3DWorkarounds, "Some D3D11 renderers do not support geometry shaders for pointsprite emulation", &members, }; FeatureInfo depthStencilBlitExtraCopy = { - "depth_stencil_blit_extra_copy", FeatureCategory::D3DWorkarounds, + "depthStencilBlitExtraCopy", FeatureCategory::D3DWorkarounds, "Bug in some drivers triggers a TDR when using CopySubresourceRegion from a staging " "texture to a depth/stencil", &members, "http://anglebug.com/1452"}; FeatureInfo expandIntegerPowExpressions = { - "expand_integer_pow_expressions", + "expandIntegerPowExpressions", FeatureCategory::D3DWorkarounds, "The HLSL optimizer has a bug with optimizing 'pow' in certain integer-valued expressions", &members, }; FeatureInfo flushAfterEndingTransformFeedback = { - "flush_after_ending_transform_feedback", + "flushAfterEndingTransformFeedback", FeatureCategory::D3DWorkarounds, "Some drivers sometimes write out-of-order results to StreamOut buffers when transform " "feedback is used to repeatedly write to the same buffer positions", @@ -70,7 +70,7 @@ struct FeaturesD3D : FeatureSetBase }; FeatureInfo getDimensionsIgnoresBaseLevel = { - "get_dimensions_ignores_base_level", + "getDimensionsIgnoresBaseLevel", FeatureCategory::D3DWorkarounds, "Some drivers do not take into account the base level of the " "texture in the results of the HLSL GetDimensions builtin", @@ -78,7 +78,7 @@ struct FeaturesD3D : FeatureSetBase }; FeatureInfo preAddTexelFetchOffsets = { - "pre_add_texel_fetch_offsets", + "preAddTexelFetchOffsets", FeatureCategory::D3DWorkarounds, "HLSL's function texture.Load returns 0 when the parameter Location is negative, even if " "the sum of Offset and Location is in range", @@ -86,14 +86,14 @@ struct FeaturesD3D : FeatureSetBase }; FeatureInfo emulateTinyStencilTextures = { - "emulate_tiny_stencil_textures", + "emulateTinyStencilTextures", FeatureCategory::D3DWorkarounds, "1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly", &members, }; FeatureInfo disableB5G6R5Support = { - "disable_b5g6r5_support", + "disableB5G6R5Support", FeatureCategory::D3DWorkarounds, "Textures with the format " "DXGI_FORMAT_B5G6R5_UNORM have incorrect data", @@ -101,28 +101,28 @@ struct FeaturesD3D : FeatureSetBase }; FeatureInfo rewriteUnaryMinusOperator = { - "rewrite_unary_minus_operator", + "rewriteUnaryMinusOperator", FeatureCategory::D3DWorkarounds, "Evaluating unary minus operator on integer may get wrong answer in vertex shaders", &members, }; - FeatureInfo emulateIsnanFloat = {"emulate_isnan_float", FeatureCategory::D3DWorkarounds, + FeatureInfo emulateIsnanFloat = {"emulateIsnanFloat", FeatureCategory::D3DWorkarounds, "Using isnan() on highp float will get wrong answer", &members, "https://crbug.com/650547"}; - FeatureInfo callClearTwice = {"call_clear_twice", FeatureCategory::D3DWorkarounds, + FeatureInfo callClearTwice = {"callClearTwice", FeatureCategory::D3DWorkarounds, "Using clear() may not take effect", &members, "https://crbug.com/655534"}; FeatureInfo useSystemMemoryForConstantBuffers = { - "use_system_memory_for_constant_buffers", FeatureCategory::D3DWorkarounds, + "useSystemMemoryForConstantBuffers", FeatureCategory::D3DWorkarounds, "Copying from staging storage to constant buffer " "storage does not work", &members, "https://crbug.com/593024"}; FeatureInfo selectViewInGeometryShader = { - "select_view_in_geometry_shader", + "selectViewInGeometryShader", FeatureCategory::D3DWorkarounds, "The viewport or render target slice will be selected in the geometry shader stage for " "the ANGLE_multiview extension", @@ -130,36 +130,36 @@ struct FeaturesD3D : FeatureSetBase }; FeatureInfo addMockTextureNoRenderTarget = { - "add_mock_texture_no_render_target", FeatureCategory::D3DWorkarounds, + "addMockTextureNoRenderTarget", FeatureCategory::D3DWorkarounds, "On some drivers when rendering with no render target, two bugs lead to incorrect behavior", &members, "http://anglebug.com/2152"}; FeatureInfo skipVSConstantRegisterZero = { - "skip_vs_constant_register_zero", + "skipVSConstantRegisterZero", FeatureCategory::D3DWorkarounds, "In specific cases the driver doesn't handle constant register zero correctly", &members, }; FeatureInfo forceAtomicValueResolution = { - "force_atomic_value_resolution", FeatureCategory::D3DWorkarounds, + "forceAtomicValueResolution", FeatureCategory::D3DWorkarounds, "On some drivers the return value from RWByteAddressBuffer.InterlockedAdd does not resolve " "when used in the .yzw components of a RWByteAddressBuffer.Store operation", &members, "http://anglebug.com/3246"}; FeatureInfo allowClearForRobustResourceInit = { - "allow_clear_for_robust_resource_init", FeatureCategory::D3DWorkarounds, + "allowClearForRobustResourceInit", FeatureCategory::D3DWorkarounds, "Some drivers corrupt texture data when clearing for robust resource initialization.", &members, "http://crbug.com/941620"}; FeatureInfo allowTranslateUniformBlockToStructuredBuffer = { - "allow_translate_uniform_block_to_structured_buffer", FeatureCategory::D3DWorkarounds, + "allowTranslateUniformBlockToStructuredBuffer", FeatureCategory::D3DWorkarounds, "There is a slow fxc compile performance issue with dynamic uniform indexing if " "translating a uniform block with a large array member to cbuffer.", &members, "http://anglebug.com/3682"}; - FeatureInfo allowES3OnFL10_0 = { - "allowES3OnFL10_0", + FeatureInfo allowES3OnFL100 = { + "allowES3OnFL100", FeatureCategory::D3DWorkarounds, "Allow ES3 on 10.0 devices", &members, diff --git a/include/platform/FeaturesGL.h b/include/platform/FeaturesGL.h index db74f307b3..50a4b6a3dc 100644 --- a/include/platform/FeaturesGL.h +++ b/include/platform/FeaturesGL.h @@ -21,162 +21,162 @@ struct FeaturesGL : FeatureSetBase ~FeaturesGL(); FeatureInfo avoid1BitAlphaTextureFormats = { - "avoid_1_bit_alpha_texture_formats", + "avoid1BitAlphaTextureFormats", FeatureCategory::OpenGLWorkarounds, "Issue with 1-bit alpha framebuffer formats", &members, }; - FeatureInfo rgba4IsNotSupportedForColorRendering = { - "rgba4_is_not_supported_for_color_rendering", + FeatureInfo RGBA4IsNotSupportedForColorRendering = { + "RGBA4IsNotSupportedForColorRendering", FeatureCategory::OpenGLWorkarounds, "GL_RGBA4 is not color renderable", &members, }; - FeatureInfo allowEtcFormats = { - "allow_etc_formats", + FeatureInfo allowETCFormats = { + "allowETCFormats", FeatureCategory::OpenGLWorkarounds, "Enable ETC2/EAC on desktop OpenGL", &members, }; FeatureInfo doesSRGBClearsOnLinearFramebufferAttachments = { - "does_srgb_clears_on_linear_framebuffer_attachments", + "doesSRGBClearsOnLinearFramebufferAttachments", FeatureCategory::OpenGLWorkarounds, "Issue clearing framebuffers with linear attachments when GL_FRAMEBUFFER_SRGB is enabled", &members, }; FeatureInfo doWhileGLSLCausesGPUHang = { - "do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds, + "doWhileGLSLCausesGPUHang", FeatureCategory::OpenGLWorkarounds, "Some GLSL constructs involving do-while loops cause GPU hangs", &members, "http://crbug.com/644669"}; - FeatureInfo addBaseVertexToVertexID = { - "vertex_id_does_not_include_base_vertex", + FeatureInfo vertexIDDoesNotIncludeBaseVertex = { + "vertexIDDoesNotIncludeBaseVertex", FeatureCategory::OpenGLWorkarounds, "gl_VertexID in GLSL vertex shader doesn't include base vertex value", &members, }; FeatureInfo finishDoesNotCauseQueriesToBeAvailable = { - "finish_does_not_cause_queries_to_be_available", + "finishDoesNotCauseQueriesToBeAvailable", FeatureCategory::OpenGLWorkarounds, "glFinish doesn't cause all queries to report available result", &members, }; FeatureInfo alwaysCallUseProgramAfterLink = { - "always_call_use_program_after_link", FeatureCategory::OpenGLWorkarounds, + "alwaysCallUseProgramAfterLink", FeatureCategory::OpenGLWorkarounds, "Always call useProgram after a successful link to avoid a driver bug", &members, "http://crbug.com/110263"}; FeatureInfo unpackOverlappingRowsSeparatelyUnpackBuffer = { - "unpack_overlapping_rows_separately_unpack_buffer", + "unpackOverlappingRowsSeparatelyUnpackBuffer", FeatureCategory::OpenGLWorkarounds, "In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row", &members, }; FeatureInfo packOverlappingRowsSeparatelyPackBuffer = { - "pack_overlapping_rows_separately_pack_buffer", + "packOverlappingRowsSeparatelyPackBuffer", FeatureCategory::OpenGLWorkarounds, "In the case of packing to a pixel pack buffer, pack overlapping rows row by row", &members, }; FeatureInfo initializeCurrentVertexAttributes = { - "initialize_current_vertex_attributes", + "initializeCurrentVertexAttributes", FeatureCategory::OpenGLWorkarounds, "During initialization, assign the current vertex attributes to the spec-mandated defaults", &members, }; - FeatureInfo emulateAbsIntFunction = {"emulate_abs_int_function", + FeatureInfo emulateAbsIntFunction = {"emulateAbsIntFunction", FeatureCategory::OpenGLWorkarounds, "abs(i) where i is an integer returns unexpected result", &members, "http://crbug.com/642227"}; FeatureInfo addAndTrueToLoopCondition = { - "add_and_true_to_loop_condition", + "addAndTrueToLoopCondition", FeatureCategory::OpenGLWorkarounds, "Calculation of loop conditions in for and while loop has bug", &members, }; FeatureInfo unpackLastRowSeparatelyForPaddingInclusion = { - "unpack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds, + "unpackLastRowSeparatelyForPaddingInclusion", FeatureCategory::OpenGLWorkarounds, "When uploading textures from an unpack buffer, some drivers count an extra row padding", &members, "http://anglebug.com/1512"}; FeatureInfo packLastRowSeparatelyForPaddingInclusion = { - "pack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds, + "packLastRowSeparatelyForPaddingInclusion", FeatureCategory::OpenGLWorkarounds, "When uploading textures from an pack buffer, some drivers count an extra row padding", &members, "http://anglebug.com/1512"}; - FeatureInfo emulateIsnanFloat = {"emulate_isnan_float", FeatureCategory::OpenGLWorkarounds, + FeatureInfo emulateIsnanFloat = {"emulateIsnanFloat", FeatureCategory::OpenGLWorkarounds, "Using isnan() on highp float will get wrong answer", &members, "http://crbug.com/650547"}; FeatureInfo useUnusedBlocksWithStandardOrSharedLayout = { - "use_unused_blocks_with_standard_or_shared_layout", + "useUnusedBlocksWithStandardOrSharedLayout", FeatureCategory::OpenGLWorkarounds, "Unused std140 or shared uniform blocks will be treated as inactive", &members, }; FeatureInfo removeInvariantAndCentroidForESSL3 = { - "remove_invarient_and_centroid_for_essl3", + "removeInvariantAndCentroidForESSL3", FeatureCategory::OpenGLWorkarounds, "Fix spec difference between GLSL 4.1 or lower and ESSL3", &members, }; FeatureInfo rewriteFloatUnaryMinusOperator = { - "rewrite_float_unary_minus_operator", FeatureCategory::OpenGLWorkarounds, + "rewriteFloatUnaryMinusOperator", FeatureCategory::OpenGLWorkarounds, "Using '-<float>' will get wrong answer", &members, "http://crbug.com/308366"}; - FeatureInfo emulateAtan2Float = {"emulate_atan_2_float", FeatureCategory::OpenGLWorkarounds, + FeatureInfo emulateAtan2Float = {"emulateAtan2Float", FeatureCategory::OpenGLWorkarounds, "atan(y, x) may return a wrong answer", &members, "http://crbug.com/672380"}; FeatureInfo reapplyUBOBindingsAfterUsingBinaryProgram = { - "reapply_ubo_bindings_after_using_binary_program", FeatureCategory::OpenGLWorkarounds, + "reapplyUBOBindingsAfterUsingBinaryProgram", FeatureCategory::OpenGLWorkarounds, "Some drivers forget about UBO bindings when using program binaries", &members, "http://anglebug.com/1637"}; FeatureInfo emulateMaxVertexAttribStride = { - "emulate_max_vertex_attrib_stride", FeatureCategory::OpenGLWorkarounds, + "emulateMaxVertexAttribStride", FeatureCategory::OpenGLWorkarounds, "Some drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members, "http://anglebug.com/1936"}; FeatureInfo dontInitializeUninitializedLocals = { - "dont_initialize_uninitialized_locals", FeatureCategory::OpenGLWorkarounds, + "dontInitializeUninitializedLocals", FeatureCategory::OpenGLWorkarounds, "Initializing uninitialized locals caused odd behavior in a few WebGL 2 tests", &members, "http://anglebug.com/2046"}; FeatureInfo clampPointSize = { - "clamp_point_size", + "clampPointSize", FeatureCategory::OpenGLWorkarounds, "The point size range reported from the API is inconsistent with the actual behavior", &members, }; FeatureInfo dontUseLoopsToInitializeVariables = { - "dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds, + "dontUseLoopsToInitializeVariables", FeatureCategory::OpenGLWorkarounds, "For loops used to initialize variables hit native GLSL compiler bugs", &members, "http://crbug.com/809422"}; FeatureInfo clampFragDepth = { - "clamp_frag_depth", + "clampFragDepth", FeatureCategory::OpenGLWorkarounds, "gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer", &members, }; FeatureInfo rewriteRepeatedAssignToSwizzled = { - "rewrite_repeated_assign_to_swizzled", + "rewriteRepeatedAssignToSwizzled", FeatureCategory::OpenGLWorkarounds, "Repeated assignment to swizzled values inside a " "GLSL user-defined function have incorrect results", @@ -184,106 +184,106 @@ struct FeaturesGL : FeatureSetBase }; FeatureInfo disableBlendFuncExtended = { - "disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds, + "disableBlendFuncExtended", FeatureCategory::OpenGLWorkarounds, "ARB_blend_func_extended does not pass the tests", &members, "http://anglebug.com/1085"}; - FeatureInfo unsizedsRGBReadPixelsDoesntTransform = { - "unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds, + FeatureInfo unsizedSRGBReadPixelsDoesntTransform = { + "unsizedSRGBReadPixelsDoesntTransform", FeatureCategory::OpenGLWorkarounds, "Drivers returning raw sRGB values instead of linearized values when calling glReadPixels " "on unsized sRGB texture formats", &members, "http://crbug.com/550292 http://crbug.com/565179"}; FeatureInfo queryCounterBitsGeneratesErrors = { - "query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds, + "queryCounterBitsGeneratesErrors", FeatureCategory::OpenGLWorkarounds, "Drivers generate errors when querying the number of bits in timer queries", &members, "http://anglebug.com/3027"}; FeatureInfo dontRelinkProgramsInParallel = { - "dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds, + "dontRelinkProgramsInParallel", FeatureCategory::OpenGLWorkarounds, "Relinking a program in parallel is buggy", &members, "http://anglebug.com/3045"}; - FeatureInfo disableWorkerContexts = {"disable_worker_contexts", + FeatureInfo disableWorkerContexts = {"disableWorkerContexts", FeatureCategory::OpenGLWorkarounds, "Some tests have been seen to fail using worker contexts", &members, "http://crbug.com/849576"}; - FeatureInfo limitMaxTextureSizeTo4096 = {"max_texture_size_limit_4096", + FeatureInfo limitMaxTextureSizeTo4096 = {"limitMaxTextureSizeTo4096", FeatureCategory::OpenGLWorkarounds, "Limit max texture size to 4096 to avoid frequent " "out-of-memory errors", &members, "http://crbug.com/927470"}; FeatureInfo limitMaxMSAASamplesTo4 = { - "max_msaa_sample_count_4", FeatureCategory::OpenGLWorkarounds, + "limitMaxMSAASamplesTo4", FeatureCategory::OpenGLWorkarounds, "Various rendering bugs have been observed when using higher MSAA counts", &members, "http://crbug.com/797243"}; FeatureInfo allowClearForRobustResourceInit = { - "allow_clear_for_robust_resource_init", FeatureCategory::OpenGLWorkarounds, + "allowClearForRobustResourceInit", FeatureCategory::OpenGLWorkarounds, "Using glClear for robust resource initialization is buggy on some drivers and leads to " "texture corruption. Default to data uploads except on MacOS where it is very slow.", &members, "https://crbug.com/848952 http://crbug.com/883276"}; - FeatureInfo clampArrayAccess = {"clamp_array_access", FeatureCategory::OpenGLWorkarounds, + FeatureInfo clampArrayAccess = {"clampArrayAccess", FeatureCategory::OpenGLWorkarounds, "Clamp uniform array access to avoid reading invalid memory.", &members, "http://anglebug.com/2978"}; FeatureInfo resetTexImage2DBaseLevel = { - "reset_teximage2d_base_level", FeatureCategory::OpenGLWorkarounds, + "resetTexImage2DBaseLevel", FeatureCategory::OpenGLWorkarounds, "Reset texture base level before calling glTexImage2D to " "work around pixel comparison failure.", &members, "https://crbug.com/705865"}; FeatureInfo clearToZeroOrOneBroken = { - "clear_to_zero_or_one_broken", FeatureCategory::OpenGLWorkarounds, + "clearToZeroOrOneBroken", FeatureCategory::OpenGLWorkarounds, "Clears when the clear color is all zeros or ones do not work.", &members, "https://crbug.com/710443"}; FeatureInfo limitMax3dArrayTextureSizeTo1024 = { - "max_3d_array_texture_size_1024", FeatureCategory::OpenGLWorkarounds, + "limitMax3dArrayTextureSizeTo1024", FeatureCategory::OpenGLWorkarounds, "Limit max 3d texture size and max array texture layers to 1024 to avoid system hang", &members, "http://crbug.com/927470"}; - FeatureInfo adjustSrcDstRegionBlitFramebuffer = { - "adjust_src_dst_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds, + FeatureInfo adjustSrcDstRegionForBlitFramebuffer = { + "adjustSrcDstRegionForBlitFramebuffer", FeatureCategory::OpenGLWorkarounds, "Many platforms have issues with blitFramebuffer when the parameters are large.", &members, "http://crbug.com/830046"}; - FeatureInfo clipSrcRegionBlitFramebuffer = { - "clip_src_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds, + FeatureInfo clipSrcRegionForBlitFramebuffer = { + "clipSrcRegionForBlitFramebuffer", FeatureCategory::OpenGLWorkarounds, "Issues with blitFramebuffer when the parameters don't match the framebuffer size.", &members, "http://crbug.com/830046"}; - FeatureInfo rgbDXT1TexturesSampleZeroAlpha = { - "rgb_dxt1_textures_sample_zero_alpha", FeatureCategory::OpenGLWorkarounds, + FeatureInfo RGBDXT1TexturesSampleZeroAlpha = { + "RGBDXT1TexturesSampleZeroAlpha", FeatureCategory::OpenGLWorkarounds, "Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac.", &members, "http://anglebug.com/3729"}; FeatureInfo unfoldShortCircuits = { - "unfold_short_circuits", FeatureCategory::OpenGLWorkarounds, + "unfoldShortCircuits", FeatureCategory::OpenGLWorkarounds, "Mac incorrectly executes both sides of && and || expressions when they should " "short-circuit.", &members, "http://anglebug.com/482"}; FeatureInfo emulatePrimitiveRestartFixedIndex = { - "emulate_primitive_restart_fixed_index", FeatureCategory::OpenGLWorkarounds, + "emulatePrimitiveRestartFixedIndex", FeatureCategory::OpenGLWorkarounds, "When GL_PRIMITIVE_RESTART_FIXED_INDEX is not available, emulate it with " "GL_PRIMITIVE_RESTART and glPrimitiveRestartIndex.", &members, "http://anglebug.com/3997"}; FeatureInfo setPrimitiveRestartFixedIndexForDrawArrays = { - "set_primitive_restart_fixed_index_for_draw_arrays", FeatureCategory::OpenGLWorkarounds, + "setPrimitiveRestartFixedIndexForDrawArrays", FeatureCategory::OpenGLWorkarounds, "Some drivers discard vertex data in DrawArrays calls when the fixed primitive restart " "index is within the number of primitives being drawn.", &members, "http://anglebug.com/3997"}; FeatureInfo removeDynamicIndexingOfSwizzledVector = { - "remove_dynamic_indexing_of_swizzled_vector", FeatureCategory::OpenGLWorkarounds, + "removeDynamicIndexingOfSwizzledVector", FeatureCategory::OpenGLWorkarounds, "Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.", &members, "http://crbug.com/709351"}; FeatureInfo preAddTexelFetchOffsets = { - "pre_add_texel_fetch_offsets", FeatureCategory::OpenGLWorkarounds, + "preAddTexelFetchOffsets", FeatureCategory::OpenGLWorkarounds, "Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid " "even if the sum of position and offset is in range, so we need to add workarounds by " "rewriting texelFetchOffset(sampler, position, lod, offset) into texelFetch(sampler, " @@ -291,156 +291,155 @@ struct FeaturesGL : FeatureSetBase &members, "http://crbug.com/642605"}; FeatureInfo regenerateStructNames = { - "regenerate_struct_names", FeatureCategory::OpenGLWorkarounds, + "regenerateStructNames", FeatureCategory::OpenGLWorkarounds, "All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct" "name with a unique prefix.", &members, "http://crbug.com/403957"}; FeatureInfo readPixelsUsingImplementationColorReadFormatForNorm16 = { - "read_pixels_using_implementation_color_read_format", FeatureCategory::OpenGLWorkarounds, + "readPixelsUsingImplementationColorReadFormatForNorm16", FeatureCategory::OpenGLWorkarounds, "Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from " "EXT_texture_norm16 correctly", &members, "http://anglebug.com/4214"}; FeatureInfo flushBeforeDeleteTextureIfCopiedTo = { - "flush_before_delete_texture_if_copied_to", FeatureCategory::OpenGLWorkarounds, + "flushBeforeDeleteTextureIfCopiedTo", FeatureCategory::OpenGLWorkarounds, "Some drivers track CopyTex{Sub}Image texture dependencies incorrectly. Flush" " before glDeleteTextures in this case", &members, "http://anglebug.com/4267"}; FeatureInfo rewriteRowMajorMatrices = { - "rewrite_row_major_matrices", FeatureCategory::OpenGLWorkarounds, + "rewriteRowMajorMatrices", FeatureCategory::OpenGLWorkarounds, "Rewrite row major matrices in shaders as column major as a driver bug workaround", &members, "http://anglebug.com/2273"}; FeatureInfo disableDrawBuffersIndexed = { - "disable_draw_buffers_indexed", + "disableDrawBuffersIndexed", FeatureCategory::OpenGLWorkarounds, "Disable OES_draw_buffers_indexed extension.", &members, }; - FeatureInfo disableSemaphoreFd = {"disable_semaphore_fd", FeatureCategory::OpenGLWorkarounds, + FeatureInfo disableSemaphoreFd = {"disableSemaphoreFd", FeatureCategory::OpenGLWorkarounds, "Disable GL_EXT_semaphore_fd extension", &members, "https://crbug.com/1046462"}; FeatureInfo disableTimestampQueries = { - "disable_timestamp_queries", FeatureCategory::OpenGLWorkarounds, + "disableTimestampQueries", FeatureCategory::OpenGLWorkarounds, "Disable GL_EXT_disjoint_timer_query extension", &members, "https://crbug.com/811661"}; - FeatureInfo encodeAndDecodeSRGBForGenerateMipmap = { - "decode_encode_srgb_for_generatemipmap", FeatureCategory::OpenGLWorkarounds, + FeatureInfo decodeEncodeSRGBForGenerateMipmap = { + "decodeEncodeSRGBForGenerateMipmap", FeatureCategory::OpenGLWorkarounds, "Decode and encode before generateMipmap for srgb format textures.", &members, "http://anglebug.com/4646"}; FeatureInfo emulateCopyTexImage2DFromRenderbuffers = { - "emulate_copyteximage2d_from_renderbuffers", FeatureCategory::OpenGLWorkarounds, + "emulateCopyTexImage2DFromRenderbuffers", FeatureCategory::OpenGLWorkarounds, "CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers.", &members, "https://anglebug.com/4674"}; FeatureInfo disableGPUSwitchingSupport = { - "disable_gpu_switching_support", FeatureCategory::OpenGLWorkarounds, + "disableGPUSwitchingSupport", FeatureCategory::OpenGLWorkarounds, "Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.", &members, "https://crbug.com/1091824"}; FeatureInfo disableNativeParallelCompile = { - "disable_native_parallel_compile", FeatureCategory::OpenGLWorkarounds, + "disableNativeParallelCompile", FeatureCategory::OpenGLWorkarounds, "Do not use native KHR_parallel_shader_compile even when available.", &members, "http://crbug.com/1094869"}; FeatureInfo emulatePackSkipRowsAndPackSkipPixels = { - "emulate_pack_skip_rows_and_pack_skip_pixels", FeatureCategory::OpenGLWorkarounds, + "emulatePackSkipRowsAndPackSkipPixels", FeatureCategory::OpenGLWorkarounds, "GL_PACK_SKIP_ROWS and GL_PACK_SKIP_PIXELS are ignored in Apple's OpenGL driver.", &members, "https://anglebug.com/4849"}; FeatureInfo clampMscRate = { - "clamp_msc_rate", FeatureCategory::OpenGLWorkarounds, + "clampMscRate", FeatureCategory::OpenGLWorkarounds, "Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz", &members, "https://crbug.com/1042393"}; FeatureInfo bindTransformFeedbackBufferBeforeBindBufferRange = { - "bind_transform_feedback_buffer_before_bind_buffer_range", - FeatureCategory::OpenGLWorkarounds, + "bindTransformFeedbackBufferBeforeBindBufferRange", FeatureCategory::OpenGLWorkarounds, "Bind transform feedback buffers to the generic binding point before calling " "glBindBufferBase or glBindBufferRange.", &members, "https://anglebug.com/5140"}; FeatureInfo disableSyncControlSupport = { - "disable_sync_control_support", FeatureCategory::OpenGLWorkarounds, + "disableSyncControlSupport", FeatureCategory::OpenGLWorkarounds, "Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders " "Chrome unusable", &members, "https://crbug.com/1137851"}; FeatureInfo keepBufferShadowCopy = { - "keep_buffer_shadow_copy", + "keepBufferShadowCopy", FeatureCategory::OpenGLWorkarounds, "Maintain a shadow copy of buffer data when the GL API does not permit reading data back.", &members, }; FeatureInfo setZeroLevelBeforeGenerateMipmap = { - "set_zero_level_before_generating_mipmap", + "setZeroLevelBeforeGenerateMipmap", FeatureCategory::OpenGLWorkarounds, "glGenerateMipmap fails if the zero texture level is not set on some Mac drivers.", &members, }; FeatureInfo promotePackedFormatsTo8BitPerChannel = { - "promote_packed_formats_to_8_bit_per_channel", FeatureCategory::OpenGLWorkarounds, + "promotePackedFormatsTo8BitPerChannel", FeatureCategory::OpenGLWorkarounds, "Packed color formats are buggy on Macs with AMD GPUs", &members, "http://anglebug.com/5469"}; FeatureInfo initFragmentOutputVariables = { - "init_fragment_output_variables", FeatureCategory::OpenGLWorkarounds, + "initFragmentOutputVariables", FeatureCategory::OpenGLWorkarounds, "No init gl_FragColor causes context lost", &members, "http://crbug.com/1171371"}; - FeatureInfo shiftInstancedArrayDataWithExtraOffset = { - "shift_instanced_array_data_with_offset", FeatureCategory::OpenGLWorkarounds, + FeatureInfo shiftInstancedArrayDataWithOffset = { + "shiftInstancedArrayDataWithOffset", FeatureCategory::OpenGLWorkarounds, "glDrawArraysInstanced is buggy on certain new Mac Intel GPUs", &members, "http://crbug.com/1144207"}; FeatureInfo syncVertexArraysToDefault = { - "sync_vertex_arrays_to_default", FeatureCategory::OpenGLWorkarounds, + "syncVertexArraysToDefault", FeatureCategory::OpenGLWorkarounds, "Only use the default VAO because of missing support or driver bugs", &members, "http://anglebug.com/5577"}; - FeatureInfo sanitizeAmdGpuRendererString = { - "sanitize_amdgpu_renderer_string", FeatureCategory::OpenGLWorkarounds, + FeatureInfo sanitizeAMDGPURendererString = { + "sanitizeAMDGPURendererString", FeatureCategory::OpenGLWorkarounds, "Strip precise kernel and DRM version information from amdgpu renderer strings.", &members, "http://crbug.com/1181193"}; - FeatureInfo unbindFBOOnContextSwitch = { - "unbind_fbo_before_switching_context", FeatureCategory::OpenGLWorkarounds, + FeatureInfo unbindFBOBeforeSwitchingContext = { + "unbindFBOBeforeSwitchingContext", FeatureCategory::OpenGLWorkarounds, "Imagination GL drivers are buggy with context switching.", &members, "http://crbug.com/1181193"}; - FeatureInfo flushOnFramebufferChange = {"flush_on_framebuffer_change", + FeatureInfo flushOnFramebufferChange = {"flushOnFramebufferChange", FeatureCategory::OpenGLWorkarounds, "Switching framebuffers without a flush can lead to " "crashes on Intel 9th Generation GPU Macs.", &members, "http://crbug.com/1181068"}; FeatureInfo disableMultisampledRenderToTexture = { - "disable_mutlisampled_render_to_texture", FeatureCategory::OpenGLWorkarounds, + "disableMultisampledRenderToTexture", FeatureCategory::OpenGLWorkarounds, "Many drivers have bugs when using GL_EXT_multisampled_render_to_texture", &members, "http://anglebug.com/2894"}; FeatureInfo uploadTextureDataInChunks = { - "chunked_texture_upload", FeatureCategory::OpenGLWorkarounds, + "uploadTextureDataInChunks", FeatureCategory::OpenGLWorkarounds, "Upload texture data in <120kb chunks to work around Mac driver hangs and crashes.", &members, "http://crbug.com/1181068"}; FeatureInfo emulateImmutableCompressedTexture3D = { - "emulate_immutable_compressed_texture_3d", FeatureCategory::OpenGLWorkarounds, + "emulateImmutableCompressedTexture3D", FeatureCategory::OpenGLWorkarounds, "Use non-immutable texture allocation to work around a driver bug.", &members, "https://crbug.com/1060012"}; - FeatureInfo emulateRGB10 = {"emulate_rgb10", FeatureCategory::OpenGLWorkarounds, + FeatureInfo emulateRGB10 = {"emulateRGB10", FeatureCategory::OpenGLWorkarounds, "Emulate RGB10 support using RGB10_A2.", &members, "https://crbug.com/1300575"}; FeatureInfo alwaysUnbindFramebufferTexture2D = { - "always_unbind_framebuffer_texture_2d", FeatureCategory::OpenGLWorkarounds, + "alwaysUnbindFramebufferTexture2D", FeatureCategory::OpenGLWorkarounds, "Force unbind framebufferTexture2D before binding renderbuffer to work around driver bug.", &members, "https://anglebug.com/5536"}; }; diff --git a/include/platform/FeaturesMtl.h b/include/platform/FeaturesMtl.h index 87cbd2ac45..a37a25657e 100644 --- a/include/platform/FeaturesMtl.h +++ b/include/platform/FeaturesMtl.h @@ -21,77 +21,77 @@ struct FeaturesMtl : FeatureSetBase ~FeaturesMtl(); FeatureInfo hasBaseVertexInstancedDraw = { - "has_base_vertex_instanced_draw", + "hasBaseVertexInstancedDraw", FeatureCategory::MetalFeatures, "The renderer supports base vertex instanced draw", &members, }; FeatureInfo hasExplicitMemBarrier = { - "has_explicit_mem_barrier_mtl", + "hasExplicitMemBarrier", FeatureCategory::MetalFeatures, "The renderer supports explicit memory barrier", &members, }; FeatureInfo hasCheapRenderPass = { - "has_cheap_render_pass_mtl", + "hasCheapRenderPass", FeatureCategory::MetalFeatures, "The renderer can cheaply break a render pass.", &members, }; FeatureInfo hasNonUniformDispatch = { - "has_non_uniform_dispatch", + "hasNonUniformDispatch", FeatureCategory::MetalFeatures, "The renderer supports non uniform compute shader dispatch's group size", &members, }; - FeatureInfo hasStencilOutput = { - "has_shader_stencil_output", + FeatureInfo hasShaderStencilOutput = { + "hasShaderStencilOutput", FeatureCategory::MetalFeatures, "The renderer supports stencil output from fragment shader", &members, }; FeatureInfo hasTextureSwizzle = { - "has_texture_swizzle", + "hasTextureSwizzle", FeatureCategory::MetalFeatures, "The renderer supports texture swizzle", &members, }; FeatureInfo hasDepthAutoResolve = { - "has_msaa_depth_auto_resolve", + "hasDepthAutoResolve", FeatureCategory::MetalFeatures, "The renderer supports MSAA depth auto resolve at the end of render pass", &members, }; FeatureInfo hasStencilAutoResolve = { - "has_msaa_stencil_auto_resolve", + "hasStencilAutoResolve", FeatureCategory::MetalFeatures, "The renderer supports MSAA stencil auto resolve at the end of render pass", &members, }; FeatureInfo hasEvents = { - "has_mtl_events", + "hasEvents", FeatureCategory::MetalFeatures, "The renderer supports MTL(Shared)Event", &members, }; FeatureInfo allowInlineConstVertexData = { - "allow_inline_const_vertex_data", + "allowInlineConstVertexData", FeatureCategory::MetalFeatures, "The renderer supports using inline constant data for small client vertex data", &members, }; - FeatureInfo allowSeparatedDepthStencilBuffers = { - "allow_separate_depth_stencil_buffers", + FeatureInfo allowSeparateDepthStencilBuffers = { + "allowSeparateDepthStencilBuffers", FeatureCategory::MetalFeatures, "Some Apple platforms such as iOS allows separate depth and stencil buffers, " "whereas others such as macOS don't", @@ -99,56 +99,56 @@ struct FeaturesMtl : FeatureSetBase }; FeatureInfo allowRuntimeSamplerCompareMode = { - "allow_runtime_sampler_compare_mode", + "allowRuntimeSamplerCompareMode", FeatureCategory::MetalFeatures, "The renderer supports changing sampler's compare mode outside shaders", &members, }; FeatureInfo allowSamplerCompareGradient = { - "allow_sampler_compare_gradient", + "allowSamplerCompareGradient", FeatureCategory::MetalFeatures, "The renderer supports sample_compare with gradients", &members, }; FeatureInfo allowSamplerCompareLod = { - "allow_sampler_compare_lod", + "allowSamplerCompareLod", FeatureCategory::MetalFeatures, "The renderer supports sample_compare with lod", &members, }; FeatureInfo allowBufferReadWrite = { - "allow_buffer_read_write", + "allowBufferReadWrite", FeatureCategory::MetalFeatures, "The renderer supports buffer read and write in the same shader", &members, }; FeatureInfo allowMultisampleStoreAndResolve = { - "allow_msaa_store_and_resolve", + "allowMultisampleStoreAndResolve", FeatureCategory::MetalFeatures, "The renderer supports MSAA store and resolve in the same pass", &members, }; FeatureInfo allowGenMultipleMipsPerPass = { - "gen_multiple_mips_per_pass", + "allowGenMultipleMipsPerPass", FeatureCategory::MetalFeatures, "The renderer supports generating multiple mipmaps per pass", &members, }; FeatureInfo forceD24S8AsUnsupported = { - "force_d24s8_as_unsupported", + "forceD24S8AsUnsupported", FeatureCategory::MetalFeatures, "Force Depth24Stencil8 format as unsupported.", &members, }; FeatureInfo forceBufferGPUStorage = { - "force_buffer_gpu_storage", + "forceBufferGPUStorage", FeatureCategory::MetalFeatures, "On systems that support both buffer' memory allocation on GPU and shared memory (such as " "macOS), force using GPU memory allocation for buffers everytime or not.", @@ -160,7 +160,7 @@ struct FeaturesMtl : FeatureSetBase "http://anglebug.com/5505"}; FeatureInfo forceNonCSBaseMipmapGeneration = { - "force_non_cs_mipmap_gen", + "forceNonCSBaseMipmapGeneration", FeatureCategory::MetalFeatures, "Turn this feature on to disallow Compute Shader based mipmap generation. Compute Shader " "based mipmap generation might cause GPU hang on some older iOS devices.", @@ -175,14 +175,14 @@ struct FeaturesMtl : FeatureSetBase }; FeatureInfo rewriteRowMajorMatrices = { - "rewrite_row_major_matrices", + "rewriteRowMajorMatrices", FeatureCategory::MetalFeatures, "Rewrite row major matrices in shaders as column major.", &members, }; FeatureInfo intelExplicitBoolCastWorkaround = { - "intel_explicit_bool_cast_workaround", + "intelExplicitBoolCastWorkaround", FeatureCategory::MetalWorkarounds, "Insert explicit casts for float/double/unsigned/signed int on macOS 10.15 with Intel " "driver", @@ -190,19 +190,19 @@ struct FeaturesMtl : FeatureSetBase }; FeatureInfo intelDisableFastMath = { - "intel_disable_fast_math", + "intelDisableFastMath", FeatureCategory::MetalWorkarounds, "Disable fast math in atan and invariance cases when running below macOS 12.0", &members, }; FeatureInfo multisampleColorFormatShaderReadWorkaround = { - "multisample_color_format_shader_read_workaround", FeatureCategory::MetalWorkarounds, + "multisampleColorFormatShaderReadWorkaround", FeatureCategory::MetalWorkarounds, "Add shaderRead usage to some multisampled texture formats", &members, "http://anglebug.com/7049"}; FeatureInfo copyIOSurfaceToNonIOSurfaceForReadOptimization = { - "copy_iosurface_to_non_iosurface_for_read_optimization", FeatureCategory::MetalWorkarounds, + "copyIOSurfaceToNonIOSurfaceForReadOptimization", FeatureCategory::MetalWorkarounds, "some GPUs are faster to read an IOSurface texture by first copying the texture to a " "non-IOSurface texture", &members, "http://anglebug.com/7117"}; diff --git a/include/platform/FeaturesVk.h b/include/platform/FeaturesVk.h index 6443b7c049..0c0e930e83 100644 --- a/include/platform/FeaturesVk.h +++ b/include/platform/FeaturesVk.h @@ -50,12 +50,12 @@ struct FeaturesVk : FeatureSetBase }; FeatureInfo clampPointSize = { - "clamp_point_size", FeatureCategory::VulkanWorkarounds, + "clampPointSize", FeatureCategory::VulkanWorkarounds, "The point size range reported from the API is inconsistent with the actual behavior", &members, "http://anglebug.com/2970"}; FeatureInfo depthClamping = { - "depth_clamping", FeatureCategory::VulkanWorkarounds, + "depthClamping", FeatureCategory::VulkanWorkarounds, "The depth value is not clamped to [0,1] for floating point depth buffers.", &members, "http://anglebug.com/3970"}; @@ -336,8 +336,8 @@ struct FeaturesVk : FeatureSetBase "and the performance is better.", &members, "http://anglebug.com/4551"}; - FeatureInfo supportsRenderPassStoreOpNoneQCOM = { - "supportsRenderPassStoreOpNoneQCOM", FeatureCategory::VulkanFeatures, + FeatureInfo supportsRenderPassStoreOpNone = { + "supportsRenderPassStoreOpNone", FeatureCategory::VulkanFeatures, "VkDevice supports VK_QCOM_render_pass_store_ops extension.", &members, "http://anglebug.com/5055"}; @@ -383,35 +383,35 @@ struct FeaturesVk : FeatureSetBase &members, "http://anglebug.com/5061"}; FeatureInfo forceTextureLodOffset1 = { - "force_texture_lod_offset_1", + "forceTextureLodOffset1", FeatureCategory::VulkanWorkarounds, "Increase the minimum texture level-of-detail by 1 when sampling.", &members, }; FeatureInfo forceTextureLodOffset2 = { - "force_texture_lod_offset_2", + "forceTextureLodOffset2", FeatureCategory::VulkanWorkarounds, "Increase the minimum texture level-of-detail by 2 when sampling.", &members, }; FeatureInfo forceTextureLodOffset3 = { - "force_texture_lod_offset_3", + "forceTextureLodOffset3", FeatureCategory::VulkanWorkarounds, "Increase the minimum texture level-of-detail by 3 when sampling.", &members, }; FeatureInfo forceTextureLodOffset4 = { - "force_texture_lod_offset_4", + "forceTextureLodOffset4", FeatureCategory::VulkanWorkarounds, "Increase the minimum texture level-of-detail by 4 when sampling.", &members, }; FeatureInfo forceNearestFiltering = { - "force_nearest_filtering", + "forceNearestFiltering", FeatureCategory::VulkanWorkarounds, "Force nearest filtering when sampling.", &members, @@ -425,7 +425,7 @@ struct FeaturesVk : FeatureSetBase }; FeatureInfo compressVertexData = { - "compress_vertex_data", + "compressVertexData", FeatureCategory::VulkanWorkarounds, "Compress vertex data to smaller data types when " "possible. Using this feature makes ANGLE non-conformant.", @@ -527,8 +527,8 @@ struct FeaturesVk : FeatureSetBase &members, }; - FeatureInfo overrideSurfaceFormatRGB8toRGBA8 = { - "overrideSurfaceFormatRGB8toRGBA8", FeatureCategory::VulkanWorkarounds, + FeatureInfo overrideSurfaceFormatRGB8ToRGBA8 = { + "overrideSurfaceFormatRGB8ToRGBA8", FeatureCategory::VulkanWorkarounds, "Override surface format GL_RGB8 to GL_RGBA8", &members, "http://anglebug.com/6651"}; FeatureInfo supportsSharedPresentableImageExtension = { @@ -585,7 +585,7 @@ struct FeaturesVk : FeatureSetBase "forceSubmitImmutableTextureUpdates", FeatureCategory::VulkanAppWorkarounds, "Force submit updates to immutable textures", &members, "http://anglebug.com/6929"}; - FeatureInfo retainSpirvDebugInfo = {"retainSpirvDebugInfo", FeatureCategory::VulkanFeatures, + FeatureInfo retainSPIRVDebugInfo = {"retainSPIRVDebugInfo", FeatureCategory::VulkanFeatures, "Retain debug info in SPIR-V blob.", &members, "http://anglebug.com/5901"}; diff --git a/include/platform/FrontendFeatures.h b/include/platform/FrontendFeatures.h index fa3168dc4a..6500c9c6b4 100644 --- a/include/platform/FrontendFeatures.h +++ b/include/platform/FrontendFeatures.h @@ -22,45 +22,45 @@ struct FrontendFeatures : FeatureSetBase ~FrontendFeatures(); FeatureInfo loseContextOnOutOfMemory = { - "lose_context_on_out_of_memory", + "loseContextOnOutOfMemory", FeatureCategory::FrontendWorkarounds, "Some users rely on a lost context notification if a GL_OUT_OF_MEMORY error occurs", &members, }; FeatureInfo disableProgramCachingForTransformFeedback = { - "disable_program_caching_for_transform_feedback", + "disableProgramCachingForTransformFeedback", FeatureCategory::FrontendWorkarounds, "On some GPUs, program binaries don't contain transform feedback varyings", &members, }; FeatureInfo scalarizeVecAndMatConstructorArgs = { - "scalarize_vec_and_mat_constructor_args", FeatureCategory::FrontendWorkarounds, + "scalarizeVecAndMatConstructorArgs", FeatureCategory::FrontendWorkarounds, "Always rewrite vec/mat constructors to be consistent", &members, "http://crbug.com/1165751"}; - FeatureInfo disableProgramBinary = {"disable_program_binary", FeatureCategory::FrontendFeatures, + FeatureInfo disableProgramBinary = {"disableProgramBinary", FeatureCategory::FrontendFeatures, "Disable support for GL_OES_get_program_binary", &members, "http://anglebug.com/5007"}; FeatureInfo disableAnisotropicFiltering = { - "disable_anisotropic_filtering", + "disableAnisotropicFiltering", FeatureCategory::FrontendWorkarounds, "Disable support for anisotropic filtering", &members, }; FeatureInfo allowCompressedFormats = { - "allow_compressed_formats", + "allowCompressedFormats", FeatureCategory::FrontendWorkarounds, "Allow compressed formats", &members, }; - FeatureInfo captureLimits = {"enable_capture_limits", FeatureCategory::FrontendFeatures, - "Set the context limits like frame capturing was enabled", - &members, "http://anglebug.com/5750"}; + FeatureInfo enableCaptureLimits = {"enableCaptureLimits", FeatureCategory::FrontendFeatures, + "Set the context limits like frame capturing was enabled", + &members, "http://anglebug.com/5750"}; FeatureInfo enableCompressingPipelineCacheInThreadPool = { "enableCompressingPipelineCacheInThreadPool", FeatureCategory::FrontendWorkarounds, diff --git a/include/platform/d3d_features.json b/include/platform/d3d_features.json index 4204434350..cc62f5ded5 100644 --- a/include/platform/d3d_features.json +++ b/include/platform/d3d_features.json @@ -8,8 +8,7 @@ ], "features": [ { - "name": "mrtPerfWorkaround", - "display_name": "mrt_perf_workaround", + "name": "mrt_perf_workaround", "category": "Workarounds", "description": [ "Some drivers have a bug where they ignore null render targets" @@ -17,8 +16,7 @@ }, { - "name": "setDataFasterThanImageUpload", - "display_name": "set_data_faster_than_image_upload", + "name": "set_data_faster_than_image_upload", "category": "Workarounds", "description": [ "Set data faster than image upload" @@ -26,8 +24,7 @@ }, { - "name": "zeroMaxLodWorkaround", - "display_name": "zero_max_lod", + "name": "zero_max_lod_workaround", "category": "Workarounds", "description": [ "Missing an option to disable mipmaps on a mipmapped texture" @@ -35,8 +32,7 @@ }, { - "name": "useInstancedPointSpriteEmulation", - "display_name": "use_instanced_point_sprite_emulation", + "name": "use_instanced_point_sprite_emulation", "category": "Workarounds", "description": [ "Some D3D11 renderers do not support geometry shaders for pointsprite emulation" @@ -44,8 +40,7 @@ }, { - "name": "depthStencilBlitExtraCopy", - "display_name": "depth_stencil_blit_extra_copy", + "name": "depth_stencil_blit_extra_copy", "category": "Workarounds", "description": [ "Bug in some drivers triggers a TDR when using CopySubresourceRegion from a staging ", @@ -55,8 +50,7 @@ }, { - "name": "expandIntegerPowExpressions", - "display_name": "expand_integer_pow_expressions", + "name": "expand_integer_pow_expressions", "category": "Workarounds", "description": [ "The HLSL optimizer has a bug with optimizing 'pow' in certain integer-valued expressions" @@ -64,8 +58,7 @@ }, { - "name": "flushAfterEndingTransformFeedback", - "display_name": "flush_after_ending_transform_feedback", + "name": "flush_after_ending_transform_feedback", "category": "Workarounds", "description": [ "Some drivers sometimes write out-of-order results to StreamOut buffers when transform ", @@ -74,8 +67,7 @@ }, { - "name": "getDimensionsIgnoresBaseLevel", - "display_name": "get_dimensions_ignores_base_level", + "name": "get_dimensions_ignores_base_level", "category": "Workarounds", "description": [ "Some drivers do not take into account the base level of the ", @@ -84,8 +76,7 @@ }, { - "name": "preAddTexelFetchOffsets", - "display_name": "pre_add_texel_fetch_offsets", + "name": "pre_add_texel_fetch_offsets", "category": "Workarounds", "description": [ "HLSL's function texture.Load returns 0 when the parameter Location is negative, even if ", @@ -94,8 +85,7 @@ }, { - "name": "emulateTinyStencilTextures", - "display_name": "emulate_tiny_stencil_textures", + "name": "emulate_tiny_stencil_textures", "category": "Workarounds", "description": [ "1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly" @@ -103,8 +93,7 @@ }, { - "name": "disableB5G6R5Support", - "display_name": "disable_b5g6r5_support", + "name": "disable_B5G6R5_support", "category": "Workarounds", "description": [ "Textures with the format ", @@ -113,8 +102,7 @@ }, { - "name": "rewriteUnaryMinusOperator", - "display_name": "rewrite_unary_minus_operator", + "name": "rewrite_unary_minus_operator", "category": "Workarounds", "description": [ "Evaluating unary minus operator on integer may get wrong answer in vertex shaders" @@ -122,8 +110,7 @@ }, { - "name": "emulateIsnanFloat", - "display_name": "emulate_isnan_float", + "name": "emulate_isnan_float", "category": "Workarounds", "description": [ "Using isnan() on highp float will get wrong answer" @@ -132,8 +119,7 @@ }, { - "name": "callClearTwice", - "display_name": "call_clear_twice", + "name": "call_clear_twice", "category": "Workarounds", "description": [ "Using clear() may not take effect" @@ -142,8 +128,7 @@ }, { - "name": "useSystemMemoryForConstantBuffers", - "display_name": "use_system_memory_for_constant_buffers", + "name": "use_system_memory_for_constant_buffers", "category": "Workarounds", "description": [ "Copying from staging storage to constant buffer ", @@ -153,8 +138,7 @@ }, { - "name": "selectViewInGeometryShader", - "display_name": "select_view_in_geometry_shader", + "name": "select_view_in_geometry_shader", "category": "Workarounds", "description": [ "The viewport or render target slice will be selected in the geometry shader stage for ", @@ -163,8 +147,7 @@ }, { - "name": "addMockTextureNoRenderTarget", - "display_name": "add_mock_texture_no_render_target", + "name": "add_mock_texture_no_render_target", "category": "Workarounds", "description": [ "On some drivers when rendering with no render target, two bugs lead to incorrect behavior" @@ -173,8 +156,7 @@ }, { - "name": "skipVSConstantRegisterZero", - "display_name": "skip_vs_constant_register_zero", + "name": "skip_VS_constant_register_zero", "category": "Workarounds", "description": [ "In specific cases the driver doesn't handle constant register zero correctly" @@ -182,8 +164,7 @@ }, { - "name": "forceAtomicValueResolution", - "display_name": "force_atomic_value_resolution", + "name": "force_atomic_value_resolution", "category": "Workarounds", "description": [ "On some drivers the return value from RWByteAddressBuffer.InterlockedAdd does not resolve ", @@ -193,8 +174,7 @@ }, { - "name": "allowClearForRobustResourceInit", - "display_name": "allow_clear_for_robust_resource_init", + "name": "allow_clear_for_robust_resource_init", "category": "Workarounds", "description": [ "Some drivers corrupt texture data when clearing for robust resource initialization." @@ -203,8 +183,7 @@ }, { - "name": "allowTranslateUniformBlockToStructuredBuffer", - "display_name": "allow_translate_uniform_block_to_structured_buffer", + "name": "allow_translate_uniform_block_to_structured_buffer", "category": "Workarounds", "description": [ "There is a slow fxc compile performance issue with dynamic uniform indexing if ", @@ -214,8 +193,7 @@ }, { - "name": "allowES3OnFL10_0", - "display_name": "allowES3OnFL10_0", + "name": "allow_ES3_on_FL10_0", "category": "Workarounds", "description": [ "Allow ES3 on 10.0 devices" diff --git a/include/platform/frontend_features.json b/include/platform/frontend_features.json index 5f7ef32fb9..b391a4494a 100644 --- a/include/platform/frontend_features.json +++ b/include/platform/frontend_features.json @@ -9,8 +9,7 @@ ], "features": [ { - "name": "loseContextOnOutOfMemory", - "display_name": "lose_context_on_out_of_memory", + "name": "lose_context_on_out_of_memory", "category": "Workarounds", "description": [ "Some users rely on a lost context notification if a GL_OUT_OF_MEMORY error occurs" @@ -18,8 +17,7 @@ }, { - "name": "disableProgramCachingForTransformFeedback", - "display_name": "disable_program_caching_for_transform_feedback", + "name": "disable_program_caching_for_transform_feedback", "category": "Workarounds", "description": [ "On some GPUs, program binaries don't contain transform feedback varyings" @@ -27,8 +25,7 @@ }, { - "name": "scalarizeVecAndMatConstructorArgs", - "display_name": "scalarize_vec_and_mat_constructor_args", + "name": "scalarize_vec_and_mat_constructor_args", "category": "Workarounds", "description": [ "Always rewrite vec/mat constructors to be consistent" @@ -37,8 +34,7 @@ }, { - "name": "disableProgramBinary", - "display_name": "disable_program_binary", + "name": "disable_program_binary", "category": "Features", "description": [ "Disable support for GL_OES_get_program_binary" @@ -47,8 +43,7 @@ }, { - "name": "disableAnisotropicFiltering", - "display_name": "disable_anisotropic_filtering", + "name": "disable_anisotropic_filtering", "category": "Workarounds", "description": [ "Disable support for anisotropic filtering" @@ -56,8 +51,7 @@ }, { - "name": "allowCompressedFormats", - "display_name": "allow_compressed_formats", + "name": "allow_compressed_formats", "category": "Workarounds", "description": [ "Allow compressed formats" @@ -65,8 +59,7 @@ }, { - "name": "captureLimits", - "display_name": "enable_capture_limits", + "name": "enable_capture_limits", "category": "Features", "description": [ "Set the context limits like frame capturing was enabled" @@ -75,8 +68,7 @@ }, { - "name": "enableCompressingPipelineCacheInThreadPool", - "display_name": "enableCompressingPipelineCacheInThreadPool", + "name": "enable_compressing_pipeline_cache_in_thread_pool", "category": "Workarounds", "description": [ "Enable compressing pipeline cache in thread pool." @@ -85,8 +77,7 @@ }, { - "name": "forceRobustResourceInit", - "display_name": "forceRobustResourceInit", + "name": "force_robust_resource_init", "category": "Features", "description": [ "Force-enable robust resource init" @@ -95,8 +86,7 @@ }, { - "name": "forceInitShaderVariables", - "display_name": "forceInitShaderVariables", + "name": "force_init_shader_variables", "category": "Features", "description": [ "Force-enable shader variable initialization" @@ -104,8 +94,7 @@ }, { - "name": "enableProgramBinaryForCapture", - "display_name": "enableProgramBinaryForCapture", + "name": "enable_program_binary_for_capture", "category": "Features", "description": [ "Even if FrameCapture is enabled, enable GL_OES_get_program_binary" diff --git a/include/platform/gen_features.py b/include/platform/gen_features.py index 74d30c8306..4156c73e2a 100755 --- a/include/platform/gen_features.py +++ b/include/platform/gen_features.py @@ -11,6 +11,7 @@ from collections import namedtuple import json import os +import re import sys feature_files = { @@ -52,7 +53,7 @@ inline {name}::~{name}() = default; #endif // ANGLE_PLATFORM_{NAME}_H_ """ -template_feature = u"""FeatureInfo {name} = {{ +template_feature = u"""FeatureInfo {var_name} = {{ "{display_name}", FeatureCategory::{category}, {description}, &members, {issue} @@ -90,7 +91,7 @@ ANGLE_UTIL_EXPORT extern const char *GetFeatureName(Feature feature); #endif // ANGLE_SRC_TESTS_TEST_UTILS_ANGLE_FEATURES_AUTOGEN_H_ """ -template_feature_enum = u"""{Name},""" +template_feature_enum = u"""{VarName},""" template_feature_list_source = u"""// GENERATED FILE - DO NOT EDIT. // Generated by {script_name} using data from {input_file_name}. @@ -122,7 +123,11 @@ const char *GetFeatureName(Feature feature) }} // namespace angle """ -template_feature_string = u"""{{Feature::{Name}, "{display_name}"}},""" +template_feature_string = u"""{{Feature::{VarName}, "{display_name}"}},""" + + +def make_camel_case(json_name): + return re.sub('_(.)', lambda m: m.group(1).upper(), json_name) def main(): @@ -145,11 +150,13 @@ def main(): # Go over the list of features and write the header file that declares the features struct for feature_json in features_json: - name = feature_json['name'] - display_name = feature_json['display_name'] + json_name = feature_json['name'] + var_name = make_camel_case(json_name) + # Use the same (camelCase) name for display as well + display_name = var_name issue = feature_json.get('issue', None) feature = template_feature.format( - name=name, + var_name=var_name, display_name=display_name, category=category_prefix + feature_json['category'], description='\n'.join('"' + line + '"' for line in feature_json['description']), @@ -158,12 +165,8 @@ def main(): features.append(feature) # Keep track of the feature names. Sometimes the same feature name is present in - # multiple backends. That's ok for the purposes of feature overriding as long as the - # display names match. - if name in name_map: - assert (display_name == name_map[name]) - else: - name_map[name] = display_name + # multiple backends. That's ok for the purposes of feature overriding. + name_map[var_name] = display_name description = '\n'.join(['// ' + line for line in src['description']]) name = header_file[:-2] @@ -183,13 +186,13 @@ def main(): # Generate helpers for use by tests to override a feature or not. feature_enums = [] feature_strings = [] - for name, display_name in sorted(name_map.items()): - Name = name[0].upper() + name[1:] + for var_name, display_name in sorted(name_map.items(), key=lambda item: item[0].lower()): + VarName = var_name[0].upper() + var_name[1:] - feature_enums.append(template_feature_enum.format(Name=Name)) + feature_enums.append(template_feature_enum.format(VarName=VarName)) feature_strings.append( - template_feature_string.format(Name=Name, display_name=display_name)) + template_feature_string.format(VarName=VarName, display_name=display_name)) with open(feature_list_header_file, 'w') as fout: fout.write( diff --git a/include/platform/gl_features.json b/include/platform/gl_features.json index 6f798b565a..0f319612fb 100644 --- a/include/platform/gl_features.json +++ b/include/platform/gl_features.json @@ -8,8 +8,7 @@ ], "features": [ { - "name": "avoid1BitAlphaTextureFormats", - "display_name": "avoid_1_bit_alpha_texture_formats", + "name": "avoid_1_bit_alpha_texture_formats", "category": "Workarounds", "description": [ "Issue with 1-bit alpha framebuffer formats" @@ -17,8 +16,7 @@ }, { - "name": "rgba4IsNotSupportedForColorRendering", - "display_name": "rgba4_is_not_supported_for_color_rendering", + "name": "RGBA4_is_not_supported_for_color_rendering", "category": "Workarounds", "description": [ "GL_RGBA4 is not color renderable" @@ -26,8 +24,7 @@ }, { - "name": "allowEtcFormats", - "display_name": "allow_etc_formats", + "name": "allow_ETC_formats", "category": "Workarounds", "description": [ "Enable ETC2/EAC on desktop OpenGL" @@ -35,8 +32,7 @@ }, { - "name": "doesSRGBClearsOnLinearFramebufferAttachments", - "display_name": "does_srgb_clears_on_linear_framebuffer_attachments", + "name": "does_SRGB_clears_on_linear_framebuffer_attachments", "category": "Workarounds", "description": [ "Issue clearing framebuffers with linear attachments when GL_FRAMEBUFFER_SRGB is enabled" @@ -44,8 +40,7 @@ }, { - "name": "doWhileGLSLCausesGPUHang", - "display_name": "do_while_glsl_causes_gpu_hang", + "name": "do_while_GLSL_causes_GPU_hang", "category": "Workarounds", "description": [ "Some GLSL constructs involving do-while loops cause GPU hangs" @@ -54,8 +49,7 @@ }, { - "name": "addBaseVertexToVertexID", - "display_name": "vertex_id_does_not_include_base_vertex", + "name": "vertex_ID_does_not_include_base_vertex", "category": "Workarounds", "description": [ "gl_VertexID in GLSL vertex shader doesn't include base vertex value" @@ -63,8 +57,7 @@ }, { - "name": "finishDoesNotCauseQueriesToBeAvailable", - "display_name": "finish_does_not_cause_queries_to_be_available", + "name": "finish_does_not_cause_queries_to_be_available", "category": "Workarounds", "description": [ "glFinish doesn't cause all queries to report available result" @@ -72,8 +65,7 @@ }, { - "name": "alwaysCallUseProgramAfterLink", - "display_name": "always_call_use_program_after_link", + "name": "always_call_use_program_after_link", "category": "Workarounds", "description": [ "Always call useProgram after a successful link to avoid a driver bug" @@ -82,8 +74,7 @@ }, { - "name": "unpackOverlappingRowsSeparatelyUnpackBuffer", - "display_name": "unpack_overlapping_rows_separately_unpack_buffer", + "name": "unpack_overlapping_rows_separately_unpack_buffer", "category": "Workarounds", "description": [ "In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row" @@ -91,8 +82,7 @@ }, { - "name": "packOverlappingRowsSeparatelyPackBuffer", - "display_name": "pack_overlapping_rows_separately_pack_buffer", + "name": "pack_overlapping_rows_separately_pack_buffer", "category": "Workarounds", "description": [ "In the case of packing to a pixel pack buffer, pack overlapping rows row by row" @@ -100,8 +90,7 @@ }, { - "name": "initializeCurrentVertexAttributes", - "display_name": "initialize_current_vertex_attributes", + "name": "initialize_current_vertex_attributes", "category": "Workarounds", "description": [ "During initialization, assign the current vertex attributes to the spec-mandated defaults" @@ -109,8 +98,7 @@ }, { - "name": "emulateAbsIntFunction", - "display_name": "emulate_abs_int_function", + "name": "emulate_abs_int_function", "category": "Workarounds", "description": [ "abs(i) where i is an integer returns unexpected result" @@ -119,8 +107,7 @@ }, { - "name": "addAndTrueToLoopCondition", - "display_name": "add_and_true_to_loop_condition", + "name": "add_and_true_to_loop_condition", "category": "Workarounds", "description": [ "Calculation of loop conditions in for and while loop has bug" @@ -128,8 +115,7 @@ }, { - "name": "unpackLastRowSeparatelyForPaddingInclusion", - "display_name": "unpack_last_row_separately_for_padding_inclusion", + "name": "unpack_last_row_separately_for_padding_inclusion", "category": "Workarounds", "description": [ "When uploading textures from an unpack buffer, some drivers count an extra row padding" @@ -138,8 +124,7 @@ }, { - "name": "packLastRowSeparatelyForPaddingInclusion", - "display_name": "pack_last_row_separately_for_padding_inclusion", + "name": "pack_last_row_separately_for_padding_inclusion", "category": "Workarounds", "description": [ "When uploading textures from an pack buffer, some drivers count an extra row padding" @@ -148,8 +133,7 @@ }, { - "name": "emulateIsnanFloat", - "display_name": "emulate_isnan_float", + "name": "emulate_isnan_float", "category": "Workarounds", "description": [ "Using isnan() on highp float will get wrong answer" @@ -158,8 +142,7 @@ }, { - "name": "useUnusedBlocksWithStandardOrSharedLayout", - "display_name": "use_unused_blocks_with_standard_or_shared_layout", + "name": "use_unused_blocks_with_standard_or_shared_layout", "category": "Workarounds", "description": [ "Unused std140 or shared uniform blocks will be treated as inactive" @@ -167,8 +150,7 @@ }, { - "name": "removeInvariantAndCentroidForESSL3", - "display_name": "remove_invarient_and_centroid_for_essl3", + "name": "remove_invariant_and_centroid_for_ESSL3", "category": "Workarounds", "description": [ "Fix spec difference between GLSL 4.1 or lower and ESSL3" @@ -176,8 +158,7 @@ }, { - "name": "rewriteFloatUnaryMinusOperator", - "display_name": "rewrite_float_unary_minus_operator", + "name": "rewrite_float_unary_minus_operator", "category": "Workarounds", "description": [ "Using '-<float>' will get wrong answer" @@ -186,8 +167,7 @@ }, { - "name": "emulateAtan2Float", - "display_name": "emulate_atan_2_float", + "name": "emulate_atan_2_float", "category": "Workarounds", "description": [ "atan(y, x) may return a wrong answer" @@ -196,8 +176,7 @@ }, { - "name": "reapplyUBOBindingsAfterUsingBinaryProgram", - "display_name": "reapply_ubo_bindings_after_using_binary_program", + "name": "reapply_UBO_bindings_after_using_binary_program", "category": "Workarounds", "description": [ "Some drivers forget about UBO bindings when using program binaries" @@ -206,8 +185,7 @@ }, { - "name": "emulateMaxVertexAttribStride", - "display_name": "emulate_max_vertex_attrib_stride", + "name": "emulate_max_vertex_attrib_stride", "category": "Workarounds", "description": [ "Some drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried" @@ -216,8 +194,7 @@ }, { - "name": "dontInitializeUninitializedLocals", - "display_name": "dont_initialize_uninitialized_locals", + "name": "dont_initialize_uninitialized_locals", "category": "Workarounds", "description": [ "Initializing uninitialized locals caused odd behavior in a few WebGL 2 tests" @@ -226,8 +203,7 @@ }, { - "name": "clampPointSize", - "display_name": "clamp_point_size", + "name": "clamp_point_size", "category": "Workarounds", "description": [ "The point size range reported from the API is inconsistent with the actual behavior" @@ -235,8 +211,7 @@ }, { - "name": "dontUseLoopsToInitializeVariables", - "display_name": "dont_use_loops_to_initialize_variables", + "name": "dont_use_loops_to_initialize_variables", "category": "Workarounds", "description": [ "For loops used to initialize variables hit native GLSL compiler bugs" @@ -245,8 +220,7 @@ }, { - "name": "clampFragDepth", - "display_name": "clamp_frag_depth", + "name": "clamp_frag_depth", "category": "Workarounds", "description": [ "gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer" @@ -254,8 +228,7 @@ }, { - "name": "rewriteRepeatedAssignToSwizzled", - "display_name": "rewrite_repeated_assign_to_swizzled", + "name": "rewrite_repeated_assign_to_swizzled", "category": "Workarounds", "description": [ "Repeated assignment to swizzled values inside a ", @@ -264,8 +237,7 @@ }, { - "name": "disableBlendFuncExtended", - "display_name": "disable_blend_func_extended", + "name": "disable_blend_func_extended", "category": "Workarounds", "description": [ "ARB_blend_func_extended does not pass the tests" @@ -274,8 +246,7 @@ }, { - "name": "unsizedsRGBReadPixelsDoesntTransform", - "display_name": "unsized_srgb_read_pixels_doesnt_transform", + "name": "unsized_SRGB_read_pixels_doesnt_transform", "category": "Workarounds", "description": [ "Drivers returning raw sRGB values instead of linearized values when calling glReadPixels ", @@ -285,8 +256,7 @@ }, { - "name": "queryCounterBitsGeneratesErrors", - "display_name": "query_counter_bits_generates_errors", + "name": "query_counter_bits_generates_errors", "category": "Workarounds", "description": [ "Drivers generate errors when querying the number of bits in timer queries" @@ -295,8 +265,7 @@ }, { - "name": "dontRelinkProgramsInParallel", - "display_name": "dont_relink_programs_in_parallel", + "name": "dont_relink_programs_in_parallel", "category": "Workarounds", "description": [ "Relinking a program in parallel is buggy" @@ -305,8 +274,7 @@ }, { - "name": "disableWorkerContexts", - "display_name": "disable_worker_contexts", + "name": "disable_worker_contexts", "category": "Workarounds", "description": [ "Some tests have been seen to fail using worker contexts" @@ -315,8 +283,7 @@ }, { - "name": "limitMaxTextureSizeTo4096", - "display_name": "max_texture_size_limit_4096", + "name": "limit_max_texture_size_to_4096", "category": "Workarounds", "description": [ "Limit max texture size to 4096 to avoid frequent ", @@ -326,8 +293,7 @@ }, { - "name": "limitMaxMSAASamplesTo4", - "display_name": "max_msaa_sample_count_4", + "name": "limit_max_MSAA_samples_to_4", "category": "Workarounds", "description": [ "Various rendering bugs have been observed when using higher MSAA counts" @@ -336,8 +302,7 @@ }, { - "name": "allowClearForRobustResourceInit", - "display_name": "allow_clear_for_robust_resource_init", + "name": "allow_clear_for_robust_resource_init", "category": "Workarounds", "description": [ "Using glClear for robust resource initialization is buggy on some drivers and leads to ", @@ -347,8 +312,7 @@ }, { - "name": "clampArrayAccess", - "display_name": "clamp_array_access", + "name": "clamp_array_access", "category": "Workarounds", "description": [ "Clamp uniform array access to avoid reading invalid memory." @@ -357,8 +321,7 @@ }, { - "name": "resetTexImage2DBaseLevel", - "display_name": "reset_teximage2d_base_level", + "name": "reset_TexImage2D_base_level", "category": "Workarounds", "description": [ "Reset texture base level before calling glTexImage2D to ", @@ -368,8 +331,7 @@ }, { - "name": "clearToZeroOrOneBroken", - "display_name": "clear_to_zero_or_one_broken", + "name": "clear_to_zero_or_one_broken", "category": "Workarounds", "description": [ "Clears when the clear color is all zeros or ones do not work." @@ -378,8 +340,7 @@ }, { - "name": "limitMax3dArrayTextureSizeTo1024", - "display_name": "max_3d_array_texture_size_1024", + "name": "limit_max_3d_array_texture_size_to_1024", "category": "Workarounds", "description": [ "Limit max 3d texture size and max array texture layers to 1024 to avoid system hang" @@ -388,8 +349,7 @@ }, { - "name": "adjustSrcDstRegionBlitFramebuffer", - "display_name": "adjust_src_dst_region_for_blitframebuffer", + "name": "adjust_src_dst_region_for_BlitFramebuffer", "category": "Workarounds", "description": [ "Many platforms have issues with blitFramebuffer when the parameters are large." @@ -398,8 +358,7 @@ }, { - "name": "clipSrcRegionBlitFramebuffer", - "display_name": "clip_src_region_for_blitframebuffer", + "name": "clip_src_region_for_BlitFramebuffer", "category": "Workarounds", "description": [ "Issues with blitFramebuffer when the parameters don't match the framebuffer size." @@ -408,8 +367,7 @@ }, { - "name": "rgbDXT1TexturesSampleZeroAlpha", - "display_name": "rgb_dxt1_textures_sample_zero_alpha", + "name": "RGB_DXT1_textures_sample_zero_alpha", "category": "Workarounds", "description": [ "Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac." @@ -418,8 +376,7 @@ }, { - "name": "unfoldShortCircuits", - "display_name": "unfold_short_circuits", + "name": "unfold_short_circuits", "category": "Workarounds", "description": [ "Mac incorrectly executes both sides of && and || expressions when they should ", @@ -429,8 +386,7 @@ }, { - "name": "emulatePrimitiveRestartFixedIndex", - "display_name": "emulate_primitive_restart_fixed_index", + "name": "emulate_primitive_restart_fixed_index", "category": "Workarounds", "description": [ "When GL_PRIMITIVE_RESTART_FIXED_INDEX is not available, emulate it with ", @@ -440,8 +396,7 @@ }, { - "name": "setPrimitiveRestartFixedIndexForDrawArrays", - "display_name": "set_primitive_restart_fixed_index_for_draw_arrays", + "name": "set_primitive_restart_fixed_index_for_draw_arrays", "category": "Workarounds", "description": [ "Some drivers discard vertex data in DrawArrays calls when the fixed primitive restart ", @@ -451,8 +406,7 @@ }, { - "name": "removeDynamicIndexingOfSwizzledVector", - "display_name": "remove_dynamic_indexing_of_swizzled_vector", + "name": "remove_dynamic_indexing_of_swizzled_vector", "category": "Workarounds", "description": [ "Dynamic indexing of swizzled l-values doesn't work correctly on various platforms." @@ -461,8 +415,7 @@ }, { - "name": "preAddTexelFetchOffsets", - "display_name": "pre_add_texel_fetch_offsets", + "name": "pre_add_texel_fetch_offsets", "category": "Workarounds", "description": [ "Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid ", @@ -474,8 +427,7 @@ }, { - "name": "regenerateStructNames", - "display_name": "regenerate_struct_names", + "name": "regenerate_struct_names", "category": "Workarounds", "description": [ "All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct", @@ -485,8 +437,7 @@ }, { - "name": "readPixelsUsingImplementationColorReadFormatForNorm16", - "display_name": "read_pixels_using_implementation_color_read_format", + "name": "read_pixels_using_implementation_color_read_format_for_norm16", "category": "Workarounds", "description": [ "Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from ", @@ -496,8 +447,7 @@ }, { - "name": "flushBeforeDeleteTextureIfCopiedTo", - "display_name": "flush_before_delete_texture_if_copied_to", + "name": "flush_before_delete_texture_if_copied_to", "category": "Workarounds", "description": [ "Some drivers track CopyTex{Sub}Image texture dependencies incorrectly. Flush", @@ -507,8 +457,7 @@ }, { - "name": "rewriteRowMajorMatrices", - "display_name": "rewrite_row_major_matrices", + "name": "rewrite_row_major_matrices", "category": "Workarounds", "description": [ "Rewrite row major matrices in shaders as column major as a driver bug workaround" @@ -517,8 +466,7 @@ }, { - "name": "disableDrawBuffersIndexed", - "display_name": "disable_draw_buffers_indexed", + "name": "disable_draw_buffers_indexed", "category": "Workarounds", "description": [ "Disable OES_draw_buffers_indexed extension." @@ -526,8 +474,7 @@ }, { - "name": "disableSemaphoreFd", - "display_name": "disable_semaphore_fd", + "name": "disable_semaphore_fd", "category": "Workarounds", "description": [ "Disable GL_EXT_semaphore_fd extension" @@ -536,8 +483,7 @@ }, { - "name": "disableTimestampQueries", - "display_name": "disable_timestamp_queries", + "name": "disable_timestamp_queries", "category": "Workarounds", "description": [ "Disable GL_EXT_disjoint_timer_query extension" @@ -546,8 +492,7 @@ }, { - "name": "encodeAndDecodeSRGBForGenerateMipmap", - "display_name": "decode_encode_srgb_for_generatemipmap", + "name": "decode_encode_SRGB_for_GenerateMipmap", "category": "Workarounds", "description": [ "Decode and encode before generateMipmap for srgb format textures." @@ -556,8 +501,7 @@ }, { - "name": "emulateCopyTexImage2DFromRenderbuffers", - "display_name": "emulate_copyteximage2d_from_renderbuffers", + "name": "emulate_CopyTexImage2D_from_renderbuffers", "category": "Workarounds", "description": [ "CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers." @@ -566,8 +510,7 @@ }, { - "name": "disableGPUSwitchingSupport", - "display_name": "disable_gpu_switching_support", + "name": "disable_GPU_switching_support", "category": "Workarounds", "description": [ "Disable GPU switching support (use only the low-power GPU) on older MacBook Pros." @@ -576,8 +519,7 @@ }, { - "name": "disableNativeParallelCompile", - "display_name": "disable_native_parallel_compile", + "name": "disable_native_parallel_compile", "category": "Workarounds", "description": [ "Do not use native KHR_parallel_shader_compile even when available." @@ -586,8 +528,7 @@ }, { - "name": "emulatePackSkipRowsAndPackSkipPixels", - "display_name": "emulate_pack_skip_rows_and_pack_skip_pixels", + "name": "emulate_pack_skip_rows_and_pack_skip_pixels", "category": "Workarounds", "description": [ "GL_PACK_SKIP_ROWS and GL_PACK_SKIP_PIXELS are ignored in Apple's OpenGL driver." @@ -596,8 +537,7 @@ }, { - "name": "clampMscRate", - "display_name": "clamp_msc_rate", + "name": "clamp_msc_rate", "category": "Workarounds", "description": [ "Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz" @@ -606,8 +546,7 @@ }, { - "name": "bindTransformFeedbackBufferBeforeBindBufferRange", - "display_name": "bind_transform_feedback_buffer_before_bind_buffer_range", + "name": "bind_transform_feedback_buffer_before_bind_buffer_range", "category": "Workarounds", "description": [ "Bind transform feedback buffers to the generic binding point before calling ", @@ -617,8 +556,7 @@ }, { - "name": "disableSyncControlSupport", - "display_name": "disable_sync_control_support", + "name": "disable_sync_control_support", "category": "Workarounds", "description": [ "Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders ", @@ -628,8 +566,7 @@ }, { - "name": "keepBufferShadowCopy", - "display_name": "keep_buffer_shadow_copy", + "name": "keep_buffer_shadow_copy", "category": "Workarounds", "description": [ "Maintain a shadow copy of buffer data when the GL API does not permit reading data back." @@ -637,8 +574,7 @@ }, { - "name": "setZeroLevelBeforeGenerateMipmap", - "display_name": "set_zero_level_before_generating_mipmap", + "name": "set_zero_level_before_GenerateMipmap", "category": "Workarounds", "description": [ "glGenerateMipmap fails if the zero texture level is not set on some Mac drivers." @@ -646,8 +582,7 @@ }, { - "name": "promotePackedFormatsTo8BitPerChannel", - "display_name": "promote_packed_formats_to_8_bit_per_channel", + "name": "promote_packed_formats_to_8_bit_per_channel", "category": "Workarounds", "description": [ "Packed color formats are buggy on Macs with AMD GPUs" @@ -656,8 +591,7 @@ }, { - "name": "initFragmentOutputVariables", - "display_name": "init_fragment_output_variables", + "name": "init_fragment_output_variables", "category": "Workarounds", "description": [ "No init gl_FragColor causes context lost" @@ -666,8 +600,7 @@ }, { - "name": "shiftInstancedArrayDataWithExtraOffset", - "display_name": "shift_instanced_array_data_with_offset", + "name": "shift_instanced_array_data_with_offset", "category": "Workarounds", "description": [ "glDrawArraysInstanced is buggy on certain new Mac Intel GPUs" @@ -676,8 +609,7 @@ }, { - "name": "syncVertexArraysToDefault", - "display_name": "sync_vertex_arrays_to_default", + "name": "sync_vertex_arrays_to_default", "category": "Workarounds", "description": [ "Only use the default VAO because of missing support or driver bugs" @@ -686,8 +618,7 @@ }, { - "name": "sanitizeAmdGpuRendererString", - "display_name": "sanitize_amdgpu_renderer_string", + "name": "sanitize_AMDGPU_renderer_string", "category": "Workarounds", "description": [ "Strip precise kernel and DRM version information from amdgpu renderer strings." @@ -696,8 +627,7 @@ }, { - "name": "unbindFBOOnContextSwitch", - "display_name": "unbind_fbo_before_switching_context", + "name": "unbind_FBO_before_switching_context", "category": "Workarounds", "description": [ "Imagination GL drivers are buggy with context switching." @@ -706,8 +636,7 @@ }, { - "name": "flushOnFramebufferChange", - "display_name": "flush_on_framebuffer_change", + "name": "flush_on_framebuffer_change", "category": "Workarounds", "description": [ "Switching framebuffers without a flush can lead to ", @@ -717,8 +646,7 @@ }, { - "name": "disableMultisampledRenderToTexture", - "display_name": "disable_mutlisampled_render_to_texture", + "name": "disable_multisampled_render_to_texture", "category": "Workarounds", "description": [ "Many drivers have bugs when using GL_EXT_multisampled_render_to_texture" @@ -727,8 +655,7 @@ }, { - "name": "uploadTextureDataInChunks", - "display_name": "chunked_texture_upload", + "name": "upload_texture_data_in_chunks", "category": "Workarounds", "description": [ "Upload texture data in <120kb chunks to work around Mac driver hangs and crashes." @@ -737,8 +664,7 @@ }, { - "name": "emulateImmutableCompressedTexture3D", - "display_name": "emulate_immutable_compressed_texture_3d", + "name": "emulate_immutable_compressed_texture_3D", "category": "Workarounds", "description": [ "Use non-immutable texture allocation to work around a driver bug." @@ -747,8 +673,7 @@ }, { - "name": "emulateRGB10", - "display_name": "emulate_rgb10", + "name": "emulate_RGB10", "category": "Workarounds", "description": [ "Emulate RGB10 support using RGB10_A2." @@ -757,8 +682,7 @@ }, { - "name": "alwaysUnbindFramebufferTexture2D", - "display_name": "always_unbind_framebuffer_texture_2d", + "name": "always_unbind_framebuffer_texture_2D", "category": "Workarounds", "description": [ "Force unbind framebufferTexture2D before binding renderbuffer to work around driver bug." diff --git a/include/platform/mtl_features.json b/include/platform/mtl_features.json index 2f2ae3ffe2..1e95bda13d 100644 --- a/include/platform/mtl_features.json +++ b/include/platform/mtl_features.json @@ -8,8 +8,7 @@ ], "features": [ { - "name": "hasBaseVertexInstancedDraw", - "display_name": "has_base_vertex_instanced_draw", + "name": "has_base_vertex_instanced_draw", "category": "Features", "description": [ "The renderer supports base vertex instanced draw" @@ -17,8 +16,7 @@ }, { - "name": "hasExplicitMemBarrier", - "display_name": "has_explicit_mem_barrier_mtl", + "name": "has_explicit_mem_barrier", "category": "Features", "description": [ "The renderer supports explicit memory barrier" @@ -26,8 +24,7 @@ }, { - "name": "hasCheapRenderPass", - "display_name": "has_cheap_render_pass_mtl", + "name": "has_cheap_render_pass", "category": "Features", "description": [ "The renderer can cheaply break a render pass." @@ -35,8 +32,7 @@ }, { - "name": "hasNonUniformDispatch", - "display_name": "has_non_uniform_dispatch", + "name": "has_non_uniform_dispatch", "category": "Features", "description": [ "The renderer supports non uniform compute shader dispatch's group size" @@ -44,8 +40,7 @@ }, { - "name": "hasStencilOutput", - "display_name": "has_shader_stencil_output", + "name": "has_shader_stencil_output", "category": "Features", "description": [ "The renderer supports stencil output from fragment shader" @@ -53,8 +48,7 @@ }, { - "name": "hasTextureSwizzle", - "display_name": "has_texture_swizzle", + "name": "has_texture_swizzle", "category": "Features", "description": [ "The renderer supports texture swizzle" @@ -62,8 +56,7 @@ }, { - "name": "hasDepthAutoResolve", - "display_name": "has_msaa_depth_auto_resolve", + "name": "has_depth_auto_resolve", "category": "Features", "description": [ "The renderer supports MSAA depth auto resolve at the end of render pass" @@ -71,8 +64,7 @@ }, { - "name": "hasStencilAutoResolve", - "display_name": "has_msaa_stencil_auto_resolve", + "name": "has_stencil_auto_resolve", "category": "Features", "description": [ "The renderer supports MSAA stencil auto resolve at the end of render pass" @@ -80,8 +72,7 @@ }, { - "name": "hasEvents", - "display_name": "has_mtl_events", + "name": "has_events", "category": "Features", "description": [ "The renderer supports MTL(Shared)Event" @@ -89,8 +80,7 @@ }, { - "name": "allowInlineConstVertexData", - "display_name": "allow_inline_const_vertex_data", + "name": "allow_inline_const_vertex_data", "category": "Features", "description": [ "The renderer supports using inline constant data for small client vertex data" @@ -98,8 +88,7 @@ }, { - "name": "allowSeparatedDepthStencilBuffers", - "display_name": "allow_separate_depth_stencil_buffers", + "name": "allow_separate_depth_stencil_buffers", "category": "Features", "description": [ "Some Apple platforms such as iOS allows separate depth and stencil buffers, ", @@ -108,8 +97,7 @@ }, { - "name": "allowRuntimeSamplerCompareMode", - "display_name": "allow_runtime_sampler_compare_mode", + "name": "allow_runtime_sampler_compare_mode", "category": "Features", "description": [ "The renderer supports changing sampler's compare mode outside shaders" @@ -117,8 +105,7 @@ }, { - "name": "allowSamplerCompareGradient", - "display_name": "allow_sampler_compare_gradient", + "name": "allow_sampler_compare_gradient", "category": "Features", "description": [ "The renderer supports sample_compare with gradients" @@ -126,8 +113,7 @@ }, { - "name": "allowSamplerCompareLod", - "display_name": "allow_sampler_compare_lod", + "name": "allow_sampler_compare_lod", "category": "Features", "description": [ "The renderer supports sample_compare with lod" @@ -135,8 +121,7 @@ }, { - "name": "allowBufferReadWrite", - "display_name": "allow_buffer_read_write", + "name": "allow_buffer_read_write", "category": "Features", "description": [ "The renderer supports buffer read and write in the same shader" @@ -144,8 +129,7 @@ }, { - "name": "allowMultisampleStoreAndResolve", - "display_name": "allow_msaa_store_and_resolve", + "name": "allow_multisample_store_and_resolve", "category": "Features", "description": [ "The renderer supports MSAA store and resolve in the same pass" @@ -153,8 +137,7 @@ }, { - "name": "allowGenMultipleMipsPerPass", - "display_name": "gen_multiple_mips_per_pass", + "name": "allow_gen_multiple_mips_per_pass", "category": "Features", "description": [ "The renderer supports generating multiple mipmaps per pass" @@ -162,8 +145,7 @@ }, { - "name": "forceD24S8AsUnsupported", - "display_name": "force_d24s8_as_unsupported", + "name": "force_D24S8_as_unsupported", "category": "Features", "description": [ "Force Depth24Stencil8 format as unsupported." @@ -171,8 +153,7 @@ }, { - "name": "forceBufferGPUStorage", - "display_name": "force_buffer_gpu_storage", + "name": "force_buffer_GPU_storage", "category": "Features", "description": [ "On systems that support both buffer' memory allocation on GPU and shared memory (such as ", @@ -181,8 +162,7 @@ }, { - "name": "directMetalGeneration", - "display_name": "directMetalGeneration", + "name": "direct_metal_generation", "category": "Features", "description": [ "Direct translation to Metal." @@ -191,8 +171,7 @@ }, { - "name": "forceNonCSBaseMipmapGeneration", - "display_name": "force_non_cs_mipmap_gen", + "name": "force_non_CS_base_mipmap_generation", "category": "Features", "description": [ "Turn this feature on to disallow Compute Shader based mipmap generation. Compute Shader ", @@ -201,8 +180,7 @@ }, { - "name": "emulateTransformFeedback", - "display_name": "emulateTransformFeedback", + "name": "emulate_transform_feedback", "category": "Features", "description": [ "Turn this on to allow transform feedback in Metal using a 2-pass VS for GLES3." @@ -210,8 +188,7 @@ }, { - "name": "rewriteRowMajorMatrices", - "display_name": "rewrite_row_major_matrices", + "name": "rewrite_row_major_matrices", "category": "Features", "description": [ "Rewrite row major matrices in shaders as column major." @@ -219,8 +196,7 @@ }, { - "name": "intelExplicitBoolCastWorkaround", - "display_name": "intel_explicit_bool_cast_workaround", + "name": "intel_explicit_bool_cast_workaround", "category": "Workarounds", "description": [ "Insert explicit casts for float/double/unsigned/signed int on macOS 10.15 with Intel ", @@ -229,8 +205,7 @@ }, { - "name": "intelDisableFastMath", - "display_name": "intel_disable_fast_math", + "name": "intel_disable_fast_math", "category": "Workarounds", "description": [ "Disable fast math in atan and invariance cases when running below macOS 12.0" @@ -238,8 +213,7 @@ }, { - "name": "multisampleColorFormatShaderReadWorkaround", - "display_name": "multisample_color_format_shader_read_workaround", + "name": "multisample_color_format_shader_read_workaround", "category": "Workarounds", "description": [ "Add shaderRead usage to some multisampled texture formats" @@ -248,8 +222,7 @@ }, { - "name": "copyIOSurfaceToNonIOSurfaceForReadOptimization", - "display_name": "copy_iosurface_to_non_iosurface_for_read_optimization", + "name": "copy_IOSurface_to_non_IOSurface_for_read_optimization", "category": "Workarounds", "description": [ "some GPUs are faster to read an IOSurface texture by first copying the texture to a ", diff --git a/include/platform/vk_features.json b/include/platform/vk_features.json index b474a5958c..1ca9d8b8c1 100644 --- a/include/platform/vk_features.json +++ b/include/platform/vk_features.json @@ -8,8 +8,7 @@ ], "features": [ { - "name": "basicGLLineRasterization", - "display_name": "basicGLLineRasterization", + "name": "basic_GL_line_rasterization", "category": "Features", "description": [ "Enable the use of pixel shader patching to implement OpenGL basic line ", @@ -18,8 +17,7 @@ }, { - "name": "bresenhamLineRasterization", - "display_name": "bresenhamLineRasterization", + "name": "bresenham_line_rasterization", "category": "Features", "description": [ "Enable Bresenham line rasterization via VK_EXT_line_rasterization extension" @@ -27,8 +25,7 @@ }, { - "name": "provokingVertex", - "display_name": "provokingVertex", + "name": "provoking_vertex", "category": "Features", "description": [ "Enable provoking vertex mode via VK_EXT_provoking_vertex extension" @@ -36,8 +33,7 @@ }, { - "name": "forceFallbackFormat", - "display_name": "forceFallbackFormat", + "name": "force_fallback_format", "category": "Workarounds", "description": [ "Force a fallback format for angle_end2end_tests" @@ -45,8 +41,7 @@ }, { - "name": "clampPointSize", - "display_name": "clamp_point_size", + "name": "clamp_point_size", "category": "Workarounds", "description": [ "The point size range reported from the API is inconsistent with the actual behavior" @@ -55,8 +50,7 @@ }, { - "name": "depthClamping", - "display_name": "depth_clamping", + "name": "depth_clamping", "category": "Workarounds", "description": [ "The depth value is not clamped to [0,1] for floating point depth buffers." @@ -65,8 +59,7 @@ }, { - "name": "supportsRenderpass2", - "display_name": "supportsRenderpass2", + "name": "supports_renderpass2", "category": "Features", "description": [ "VkDevice supports the VK_KHR_create_renderpass2 extension" @@ -74,8 +67,7 @@ }, { - "name": "supportsIncrementalPresent", - "display_name": "supportsIncrementalPresent", + "name": "supports_incremental_present", "category": "Features", "description": [ "VkDevice supports the VK_KHR_incremental_present extension" @@ -83,8 +75,7 @@ }, { - "name": "supportsAndroidHardwareBuffer", - "display_name": "supportsAndroidHardwareBuffer", + "name": "supports_android_hardware_buffer", "category": "Features", "description": [ "VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer extension" @@ -92,8 +83,7 @@ }, { - "name": "supportsGGPFrameToken", - "display_name": "supportsGGPFrameToken", + "name": "supports_GGP_frame_token", "category": "Features", "description": [ "VkDevice supports the VK_GGP_frame_token extension" @@ -101,8 +91,7 @@ }, { - "name": "supportsExternalMemoryFd", - "display_name": "supportsExternalMemoryFd", + "name": "supports_external_memory_fd", "category": "Features", "description": [ "VkDevice supports the VK_KHR_external_memory_fd extension" @@ -110,8 +99,7 @@ }, { - "name": "supportsExternalMemoryFuchsia", - "display_name": "supportsExternalMemoryFuchsia", + "name": "supports_external_memory_fuchsia", "category": "Features", "description": [ "VkDevice supports the VK_FUCHSIA_external_memory extension" @@ -119,8 +107,7 @@ }, { - "name": "supportsFilteringPrecision", - "display_name": "supportsFilteringPrecision", + "name": "supports_filtering_precision", "category": "Features", "description": [ "VkDevice supports the VK_GOOGLE_sampler_filtering_precision extension" @@ -128,8 +115,7 @@ }, { - "name": "supportsExternalFenceCapabilities", - "display_name": "supportsExternalFenceCapabilities", + "name": "supports_external_fence_capabilities", "category": "Features", "description": [ "VkInstance supports the VK_KHR_external_fence_capabilities extension" @@ -137,8 +123,7 @@ }, { - "name": "supportsExternalSemaphoreCapabilities", - "display_name": "supportsExternalSemaphoreCapabilities", + "name": "supports_external_semaphore_capabilities", "category": "Features", "description": [ "VkInstance supports the VK_KHR_external_semaphore_capabilities extension" @@ -146,8 +131,7 @@ }, { - "name": "supportsExternalSemaphoreFd", - "display_name": "supportsExternalSemaphoreFd", + "name": "supports_external_semaphore_fd", "category": "Features", "description": [ "VkDevice supports the VK_KHR_external_semaphore_fd extension" @@ -155,8 +139,7 @@ }, { - "name": "supportsExternalSemaphoreFuchsia", - "display_name": "supportsExternalSemaphoreFuchsia", + "name": "supports_external_semaphore_fuchsia", "category": "Features", "description": [ "VkDevice supports the VK_FUCHSIA_external_semaphore extension" @@ -164,8 +147,7 @@ }, { - "name": "supportsExternalFenceFd", - "display_name": "supportsExternalFenceFd", + "name": "supports_external_fence_fd", "category": "Features", "description": [ "VkDevice supports the VK_KHR_external_fence_fd extension" @@ -174,8 +156,7 @@ }, { - "name": "supportsAndroidNativeFenceSync", - "display_name": "supportsAndroidNativeFenceSync", + "name": "supports_android_native_fence_sync", "category": "Features", "description": [ "VkDevice supports the EGL_ANDROID_native_fence_sync extension" @@ -184,8 +165,7 @@ }, { - "name": "supportsImageCubeArray", - "display_name": "supportsImageCubeArray", + "name": "supports_image_cube_array", "category": "Features", "description": [ "VkDevice supports the imageCubeArray feature properly" @@ -194,8 +174,7 @@ }, { - "name": "supportsPipelineStatisticsQuery", - "display_name": "supportsPipelineStatisticsQuery", + "name": "supports_pipeline_statistics_query", "category": "Features", "description": [ "VkDevice supports the pipelineStatisticsQuery feature" @@ -204,8 +183,7 @@ }, { - "name": "supportsShaderStencilExport", - "display_name": "supportsShaderStencilExport", + "name": "supports_shader_stencil_export", "category": "Features", "description": [ "VkDevice supports the VK_EXT_shader_stencil_export extension" @@ -213,8 +191,7 @@ }, { - "name": "supportsYUVSamplerConversion", - "display_name": "supportsYUVSamplerConversion", + "name": "supports_YUV_sampler_conversion", "category": "Features", "description": [ "VkDevice supports the VK_KHR_sampler_ycbcr_conversion extension" @@ -222,8 +199,7 @@ }, { - "name": "emulateTransformFeedback", - "display_name": "emulateTransformFeedback", + "name": "emulate_transform_feedback", "category": "Features", "description": [ "Emulate transform feedback as the VK_EXT_transform_feedback is not present." @@ -232,8 +208,7 @@ }, { - "name": "supportsTransformFeedbackExtension", - "display_name": "supportsTransformFeedbackExtension", + "name": "supports_transform_feedback_extension", "category": "Features", "description": [ "Transform feedback uses the VK_EXT_transform_feedback extension." @@ -242,8 +217,7 @@ }, { - "name": "supportsGeometryStreamsCapability", - "display_name": "supportsGeometryStreamsCapability", + "name": "supports_geometry_streams_capability", "category": "Features", "description": [ "Implementation supports the GeometryStreams SPIR-V capability." @@ -252,8 +226,7 @@ }, { - "name": "supportsIndexTypeUint8", - "display_name": "supportsIndexTypeUint8", + "name": "supports_index_type_uint8", "category": "Features", "description": [ "VkDevice supports the VK_EXT_index_type_uint8 extension" @@ -262,8 +235,7 @@ }, { - "name": "supportsCustomBorderColor", - "display_name": "supportsCustomBorderColor", + "name": "supports_custom_border_color", "category": "Features", "description": [ "VkDevice supports the VK_EXT_custom_border_color extension" @@ -272,8 +244,7 @@ }, { - "name": "supportsMultiDrawIndirect", - "display_name": "supportsMultiDrawIndirect", + "name": "supports_multi_draw_indirect", "category": "Features", "description": [ "VkDevice supports the multiDrawIndirect extension" @@ -282,8 +253,7 @@ }, { - "name": "supportsDepthStencilResolve", - "display_name": "supportsDepthStencilResolve", + "name": "supports_depth_stencil_resolve", "category": "Features", "description": [ "VkDevice supports the VK_KHR_depth_stencil_resolve ", @@ -293,8 +263,7 @@ }, { - "name": "supportsMultisampledRenderToSingleSampled", - "display_name": "supportsMultisampledRenderToSingleSampled", + "name": "supports_multisampled_render_to_single_sampled", "category": "Features", "description": [ "VkDevice supports the VK_EXT_multisampled_render_to_single_sampled extension" @@ -303,8 +272,7 @@ }, { - "name": "supportsMultiview", - "display_name": "supportsMultiview", + "name": "supports_multiview", "category": "Features", "description": [ "VkDevice supports the VK_KHR_multiview extension" @@ -313,8 +281,7 @@ }, { - "name": "disableFifoPresentMode", - "display_name": "disableFifoPresentMode", + "name": "disable_fifo_present_mode", "category": "Workarounds", "description": [ "VK_PRESENT_MODE_FIFO_KHR causes random timeouts" @@ -323,8 +290,7 @@ }, { - "name": "bindEmptyForUnusedDescriptorSets", - "display_name": "bindEmptyForUnusedDescriptorSets", + "name": "bind_empty_for_unused_descriptor_sets", "category": "Workarounds", "description": [ "Gaps in bound descriptor set indices causes the post-gap sets to misbehave" @@ -333,8 +299,7 @@ }, { - "name": "forceD16TexFilter", - "display_name": "forceD16TexFilter", + "name": "force_D16_tex_filter", "category": "Workarounds", "description": [ "VK_FORMAT_D16_UNORM does not support VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, ", @@ -344,8 +309,7 @@ }, { - "name": "disableFlippingBlitWithCommand", - "display_name": "disableFlippingBlitWithCommand", + "name": "disable_flipping_blit_with_command", "category": "Workarounds", "description": [ "vkCmdBlitImage with flipped coordinates blits incorrectly." @@ -354,8 +318,7 @@ }, { - "name": "perFrameWindowSizeQuery", - "display_name": "perFrameWindowSizeQuery", + "name": "per_frame_window_size_query", "category": "Workarounds", "description": [ "Vulkan swapchain is not returning VK_ERROR_OUT_OF_DATE when window resizing" @@ -364,8 +327,7 @@ }, { - "name": "disallowSeamfulCubeMapEmulation", - "display_name": "disallowSeamfulCubeMapEmulation", + "name": "disallow_seamful_cube_map_emulation", "category": "Workarounds", "description": [ "Seamful cube map emulation misbehaves on some drivers, so it's disallowed" @@ -374,8 +336,7 @@ }, { - "name": "padBuffersToMaxVertexAttribStride", - "display_name": "padBuffersToMaxVertexAttribStride", + "name": "pad_buffers_to_max_vertex_attrib_stride", "category": "Workarounds", "description": [ "Vulkan considers vertex attribute accesses to count up to the last multiple of the ", @@ -389,8 +350,7 @@ }, { - "name": "supportsExternalMemoryDmaBufAndModifiers", - "display_name": "supportsExternalMemoryDmaBufAndModifiers", + "name": "supports_external_memory_dma_buf_and_modifiers", "category": "Features", "description": [ "VkDevice supports the VK_EXT_external_memory_dma_buf and VK_EXT_image_drm_format_modifier ", @@ -400,8 +360,7 @@ }, { - "name": "supportsExternalMemoryHost", - "display_name": "supportsExternalMemoryHost", + "name": "supports_external_memory_host", "category": "Features", "description": [ "VkDevice supports the VK_EXT_external_memory_host extension" @@ -409,8 +368,7 @@ }, { - "name": "allocateNonZeroMemory", - "display_name": "allocateNonZeroMemory", + "name": "allocate_non_zero_memory", "category": "Features", "description": [ "Fill new allocations with non-zero values to flush out errors." @@ -419,8 +377,7 @@ }, { - "name": "logMemoryReportCallbacks", - "display_name": "logMemoryReportCallbacks", + "name": "log_memory_report_callbacks", "category": "Features", "description": [ "Log each callback from VK_EXT_device_memory_report" @@ -428,8 +385,7 @@ }, { - "name": "logMemoryReportStats", - "display_name": "logMemoryReportStats", + "name": "log_memory_report_stats", "category": "Features", "description": [ "Log stats from VK_EXT_device_memory_report each swap" @@ -437,8 +393,7 @@ }, { - "name": "shadowBuffers", - "display_name": "shadowBuffers", + "name": "shadow_buffers", "category": "Features", "description": [ "Allocate a shadow buffer for GL buffer objects to reduce glMap* latency." @@ -447,8 +402,7 @@ }, { - "name": "preferCPUForBufferSubData", - "display_name": "preferCPUForBufferSubData", + "name": "prefer_CPU_for_buffer_sub_data", "category": "Features", "description": [ "Prefer use CPU to do bufferSubData instead of staged update." @@ -457,8 +411,7 @@ }, { - "name": "persistentlyMappedBuffers", - "display_name": "persistentlyMappedBuffers", + "name": "persistently_mapped_buffers", "category": "Features", "description": [ "Persistently map buffer memory to reduce map/unmap IOCTL overhead." @@ -467,8 +420,7 @@ }, { - "name": "enablePreRotateSurfaces", - "display_name": "enablePreRotateSurfaces", + "name": "enable_pre_rotate_surfaces", "category": "Features", "description": [ "Enable Android pre-rotation for landscape applications" @@ -477,8 +429,7 @@ }, { - "name": "enablePrecisionQualifiers", - "display_name": "enablePrecisionQualifiers", + "name": "enable_precision_qualifiers", "category": "Features", "description": [ "Enable precision qualifiers in shaders" @@ -487,8 +438,7 @@ }, { - "name": "preferAggregateBarrierCalls", - "display_name": "preferAggregateBarrierCalls", + "name": "prefer_aggregate_barrier_calls", "category": "Workarounds", "description": [ "Single barrier call is preferred over multiple calls with ", @@ -498,8 +448,7 @@ }, { - "name": "preferSkippingInvalidateForEmulatedFormats", - "display_name": "preferSkippingInvalidateForEmulatedFormats", + "name": "prefer_skipping_invalidate_for_emulated_formats", "category": "Workarounds", "description": [ "Skipping invalidate is preferred for emulated formats that have extra channels over ", @@ -509,8 +458,7 @@ }, { - "name": "asyncCommandQueue", - "display_name": "asyncCommandQueue", + "name": "async_command_queue", "category": "Features", "description": [ "Use CommandQueue worker thread to dispatch work to GPU." @@ -519,8 +467,7 @@ }, { - "name": "supportsShaderFloat16", - "display_name": "supportsShaderFloat16", + "name": "supports_shader_float16", "category": "Features", "description": [ "VkDevice supports the VK_KHR_shader_float16_int8 extension ", @@ -530,8 +477,7 @@ }, { - "name": "allowGenerateMipmapWithCompute", - "display_name": "allowGenerateMipmapWithCompute", + "name": "allow_GenerateMipmap_with_compute", "category": "Features", "description": [ "Use the compute path to generate mipmaps on devices that meet the minimum requirements, ", @@ -541,8 +487,7 @@ }, { - "name": "supportsRenderPassStoreOpNoneQCOM", - "display_name": "supportsRenderPassStoreOpNoneQCOM", + "name": "supports_render_pass_store_op_none", "category": "Features", "description": [ "VkDevice supports VK_QCOM_render_pass_store_ops extension." @@ -551,8 +496,7 @@ }, { - "name": "supportsRenderPassLoadStoreOpNone", - "display_name": "supportsRenderPassLoadStoreOpNone", + "name": "supports_render_pass_load_store_op_none", "category": "Features", "description": [ "VkDevice supports VK_EXT_load_store_op_none extension." @@ -561,8 +505,7 @@ }, { - "name": "supportsDepthClipControl", - "display_name": "supportsDepthClipControl", + "name": "supports_depth_clip_control", "category": "Features", "description": [ "VkDevice supports VK_EXT_depth_clip_control extension." @@ -571,8 +514,7 @@ }, { - "name": "supportsBlendOperationAdvanced", - "display_name": "supportsBlendOperationAdvanced", + "name": "supports_blend_operation_advanced", "category": "Features", "description": [ "VkDevice supports VK_EXT_blend_operation_advanced extension." @@ -581,8 +523,7 @@ }, { - "name": "forceMaxUniformBufferSize16KB", - "display_name": "forceMaxUniformBufferSize16KB", + "name": "force_max_uniform_buffer_size_16KB", "category": "Workarounds", "description": [ "Force max uniform buffer size to 16K on some device due to bug" @@ -591,8 +532,7 @@ }, { - "name": "supportsImageFormatList", - "display_name": "supportsImageFormatList", + "name": "supports_image_format_list", "category": "Features", "description": [ "Enable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT by default for ICDs ", @@ -602,8 +542,7 @@ }, { - "name": "enableMultisampledRenderToTexture", - "display_name": "enableMultisampledRenderToTexture", + "name": "enable_multisampled_render_to_texture", "category": "Workarounds", "description": [ "Expose EXT_multisampled_render_to_texture" @@ -612,8 +551,7 @@ }, { - "name": "deferFlushUntilEndRenderPass", - "display_name": "deferFlushUntilEndRenderPass", + "name": "defer_flush_until_end_render_pass", "category": "Workarounds", "description": [ "Allow glFlush to be deferred until renderpass ends" @@ -622,8 +560,7 @@ }, { - "name": "waitIdleBeforeSwapchainRecreation", - "display_name": "waitIdleBeforeSwapchainRecreation", + "name": "wait_idle_before_swapchain_recreation", "category": "Workarounds", "description": [ "Before passing an oldSwapchain to VkSwapchainCreateInfoKHR, wait for queue to be idle. ", @@ -633,8 +570,7 @@ }, { - "name": "forceTextureLodOffset1", - "display_name": "force_texture_lod_offset_1", + "name": "force_texture_lod_offset_1", "category": "Workarounds", "description": [ "Increase the minimum texture level-of-detail by 1 when sampling." @@ -642,8 +578,7 @@ }, { - "name": "forceTextureLodOffset2", - "display_name": "force_texture_lod_offset_2", + "name": "force_texture_lod_offset_2", "category": "Workarounds", "description": [ "Increase the minimum texture level-of-detail by 2 when sampling." @@ -651,8 +586,7 @@ }, { - "name": "forceTextureLodOffset3", - "display_name": "force_texture_lod_offset_3", + "name": "force_texture_lod_offset_3", "category": "Workarounds", "description": [ "Increase the minimum texture level-of-detail by 3 when sampling." @@ -660,8 +594,7 @@ }, { - "name": "forceTextureLodOffset4", - "display_name": "force_texture_lod_offset_4", + "name": "force_texture_lod_offset_4", "category": "Workarounds", "description": [ "Increase the minimum texture level-of-detail by 4 when sampling." @@ -669,8 +602,7 @@ }, { - "name": "forceNearestFiltering", - "display_name": "force_nearest_filtering", + "name": "force_nearest_filtering", "category": "Workarounds", "description": [ "Force nearest filtering when sampling." @@ -678,8 +610,7 @@ }, { - "name": "forceNearestMipFiltering", - "display_name": "forceNearestMipFiltering", + "name": "force_nearest_mip_filtering", "category": "Workarounds", "description": [ "Force nearest mip filtering when sampling." @@ -687,8 +618,7 @@ }, { - "name": "compressVertexData", - "display_name": "compress_vertex_data", + "name": "compress_vertex_data", "category": "Workarounds", "description": [ "Compress vertex data to smaller data types when ", @@ -697,8 +627,7 @@ }, { - "name": "preferDrawClearOverVkCmdClearAttachments", - "display_name": "preferDrawClearOverVkCmdClearAttachments", + "name": "prefer_draw_clear_over_vkCmdClearAttachments", "category": "Workarounds", "description": [ "On some hardware, clear using a draw call instead of vkCmdClearAttachments in the middle ", @@ -708,8 +637,7 @@ }, { - "name": "emulatedPrerotation90", - "display_name": "emulatedPrerotation90", + "name": "emulated_prerotation_90", "category": "Features", "description": [ "Emulate 90-degree prerotation." @@ -718,8 +646,7 @@ }, { - "name": "emulatedPrerotation180", - "display_name": "emulatedPrerotation180", + "name": "emulated_prerotation_180", "category": "Features", "description": [ "Emulate 180-degree prerotation." @@ -728,8 +655,7 @@ }, { - "name": "emulatedPrerotation270", - "display_name": "emulatedPrerotation270", + "name": "emulated_prerotation_270", "category": "Features", "description": [ "Emulate 270-degree prerotation." @@ -738,8 +664,7 @@ }, { - "name": "generateSPIRVThroughGlslang", - "display_name": "generateSPIRVThroughGlslang", + "name": "generate_SPIRV_through_glslang", "category": "Features", "description": [ "Translate SPIR-V through glslang." @@ -748,8 +673,7 @@ }, { - "name": "forceDriverUniformOverSpecConst", - "display_name": "forceDriverUniformOverSpecConst", + "name": "force_driver_uniform_over_spec_const", "category": "Workarounds", "description": [ "Forces using driver uniforms instead of specialization constants." @@ -758,8 +682,7 @@ }, { - "name": "exposeNonConformantExtensionsAndVersions", - "display_name": "exposeNonConformantExtensionsAndVersions", + "name": "expose_non_conformant_extensions_and_versions", "category": "Workarounds", "description": [ "Expose GLES versions and extensions that are not conformant." @@ -768,8 +691,7 @@ }, { - "name": "emulateR32fImageAtomicExchange", - "display_name": "emulateR32fImageAtomicExchange", + "name": "emulate_R32f_image_atomic_exchange", "category": "Workarounds", "description": [ "Emulate r32f images with r32ui to support imageAtomicExchange." @@ -778,8 +700,7 @@ }, { - "name": "supportsNegativeViewport", - "display_name": "supportsNegativeViewport", + "name": "supports_negative_viewport", "category": "Features", "description": [ "The driver supports inverting the viewport with a negative height." @@ -787,8 +708,7 @@ }, { - "name": "forceFragmentShaderPrecisionHighpToMediump", - "display_name": "forceFragmentShaderPrecisionHighpToMediump", + "name": "force_fragment_shader_precision_highp_to_mediump", "category": "Workarounds", "description": [ "Forces highp precision in fragment shader to mediump." @@ -797,8 +717,7 @@ }, { - "name": "preferSubmitAtFBOBoundary", - "display_name": "preferSubmitAtFBOBoundary", + "name": "prefer_submit_at_FBO_boundary", "category": "Workarounds", "description": [ "Submit commands to driver at each FBO boundary for performance improvements." @@ -807,8 +726,7 @@ }, { - "name": "useMultipleDescriptorsForExternalFormats", - "display_name": "useMultipleDescriptorsForExternalFormats", + "name": "use_multiple_descriptors_for_external_formats", "category": "Workarounds", "description": [ "Return a default descriptor count for external formats." @@ -817,8 +735,7 @@ }, { - "name": "supportsProtectedMemory", - "display_name": "supportsProtectedMemory", + "name": "supports_protected_memory", "category": "Features", "description": [ "VkDevice supports protected memory" @@ -827,8 +744,7 @@ }, { - "name": "supportsHostQueryReset", - "display_name": "supportsHostQueryReset", + "name": "supports_host_query_reset", "category": "Features", "description": [ "VkDevice supports VK_EXT_host_query_reset extension" @@ -837,8 +753,7 @@ }, { - "name": "supportsSurfaceCapabilities2Extension", - "display_name": "supportsSurfaceCapabilities2Extension", + "name": "supports_surface_capabilities2_extension", "category": "Features", "description": [ "VkInstance supports the VK_KHR_get_surface_capabilities2 extension" @@ -846,8 +761,7 @@ }, { - "name": "supportsSurfaceProtectedCapabilitiesExtension", - "display_name": "supportsSurfaceProtectedCapabilitiesExtension", + "name": "supports_surface_protected_capabilities_extension", "category": "Features", "description": [ "VkInstance supports the VK_KHR_surface_protected_capabilities extension" @@ -855,8 +769,7 @@ }, { - "name": "supportsSurfacelessQueryExtension", - "display_name": "supportsSurfacelessQueryExtension", + "name": "supports_surfaceless_query_extension", "category": "Features", "description": [ "VkInstance supports the VK_GOOGLE_surfaceless_query extension" @@ -864,8 +777,7 @@ }, { - "name": "supportsSurfaceProtectedSwapchains", - "display_name": "supportsSurfaceProtectedSwapchains", + "name": "supports_surface_protected_swapchains", "category": "Features", "description": [ "VkSurface supportsProtected for protected swapchains" @@ -873,8 +785,7 @@ }, { - "name": "overrideSurfaceFormatRGB8toRGBA8", - "display_name": "overrideSurfaceFormatRGB8toRGBA8", + "name": "override_surface_format_RGB8_to_RGBA8", "category": "Workarounds", "description": [ "Override surface format GL_RGB8 to GL_RGBA8" @@ -883,8 +794,7 @@ }, { - "name": "supportsSharedPresentableImageExtension", - "display_name": "supportsSharedPresentableImageExtension", + "name": "supports_shared_presentable_image_extension", "category": "Features", "description": [ "VkSurface supports the VK_KHR_shared_presentable_images extension" @@ -892,8 +802,7 @@ }, { - "name": "supportsShaderFramebufferFetch", - "display_name": "supportsShaderFramebufferFetch", + "name": "supports_shader_framebuffer_fetch", "category": "Features", "description": [ "Whether the Vulkan backend supports coherent framebuffer fetch" @@ -901,8 +810,7 @@ }, { - "name": "supportsShaderFramebufferFetchNonCoherent", - "display_name": "supportsShaderFramebufferFetchNonCoherent", + "name": "supports_shader_framebuffer_fetch_non_coherent", "category": "Features", "description": [ "Whether the Vulkan backend supports non-coherent framebuffer fetch" @@ -910,8 +818,7 @@ }, { - "name": "supportsLockSurfaceExtension", - "display_name": "supportsLockSurfaceExtension", + "name": "supports_lock_surface_extension", "category": "Features", "description": [ "Surface supports the EGL_KHR_lock_surface3 extension" @@ -919,8 +826,7 @@ }, { - "name": "swapbuffersOnFlushOrFinishWithSingleBuffer", - "display_name": "swapbuffersOnFlushOrFinishWithSingleBuffer", + "name": "swapbuffers_on_flush_or_finish_with_single_buffer", "category": "Features", "description": [ "Bypass deferredFlush with calling swapbuffers on flush or finish when in Shared Present ", @@ -930,8 +836,7 @@ }, { - "name": "emulateDithering", - "display_name": "emulateDithering", + "name": "emulate_dithering", "category": "Features", "description": [ "Emulate OpenGL dithering" @@ -940,8 +845,7 @@ }, { - "name": "emulateAdvancedBlendEquations", - "display_name": "emulateAdvancedBlendEquations", + "name": "emulate_advanced_blend_equations", "category": "Features", "description": [ "Emulate GL_KHR_blend_equation_advanced" @@ -950,8 +854,7 @@ }, { - "name": "bottomLeftOriginPresentRegionRectangles", - "display_name": "bottomLeftOriginPresentRegionRectangles", + "name": "bottom_left_origin_present_region_rectangles", "category": "Workarounds", "description": [ "On some platforms present region rectangles are expected to have a bottom-left origin, ", @@ -960,8 +863,7 @@ }, { - "name": "forceSubmitImmutableTextureUpdates", - "display_name": "forceSubmitImmutableTextureUpdates", + "name": "force_submit_immutable_texture_updates", "category": "AppWorkarounds", "description": [ "Force submit updates to immutable textures" @@ -970,8 +872,7 @@ }, { - "name": "retainSpirvDebugInfo", - "display_name": "retainSpirvDebugInfo", + "name": "retain_SPIRV_debug_info", "category": "Features", "description": [ "Retain debug info in SPIR-V blob." @@ -980,8 +881,7 @@ }, { - "name": "createPipelineDuringLink", - "display_name": "createPipelineDuringLink", + "name": "create_pipeline_during_link", "category": "Features", "description": [ "Create pipeline with default state during glLinkProgram" diff --git a/scripts/code_generation_hashes/ANGLE_features.json b/scripts/code_generation_hashes/ANGLE_features.json index 6b97211bc7..3c244996a0 100644 --- a/scripts/code_generation_hashes/ANGLE_features.json +++ b/scripts/code_generation_hashes/ANGLE_features.json @@ -1,28 +1,28 @@ { "include/platform/FeaturesD3D.h": - "66f7409cc3fed196ef4b30fa2a911cf5", + "1333a97be19dac076944fd00e46a9c7d", "include/platform/FeaturesGL.h": - "c29f5ed18ab719dc01c42221bde72519", + "2d35716bcbfc713b0968f2571d783e8f", "include/platform/FeaturesMtl.h": - "351a698b8956590eb64afe7a0872cf0c", + "84ab0985624641c8b3894c3ab08820cf", "include/platform/FeaturesVk.h": - "9ef07a932e5fce68c47180bcf0accce3", + "52c0687135636d701cf7c43f6358e9c4", "include/platform/FrontendFeatures.h": - "69191d0121faa83ad7e38eccf454fb91", + "ee4c60a2388ec39b3a63488a3f42282c", "include/platform/d3d_features.json": - "abdcf90e79eb2aae4f55a33b1ca17b72", + "9446c8351c963d8550ff7bf246834907", "include/platform/frontend_features.json": - "cf60ba62068fbd82274a20fbbb5a3030", + "53df8a8be9795eaad30044456f85b7f0", "include/platform/gen_features.py": - "d717215ff1884d23cde74db5074188e0", + "a5d356a52dab33dd3865c74363e66a53", "include/platform/gl_features.json": - "ff2f4dac740e071f511f751f59f3ef31", + "722ca2cf6ba57112fda359171bcea9d3", "include/platform/mtl_features.json": - "82d4a2487985b1ba5f440c88bba22e1c", + "9ff73684f28ff8df40fb66da8fe4713a", "include/platform/vk_features.json": - "88a1d0be37101c4a0bd90ddabff23a7d", + "80d2fa526bd59fcb6df368cc3b5f510d", "util/angle_features_autogen.cpp": - "0493a7bb6d4c1501faf2167e785e4505", + "79f67c452a945a5515d16ac80035f00c", "util/angle_features_autogen.h": - "7de3794b3d93f8094fde74e2329f9374" + "337975ddfeed8355d04983f41067f0ec" }
\ No newline at end of file diff --git a/scripts/code_generation_hashes/Test_spec_JSON.json b/scripts/code_generation_hashes/Test_spec_JSON.json index 50d529f65b..ca5feaf88f 100644 --- a/scripts/code_generation_hashes/Test_spec_JSON.json +++ b/scripts/code_generation_hashes/Test_spec_JSON.json @@ -14,7 +14,7 @@ "infra/specs/waterfalls.pyl": "db329524ea9686da7b32544a26b13203", "testing/buildbot/generate_buildbot_json.py": - "dedd849a6d73b647daaeef0e7ab837a5", + "91a555b5f15999adf9d61624a8af7454", "testing/buildbot/mixins.pyl": - "eed9c6f949d0e25d8229f84dac2fb50a" + "6233d592965cfae45c411323626e7566" }
\ No newline at end of file diff --git a/scripts/code_generation_hashes/overlay_widgets.json b/scripts/code_generation_hashes/overlay_widgets.json index ec1cf1ba28..7f2b2897f6 100644 --- a/scripts/code_generation_hashes/overlay_widgets.json +++ b/scripts/code_generation_hashes/overlay_widgets.json @@ -1,10 +1,10 @@ { "src/libANGLE/Overlay_autogen.cpp": - "45ac90c90602c3f20ae798cb80e3cf58", + "c9763a51339da8432a0827322f21bd2e", "src/libANGLE/Overlay_autogen.h": - "ca17ed3d781260786075375d6275b95c", + "e9594b02a505c22e121541810551a19d", "src/libANGLE/gen_overlay_widgets.py": "4530a7f65c51206ce9de6917683e3687", "src/libANGLE/overlay_widgets.json": - "48e3cb7165d22a40772b2c733e4c98b5" + "2a424ff932317c54df13acabfb1251a3" }
\ No newline at end of file diff --git a/scripts/export_targets.py b/scripts/export_targets.py index 6117a26c73..cbb0663c5b 100755 --- a/scripts/export_targets.py +++ b/scripts/export_targets.py @@ -210,6 +210,7 @@ IGNORED_INCLUDES = { b'libANGLE/renderer/vulkan/mac/DisplayVkMac.h', b'libANGLE/renderer/vulkan/win32/DisplayVkWin32.h', b'libANGLE/renderer/vulkan/xcb/DisplayVkXcb.h', + b'libANGLE/renderer/vulkan/wayland/DisplayVkWayland.h', b'loader_cmake_config.h', b'loader_linux.h', b'loader_windows.h', diff --git a/src/common/angleutils.h b/src/common/angleutils.h index 8d7bcbb586..9b37fb2e3f 100644 --- a/src/common/angleutils.h +++ b/src/common/angleutils.h @@ -130,55 +130,55 @@ struct PerfMonitorTriplet uint32_t value; }; -#define ANGLE_VK_PERF_COUNTERS_X(FN) \ - FN(primaryBuffers) \ - FN(renderPasses) \ - FN(submittedCommands) \ - FN(writeDescriptorSets) \ - FN(flushedOutsideRenderPassCommandBuffers) \ - FN(swapchainResolveInSubpass) \ - FN(swapchainResolveOutsideSubpass) \ - FN(resolveImageCommands) \ - FN(colorLoadOpClears) \ - FN(colorLoadOpLoads) \ - FN(colorLoadOpNones) \ - FN(colorStoreOpStores) \ - FN(colorStoreOpNones) \ - FN(colorClearAttachments) \ - FN(depthLoadOpClears) \ - FN(depthLoadOpLoads) \ - FN(depthLoadOpNones) \ - FN(depthStoreOpStores) \ - FN(depthStoreOpNones) \ - FN(depthClearAttachments) \ - FN(stencilLoadOpClears) \ - FN(stencilLoadOpLoads) \ - FN(stencilLoadOpNones) \ - FN(stencilStoreOpStores) \ - FN(stencilStoreOpNones) \ - FN(stencilClearAttachments) \ - FN(colorAttachmentUnresolves) \ - FN(depthAttachmentUnresolves) \ - FN(stencilAttachmentUnresolves) \ - FN(colorAttachmentResolves) \ - FN(depthAttachmentResolves) \ - FN(stencilAttachmentResolves) \ - FN(readOnlyDepthStencilRenderPasses) \ - FN(descriptorSetAllocations) \ - FN(descriptorSetCacheTotalSize) \ - FN(descriptorSetCacheKeySizeBytes) \ - FN(uniformsAndXfbDescriptorSetCacheHits) \ - FN(uniformsAndXfbDescriptorSetCacheMisses) \ - FN(uniformsAndXfbDescriptorSetCacheTotalSize) \ - FN(textureDescriptorSetCacheHits) \ - FN(textureDescriptorSetCacheMisses) \ - FN(textureDescriptorSetCacheTotalSize) \ - FN(shaderBuffersDescriptorSetCacheHits) \ - FN(shaderBuffersDescriptorSetCacheMisses) \ - FN(shaderBuffersDescriptorSetCacheTotalSize) \ - FN(buffersGhosted) \ - FN(vertexArraySyncStateCalls) \ - FN(allocateNewBufferBlockCalls) \ +#define ANGLE_VK_PERF_COUNTERS_X(FN) \ + FN(primaryBuffers) \ + FN(renderPasses) \ + FN(submittedCommands) \ + FN(writeDescriptorSets) \ + FN(flushedOutsideRenderPassCommandBuffers) \ + FN(swapchainResolveInSubpass) \ + FN(swapchainResolveOutsideSubpass) \ + FN(resolveImageCommands) \ + FN(colorLoadOpClears) \ + FN(colorLoadOpLoads) \ + FN(colorLoadOpNones) \ + FN(colorStoreOpStores) \ + FN(colorStoreOpNones) \ + FN(colorClearAttachments) \ + FN(depthLoadOpClears) \ + FN(depthLoadOpLoads) \ + FN(depthLoadOpNones) \ + FN(depthStoreOpStores) \ + FN(depthStoreOpNones) \ + FN(depthClearAttachments) \ + FN(stencilLoadOpClears) \ + FN(stencilLoadOpLoads) \ + FN(stencilLoadOpNones) \ + FN(stencilStoreOpStores) \ + FN(stencilStoreOpNones) \ + FN(stencilClearAttachments) \ + FN(colorAttachmentUnresolves) \ + FN(depthAttachmentUnresolves) \ + FN(stencilAttachmentUnresolves) \ + FN(colorAttachmentResolves) \ + FN(depthAttachmentResolves) \ + FN(stencilAttachmentResolves) \ + FN(readOnlyDepthStencilRenderPasses) \ + FN(descriptorSetAllocations) \ + FN(descriptorSetCacheTotalSize) \ + FN(descriptorSetCacheKeySizeBytes) \ + FN(uniformsAndXfbDescriptorSetCacheHits) \ + FN(uniformsAndXfbDescriptorSetCacheMisses) \ + FN(uniformsAndXfbDescriptorSetCacheTotalSize) \ + FN(textureDescriptorSetCacheHits) \ + FN(textureDescriptorSetCacheMisses) \ + FN(textureDescriptorSetCacheTotalSize) \ + FN(shaderResourcesDescriptorSetCacheHits) \ + FN(shaderResourcesDescriptorSetCacheMisses) \ + FN(shaderResourcesDescriptorSetCacheTotalSize) \ + FN(buffersGhosted) \ + FN(vertexArraySyncStateCalls) \ + FN(allocateNewBufferBlockCalls) \ FN(dynamicBufferAllocations) #define ANGLE_DECLARE_PERF_COUNTER(COUNTER) uint32_t COUNTER; diff --git a/src/common/string_utils.cpp b/src/common/string_utils.cpp index 6956c230cd..a208555831 100644 --- a/src/common/string_utils.cpp +++ b/src/common/string_utils.cpp @@ -272,6 +272,30 @@ int ReplaceAllSubstrings(std::string *str, return count; } +std::string ToCamelCase(const std::string &str) +{ + std::string result; + + bool lastWasUnderscore = false; + for (char c : str) + { + if (c == '_') + { + lastWasUnderscore = true; + continue; + } + + if (lastWasUnderscore) + { + c = static_cast<char>(std::toupper(c)); + lastWasUnderscore = false; + } + result += c; + } + + return result; +} + std::vector<std::string> GetStringsFromEnvironmentVarOrAndroidProperty(const char *varName, const char *propertyName, const char *separator) diff --git a/src/common/string_utils.h b/src/common/string_utils.h index fadfe17d7a..a16ddddb28 100644 --- a/src/common/string_utils.h +++ b/src/common/string_utils.h @@ -103,6 +103,9 @@ int ReplaceAllSubstrings(std::string *str, const std::string &substring, const std::string &replacement); +// Takes a snake_case string and turns it into camelCase. +std::string ToCamelCase(const std::string &str); + // Split up a string parsed from an environment variable. std::vector<std::string> GetStringsFromEnvironmentVarOrAndroidProperty(const char *varName, const char *propertyName, diff --git a/src/common/string_utils_unittest.cpp b/src/common/string_utils_unittest.cpp index f34d84095a..d78db0d395 100644 --- a/src/common/string_utils_unittest.cpp +++ b/src/common/string_utils_unittest.cpp @@ -177,6 +177,43 @@ TEST(StringUtilsTest, HexStringToUIntBasic) EXPECT_FALSE(HexStringToUInt(testStringD, &uintValue)); } +// Tests for ToCamelCase +TEST(StringUtilsTest, ToCamelCase) +{ + // No underscore in input; expect identical output + EXPECT_EQ("", ToCamelCase("")); + EXPECT_EQ("a", ToCamelCase("a")); + EXPECT_EQ("AbCdEfG", ToCamelCase("AbCdEfG")); + EXPECT_EQ("aBcDeFg", ToCamelCase("aBcDeFg")); + + // Underscore should be removed and the next character turned upper case + EXPECT_EQ("", ToCamelCase("_")); + EXPECT_EQ("aB", ToCamelCase("a_b")); + EXPECT_EQ("aB", ToCamelCase("a_b")); + EXPECT_EQ("camelCase", ToCamelCase("camel_case")); + EXPECT_EQ("abCDeBEfG", ToCamelCase("abCDe_bEfG")); + + // Multiple underscores + EXPECT_EQ("aBCDEFG", ToCamelCase("a_b_c_d_e_f_g")); + EXPECT_EQ("abCdEfGh", ToCamelCase("ab_cd_ef_gh")); + EXPECT_EQ("aShortName", ToCamelCase("a_short_name")); + EXPECT_EQ("someShortWords", ToCamelCase("some_short_words")); + EXPECT_EQ("bunchOLetters", ToCamelCase("bunch_o_letters")); + EXPECT_EQ("whatEndsInE", ToCamelCase("what_ends_in_e")); + EXPECT_EQ("adjustSrcDstRegionForBlitFramebuffer", + ToCamelCase("adjust_src_dst_region_for_BlitFramebuffer")); + + // Uppercase after underscore + EXPECT_EQ("abCDEFGh", ToCamelCase("ab_CD_eF_Gh")); + EXPECT_EQ("IWasThere", ToCamelCase("I_was_there")); + EXPECT_EQ("whereDidTHATComeFrom", ToCamelCase("where_did_THAT_come_from")); + + // Digits + EXPECT_EQ("ab123c4deF5gHi6J", ToCamelCase("ab1_2_3c_4de_f5g_hi6_j")); + EXPECT_EQ("maxSize16KB", ToCamelCase("max_size_16KB")); + EXPECT_EQ("supportRGBA8", ToCamelCase("support_RGBA8")); +} + // Basic functionality for NamesMatchWithWildcard. TEST(StringUtilsTest, NamesMatchWithWildcard) { diff --git a/src/libANGLE/Buffer.cpp b/src/libANGLE/Buffer.cpp index e307d6450d..c756347527 100644 --- a/src/libANGLE/Buffer.cpp +++ b/src/libANGLE/Buffer.cpp @@ -391,15 +391,11 @@ angle::Result Buffer::getSubData(const gl::Context *context, void Buffer::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) { - if (message == angle::SubjectMessage::BufferVkStorageChanged) - { - return; - } - // Pass it along! ASSERT(index == kImplementationSubjectIndex); ASSERT(message == angle::SubjectMessage::SubjectChanged || - message == angle::SubjectMessage::InternalMemoryAllocationChanged); + message == angle::SubjectMessage::InternalMemoryAllocationChanged || + message == angle::SubjectMessage::BufferVkStorageChanged); onStateChange(message); } diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index 9356bf22a5..c257f59af3 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -4006,7 +4006,7 @@ void Context::initCaps() // If we're capturing application calls for replay, apply some feature limits to increase // portability of the trace. if (getShareGroup()->getFrameCaptureShared()->enabled() || - getFrontendFeatures().captureLimits.enabled) + getFrontendFeatures().enableCaptureLimits.enabled) { INFO() << "Limit some features because " << (getShareGroup()->getFrameCaptureShared()->enabled() diff --git a/src/libANGLE/Display.cpp b/src/libANGLE/Display.cpp index d7b75bf625..9b6fcc2ee4 100644 --- a/src/libANGLE/Display.cpp +++ b/src/libANGLE/Display.cpp @@ -280,6 +280,8 @@ EGLAttrib GetPlatformTypeFromEnvironment() return 0; #elif defined(ANGLE_USE_X11) return EGL_PLATFORM_X11_EXT; +#elif defined(ANGLE_USE_WAYLAND) + return EGL_PLATFORM_WAYLAND_EXT; #elif defined(ANGLE_USE_VULKAN_DISPLAY) && defined(ANGLE_VULKAN_DISPLAY_MODE_SIMPLE) return EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE; #elif defined(ANGLE_USE_VULKAN_DISPLAY) && defined(ANGLE_VULKAN_DISPLAY_MODE_HEADLESS) @@ -432,6 +434,13 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, break; } # endif +# if defined(ANGLE_USE_WAYLAND) + if (platformType == EGL_PLATFORM_WAYLAND_EXT && rx::IsVulkanWaylandDisplayAvailable()) + { + impl = rx::CreateVulkanWaylandDisplay(state); + break; + } +# endif # if defined(ANGLE_USE_VULKAN_DISPLAY) if (platformType == EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE && rx::IsVulkanSimpleDisplayAvailable()) diff --git a/src/libANGLE/OverlayWidgets.cpp b/src/libANGLE/OverlayWidgets.cpp index 3e1d745a1f..f538105e0d 100644 --- a/src/libANGLE/OverlayWidgets.cpp +++ b/src/libANGLE/OverlayWidgets.cpp @@ -447,15 +447,15 @@ void AppendWidgetDataHelper::AppendVulkanDescriptorSetAllocations(const overlay: AppendRunningGraphCommon(widget, imageExtent, textWidget, graphWidget, widgetCounts, format); } -void AppendWidgetDataHelper::AppendVulkanShaderBufferDSHitRate(const overlay::Widget *widget, - const gl::Extents &imageExtent, - TextWidgetData *textWidget, - GraphWidgetData *graphWidget, - OverlayWidgetCounts *widgetCounts) +void AppendWidgetDataHelper::AppendVulkanShaderResourceDSHitRate(const overlay::Widget *widget, + const gl::Extents &imageExtent, + TextWidgetData *textWidget, + GraphWidgetData *graphWidget, + OverlayWidgetCounts *widgetCounts) { auto format = [](size_t maxValue) { std::ostringstream text; - text << "Shader Buffer DS Hit Rate (Max: " << maxValue << "%)"; + text << "Shader Resource DS Hit Rate (Max: " << maxValue << "%)"; return text.str(); }; diff --git a/src/libANGLE/Overlay_autogen.cpp b/src/libANGLE/Overlay_autogen.cpp index 87d47e38de..6fb3283c56 100644 --- a/src/libANGLE/Overlay_autogen.cpp +++ b/src/libANGLE/Overlay_autogen.cpp @@ -338,13 +338,13 @@ void Overlay::initOverlayWidgets() widget->color[2] = 0.29411764705882354f; widget->color[3] = 0.7843137254901961f; } - mState.mOverlayWidgets[WidgetId::VulkanShaderBufferDSHitRate].reset(widget); + mState.mOverlayWidgets[WidgetId::VulkanShaderResourceDSHitRate].reset(widget); { const int32_t fontSize = GetFontSize(kFontMipSmall, kLargeFont); const int32_t offsetX = - mState.mOverlayWidgets[WidgetId::VulkanShaderBufferDSHitRate]->coords[0]; + mState.mOverlayWidgets[WidgetId::VulkanShaderResourceDSHitRate]->coords[0]; const int32_t offsetY = - mState.mOverlayWidgets[WidgetId::VulkanShaderBufferDSHitRate]->coords[1]; + mState.mOverlayWidgets[WidgetId::VulkanShaderResourceDSHitRate]->coords[1]; const int32_t width = 40 * (kFontGlyphWidth >> fontSize); const int32_t height = (kFontGlyphHeight >> fontSize); diff --git a/src/libANGLE/Overlay_autogen.h b/src/libANGLE/Overlay_autogen.h index 34facfb992..533fb35e00 100644 --- a/src/libANGLE/Overlay_autogen.h +++ b/src/libANGLE/Overlay_autogen.h @@ -28,8 +28,8 @@ enum class WidgetId VulkanWriteDescriptorSetCount, // Descriptor Set Allocations. VulkanDescriptorSetAllocations, - // Shader Buffer Descriptor Set Cache Hit Rate. - VulkanShaderBufferDSHitRate, + // Shader Resource Descriptor Set Cache Hit Rate. + VulkanShaderResourceDSHitRate, // Buffer Allocations Made By vk::DynamicBuffer. VulkanDynamicBufferAllocations, // Total size of all descriptor set caches @@ -55,7 +55,7 @@ enum class WidgetId PROC(VulkanSecondaryCommandBufferPoolWaste) \ PROC(VulkanWriteDescriptorSetCount) \ PROC(VulkanDescriptorSetAllocations) \ - PROC(VulkanShaderBufferDSHitRate) \ + PROC(VulkanShaderResourceDSHitRate) \ PROC(VulkanDynamicBufferAllocations) \ PROC(VulkanDescriptorCacheSize) \ PROC(VulkanTextureDescriptorCacheSize) \ diff --git a/src/libANGLE/Platform.cpp b/src/libANGLE/Platform.cpp index 3ee8d4ed50..fafd1afdf1 100644 --- a/src/libANGLE/Platform.cpp +++ b/src/libANGLE/Platform.cpp @@ -48,6 +48,13 @@ bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display, { const char *expectedName = angle::g_PlatformMethodNames[nameIndex]; const char *actualName = methodNames[nameIndex]; + + // Skip deprecated methods. The names of these methods start with |placeholder|. + constexpr char kPlaceholder[] = "placeholder"; + if (strncmp(expectedName, kPlaceholder, sizeof(kPlaceholder) - 1) == 0) + { + continue; + } if (strcmp(expectedName, actualName) != 0) { ERR() << "Invalid platform method name: " << actualName << ", expected " << expectedName diff --git a/src/libANGLE/VertexArray.cpp b/src/libANGLE/VertexArray.cpp index 1ba4bf310b..2ec19e82c5 100644 --- a/src/libANGLE/VertexArray.cpp +++ b/src/libANGLE/VertexArray.cpp @@ -714,10 +714,8 @@ void VertexArray::onSubjectStateChange(angle::SubjectIndex index, angle::Subject break; case angle::SubjectMessage::InternalMemoryAllocationChanged: - setDependentDirtyBit(false, index); - break; - case angle::SubjectMessage::BufferVkStorageChanged: + setDependentDirtyBit(false, index); break; default: diff --git a/src/libANGLE/overlay_widgets.json b/src/libANGLE/overlay_widgets.json index 07092e75b1..da2108a550 100644 --- a/src/libANGLE/overlay_widgets.json +++ b/src/libANGLE/overlay_widgets.json @@ -134,8 +134,8 @@ } }, { - "name": "VulkanShaderBufferDSHitRate", - "comment": "Shader Buffer Descriptor Set Cache Hit Rate.", + "name": "VulkanShaderResourceDSHitRate", + "comment": "Shader Resource Descriptor Set Cache Hit Rate.", "type": "RunningGraph(60)", "color": [255, 0, 75, 200], "coords": [-50, 360], @@ -143,8 +143,8 @@ "height": 100, "description": { "color": [255, 0, 75, 255], - "coords": ["VulkanShaderBufferDSHitRate.left.align", - "VulkanShaderBufferDSHitRate.top.adjacent"], + "coords": ["VulkanShaderResourceDSHitRate.left.align", + "VulkanShaderResourceDSHitRate.top.adjacent"], "font": "small", "length": 40 } diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp index e71891ed37..96994d1d8c 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp @@ -1085,7 +1085,7 @@ void Renderer11::populateRenderer11DeviceCaps() &mRenderer11DeviceCaps.B5G6R5maxSamples); } - if (getFeatures().allowES3OnFL10_0.enabled) + if (getFeatures().allowES3OnFL100.enabled) { mRenderer11DeviceCaps.allowES3OnFL10_0 = true; } diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp index b23d19bfe8..2e40d4f756 100644 --- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp @@ -2446,7 +2446,7 @@ void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps, ANGLE_FEATURE_CONDITION(features, mrtPerfWorkaround, true); ANGLE_FEATURE_CONDITION(features, zeroMaxLodWorkaround, isFeatureLevel9_3); ANGLE_FEATURE_CONDITION(features, useInstancedPointSpriteEmulation, isFeatureLevel9_3); - ANGLE_FEATURE_CONDITION(features, allowES3OnFL10_0, false); + ANGLE_FEATURE_CONDITION(features, allowES3OnFL100, false); // TODO(jmadill): Disable workaround when we have a fixed compiler DLL. ANGLE_FEATURE_CONDITION(features, expandIntegerPowExpressions, true); diff --git a/src/libANGLE/renderer/gl/ContextGL.cpp b/src/libANGLE/renderer/gl/ContextGL.cpp index 6ea4d2a4da..dcb8cdb40f 100644 --- a/src/libANGLE/renderer/gl/ContextGL.cpp +++ b/src/libANGLE/renderer/gl/ContextGL.cpp @@ -223,7 +223,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawArraysState(const gl::Context *cont { const angle::FeaturesGL &features = getFeaturesGL(); if (context->getStateCache().hasAnyActiveClientAttrib() || - (features.shiftInstancedArrayDataWithExtraOffset.enabled && first > 0)) + (features.shiftInstancedArrayDataWithOffset.enabled && first > 0)) { const gl::State &glState = context->getState(); const gl::ProgramExecutable *executable = getState().getProgramExecutable(); @@ -237,7 +237,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawArraysState(const gl::Context *cont ANGLE_TRY(vaoGL->validateState(context)); #endif // ANGLE_STATE_VALIDATION_ENABLED } - else if (features.shiftInstancedArrayDataWithExtraOffset.enabled && first == 0) + else if (features.shiftInstancedArrayDataWithOffset.enabled && first == 0) { // There could be previous draw call that has modified the attributes // Instead of forcefully streaming attributes, we just rebind the original ones @@ -270,7 +270,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawElementsState(const gl::Context *co const gl::StateCache &stateCache = context->getStateCache(); const angle::FeaturesGL &features = getFeaturesGL(); - if (features.shiftInstancedArrayDataWithExtraOffset.enabled) + if (features.shiftInstancedArrayDataWithOffset.enabled) { // There might be instanced arrays that are forced streaming for drawArraysInstanced // They cannot be ELEMENT_ARRAY_BUFFER @@ -905,7 +905,7 @@ angle::Result ContextGL::onMakeCurrent(const gl::Context *context) angle::Result ContextGL::onUnMakeCurrent(const gl::Context *context) { ANGLE_TRY(flush(context)); - if (getFeaturesGL().unbindFBOOnContextSwitch.enabled) + if (getFeaturesGL().unbindFBOBeforeSwitchingContext.enabled) { mRenderer->getStateManager()->bindFramebuffer(GL_FRAMEBUFFER, 0); } diff --git a/src/libANGLE/renderer/gl/DisplayGL.cpp b/src/libANGLE/renderer/gl/DisplayGL.cpp index d7222aaed4..8f679b932e 100644 --- a/src/libANGLE/renderer/gl/DisplayGL.cpp +++ b/src/libANGLE/renderer/gl/DisplayGL.cpp @@ -175,7 +175,7 @@ std::string DisplayGL::getRendererDescription() std::string rendererString = GetRendererString(getRenderer()->getFunctions()); const angle::FeaturesGL &features = getRenderer()->getFeatures(); - if (features.sanitizeAmdGpuRendererString.enabled) + if (features.sanitizeAMDGPURendererString.enabled) { return SanitizeRendererString(rendererString); } diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp index 3d20ff5ab7..14b30c4927 100644 --- a/src/libANGLE/renderer/gl/FramebufferGL.cpp +++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp @@ -847,7 +847,7 @@ angle::Result FramebufferGL::blit(const gl::Context *context, gl::Rectangle finalSourceArea(sourceArea); gl::Rectangle finalDestArea(destArea); - if (features.adjustSrcDstRegionBlitFramebuffer.enabled) + if (features.adjustSrcDstRegionForBlitFramebuffer.enabled) { angle::Result result = adjustSrcDstRegion(context, finalSourceArea, finalDestArea, &finalSourceArea, &finalDestArea); @@ -856,7 +856,7 @@ angle::Result FramebufferGL::blit(const gl::Context *context, return result; } } - if (features.clipSrcRegionBlitFramebuffer.enabled) + if (features.clipSrcRegionForBlitFramebuffer.enabled) { angle::Result result = clipSrcRegion(context, finalSourceArea, finalDestArea, &finalSourceArea, &finalDestArea); diff --git a/src/libANGLE/renderer/gl/ShaderGL.cpp b/src/libANGLE/renderer/gl/ShaderGL.cpp index 041922d8a6..da1841622c 100644 --- a/src/libANGLE/renderer/gl/ShaderGL.cpp +++ b/src/libANGLE/renderer/gl/ShaderGL.cpp @@ -340,7 +340,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderGL::compile(const gl::Context *conte additionalOptions |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS; } - if (features.addBaseVertexToVertexID.enabled) + if (features.vertexIDDoesNotIncludeBaseVertex.enabled) { additionalOptions |= SH_ADD_BASE_VERTEX_TO_VERTEX_ID; } diff --git a/src/libANGLE/renderer/gl/TextureGL.cpp b/src/libANGLE/renderer/gl/TextureGL.cpp index eaf4652862..ad9bd10c21 100644 --- a/src/libANGLE/renderer/gl/TextureGL.cpp +++ b/src/libANGLE/renderer/gl/TextureGL.cpp @@ -73,7 +73,7 @@ bool GetDepthStencilWorkaround(GLenum format) bool GetEmulatedAlphaChannel(const angle::FeaturesGL &features, const gl::InternalFormat &originalInternalFormat) { - return (features.rgbDXT1TexturesSampleZeroAlpha.enabled && + return (features.RGBDXT1TexturesSampleZeroAlpha.enabled && originalInternalFormat.sizedInternalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT) || (features.emulateRGB10.enabled && originalInternalFormat.format == GL_RGB && originalInternalFormat.type == GL_UNSIGNED_INT_2_10_10_10_REV_EXT); @@ -1360,7 +1360,7 @@ angle::Result TextureGL::generateMipmap(const gl::Context *context) stateManager->bindTexture(getType(), mTextureID); if (baseLevelInternalFormat.colorEncoding == GL_SRGB && - features.encodeAndDecodeSRGBForGenerateMipmap.enabled && getType() == gl::TextureType::_2D) + features.decodeEncodeSRGBForGenerateMipmap.enabled && getType() == gl::TextureType::_2D) { nativegl::TexImageFormat texImageFormat = nativegl::GetTexImageFormat( functions, features, baseLevelInternalFormat.internalFormat, diff --git a/src/libANGLE/renderer/gl/VertexArrayGL.cpp b/src/libANGLE/renderer/gl/VertexArrayGL.cpp index 309027c0f3..dc981dee0d 100644 --- a/src/libANGLE/renderer/gl/VertexArrayGL.cpp +++ b/src/libANGLE/renderer/gl/VertexArrayGL.cpp @@ -212,7 +212,7 @@ angle::Result VertexArrayGL::syncDrawState(const gl::Context *context, indexRange.start = first; indexRange.end = first + count - 1; - if (features.shiftInstancedArrayDataWithExtraOffset.enabled && first > 0) + if (features.shiftInstancedArrayDataWithOffset.enabled && first > 0) { gl::AttributesMask updatedStreamingAttribsMask = needsStreamingAttribs; auto candidateAttributesMask = @@ -438,7 +438,7 @@ angle::Result VertexArrayGL::streamAttributes( GLuint adjustedDivisor = GetAdjustedDivisor(mAppliedNumViews, binding.getDivisor()); // streamedVertexCount is only going to be modified by - // shiftInstancedArrayDataWithExtraOffset workaround, otherwise it's const + // shiftInstancedArrayDataWithOffset workaround, otherwise it's const size_t streamedVertexCount = ComputeVertexBindingElementCount( adjustedDivisor, indexRange.vertexCount(), instanceCount); diff --git a/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp b/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp index a2b44d2bf0..af27e1ee4c 100644 --- a/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp +++ b/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp @@ -250,11 +250,14 @@ bool IOSurfaceSurfaceCGL::validateAttributes(EGLClientBuffer buffer, return false; } - // Check that the format matches this IOSurface plane + // FIXME: Check that the format matches this IOSurface plane for pixel formats that we know of. + // We could map IOSurfaceGetPixelFormat to expected type plane and format type. + // However, the caller might supply us non-public pixel format, which makes exhaustive checks + // problematic. if (IOSurfaceGetBytesPerElementOfPlane(ioSurface, plane) != kIOSurfaceFormats[formatIndex].componentBytes) { - return false; + WARN() << "IOSurface bytes per elements does not match the pbuffer internal format."; } return true; diff --git a/src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm b/src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm index ce4520df8c..8d6305aad4 100644 --- a/src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm +++ b/src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm @@ -319,10 +319,16 @@ bool IOSurfaceSurfaceEAGL::validateAttributes(EGLClientBuffer buffer, { return false; } + // FIXME: Check that the format matches this IOSurface plane for pixel formats that we know of. // We could map IOSurfaceGetPixelFormat to expected type plane and format type. // However, the caller might supply us non-public pixel format, which makes exhaustive checks // problematic. + if (IOSurfaceGetBytesPerElementOfPlane(ioSurface, plane) != + kIOSurfaceFormats[formatIndex].componentBytes) + { + WARN() << "IOSurface bytes per elements does not match the pbuffer internal format."; + } return true; } diff --git a/src/libANGLE/renderer/gl/formatutilsgl.cpp b/src/libANGLE/renderer/gl/formatutilsgl.cpp index 01d0e779c5..839a6b9c3b 100644 --- a/src/libANGLE/renderer/gl/formatutilsgl.cpp +++ b/src/libANGLE/renderer/gl/formatutilsgl.cpp @@ -507,7 +507,7 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, } if (internalFormat.sizedInternalFormat == GL_RGBA4 && - (features.rgba4IsNotSupportedForColorRendering.enabled || + (features.RGBA4IsNotSupportedForColorRendering.enabled || features.promotePackedFormatsTo8BitPerChannel.enabled)) { // Use an 8-bit format instead @@ -576,7 +576,7 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, } else if (internalFormat.colorEncoding == GL_SRGB) { - if (features.unsizedsRGBReadPixelsDoesntTransform.enabled) + if (features.unsizedSRGBReadPixelsDoesntTransform.enabled) { // Work around some Adreno driver bugs that don't read back SRGB data correctly when // it's in unsized SRGB texture formats. @@ -655,7 +655,7 @@ static GLenum GetNativeFormat(const FunctionsGL *functions, // Transform sRGB formats to RGB if either the GLES driver doesn't support GL_EXT_sRGB, or // to work around Adreno driver bugs reading back unsized sRGB texture data. if (!functions->hasGLESExtension("GL_EXT_sRGB") || - features.unsizedsRGBReadPixelsDoesntTransform.enabled) + features.unsizedSRGBReadPixelsDoesntTransform.enabled) { if (format == GL_SRGB) { diff --git a/src/libANGLE/renderer/gl/renderergl_utils.cpp b/src/libANGLE/renderer/gl/renderergl_utils.cpp index d6eff0dd93..a541a3e890 100644 --- a/src/libANGLE/renderer/gl/renderergl_utils.cpp +++ b/src/libANGLE/renderer/gl/renderergl_utils.cpp @@ -1709,17 +1709,17 @@ void GenerateCaps(const FunctionsGL *functions, // Expose this extension only when we support the formats or we're running on top of a native // ES driver. extensions->compressedTextureEtcANGLE = - (features.allowEtcFormats.enabled || functions->standard == STANDARD_GL_ES) && + (features.allowETCFormats.enabled || functions->standard == STANDARD_GL_ES) && gl::DetermineCompressedTextureETCSupport(*textureCapsMap); // When running on top of desktop OpenGL drivers and allow_etc_formats feature is not enabled, // mark ETC1 as emulated to hide it from WebGL clients. limitations->emulatedEtc1 = - !features.allowEtcFormats.enabled && functions->standard == STANDARD_GL_DESKTOP; + !features.allowETCFormats.enabled && functions->standard == STANDARD_GL_DESKTOP; // To work around broken unsized sRGB textures, sized sRGB textures are used. Disable EXT_sRGB // if those formats are not available. - if (features.unsizedsRGBReadPixelsDoesntTransform.enabled && + if (features.unsizedSRGBReadPixelsDoesntTransform.enabled && !functions->isAtLeastGLES(gl::Version(3, 0))) { extensions->sRGBEXT = false; @@ -1894,13 +1894,13 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ANGLE_FEATURE_CONDITION(features, avoid1BitAlphaTextureFormats, functions->standard == STANDARD_GL_DESKTOP && isAMD); - ANGLE_FEATURE_CONDITION(features, rgba4IsNotSupportedForColorRendering, + ANGLE_FEATURE_CONDITION(features, RGBA4IsNotSupportedForColorRendering, functions->standard == STANDARD_GL_DESKTOP && isIntel); // Although "Sandy Bridge", "Ivy Bridge", and "Haswell" may support GL_ARB_ES3_compatibility // extension, ETC2/EAC formats are emulated there. Newer Intel GPUs support them natively. ANGLE_FEATURE_CONDITION( - features, allowEtcFormats, + features, allowETCFormats, isIntel && !IsSandyBridge(device) && !IsIvyBridge(device) && !IsHaswell(device)); // Ported from gpu_driver_bug_list.json (#183) @@ -1931,7 +1931,7 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ANGLE_FEATURE_CONDITION(features, rewriteFloatUnaryMinusOperator, IsApple() && isIntel && GetMacOSVersion() < OSVersion(10, 12, 0)); - ANGLE_FEATURE_CONDITION(features, addBaseVertexToVertexID, IsApple() && isAMD); + ANGLE_FEATURE_CONDITION(features, vertexIDDoesNotIncludeBaseVertex, IsApple() && isAMD); // Triggers a bug on Marshmallow Adreno (4xx?) driver. // http://anglebug.com/2046 @@ -1982,7 +1982,7 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ANGLE_FEATURE_CONDITION(features, disableBlendFuncExtended, isAMD || isIntel); - ANGLE_FEATURE_CONDITION(features, unsizedsRGBReadPixelsDoesntTransform, + ANGLE_FEATURE_CONDITION(features, unsizedSRGBReadPixelsDoesntTransform, IsAndroid() && isQualcomm); ANGLE_FEATURE_CONDITION(features, queryCounterBitsGeneratesErrors, IsNexus5X(vendor, device)); @@ -2024,14 +2024,14 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ANGLE_FEATURE_CONDITION(features, clearToZeroOrOneBroken, IsApple() && isIntel && GetMacOSVersion() < OSVersion(10, 12, 6)); - ANGLE_FEATURE_CONDITION(features, adjustSrcDstRegionBlitFramebuffer, + ANGLE_FEATURE_CONDITION(features, adjustSrcDstRegionForBlitFramebuffer, IsLinux() || (IsAndroid() && isNvidia) || (IsWindows() && isNvidia) || (IsApple() && functions->standard == STANDARD_GL_ES)); - ANGLE_FEATURE_CONDITION(features, clipSrcRegionBlitFramebuffer, + ANGLE_FEATURE_CONDITION(features, clipSrcRegionForBlitFramebuffer, IsApple() || (IsLinux() && isAMD)); - ANGLE_FEATURE_CONDITION(features, rgbDXT1TexturesSampleZeroAlpha, IsApple()); + ANGLE_FEATURE_CONDITION(features, RGBDXT1TexturesSampleZeroAlpha, IsApple()); ANGLE_FEATURE_CONDITION(features, unfoldShortCircuits, IsApple()); @@ -2081,7 +2081,7 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature (IsAndroid() && IsMaliT8xxOrOlder(functions)) || (IsAndroid() && IsMaliG31OrOlder(functions))); - ANGLE_FEATURE_CONDITION(features, encodeAndDecodeSRGBForGenerateMipmap, IsApple()); + ANGLE_FEATURE_CONDITION(features, decodeEncodeSRGBForGenerateMipmap, IsApple()); // anglebug.com/4674 // The (redundant) explicit exclusion of Windows AMD is because the workaround fails @@ -2155,7 +2155,7 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature // http://crbug.com/1144207 // The Mac bot with Intel Iris GPU seems unaffected by this bug. Exclude the Haswell family for // now. - ANGLE_FEATURE_CONDITION(features, shiftInstancedArrayDataWithExtraOffset, + ANGLE_FEATURE_CONDITION(features, shiftInstancedArrayDataWithOffset, IsApple() && IsIntel(vendor) && !IsHaswell(device)); ANGLE_FEATURE_CONDITION(features, syncVertexArraysToDefault, !nativegl::SupportsVertexArrayObjects(functions)); @@ -2163,12 +2163,12 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature // http://crbug.com/1181193 // On desktop Linux/AMD when using the amdgpu drivers, the precise kernel and DRM version are // leaked via GL_RENDERER. We workaround this too improve user security. - ANGLE_FEATURE_CONDITION(features, sanitizeAmdGpuRendererString, IsLinux() && hasAMD); + ANGLE_FEATURE_CONDITION(features, sanitizeAMDGPURendererString, IsLinux() && hasAMD); // http://crbug.com/1187513 // Imagination drivers are buggy with context switching. It needs to unbind fbo before context // switching to workadround the driver issues. - ANGLE_FEATURE_CONDITION(features, unbindFBOOnContextSwitch, IsPowerVR(vendor)); + ANGLE_FEATURE_CONDITION(features, unbindFBOBeforeSwitchingContext, IsPowerVR(vendor)); // http://crbug.com/1181068 and http://crbug.com/783979 ANGLE_FEATURE_CONDITION(features, flushOnFramebufferChange, @@ -2238,7 +2238,7 @@ void ReInitializeFeaturesAtGPUSwitch(const FunctionsGL *functions, angle::Featur // The Mac bot with Intel Iris GPU seems unaffected by this bug. Exclude the Haswell family for // now. // We need to reinitialize this feature when switching between buggy and non-buggy GPUs. - ANGLE_FEATURE_CONDITION(features, shiftInstancedArrayDataWithExtraOffset, + ANGLE_FEATURE_CONDITION(features, shiftInstancedArrayDataWithOffset, IsApple() && IsIntel(vendor) && !IsHaswell(device)); } diff --git a/src/libANGLE/renderer/metal/DisplayMtl.mm b/src/libANGLE/renderer/metal/DisplayMtl.mm index c464e65211..3008823731 100644 --- a/src/libANGLE/renderer/metal/DisplayMtl.mm +++ b/src/libANGLE/renderer/metal/DisplayMtl.mm @@ -1062,7 +1062,7 @@ void DisplayMtl::initializeFeatures() // http://anglebug.com/4919 // Stencil blit shader is not compiled on Intel & NVIDIA, need investigation. - ANGLE_FEATURE_CONDITION((&mFeatures), hasStencilOutput, + ANGLE_FEATURE_CONDITION((&mFeatures), hasShaderStencilOutput, isMetal2_1 && !isIntel() && !isNVIDIA()); ANGLE_FEATURE_CONDITION((&mFeatures), hasTextureSwizzle, @@ -1085,7 +1085,7 @@ void DisplayMtl::initializeFeatures() ANGLE_FEATURE_CONDITION((&mFeatures), hasNonUniformDispatch, isOSX || isCatalyst || supportsAppleGPUFamily(4)); - ANGLE_FEATURE_CONDITION((&mFeatures), allowSeparatedDepthStencilBuffers, + ANGLE_FEATURE_CONDITION((&mFeatures), allowSeparateDepthStencilBuffers, !isOSX && !isCatalyst && !isSimulator); ANGLE_FEATURE_CONDITION((&mFeatures), rewriteRowMajorMatrices, true); ANGLE_FEATURE_CONDITION((&mFeatures), emulateTransformFeedback, true); diff --git a/src/libANGLE/renderer/metal/FrameBufferMtl.h b/src/libANGLE/renderer/metal/FrameBufferMtl.h index 00693bfe94..2e033c0da1 100644 --- a/src/libANGLE/renderer/metal/FrameBufferMtl.h +++ b/src/libANGLE/renderer/metal/FrameBufferMtl.h @@ -206,6 +206,7 @@ class FramebufferMtl : public FramebufferImpl const mtl::BufferRef *dstBuffer) const; RenderTargetMtl *getColorReadRenderTargetNoCache(const gl::Context *context) const; + bool prepareForUse(const gl::Context *context) const; // NOTE: we cannot use RenderTargetCache here because it doesn't support separate // depth & stencil attachments as of now. Separate depth & stencil could be useful to diff --git a/src/libANGLE/renderer/metal/FrameBufferMtl.mm b/src/libANGLE/renderer/metal/FrameBufferMtl.mm index 70fc858e23..422b0cac21 100644 --- a/src/libANGLE/renderer/metal/FrameBufferMtl.mm +++ b/src/libANGLE/renderer/metal/FrameBufferMtl.mm @@ -487,7 +487,7 @@ angle::Result FramebufferMtl::blitWithDraw(const gl::Context *context, dsBlitParams.srcLevel = srcStencilRt->getLevelIndex(); dsBlitParams.srcLayer = srcStencilRt->getLayerIndex(); - if (!contextMtl->getDisplay()->getFeatures().hasStencilOutput.enabled && + if (!contextMtl->getDisplay()->getFeatures().hasShaderStencilOutput.enabled && mStencilRenderTarget) { // Directly writing to stencil in shader is not supported, use temporary copy buffer @@ -551,7 +551,7 @@ gl::FramebufferStatus FramebufferMtl::checkStatus(const gl::Context *context) co } ContextMtl *contextMtl = mtl::GetImpl(context); - if (!contextMtl->getDisplay()->getFeatures().allowSeparatedDepthStencilBuffers.enabled && + if (!contextMtl->getDisplay()->getFeatures().allowSeparateDepthStencilBuffers.enabled && mState.hasSeparateDepthAndStencilAttachments()) { return gl::FramebufferStatus::Incomplete( @@ -687,26 +687,37 @@ angle::Result FramebufferMtl::getSamplePosition(const gl::Context *context, return angle::Result::Stop; } -RenderTargetMtl *FramebufferMtl::getColorReadRenderTarget(const gl::Context *context) const +bool FramebufferMtl::prepareForUse(const gl::Context *context) const { - if (mState.getReadIndex() >= mColorRenderTargets.size()) - { - return nullptr; - } - if (mBackbuffer) { - bool isNewDrawable = false; - if (IsError(mBackbuffer->ensureCurrentDrawableObtained(context, &isNewDrawable))) + // Backbuffer might obtain new drawable, which means it might change the + // the native texture used as the target of the render pass. + // We need to call this before creating render encoder. + if (IsError(mBackbuffer->ensureCurrentDrawableObtained(context))) { - return nullptr; + return false; } - if (isNewDrawable && mBackbuffer->hasRobustResourceInit()) + if (mBackbuffer->hasRobustResourceInit()) { (void)mBackbuffer->initializeContents(context, gl::ImageIndex::Make2D(0)); } } + return true; +} + +RenderTargetMtl *FramebufferMtl::getColorReadRenderTarget(const gl::Context *context) const +{ + if (mState.getReadIndex() >= mColorRenderTargets.size()) + { + return nullptr; + } + + if (!prepareForUse(context)) + { + return nullptr; + } return mColorRenderTargets[mState.getReadIndex()]; } @@ -761,22 +772,9 @@ mtl::RenderCommandEncoder *FramebufferMtl::ensureRenderPassStarted(const gl::Con { ContextMtl *contextMtl = mtl::GetImpl(context); - if (mBackbuffer) + if (!prepareForUse(context)) { - // Backbuffer might obtain new drawable, which means it might change the - // the native texture used as the target of the render pass. - // We need to call this before creating render encoder. - bool isNewDrawable; - if (IsError(mBackbuffer->ensureCurrentDrawableObtained(context, &isNewDrawable))) - { - return nullptr; - } - - if (isNewDrawable && mBackbuffer->hasRobustResourceInit()) - { - // Apply robust resource initialization on newly obtained drawable. - (void)mBackbuffer->initializeContents(context, gl::ImageIndex::Make2D(0)); - } + return nullptr; } // Only support ensureRenderPassStarted() with different load & store options only. The diff --git a/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm b/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm index ab7283ae1c..2eba972a0b 100644 --- a/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm +++ b/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm @@ -219,11 +219,14 @@ bool IOSurfaceSurfaceMtl::ValidateAttributes(EGLClientBuffer buffer, return false; } - // Check that the format matches this IOSurface plane + // FIXME: Check that the format matches this IOSurface plane for pixel formats that we know of. + // We could map IOSurfaceGetPixelFormat to expected type plane and format type. + // However, the caller might supply us non-public pixel format, which makes exhaustive checks + // problematic. if (IOSurfaceGetBytesPerElementOfPlane(ioSurface, plane) != kIOSurfaceFormats[formatIndex].componentBytes) { - return false; + WARN() << "IOSurface bytes per elements does not match the pbuffer internal format."; } return true; diff --git a/src/libANGLE/renderer/metal/SurfaceMtl.h b/src/libANGLE/renderer/metal/SurfaceMtl.h index 10d2e527e9..142ee9e99d 100644 --- a/src/libANGLE/renderer/metal/SurfaceMtl.h +++ b/src/libANGLE/renderer/metal/SurfaceMtl.h @@ -107,6 +107,7 @@ class SurfaceMtl : public SurfaceImpl bool mAutoResolveMSColorTexture = false; bool mRobustResourceInit = false; + bool mContentInitialized = false; mtl::Format mColorFormat; mtl::Format mDepthFormat; @@ -154,8 +155,6 @@ class WindowSurfaceMtl : public SurfaceMtl FramebufferAttachmentRenderTarget **rtOut) override; angle::Result ensureCurrentDrawableObtained(const gl::Context *context); - angle::Result ensureCurrentDrawableObtained(const gl::Context *context, - bool *newDrawableOut /** nullable */); // Ensure the the texture returned from getColorTexture() is ready for glReadPixels(). This // implicitly calls ensureCurrentDrawableObtained(). diff --git a/src/libANGLE/renderer/metal/SurfaceMtl.mm b/src/libANGLE/renderer/metal/SurfaceMtl.mm index 6855e4516c..b88ff19476 100644 --- a/src/libANGLE/renderer/metal/SurfaceMtl.mm +++ b/src/libANGLE/renderer/metal/SurfaceMtl.mm @@ -97,7 +97,7 @@ SurfaceMtl::SurfaceMtl(DisplayMtl *display, if (depthBits && stencilBits) { - if (display->getFeatures().allowSeparatedDepthStencilBuffers.enabled) + if (display->getFeatures().allowSeparateDepthStencilBuffers.enabled) { mDepthFormat = display->getPixelFormat(kDefaultFrameBufferDepthFormatId); mStencilFormat = display->getPixelFormat(kDefaultFrameBufferStencilFormatId); @@ -255,6 +255,12 @@ angle::Result SurfaceMtl::initializeContents(const gl::Context *context, const gl::ImageIndex &imageIndex) { ASSERT(mColorTexture); + + if (mContentInitialized) + { + return angle::Result::Continue; + } + ContextMtl *contextMtl = mtl::GetImpl(context); // Use loadAction=clear @@ -279,6 +285,7 @@ angle::Result SurfaceMtl::initializeContents(const gl::Context *context, } mtl::RenderCommandEncoder *encoder = contextMtl->getRenderPassCommandEncoder(rpDesc); encoder->setStoreAction(MTLStoreActionStore); + mContentInitialized = true; return angle::Result::Continue; } @@ -499,14 +506,7 @@ EGLint WindowSurfaceMtl::getSwapBehavior() const angle::Result WindowSurfaceMtl::initializeContents(const gl::Context *context, const gl::ImageIndex &imageIndex) { - bool newDrawable; - ANGLE_TRY(ensureCurrentDrawableObtained(context, &newDrawable)); - - if (!newDrawable) - { - return angle::Result::Continue; - } - + ANGLE_TRY(ensureCurrentDrawableObtained(context)); return SurfaceMtl::initializeContents(context, imageIndex); } @@ -516,7 +516,7 @@ angle::Result WindowSurfaceMtl::getAttachmentRenderTarget(const gl::Context *con GLsizei samples, FramebufferAttachmentRenderTarget **rtOut) { - ANGLE_TRY(ensureCurrentDrawableObtained(context, nullptr)); + ANGLE_TRY(ensureCurrentDrawableObtained(context)); ANGLE_TRY(ensureCompanionTexturesSizeCorrect(context)); return SurfaceMtl::getAttachmentRenderTarget(context, binding, imageIndex, samples, rtOut); @@ -524,16 +524,6 @@ angle::Result WindowSurfaceMtl::getAttachmentRenderTarget(const gl::Context *con angle::Result WindowSurfaceMtl::ensureCurrentDrawableObtained(const gl::Context *context) { - return ensureCurrentDrawableObtained(context, nullptr); -} -angle::Result WindowSurfaceMtl::ensureCurrentDrawableObtained(const gl::Context *context, - bool *newDrawableOut) -{ - if (newDrawableOut) - { - *newDrawableOut = !mCurrentDrawable; - } - if (!mCurrentDrawable) { ANGLE_TRY(obtainNextDrawable(context)); @@ -556,7 +546,7 @@ angle::Result WindowSurfaceMtl::ensureCompanionTexturesSizeCorrect(const gl::Con angle::Result WindowSurfaceMtl::ensureColorTextureReadyForReadPixels(const gl::Context *context) { - ANGLE_TRY(ensureCurrentDrawableObtained(context, nullptr)); + ANGLE_TRY(ensureCurrentDrawableObtained(context)); if (mMSColorTexture) { @@ -632,6 +622,7 @@ angle::Result WindowSurfaceMtl::obtainNextDrawable(const gl::Context *context) mMetalLayer.get().allowsNextDrawableTimeout = NO; mCurrentDrawable.retainAssign([mMetalLayer nextDrawable]); mMetalLayer.get().allowsNextDrawableTimeout = YES; + mContentInitialized = false; } if (!mColorTexture) diff --git a/src/libANGLE/renderer/metal/mtl_render_utils.mm b/src/libANGLE/renderer/metal/mtl_render_utils.mm index 1613ee9b7f..ad9e886134 100644 --- a/src/libANGLE/renderer/metal/mtl_render_utils.mm +++ b/src/libANGLE/renderer/metal/mtl_render_utils.mm @@ -1746,7 +1746,7 @@ angle::Result DepthStencilBlitUtils::setupDepthStencilBlitWithDraw( { cmdEncoder->setFragmentTexture(params.srcStencil, 1); - if (!contextMtl->getDisplay()->getFeatures().hasStencilOutput.enabled) + if (!contextMtl->getDisplay()->getFeatures().hasShaderStencilOutput.enabled) { // Hardware must support stencil writing directly in shader. UNREACHABLE(); diff --git a/src/libANGLE/renderer/renderer_utils.cpp b/src/libANGLE/renderer/renderer_utils.cpp index a896d88c34..9ac2be7e8c 100644 --- a/src/libANGLE/renderer/renderer_utils.cpp +++ b/src/libANGLE/renderer/renderer_utils.cpp @@ -24,6 +24,75 @@ #include "platform/Feature.h" #include <string.h> +#include <cctype> + +namespace angle +{ +namespace +{ +// For the sake of feature name matching, underscore is ignored, and the names are matched +// case-insensitive. This allows feature names to be overriden both in snake_case (previously used +// by ANGLE) and camelCase. +bool FeatureNameMatch(const std::string &a, const std::string &b) +{ + size_t ai = 0; + size_t bi = 0; + + while (ai < a.size() && bi < b.size()) + { + if (a[ai] == '_') + { + ++ai; + } + if (b[bi] == '_') + { + ++bi; + } + if (std::tolower(a[ai++]) != std::tolower(b[bi++])) + { + return false; + } + } + + return ai == a.size() && bi == b.size(); +} + +// Search for a feature by name, matching it loosely so that both snake_case and camelCase names are +// matched. +FeatureInfo *FindFeatureByName(FeatureMap *features, const std::string &name) +{ + for (auto iter : *features) + { + if (FeatureNameMatch(iter.first, name)) + { + return iter.second; + } + } + return nullptr; +} +} // anonymous namespace + +// FeatureSetBase implementation +void FeatureSetBase::overrideFeatures(const std::vector<std::string> &featureNames, bool enabled) +{ + for (const std::string &name : featureNames) + { + FeatureInfo *feature = FindFeatureByName(&members, name); + if (feature != nullptr) + { + feature->enabled = enabled; + } + } +} + +void FeatureSetBase::populateFeatureList(FeatureList *features) const +{ + for (FeatureMap::const_iterator it = members.begin(); it != members.end(); it++) + { + features->push_back(it->second); + } +} +} // namespace angle namespace rx { @@ -225,7 +294,6 @@ void SetFloatUniformMatrixFast(unsigned int arrayElementOffset, memcpy(targetData, valueData, matrixSize * count); } - } // anonymous namespace void RotateRectangle(const SurfaceRotation rotation, @@ -1012,6 +1080,7 @@ void ApplyFeatureOverrides(angle::FeatureSetBase *features, const egl::DisplaySt std::vector<std::string> overridesDisabled = angle::GetCachedStringsFromEnvironmentVarOrAndroidProperty( kAngleFeatureOverridesDisabledEnvName, kAngleFeatureOverridesDisabledPropertyName, ":"); + features->overrideFeatures(overridesEnabled, true); LogFeatureStatus(*features, overridesEnabled, true); diff --git a/src/libANGLE/renderer/vulkan/BUILD.gn b/src/libANGLE/renderer/vulkan/BUILD.gn index bf7a68ad24..13281676fc 100644 --- a/src/libANGLE/renderer/vulkan/BUILD.gn +++ b/src/libANGLE/renderer/vulkan/BUILD.gn @@ -197,6 +197,15 @@ if (angle_use_x11) { ] } +if (angle_use_wayland) { + _vulkan_backend_sources += [ + "linux/wayland/DisplayVkWayland.cpp", + "linux/wayland/DisplayVkWayland.h", + "linux/wayland/WindowSurfaceVkWayland.cpp", + "linux/wayland/WindowSurfaceVkWayland.h", + ] +} + if (is_fuchsia) { _vulkan_backend_sources += [ "fuchsia/DisplayVkFuchsia.cpp", @@ -292,6 +301,10 @@ angle_source_set("angle_vulkan_backend") { ] public_configs = [ ":angle_vulkan_backend_config" ] + if (angle_use_wayland) { + public_configs += [ "$angle_root:angle_wayland_config" ] + } + data_deps = [] defines = [] diff --git a/src/libANGLE/renderer/vulkan/BufferVk.cpp b/src/libANGLE/renderer/vulkan/BufferVk.cpp index 120db49aae..a2abbdcac1 100644 --- a/src/libANGLE/renderer/vulkan/BufferVk.cpp +++ b/src/libANGLE/renderer/vulkan/BufferVk.cpp @@ -365,11 +365,12 @@ angle::Result BufferVk::setDataWithMemoryType(const gl::Context *context, return angle::Result::Continue; } - const bool wholeSize = size == static_cast<size_t>(mState.getSize()); + const bool bufferSizeChanged = size != static_cast<size_t>(mState.getSize()); + const bool inUseAndRespecifiedWithoutData = (data == nullptr && isCurrentlyInUse(contextVk)); - // BufferData call is re-specifying the entire buffer - // Release and init a new mBuffer with this new size - if (!wholeSize) + // The entire buffer is being respecified, possibly with null data. + // Release and init a new mBuffer with requested size. + if (bufferSizeChanged || inUseAndRespecifiedWithoutData) { // Release and re-create the memory and buffer. release(contextVk); @@ -383,8 +384,8 @@ angle::Result BufferVk::setDataWithMemoryType(const gl::Context *context, if (data) { // Treat full-buffer updates as SubData calls. - BufferUpdateType updateType = - wholeSize ? BufferUpdateType::ContentsUpdate : BufferUpdateType::StorageRedefined; + BufferUpdateType updateType = bufferSizeChanged ? BufferUpdateType::StorageRedefined + : BufferUpdateType::ContentsUpdate; ANGLE_TRY(setDataImpl(contextVk, static_cast<const uint8_t *>(data), size, 0, updateType)); } diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp index ae4061a413..370512f9d5 100644 --- a/src/libANGLE/renderer/vulkan/ContextVk.cpp +++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp @@ -2460,22 +2460,21 @@ angle::Result ContextVk::handleDirtyDescriptorSetsImpl(CommandBufferT *commandBu void ContextVk::syncObjectPerfCounters() { - mPerfCounters.descriptorSetCacheTotalSize = 0; - mPerfCounters.descriptorSetCacheKeySizeBytes = 0; - mPerfCounters.uniformsAndXfbDescriptorSetCacheHits = 0; - mPerfCounters.uniformsAndXfbDescriptorSetCacheMisses = 0; - mPerfCounters.uniformsAndXfbDescriptorSetCacheTotalSize = 0; - mPerfCounters.textureDescriptorSetCacheHits = 0; - mPerfCounters.textureDescriptorSetCacheMisses = 0; - mPerfCounters.textureDescriptorSetCacheTotalSize = 0; - mPerfCounters.shaderBuffersDescriptorSetCacheHits = 0; - mPerfCounters.shaderBuffersDescriptorSetCacheMisses = 0; - mPerfCounters.shaderBuffersDescriptorSetCacheTotalSize = 0; - mPerfCounters.dynamicBufferAllocations = 0; + mPerfCounters.descriptorSetCacheTotalSize = 0; + mPerfCounters.descriptorSetCacheKeySizeBytes = 0; + mPerfCounters.uniformsAndXfbDescriptorSetCacheHits = 0; + mPerfCounters.uniformsAndXfbDescriptorSetCacheMisses = 0; + mPerfCounters.uniformsAndXfbDescriptorSetCacheTotalSize = 0; + mPerfCounters.textureDescriptorSetCacheHits = 0; + mPerfCounters.textureDescriptorSetCacheMisses = 0; + mPerfCounters.textureDescriptorSetCacheTotalSize = 0; + mPerfCounters.shaderResourcesDescriptorSetCacheHits = 0; + mPerfCounters.shaderResourcesDescriptorSetCacheMisses = 0; + mPerfCounters.shaderResourcesDescriptorSetCacheTotalSize = 0; + mPerfCounters.dynamicBufferAllocations = 0; // ProgramExecutableVk's descriptor set allocations - const gl::State &state = getState(); - const gl::ShaderProgramManager &shadersAndPrograms = state.getShaderProgramManagerForCapture(); + const gl::ShaderProgramManager &shadersAndPrograms = mState.getShaderProgramManagerForCapture(); const gl::ResourceMap<gl::Program, gl::ShaderProgramID> &programs = shadersAndPrograms.getProgramsForCaptureAndPerf(); for (const std::pair<GLuint, gl::Program *> &resource : programs) @@ -2487,7 +2486,7 @@ void ContextVk::syncObjectPerfCounters() } ProgramVk *programVk = vk::GetImpl(resource.second); ProgramExecutablePerfCounters progPerfCounters = - programVk->getExecutable().getAndResetObjectPerfCounters(); + programVk->getExecutable().getDescriptorSetPerfCounters(); mPerfCounters.uniformsAndXfbDescriptorSetCacheHits += progPerfCounters.cacheStats[DescriptorSetIndex::UniformsAndXfb].getHitCount(); @@ -2501,11 +2500,11 @@ void ContextVk::syncObjectPerfCounters() progPerfCounters.cacheStats[DescriptorSetIndex::Texture].getMissCount(); mPerfCounters.textureDescriptorSetCacheTotalSize += progPerfCounters.cacheStats[DescriptorSetIndex::Texture].getSize(); - mPerfCounters.shaderBuffersDescriptorSetCacheHits += + mPerfCounters.shaderResourcesDescriptorSetCacheHits += progPerfCounters.cacheStats[DescriptorSetIndex::ShaderResource].getHitCount(); - mPerfCounters.shaderBuffersDescriptorSetCacheMisses += + mPerfCounters.shaderResourcesDescriptorSetCacheMisses += progPerfCounters.cacheStats[DescriptorSetIndex::ShaderResource].getMissCount(); - mPerfCounters.shaderBuffersDescriptorSetCacheTotalSize += + mPerfCounters.shaderResourcesDescriptorSetCacheTotalSize += progPerfCounters.cacheStats[DescriptorSetIndex::ShaderResource].getSize(); for (uint32_t keySizeBytes : progPerfCounters.descriptorSetCacheKeySizesBytes) @@ -2518,7 +2517,7 @@ void ContextVk::syncObjectPerfCounters() mPerfCounters.uniformsAndXfbDescriptorSetCacheTotalSize; mPerfCounters.descriptorSetCacheTotalSize += mPerfCounters.textureDescriptorSetCacheTotalSize; mPerfCounters.descriptorSetCacheTotalSize += - mPerfCounters.shaderBuffersDescriptorSetCacheTotalSize; + mPerfCounters.shaderResourcesDescriptorSetCacheTotalSize; for (const DriverUniformsDescriptorSet &driverSet : mDriverUniforms) { @@ -2556,18 +2555,18 @@ void ContextVk::updateOverlayOnPresent() } { - gl::RunningGraphWidget *shaderBufferHitRate = - overlay->getRunningGraphWidget(gl::WidgetId::VulkanShaderBufferDSHitRate); - size_t numCacheAccesses = mPerfCounters.shaderBuffersDescriptorSetCacheHits + - mPerfCounters.shaderBuffersDescriptorSetCacheMisses; + gl::RunningGraphWidget *shaderResourceHitRate = + overlay->getRunningGraphWidget(gl::WidgetId::VulkanShaderResourceDSHitRate); + size_t numCacheAccesses = mPerfCounters.shaderResourcesDescriptorSetCacheHits + + mPerfCounters.shaderResourcesDescriptorSetCacheMisses; if (numCacheAccesses > 0) { float hitRateFloat = - static_cast<float>(mPerfCounters.shaderBuffersDescriptorSetCacheHits) / + static_cast<float>(mPerfCounters.shaderResourcesDescriptorSetCacheHits) / static_cast<float>(numCacheAccesses); size_t hitRate = static_cast<size_t>(hitRateFloat * 100.0f); - shaderBufferHitRate->add(hitRate); - shaderBufferHitRate->next(); + shaderResourceHitRate->add(hitRate); + shaderResourceHitRate->next(); } } @@ -6146,8 +6145,6 @@ angle::Result ContextVk::flushAndGetSerial(const vk::Semaphore *signalSemaphore, ANGLE_TRY(submitFrame(signalSemaphore, submitSerialOut)); - resetPerFramePerfCounters(); - ASSERT(mWaitSemaphores.empty()); ASSERT(mWaitSemaphoreStageMasks.empty()); @@ -7229,5 +7226,18 @@ void ContextVk::resetPerFramePerfCounters() mPerfCounters.flushedOutsideRenderPassCommandBuffers = 0; mPerfCounters.resolveImageCommands = 0; mPerfCounters.descriptorSetAllocations = 0; + + const gl::ResourceMap<gl::Program, gl::ShaderProgramID> &programs = + mState.getShaderProgramManagerForCapture().getProgramsForCaptureAndPerf(); + for (const std::pair<GLuint, gl::Program *> &resource : programs) + { + gl::Program *program = resource.second; + if (program->hasLinkingState()) + { + continue; + } + ProgramVk *programVk = vk::GetImpl(program); + programVk->getExecutable().resetDescriptorSetPerfCounters(); + } } } // namespace rx diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h index 78178560aa..f8f79b5591 100644 --- a/src/libANGLE/renderer/vulkan/ContextVk.h +++ b/src/libANGLE/renderer/vulkan/ContextVk.h @@ -737,6 +737,8 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText const angle::PerfMonitorCounterGroups &getPerfMonitorCounters() override; + void resetPerFramePerfCounters(); + private: // Dirty bits. enum DirtyBitType : size_t @@ -1164,8 +1166,6 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText void updateShaderResourcesDescriptorDesc(PipelineType pipelineType); - void resetPerFramePerfCounters(); - std::array<GraphicsDirtyBitHandler, DIRTY_BIT_MAX> mGraphicsDirtyBitHandlers; std::array<ComputeDirtyBitHandler, DIRTY_BIT_MAX> mComputeDirtyBitHandlers; diff --git a/src/libANGLE/renderer/vulkan/DisplayVk_api.h b/src/libANGLE/renderer/vulkan/DisplayVk_api.h index 39fd2cb35d..24ad077822 100644 --- a/src/libANGLE/renderer/vulkan/DisplayVk_api.h +++ b/src/libANGLE/renderer/vulkan/DisplayVk_api.h @@ -24,6 +24,9 @@ DisplayImpl *CreateVulkanWin32Display(const egl::DisplayState &state); #endif // defined(ANGLE_PLATFORM_WINDOWS) #if defined(ANGLE_PLATFORM_LINUX) +bool IsVulkanWaylandDisplayAvailable(); +DisplayImpl *CreateVulkanWaylandDisplay(const egl::DisplayState &state); + bool IsVulkanXcbDisplayAvailable(); DisplayImpl *CreateVulkanXcbDisplay(const egl::DisplayState &state); diff --git a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp index 671eb696ec..3a101561c5 100644 --- a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp +++ b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp @@ -199,7 +199,7 @@ angle::Result ProgramInfo::initProgram(ContextVk *contextVk, options.shaderType = shaderType; options.removeEarlyFragmentTestsOptimization = shaderType == gl::ShaderType::Fragment && optionBits.removeEarlyFragmentTestsOptimization; - options.removeDebugInfo = !contextVk->getFeatures().retainSpirvDebugInfo.enabled; + options.removeDebugInfo = !contextVk->getFeatures().retainSPIRVDebugInfo.enabled; options.isTransformFeedbackStage = isLastPreFragmentStage && isTransformFeedbackProgram && !optionBits.removeTransformFeedbackEmulation; options.isTransformFeedbackEmulated = contextVk->getFeatures().emulateTransformFeedback.enabled; @@ -1261,13 +1261,13 @@ void ProgramExecutableVk::updateDefaultUniformsDescriptorSet( angle::Result ProgramExecutableVk::allocateShaderResourcesDescriptorSet( vk::Context *context, vk::ResourceUseList *resourceUseList, - const vk::DescriptorSetDesc *shaderBuffersDesc) + const vk::DescriptorSetDesc *shaderResourcesDesc) { bool newPoolAllocated = false; ANGLE_TRY(allocateDescriptorSetAndGetInfo( context, resourceUseList, DescriptorSetIndex::ShaderResource, &newPoolAllocated)); - if (shaderBuffersDesc) + if (shaderResourcesDesc) { // Clear descriptor set cache. It may no longer be valid. if (newPoolAllocated) @@ -1276,7 +1276,7 @@ angle::Result ProgramExecutableVk::allocateShaderResourcesDescriptorSet( } mShaderBufferDescriptorsCache.insert( - *shaderBuffersDesc, mDescriptorSets[DescriptorSetIndex::ShaderResource], + *shaderResourcesDesc, mDescriptorSets[DescriptorSetIndex::ShaderResource], &mPerfCounters.cacheStats[DescriptorSetIndex::ShaderResource]); } return angle::Result::Continue; @@ -1288,7 +1288,7 @@ angle::Result ProgramExecutableVk::updateBuffersDescriptorSet( vk::BufferHelper *emptyBuffer, vk::ResourceUseList *resourceUseList, gl::ShaderType shaderType, - const vk::DescriptorSetDesc &shaderBuffersDesc, + const vk::DescriptorSetDesc &shaderResourcesDesc, const gl::BufferVector &buffers, const std::vector<gl::InterfaceBlock> &blocks, ShaderVariableType variableType, @@ -1389,7 +1389,7 @@ angle::Result ProgramExecutableVk::updateAtomicCounterBuffersDescriptorSet( const gl::BufferVector &atomicCounterBufferBindings, const gl::ProgramExecutable &executable, gl::ShaderType shaderType, - const vk::DescriptorSetDesc &shaderBuffersDesc, + const vk::DescriptorSetDesc &shaderResourcesDesc, bool cacheHit) { const std::vector<gl::AtomicCounterBuffer> &atomicCounterBuffers = @@ -1585,7 +1585,7 @@ angle::Result ProgramExecutableVk::updateShaderResourcesDescriptorSet( vk::BufferHelper *emptyBuffer, vk::ResourceUseList *resourceUseList, FramebufferVk *framebufferVk, - const vk::DescriptorSetDesc &shaderBuffersDesc) + const vk::DescriptorSetDesc &shaderResourcesDesc) { // Reset the descriptor set handles so we only allocate a new one when necessary. mDescriptorSets[DescriptorSetIndex::ShaderResource] = VK_NULL_HANDLE; @@ -1603,7 +1603,7 @@ angle::Result ProgramExecutableVk::updateShaderResourcesDescriptorSet( { VkDescriptorSet descriptorSet = VK_NULL_HANDLE; if (mShaderBufferDescriptorsCache.get( - shaderBuffersDesc, &descriptorSet, + shaderResourcesDesc, &descriptorSet, &mPerfCounters.cacheStats[DescriptorSetIndex::ShaderResource])) { mDescriptorSets[DescriptorSetIndex::ShaderResource] = descriptorSet; @@ -1616,7 +1616,7 @@ angle::Result ProgramExecutableVk::updateShaderResourcesDescriptorSet( else { ANGLE_TRY(allocateShaderResourcesDescriptorSet(contextVk, resourceUseList, - &shaderBuffersDesc)); + &shaderResourcesDesc)); } } else @@ -1640,17 +1640,17 @@ angle::Result ProgramExecutableVk::updateShaderResourcesDescriptorSet( for (gl::ShaderType shaderType : executable->getLinkedShaderStages()) { ANGLE_TRY(updateBuffersDescriptorSet( - contextVk, updateBuilder, emptyBuffer, resourceUseList, shaderType, shaderBuffersDesc, + contextVk, updateBuilder, emptyBuffer, resourceUseList, shaderType, shaderResourcesDesc, uniformBuffers, executable->getUniformBlocks(), ShaderVariableType::UniformBuffer, mUniformBufferDescriptorType, limits.maxUniformBufferRange, cacheHit)); ANGLE_TRY(updateBuffersDescriptorSet( - contextVk, updateBuilder, emptyBuffer, resourceUseList, shaderType, shaderBuffersDesc, + contextVk, updateBuilder, emptyBuffer, resourceUseList, shaderType, shaderResourcesDesc, storageBuffers, executable->getShaderStorageBlocks(), ShaderVariableType::ShaderStorageBuffer, kStorageBufferDescriptorType, limits.maxStorageBufferRange, cacheHit)); ANGLE_TRY(updateAtomicCounterBuffersDescriptorSet( contextVk, updateBuilder, emptyBuffer, resourceUseList, atomicCounterBufferBindings, - *executable, shaderType, shaderBuffersDesc, cacheHit)); + *executable, shaderType, shaderResourcesDesc, cacheHit)); ANGLE_TRY(updateImagesDescriptorSet(contextVk, resourceUseList, updateBuilder, activeImages, glState.getImageUnits(), *executable, shaderType)); ANGLE_TRY(updateInputAttachmentDescriptorSet(contextVk, resourceUseList, updateBuilder, @@ -2035,8 +2035,9 @@ template angle::Result ProgramExecutableVk::updateDescriptorSets<vk::VulkanSecon vk::VulkanSecondaryCommandBuffer *commandBuffer, PipelineType pipelineType); -ProgramExecutablePerfCounters ProgramExecutableVk::getAndResetObjectPerfCounters() +ProgramExecutablePerfCounters ProgramExecutableVk::getDescriptorSetPerfCounters() { + mPerfCounters.descriptorSetCacheKeySizesBytes = {}; mPerfCounters.descriptorSetCacheKeySizesBytes[DescriptorSetIndex::UniformsAndXfb] = static_cast<uint32_t>(mUniformsAndXfbDescriptorsCache.getTotalCacheKeySizeBytes()); mPerfCounters.descriptorSetCacheKeySizesBytes[DescriptorSetIndex::Texture] = @@ -2044,9 +2045,15 @@ ProgramExecutablePerfCounters ProgramExecutableVk::getAndResetObjectPerfCounters mPerfCounters.descriptorSetCacheKeySizesBytes[DescriptorSetIndex::ShaderResource] = static_cast<uint32_t>(mShaderBufferDescriptorsCache.getTotalCacheKeySizeBytes()); - ProgramExecutablePerfCounters counters = mPerfCounters; - mPerfCounters.descriptorSetCacheKeySizesBytes = {}; - return counters; + return mPerfCounters; +} + +void ProgramExecutableVk::resetDescriptorSetPerfCounters() +{ + for (CacheStats &cacheStats : mPerfCounters.cacheStats) + { + cacheStats.resetHitAndMissCount(); + } } void ProgramExecutableVk::setAllDefaultUniformsDirty(const gl::ProgramExecutable &executable) diff --git a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h index cd540cbca3..3083927517 100644 --- a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h +++ b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h @@ -171,7 +171,7 @@ class ProgramExecutableVk vk::BufferHelper *emptyBuffer, vk::ResourceUseList *resourceUseList, FramebufferVk *framebufferVk, - const vk::DescriptorSetDesc &shaderBuffersDesc); + const vk::DescriptorSetDesc &shaderResourcesDesc); angle::Result updateUniformsAndXfbDescriptorSet(vk::Context *context, UpdateDescriptorSetsBuilder *updateBuilder, vk::ResourceUseList *resourceUseList, @@ -211,7 +211,8 @@ class ProgramExecutableVk } void accumulateCacheStats(VulkanCacheType cacheType, const CacheStats &cacheStats); - ProgramExecutablePerfCounters getAndResetObjectPerfCounters(); + ProgramExecutablePerfCounters getDescriptorSetPerfCounters(); + void resetDescriptorSetPerfCounters(); size_t getDefaultUniformAlignedSize(vk::Context *context, gl::ShaderType shaderType) const { @@ -293,13 +294,13 @@ class ProgramExecutableVk angle::Result allocateShaderResourcesDescriptorSet( vk::Context *context, vk::ResourceUseList *resourceUseList, - const vk::DescriptorSetDesc *shaderBuffersDesc); + const vk::DescriptorSetDesc *shaderResourcesDesc); angle::Result updateBuffersDescriptorSet(vk::Context *context, UpdateDescriptorSetsBuilder *updateBuilder, vk::BufferHelper *emptyBuffer, vk::ResourceUseList *resourceUseList, gl::ShaderType shaderType, - const vk::DescriptorSetDesc &shaderBuffersDesc, + const vk::DescriptorSetDesc &shaderResourcesDesc, const gl::BufferVector &buffers, const std::vector<gl::InterfaceBlock> &blocks, ShaderVariableType variableType, @@ -314,7 +315,7 @@ class ProgramExecutableVk const gl::BufferVector &atomicCounterBufferBindings, const gl::ProgramExecutable &executable, gl::ShaderType shaderType, - const vk::DescriptorSetDesc &shaderBuffersDesc, + const vk::DescriptorSetDesc &shaderResourcesDesc, bool cacheHit); angle::Result updateImagesDescriptorSet(vk::Context *context, vk::ResourceUseList *resourceUseList, diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp index 1b901b9a32..cfa1476310 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.cpp +++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp @@ -584,7 +584,7 @@ DebugMessageReport ShouldReportDebugMessage(RendererVk *renderer, // Then check with syncval messages: const bool isStoreOpNoneSupported = renderer->getFeatures().supportsRenderPassLoadStoreOpNone.enabled || - renderer->getFeatures().supportsRenderPassStoreOpNoneQCOM.enabled; + renderer->getFeatures().supportsRenderPassStoreOpNone.enabled; const bool isFramebufferFetchUsed = renderer->isFramebufferFetchUsed(); for (const SkippedSyncvalMessage &msg : kSkippedSyncvalMessages) { @@ -2238,7 +2238,7 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF { mEnabledDeviceExtensions.push_back(VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME); } - else if (getFeatures().supportsRenderPassStoreOpNoneQCOM.enabled) + else if (getFeatures().supportsRenderPassStoreOpNone.enabled) { mEnabledDeviceExtensions.push_back(VK_QCOM_RENDER_PASS_STORE_OPS_EXTENSION_NAME); } @@ -3038,7 +3038,7 @@ void RendererVk::initFeatures(DisplayVk *displayVk, ExtensionFound(VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME, deviceExtensionNames)); ANGLE_FEATURE_CONDITION( - &mFeatures, supportsRenderPassStoreOpNoneQCOM, + &mFeatures, supportsRenderPassStoreOpNone, !mFeatures.supportsRenderPassLoadStoreOpNone.enabled && ExtensionFound(VK_QCOM_RENDER_PASS_STORE_OPS_EXTENSION_NAME, deviceExtensionNames)); @@ -3275,7 +3275,7 @@ void RendererVk::initFeatures(DisplayVk *displayVk, // Android prevents creating swapchain images with VK_FORMAT_R8G8B8_UNORM. // Do this for all platforms, since few (none?) IHVs support 24-bit formats with their HW // natively anyway. - ANGLE_FEATURE_CONDITION(&mFeatures, overrideSurfaceFormatRGB8toRGBA8, true); + ANGLE_FEATURE_CONDITION(&mFeatures, overrideSurfaceFormatRGB8ToRGBA8, true); // http://anglebug.com/6872 // On ARM hardware, framebuffer-fetch-like behavior on Vulkan is already coherent, so we can @@ -3319,7 +3319,7 @@ void RendererVk::initFeatures(DisplayVk *displayVk, ANGLE_FEATURE_CONDITION(&mFeatures, bottomLeftOriginPresentRegionRectangles, IsAndroid()); // Retain debug info in SPIR-V blob. - ANGLE_FEATURE_CONDITION(&mFeatures, retainSpirvDebugInfo, getEnableValidationLayers()); + ANGLE_FEATURE_CONDITION(&mFeatures, retainSPIRVDebugInfo, getEnableValidationLayers()); ANGLE_FEATURE_CONDITION(&mFeatures, generateSPIRVThroughGlslang, kUseSpirvGenThroughGlslang); diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp index 2b33d86789..be99b33fcf 100644 --- a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp +++ b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp @@ -148,7 +148,7 @@ angle::Result InitImageHelper(DisplayVk *displayVk, angle::FormatID renderableFormatId = vkFormat.getActualRenderableImageFormatID(); // For devices that don't support creating swapchain images with RGB8, emulate with RGBA8. - if (rendererVk->getFeatures().overrideSurfaceFormatRGB8toRGBA8.enabled && + if (rendererVk->getFeatures().overrideSurfaceFormatRGB8ToRGBA8.enabled && renderableFormatId == angle::FormatID::R8G8B8_UNORM) { renderableFormatId = angle::FormatID::R8G8B8A8_UNORM; @@ -1013,7 +1013,7 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk) VkFormat nativeFormat = format.getActualRenderableImageVkFormat(); RendererVk *rendererVk = displayVk->getRenderer(); // For devices that don't support creating swapchain images with RGB8, emulate with RGBA8. - if (rendererVk->getFeatures().overrideSurfaceFormatRGB8toRGBA8.enabled && + if (rendererVk->getFeatures().overrideSurfaceFormatRGB8ToRGBA8.enabled && nativeFormat == VK_FORMAT_R8G8B8_UNORM) { nativeFormat = VK_FORMAT_R8G8B8A8_UNORM; @@ -1261,7 +1261,7 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context, angle::FormatID intendedFormatID = format.getIntendedFormatID(); // For devices that don't support creating swapchain images with RGB8, emulate with RGBA8. - if (renderer->getFeatures().overrideSurfaceFormatRGB8toRGBA8.enabled && + if (renderer->getFeatures().overrideSurfaceFormatRGB8ToRGBA8.enabled && intendedFormatID == angle::FormatID::R8G8B8_UNORM) { actualFormatID = angle::FormatID::R8G8B8A8_UNORM; @@ -1816,6 +1816,8 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk, ANGLE_TRY(computePresentOutOfDate(contextVk, result, presentOutOfDate)); + contextVk->resetPerFramePerfCounters(); + return angle::Result::Continue; } diff --git a/src/libANGLE/renderer/vulkan/linux/DisplayVkLinux.h b/src/libANGLE/renderer/vulkan/linux/DisplayVkLinux.h index 9f78491dd7..12418b876d 100644 --- a/src/libANGLE/renderer/vulkan/linux/DisplayVkLinux.h +++ b/src/libANGLE/renderer/vulkan/linux/DisplayVkLinux.h @@ -5,8 +5,8 @@ // // DisplayVkLinux.h: // Defines the class interface for DisplayVkLinux, which is the base of DisplayVkSimple, -// DisplayVkHeadless and DisplayVkXcb. This base class implements the common functionality of -// handling Linux dma-bufs. +// DisplayVkHeadless, DisplayVkXcb and DisplayVkWayland. This base class implements the +// common functionality of handling Linux dma-bufs. // #ifndef LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKLINUX_H_ diff --git a/src/libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.cpp b/src/libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.cpp new file mode 100644 index 0000000000..c5a3d7600a --- /dev/null +++ b/src/libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.cpp @@ -0,0 +1,103 @@ +// +// Copyright 2021-2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// DisplayVkWayland.cpp: +// Implements the class methods for DisplayVkWayland. +// + +#include "libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.h" + +#include <wayland-client.h> + +#include "common/system_utils.h" +#include "libANGLE/Display.h" +#include "libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.h" +#include "libANGLE/renderer/vulkan/vk_caps_utils.h" + +namespace rx +{ + +DisplayVkWayland::DisplayVkWayland(const egl::DisplayState &state) + : DisplayVkLinux(state), mWaylandDisplay(nullptr) +{} + +egl::Error DisplayVkWayland::initialize(egl::Display *display) +{ + mWaylandDisplay = reinterpret_cast<wl_display *>(display->getNativeDisplayId()); + if (!mWaylandDisplay) + { + ERR() << "Failed to retrieve wayland display"; + return egl::EglNotInitialized(); + } + + return DisplayVk::initialize(display); +} + +void DisplayVkWayland::terminate() +{ + mWaylandDisplay = nullptr; + DisplayVk::terminate(); +} + +bool DisplayVkWayland::isValidNativeWindow(EGLNativeWindowType window) const +{ + // Wayland display Errors are fatal. + // If this function returns non-zero, the display is not valid anymore. + int error = wl_display_get_error(mWaylandDisplay); + if (error) + { + WARN() << "Wayland window is not valid: " << error << " " << strerror(error); + } + return error == 0; +} + +SurfaceImpl *DisplayVkWayland::createWindowSurfaceVk(const egl::SurfaceState &state, + EGLNativeWindowType window) +{ + return new WindowSurfaceVkWayland(state, window, mWaylandDisplay); +} + +egl::ConfigSet DisplayVkWayland::generateConfigs() +{ + const std::array<GLenum, 1> kColorFormats = {GL_BGRA8_EXT}; + + std::vector<GLenum> depthStencilFormats( + egl_vk::kConfigDepthStencilFormats, + egl_vk::kConfigDepthStencilFormats + ArraySize(egl_vk::kConfigDepthStencilFormats)); + + if (getCaps().stencil8) + { + depthStencilFormats.push_back(GL_STENCIL_INDEX8); + } + return egl_vk::GenerateConfigs(kColorFormats.data(), kColorFormats.size(), + depthStencilFormats.data(), depthStencilFormats.size(), this); +} + +void DisplayVkWayland::checkConfigSupport(egl::Config *config) +{ + // In wayland there is no native visual ID or type +} + +const char *DisplayVkWayland::getWSIExtension() const +{ + return VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME; +} + +bool IsVulkanWaylandDisplayAvailable() +{ + wl_display *display = wl_display_connect(nullptr); + if (!display) + { + return false; + } + wl_display_disconnect(display); + return true; +} + +DisplayImpl *CreateVulkanWaylandDisplay(const egl::DisplayState &state) +{ + return new DisplayVkWayland(state); +} +} // namespace rx diff --git a/src/libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.h b/src/libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.h new file mode 100644 index 0000000000..df1f2f65bb --- /dev/null +++ b/src/libANGLE/renderer/vulkan/linux/wayland/DisplayVkWayland.h @@ -0,0 +1,44 @@ +// +// Copyright 2021-2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// DisplayVkWayland.h: +// Defines the class interface for DisplayVkWayland, implementing DisplayVk for Wayland. +// + +#ifndef LIBANGLE_RENDERER_VULKAN_WAYLAND_DISPLAYVKWAYLAND_H_ +#define LIBANGLE_RENDERER_VULKAN_WAYLAND_DISPLAYVKWAYLAND_H_ + +#include "libANGLE/renderer/vulkan/linux/DisplayVkLinux.h" + +struct wl_display; + +namespace rx +{ + +class DisplayVkWayland : public DisplayVkLinux +{ + public: + DisplayVkWayland(const egl::DisplayState &state); + + egl::Error initialize(egl::Display *display) override; + void terminate() override; + + bool isValidNativeWindow(EGLNativeWindowType window) const override; + + SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state, + EGLNativeWindowType window) override; + + egl::ConfigSet generateConfigs() override; + void checkConfigSupport(egl::Config *config) override; + + const char *getWSIExtension() const override; + + private: + wl_display *mWaylandDisplay; +}; + +} // namespace rx + +#endif // LIBANGLE_RENDERER_VULKAN_WAYLAND_DISPLAYVKWAYLAND_H_ diff --git a/src/libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.cpp b/src/libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.cpp new file mode 100644 index 0000000000..964e7302f5 --- /dev/null +++ b/src/libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.cpp @@ -0,0 +1,67 @@ +// +// Copyright 2021-2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// WindowSurfaceVkWayland.cpp: +// Implements the class methods for WindowSurfaceVkWayland. +// + +#include "libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.h" + +#include "libANGLE/renderer/vulkan/RendererVk.h" + +#include <wayland-egl-backend.h> + +namespace rx +{ + +void WindowSurfaceVkWayland::ResizeCallback(wl_egl_window *eglWindow, void *payload) +{ + WindowSurfaceVkWayland *windowSurface = reinterpret_cast<WindowSurfaceVkWayland *>(payload); + + windowSurface->mExtents.width = eglWindow->width; + windowSurface->mExtents.height = eglWindow->height; +} + +WindowSurfaceVkWayland::WindowSurfaceVkWayland(const egl::SurfaceState &surfaceState, + EGLNativeWindowType window, + wl_display *display) + : WindowSurfaceVk(surfaceState, window), mWaylandDisplay(display) +{ + wl_egl_window *eglWindow = reinterpret_cast<wl_egl_window *>(window); + eglWindow->resize_callback = WindowSurfaceVkWayland::ResizeCallback; + eglWindow->driver_private = this; + + mExtents = gl::Extents(eglWindow->width, eglWindow->height, 1); +} + +angle::Result WindowSurfaceVkWayland::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) +{ + ANGLE_VK_CHECK(context, + vkGetPhysicalDeviceWaylandPresentationSupportKHR( + context->getRenderer()->getPhysicalDevice(), 0, mWaylandDisplay), + VK_ERROR_INITIALIZATION_FAILED); + + wl_egl_window *eglWindow = reinterpret_cast<wl_egl_window *>(mNativeWindowType); + + VkWaylandSurfaceCreateInfoKHR createInfo = {}; + + createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + createInfo.flags = 0; + createInfo.display = mWaylandDisplay; + createInfo.surface = eglWindow->surface; + ANGLE_VK_TRY(context, vkCreateWaylandSurfaceKHR(context->getRenderer()->getInstance(), + &createInfo, nullptr, &mSurface)); + + return getCurrentWindowSize(context, extentsOut); +} + +angle::Result WindowSurfaceVkWayland::getCurrentWindowSize(vk::Context *context, + gl::Extents *extentsOut) +{ + *extentsOut = mExtents; + return angle::Result::Continue; +} + +} // namespace rx diff --git a/src/libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.h b/src/libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.h new file mode 100644 index 0000000000..e57ea36062 --- /dev/null +++ b/src/libANGLE/renderer/vulkan/linux/wayland/WindowSurfaceVkWayland.h @@ -0,0 +1,40 @@ +// +// Copyright 2021-2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// WindowSurfaceVkWayland.h: +// Defines the class interface for WindowSurfaceVkWayland, implementing WindowSurfaceVk. +// + +#ifndef LIBANGLE_RENDERER_VULKAN_WAYLAND_WINDOWSURFACEVKWAYLAND_H_ +#define LIBANGLE_RENDERER_VULKAN_WAYLAND_WINDOWSURFACEVKWAYLAND_H_ + +#include "libANGLE/renderer/vulkan/SurfaceVk.h" + +struct wl_display; +struct wl_egl_window; + +namespace rx +{ + +class WindowSurfaceVkWayland : public WindowSurfaceVk +{ + public: + static void ResizeCallback(wl_egl_window *window, void *payload); + + WindowSurfaceVkWayland(const egl::SurfaceState &surfaceState, + EGLNativeWindowType window, + wl_display *display); + + private: + angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) override; + angle::Result getCurrentWindowSize(vk::Context *context, gl::Extents *extentsOut) override; + + wl_display *mWaylandDisplay; + gl::Extents mExtents; +}; + +} // namespace rx + +#endif // LIBANGLE_RENDERER_VULKAN_WAYLAND_WINDOWSURFACEVKWAYLAND_H_ diff --git a/src/libANGLE/renderer/vulkan/linux/xcb/DisplayVkXcb.cpp b/src/libANGLE/renderer/vulkan/linux/xcb/DisplayVkXcb.cpp index e96b3decca..3ea9c53dc7 100644 --- a/src/libANGLE/renderer/vulkan/linux/xcb/DisplayVkXcb.cpp +++ b/src/libANGLE/renderer/vulkan/linux/xcb/DisplayVkXcb.cpp @@ -147,6 +147,12 @@ const char *DisplayVkXcb::getWSIExtension() const bool IsVulkanXcbDisplayAvailable() { + Display *display = XOpenDisplay(nullptr); + if (!display) + { + return false; + } + XCloseDisplay(display); return true; } diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.h b/src/libANGLE/renderer/vulkan/vk_cache_utils.h index d5fb0a8ed7..7d32d38a7f 100644 --- a/src/libANGLE/renderer/vulkan/vk_cache_utils.h +++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.h @@ -1566,6 +1566,12 @@ class CacheStats final : angle::NonCopyable mSize = 0; } + void resetHitAndMissCount() + { + mHitCount = 0; + mMissCount = 0; + } + private: uint64_t mHitCount; uint64_t mMissCount; diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp index e75ff8f13c..e2e6fcbb4c 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp +++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp @@ -1128,7 +1128,7 @@ void RenderPassAttachment::finalizeLoadStore(Context *context, context->getRenderer()->getFeatures().supportsRenderPassLoadStoreOpNone.enabled; const bool supportsStoreOpNone = supportsLoadStoreOpNone || - context->getRenderer()->getFeatures().supportsRenderPassStoreOpNoneQCOM.enabled; + context->getRenderer()->getFeatures().supportsRenderPassStoreOpNone.enabled; if (mAccess == ResourceAccess::ReadOnly && supportsStoreOpNone) { if (*storeOp == RenderPassStoreOp::Store && *loadOp != RenderPassLoadOp::Clear) diff --git a/src/tests/BUILD.gn b/src/tests/BUILD.gn index b3adb9c726..bfc8d8400d 100644 --- a/src/tests/BUILD.gn +++ b/src/tests/BUILD.gn @@ -26,7 +26,7 @@ if (is_android) { ] deps = [ - "//build/android:native_libraries_java", + "//build/android:build_java", "//build/android/gtest_apk:native_test_instrumentation_test_runner_java", ] } @@ -243,6 +243,9 @@ if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) { if (angle_use_x11) { sources += [ "egl_tests/EGLX11VisualTest.cpp" ] } + if (angle_use_wayland) { + sources += [ "egl_tests/EGLWaylandTest.cpp" ] + } configs += [ "${angle_root}:libANGLE_config" ] diff --git a/src/tests/angle_end2end_tests_expectations.txt b/src/tests/angle_end2end_tests_expectations.txt index 7d5bdc7169..4d71bf69d5 100644 --- a/src/tests/angle_end2end_tests_expectations.txt +++ b/src/tests/angle_end2end_tests_expectations.txt @@ -288,6 +288,7 @@ 7109 WIN D3D11 : SimpleStateChangeTestES3.DrawAndInvalidateRGBThenVerifyAlpha/* = SKIP 7113 WIN D3D9 : GLSLTest.LoopBodyEndingInBranch*/* = SKIP 7148 WIN D3D9 : RobustResourceInitTest.OutOfBoundsArrayBuffers/* = SKIP +7213 WIN D3D11 : BufferDataTestES3.BufferDataWithNullFollowedByMap/* = SKIP // Android 6095 ANDROID GLES : GLSLTest_ES3.InitGlobalComplexConstant/* = SKIP @@ -378,6 +379,7 @@ 5981 PIXEL4ORXL GLES : VulkanExternalImageTest.ShouldClearOpaqueFdRGBA8/* = SKIP 5981 PIXEL4ORXL GLES : VulkanExternalImageTest.TextureFormatCompatChromiumFd/* = SKIP 7142 PIXEL4ORXL GLES : GLSLTest.AliasingFunctionOutParamAndGlobal/* = SKIP +7213 PIXEL4ORXL GLES : BufferDataTestES3.BufferDataWithNullFollowedByMap/* = SKIP 5946 PIXEL4ORXL VULKAN : TransformFeedbackTestES32.PrimitivesWrittenAndGenerated/* = SKIP 5947 PIXEL4ORXL VULKAN : FramebufferFetchES31.DrawFetchBlitDrawFetch_NonCoherent/* = SKIP @@ -424,6 +426,8 @@ 7140 PIXEL4ORXL VULKAN : DrawBuffersTest.MidRenderPassClearWithGaps/* = SKIP 7140 PIXEL4ORXL VULKAN : DrawBuffersTest.MidRenderPassClearWithGapsRGB/* = SKIP +7207 PIXEL4ORXL VULKAN : VulkanPerformanceCounterTest.InRenderpassFlushShouldNotBreakRenderpass/* = SKIP + 6167 NEXUS5X GLES : DepthStencilTestES3.FramebufferClearThenStencilAttachedThenStencilTestState/* = SKIP 6167 NEXUS5X GLES : DepthStencilTestES3.FramebufferClearThenStencilTestStateThenStencilAttached/* = SKIP 6167 NEXUS5X GLES : DepthStencilTestES3.StencilTestStateThenFramebufferClearThenStencilAttached/* = SKIP diff --git a/src/tests/egl_tests/EGLFeatureControlTest.cpp b/src/tests/egl_tests/EGLFeatureControlTest.cpp index 83264fb2b0..917f90de38 100644 --- a/src/tests/egl_tests/EGLFeatureControlTest.cpp +++ b/src/tests/egl_tests/EGLFeatureControlTest.cpp @@ -8,6 +8,7 @@ #include <gtest/gtest.h> +#include "common/string_utils.h" #include "libANGLE/Display.h" #include "test_utils/ANGLETest.h" @@ -46,6 +47,9 @@ class EGLFeatureControlTest : public ANGLETest return true; } + + using FeatureNameModifier = std::function<std::string(const std::string &)>; + void testOverrideFeatures(FeatureNameModifier modifyName); }; // Ensure eglQueryStringiANGLE generates EGL_BAD_DISPLAY if the display passed in is invalid. @@ -120,9 +124,7 @@ TEST_P(EGLFeatureControlTest, FeatureCount) ASSERT_EGL_SUCCESS(); } -// Submit a list of features to override when creating the display with eglGetPlatformDisplay, and -// ensure that the features are correctly overridden. -TEST_P(EGLFeatureControlTest, OverrideFeatures) +void EGLFeatureControlTest::testOverrideFeatures(FeatureNameModifier modifyName) { ANGLE_SKIP_TEST_IF(!initTest()); egl::Display *display = static_cast<egl::Display *>(mDisplay); @@ -130,29 +132,38 @@ TEST_P(EGLFeatureControlTest, OverrideFeatures) // Build lists of features to enable/disabled. Toggle features we know are ok to toggle based // from this list. - std::vector<const char *> enabled = std::vector<const char *>(); - std::vector<const char *> disabled = std::vector<const char *>(); - std::vector<bool> shouldBe = std::vector<bool>(); - std::vector<std::string> testedFeatures = { - "add_and_true_to_loop_condition", // Safe to toggle GL - "clamp_frag_depth", // Safe to toggle GL - "clamp_point_size", // Safe to toggle GL and Vulkan - "flip_viewport_y", // Safe to toggle on Vulkan - "zero_max_lod", // Safe to toggle on D3D - "expand_integer_pow_expressions", // Safe to toggle on D3D - "rewrite_unary_minus_operator", // Safe to toggle on D3D + std::vector<const char *> enabled = std::vector<const char *>(); + std::vector<const char *> disabled = std::vector<const char *>(); + std::vector<std::string> modifiedNameStorage = std::vector<std::string>(); + std::vector<bool> shouldBe = std::vector<bool>(); + std::vector<std::string> testedFeatures = { + // Safe to toggle on GL + angle::GetFeatureName(angle::Feature::AddAndTrueToLoopCondition), + angle::GetFeatureName(angle::Feature::ClampFragDepth), + // Safe to toggle on GL and Vulkan + angle::GetFeatureName(angle::Feature::ClampPointSize), + // Safe to toggle on Vulkan + angle::GetFeatureName(angle::Feature::SupportsNegativeViewport), + // Safe to toggle on D3D + angle::GetFeatureName(angle::Feature::ZeroMaxLodWorkaround), + angle::GetFeatureName(angle::Feature::ExpandIntegerPowExpressions), + angle::GetFeatureName(angle::Feature::RewriteUnaryMinusOperator), }; for (size_t i = 0; i < features.size(); i++) { + modifiedNameStorage.push_back(modifyName(features[i]->name)); + } + for (size_t i = 0; i < features.size(); i++) + { bool toggle = std::find(testedFeatures.begin(), testedFeatures.end(), std::string(features[i]->name)) != testedFeatures.end(); if (features[i]->enabled ^ toggle) { - enabled.push_back(features[i]->name); + enabled.push_back(modifiedNameStorage[i].c_str()); } else { - disabled.push_back(features[i]->name); + disabled.push_back(modifiedNameStorage[i].c_str()); } // Save what we expect the feature status will be when checking later. shouldBe.push_back(features[i]->enabled ^ toggle); @@ -181,10 +192,25 @@ TEST_P(EGLFeatureControlTest, OverrideFeatures) for (size_t i = 0; i < features.size(); i++) { EXPECT_STREQ(FeatureStatusToString(shouldBe[i]), - eglQueryStringiANGLE(dpy_override, EGL_FEATURE_STATUS_ANGLE, i)); + eglQueryStringiANGLE(dpy_override, EGL_FEATURE_STATUS_ANGLE, i)) + << modifiedNameStorage[i]; } } +// Submit a list of features to override when creating the display with eglGetPlatformDisplay, and +// ensure that the features are correctly overridden. +TEST_P(EGLFeatureControlTest, OverrideFeatures) +{ + testOverrideFeatures([](const std::string &featureName) { return featureName; }); +} + +// Similar to OverrideFeatures, but ensures that camelCase variants of the name match as well. +TEST_P(EGLFeatureControlTest, OverrideFeaturesCamelCase) +{ + testOverrideFeatures( + [](const std::string &featureName) { return angle::ToCamelCase(featureName); }); +} + ANGLE_INSTANTIATE_TEST(EGLFeatureControlTest, WithNoFixture(ES2_D3D9()), WithNoFixture(ES2_D3D11()), diff --git a/src/tests/egl_tests/EGLWaylandTest.cpp b/src/tests/egl_tests/EGLWaylandTest.cpp new file mode 100644 index 0000000000..76b8a11350 --- /dev/null +++ b/src/tests/egl_tests/EGLWaylandTest.cpp @@ -0,0 +1,154 @@ +// +// Copyright 2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// EGLWaylandTest.cpp: tests for EGL_EXT_platform_wayland + +#include <gtest/gtest.h> + +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <wayland-client.h> +#include <wayland-egl-backend.h> + +#include "test_utils/ANGLETest.h" +#include "util/linux/wayland/WaylandWindow.h" + +using namespace angle; + +namespace +{ +const EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE}; +} + +class EGLWaylandTest : public ANGLETest +{ + public: + std::vector<EGLint> getDisplayAttributes() const + { + std::vector<EGLint> attribs; + + attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); + attribs.push_back(GetParam().getRenderer()); + attribs.push_back(EGL_NONE); + + return attribs; + } + + void testSetUp() override + { + mOsWindow = WaylandWindow::New(); + ASSERT_TRUE(mOsWindow->initialize("EGLWaylandTest", 500, 500)); + setWindowVisible(mOsWindow, true); + + EGLNativeDisplayType waylandDisplay = mOsWindow->getNativeDisplay(); + std::vector<EGLint> attribs = getDisplayAttributes(); + mDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, (void *)waylandDisplay, + attribs.data()); + ASSERT_NE(EGL_NO_DISPLAY, mDisplay); + + ASSERT_TRUE(EGL_TRUE == eglInitialize(mDisplay, nullptr, nullptr)); + + int nConfigs = 0; + ASSERT_TRUE(EGL_TRUE == eglGetConfigs(mDisplay, nullptr, 0, &nConfigs)); + ASSERT_GE(nConfigs, 1); + + int nReturnedConfigs = 0; + mConfigs.resize(nConfigs); + ASSERT_TRUE(EGL_TRUE == + eglGetConfigs(mDisplay, mConfigs.data(), nConfigs, &nReturnedConfigs)); + ASSERT_EQ(nConfigs, nReturnedConfigs); + } + + void testTearDown() override + { + mConfigs.clear(); + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglTerminate(mDisplay); + OSWindow::Delete(&mOsWindow); + } + + OSWindow *mOsWindow; + EGLDisplay mDisplay; + std::vector<EGLConfig> mConfigs; +}; + +// Test that a Wayland window can be created and used for rendering +TEST_P(EGLWaylandTest, WaylandWindowRendering) +{ + for (EGLConfig config : mConfigs) + { + // Finally, try to do a clear on the window. + EGLContext context = eglCreateContext(mDisplay, config, EGL_NO_CONTEXT, contextAttribs); + ASSERT_NE(EGL_NO_CONTEXT, context); + + EGLSurface window = + eglCreateWindowSurface(mDisplay, config, mOsWindow->getNativeWindow(), nullptr); + ASSERT_EGL_SUCCESS(); + + eglMakeCurrent(mDisplay, window, window, context); + ASSERT_EGL_SUCCESS(); + + glViewport(0, 0, 500, 500); + glClearColor(0.0f, 0.0f, 1.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + ASSERT_GL_NO_ERROR(); + EXPECT_PIXEL_EQ(250, 250, 0, 0, 255, 255); + + // Teardown + eglDestroySurface(mDisplay, window); + ASSERT_EGL_SUCCESS(); + + eglDestroyContext(mDisplay, context); + ASSERT_EGL_SUCCESS(); + + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + ASSERT_EGL_SUCCESS(); + } +} + +// Test that a Wayland window can swap buffers multiple times with no issues +TEST_P(EGLWaylandTest, SwapBuffers) +{ + for (EGLConfig config : mConfigs) + { + EGLContext context = eglCreateContext(mDisplay, config, EGL_NO_CONTEXT, contextAttribs); + ASSERT_NE(EGL_NO_CONTEXT, context); + + EGLSurface surface = + eglCreateWindowSurface(mDisplay, config, mOsWindow->getNativeWindow(), nullptr); + ASSERT_EGL_SUCCESS(); + + eglMakeCurrent(mDisplay, surface, surface, context); + ASSERT_EGL_SUCCESS(); + + const uint32_t loopcount = 16; + for (uint32_t i = 0; i < loopcount; i++) + { + mOsWindow->messageLoop(); + + glViewport(0, 0, 500, 500); + glClearColor(0.0f, 0.0f, 1.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + ASSERT_GL_NO_ERROR() << "glClear failed"; + EXPECT_PIXEL_EQ(250, 250, 0, 0, 255, 255); + + eglSwapBuffers(mDisplay, surface); + ASSERT_EGL_SUCCESS() << "eglSwapBuffers failed."; + } + + // Teardown + eglDestroySurface(mDisplay, surface); + ASSERT_EGL_SUCCESS(); + + eglDestroyContext(mDisplay, context); + ASSERT_EGL_SUCCESS(); + + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + ASSERT_EGL_SUCCESS(); + } +} + +ANGLE_INSTANTIATE_TEST(EGLWaylandTest, WithNoFixture(ES2_VULKAN())); diff --git a/src/tests/egl_tests/EGLX11VisualTest.cpp b/src/tests/egl_tests/EGLX11VisualTest.cpp index c3c072f866..0234d0ba15 100644 --- a/src/tests/egl_tests/EGLX11VisualTest.cpp +++ b/src/tests/egl_tests/EGLX11VisualTest.cpp @@ -14,7 +14,7 @@ #include "test_utils/ANGLETest.h" #include "util/OSWindow.h" -#include "util/x11/X11Window.h" +#include "util/linux/x11/X11Window.h" using namespace angle; diff --git a/src/tests/gl_tests/BlitFramebufferANGLETest.cpp b/src/tests/gl_tests/BlitFramebufferANGLETest.cpp index 6366af372d..d86a974b53 100644 --- a/src/tests/gl_tests/BlitFramebufferANGLETest.cpp +++ b/src/tests/gl_tests/BlitFramebufferANGLETest.cpp @@ -3478,14 +3478,14 @@ ANGLE_INSTANTIATE_TEST(BlitFramebufferANGLETest, ES3_VULKAN().enable(Feature::EmulatedPrerotation180), ES3_VULKAN().enable(Feature::EmulatedPrerotation270), ES2_METAL(), - ES2_METAL().disable(Feature::HasStencilOutput)); + ES2_METAL().disable(Feature::HasShaderStencilOutput)); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BlitFramebufferTest); ANGLE_INSTANTIATE_TEST_ES3_AND(BlitFramebufferTest, ES3_VULKAN().enable(Feature::EmulatedPrerotation90), ES3_VULKAN().enable(Feature::EmulatedPrerotation180), ES3_VULKAN().enable(Feature::EmulatedPrerotation270), - ES3_METAL().disable(Feature::HasStencilOutput)); + ES3_METAL().disable(Feature::HasShaderStencilOutput)); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BlitFramebufferTestES31); ANGLE_INSTANTIATE_TEST_ES31(BlitFramebufferTestES31); diff --git a/src/tests/gl_tests/BufferDataTest.cpp b/src/tests/gl_tests/BufferDataTest.cpp index ba49f3cd5f..649bde57cd 100644 --- a/src/tests/gl_tests/BufferDataTest.cpp +++ b/src/tests/gl_tests/BufferDataTest.cpp @@ -1143,6 +1143,60 @@ void main() EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::cyan); } +// Verify that previous draws are not affected when a buffer is respecified with null data +// and updated by calling map. +TEST_P(BufferDataTestES3, BufferDataWithNullFollowedByMap) +{ + // Draw without using drawQuad. + glUseProgram(mProgram); + + // Set up position attribute + const auto &quadVertices = GetQuadVertices(); + GLint positionLocation = glGetAttribLocation(mProgram, "position"); + ASSERT_NE(-1, positionLocation); + GLBuffer positionBuffer; + glBindBuffer(GL_ARRAY_BUFFER, positionBuffer); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * quadVertices.size() * 3, quadVertices.data(), + GL_DYNAMIC_DRAW); + glVertexAttribPointer(positionLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr); + glEnableVertexAttribArray(positionLocation); + EXPECT_GL_NO_ERROR(); + + // Set up "in_attrib" attribute + const std::vector<GLfloat> kData(6, 1.0f); + glBindBuffer(GL_ARRAY_BUFFER, mBuffer); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * kData.size(), kData.data(), GL_STATIC_DRAW); + glVertexAttribPointer(mAttribLocation, 1, GL_FLOAT, GL_FALSE, 0, nullptr); + glEnableVertexAttribArray(mAttribLocation); + EXPECT_GL_NO_ERROR(); + + // This draw (draw_0) renders red to the entire window. + glDrawArrays(GL_TRIANGLES, 0, 6); + EXPECT_GL_NO_ERROR(); + + // Respecify buffer bound to "in_attrib" attribute then map it and fill it with zeroes. + const std::vector<GLfloat> kZeros(6, 0.0f); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * kZeros.size(), nullptr, GL_STATIC_DRAW); + uint8_t *mapPtr = reinterpret_cast<uint8_t *>( + glMapBufferRange(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * kZeros.size(), + GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT)); + ASSERT_NE(nullptr, mapPtr); + ASSERT_GL_NO_ERROR(); + memcpy(mapPtr, kZeros.data(), sizeof(GLfloat) * kZeros.size()); + glUnmapBuffer(GL_ARRAY_BUFFER); + ASSERT_GL_NO_ERROR(); + + // This draw (draw_1) renders black to the upper right triangle. + glDrawArrays(GL_TRIANGLES, 3, 3); + EXPECT_GL_NO_ERROR(); + + // Respecification and data update of mBuffer should not have affected draw_0. + // Expect bottom left to be red and top right to be black. + EXPECT_PIXEL_COLOR_EQ(1, 1, GLColor::red); + EXPECT_PIXEL_COLOR_EQ(getWindowWidth() - 1, getWindowHeight() - 1, GLColor::black); + EXPECT_GL_NO_ERROR(); +} + class BufferStorageTestES3 : public BufferDataTest {}; diff --git a/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp b/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp index a5021e3248..b777782d75 100644 --- a/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp +++ b/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp @@ -73,10 +73,11 @@ class VulkanPerformanceCounterTest : public ANGLETest ASSERT_NE(featureName, nullptr); ASSERT_NE(featureStatus, nullptr); - const bool isStoreOpNoneQCOM = - strcmp(featureName, "supportsRenderPassStoreOpNoneQCOM") == 0; + const bool isStoreOpNone = + strcmp(featureName, GetFeatureName(Feature::SupportsRenderPassStoreOpNone)) == 0; const bool isLoadStoreOpNoneEXT = - strcmp(featureName, "supportsRenderPassLoadStoreOpNone") == 0; + strcmp(featureName, GetFeatureName(Feature::SupportsRenderPassLoadStoreOpNone)) == + 0; const bool isEnabled = strcmp(featureStatus, angle::kFeatureStatusEnabled) == 0; const bool isDisabled = strcmp(featureStatus, angle::kFeatureStatusDisabled) == 0; ASSERT_TRUE(isEnabled || isDisabled); @@ -88,7 +89,7 @@ class VulkanPerformanceCounterTest : public ANGLETest mLoadOpNoneSupport = isSupported; } - if (isStoreOpNoneQCOM || isLoadStoreOpNoneEXT) + if (isStoreOpNone || isLoadStoreOpNoneEXT) { if (mStoreOpNoneSupport == ANGLEFeature::Unknown || mStoreOpNoneSupport == ANGLEFeature::Unsupported) @@ -97,7 +98,8 @@ class VulkanPerformanceCounterTest : public ANGLETest } } - if (strcmp(featureName, "preferDrawClearOverVkCmdClearAttachments") == 0) + if (strcmp(featureName, + GetFeatureName(Feature::PreferDrawClearOverVkCmdClearAttachments)) == 0) { mPreferDrawOverClearAttachments = isSupported; } @@ -4059,8 +4061,7 @@ void main() } } - // TODO(syoussefi): Validate. - ANGLE_UNUSED_VARIABLE(descriptorSetAllocationsBefore); + EXPECT_GT(descriptorSetAllocationsBefore, 0u); ASSERT_GL_NO_ERROR(); @@ -4078,7 +4079,7 @@ void main() // Check for unnecessary descriptor set allocations. uint32_t descriptorSetAllocationsAfter = getPerfCounters().descriptorSetAllocations; - EXPECT_EQ(descriptorSetAllocationsAfter, 0u); + EXPECT_EQ(descriptorSetAllocationsAfter, descriptorSetAllocationsBefore); } // Test that mapping a buffer that the GPU is using as read-only ghosts the buffer, rather than diff --git a/src/tests/perf_tests/ANGLEPerfTest.cpp b/src/tests/perf_tests/ANGLEPerfTest.cpp index f0d79a8b1e..ca583edec8 100644 --- a/src/tests/perf_tests/ANGLEPerfTest.cpp +++ b/src/tests/perf_tests/ANGLEPerfTest.cpp @@ -431,36 +431,47 @@ void ANGLEPerfTest::processResults() const std::string &counterName = iter.second.name; std::vector<GLuint> samples = iter.second.samples; - size_t midpoint = samples.size() >> 1; - std::nth_element(samples.begin(), samples.begin() + midpoint, samples.end()); - + // Median { + size_t midpoint = samples.size() >> 1; + std::nth_element(samples.begin(), samples.begin() + midpoint, samples.end()); + std::stringstream medianStr; medianStr << "." << counterName << "_median"; std::string medianName = medianStr.str(); mReporter->AddResult(medianName, static_cast<size_t>(samples[midpoint])); - } - { std::string measurement = mName + mBackend + "." + counterName + "_median"; TestSuite::GetInstance()->addHistogramSample(measurement, mStory, samples[midpoint], "count"); } - const auto &maxIt = std::max_element(samples.begin(), samples.end()); - + // Maximum { + const auto &maxIt = std::max_element(samples.begin(), samples.end()); + std::stringstream maxStr; maxStr << "." << counterName << "_max"; std::string maxName = maxStr.str(); mReporter->AddResult(maxName, static_cast<size_t>(*maxIt)); - } - { std::string measurement = mName + mBackend + "." + counterName + "_max"; TestSuite::GetInstance()->addHistogramSample(measurement, mStory, *maxIt, "count"); } + + // Sum + { + GLuint sum = std::accumulate(samples.begin(), samples.end(), 0); + + std::stringstream sumStr; + sumStr << "." << counterName << "_sum"; + std::string sumName = sumStr.str(); + mReporter->AddResult(sumName, static_cast<size_t>(sum)); + + std::string measurement = mName + mBackend + "." + counterName + "_sum"; + TestSuite::GetInstance()->addHistogramSample(measurement, mStory, sum, "count"); + } } } @@ -944,6 +955,13 @@ void ANGLERenderTest::initPerfCounters() mReporter->RegisterImportantMetric(maxName, "count"); } + { + std::stringstream sumStr; + sumStr << '.' << indexMapName << "_sum"; + std::string sumName = sumStr.str(); + mReporter->RegisterImportantMetric(sumName, "count"); + } + GLuint index = indexMapIter.second; mPerfCounterInfo[index] = {indexMapName, {}}; diff --git a/src/tests/perf_tests/TracePerfTest.cpp b/src/tests/perf_tests/TracePerfTest.cpp index a98d1beade..42b685729c 100644 --- a/src/tests/perf_tests/TracePerfTest.cpp +++ b/src/tests/perf_tests/TracePerfTest.cpp @@ -2068,7 +2068,7 @@ void RegisterTraceTests() if (gTraceTestValidation) { // Enable limits when validating traces because we usually turn off capture. - overrideParams.eglParameters.enable(Feature::CaptureLimits); + overrideParams.eglParameters.enable(Feature::EnableCaptureLimits); // This feature should also be enabled in capture to mirror the replay. overrideParams.eglParameters.enable(Feature::ForceInitShaderVariables); diff --git a/src/tests/test_utils/angle_test_configs.cpp b/src/tests/test_utils/angle_test_configs.cpp index 0ac01c4f6a..9a4c25e9ca 100644 --- a/src/tests/test_utils/angle_test_configs.cpp +++ b/src/tests/test_utils/angle_test_configs.cpp @@ -7,6 +7,7 @@ #include "test_utils/angle_test_configs.h" #include "common/platform.h" +#include "common/string_utils.h" #include "util/util_gl.h" #include <algorithm> @@ -26,7 +27,9 @@ void AppendCapitalizedFeature(std::ostream &stream, Feature feature) return; } - stream << static_cast<char>(std::toupper(name[0])) << (name + 1); + const std::string camelCase = angle::ToCamelCase(name); + + stream << static_cast<char>(std::toupper(camelCase[0])) << (camelCase.c_str() + 1); } bool HasFeatureOverride(const std::vector<Feature> &overrides, Feature feature) diff --git a/third_party/SwiftShader b/third_party/SwiftShader -Subproject 103a69bd6c82980c967c2f4002c9a302ea67c71 +Subproject ea5f37f391931f7f39402ae1b8d6d5984380794 diff --git a/third_party/catapult b/third_party/catapult -Subproject 28b8ede735b79253b8689d5e270f4783e841364 +Subproject e356f14bf028802d749d7ca504a26461f087b87 diff --git a/third_party/depot_tools b/third_party/depot_tools -Subproject 7d2693ad8d9d304391b1c1fee9f88f258af5a21 +Subproject 89ccf4a8054906ad20ac112306e511246c90cb8 diff --git a/third_party/vulkan-deps/DEPS b/third_party/vulkan-deps/DEPS index e9a9953ef2..4de2c5bad2 100644 --- a/third_party/vulkan-deps/DEPS +++ b/third_party/vulkan-deps/DEPS @@ -12,13 +12,13 @@ vars = { 'glslang_revision': '06ac14141222bc059f48609b9a4a68fdb6fc4814', # Current revision of spirv-cross, the Khronos SPIRV cross compiler. - 'spirv_cross_revision': '779138f39fa33f6fe6dab2e3b21938884f74a4bb', + 'spirv_cross_revision': 'd7cae5e7cd326ca0ebfb2a7ac4e634a63ecfe19f', # Current revision fo the SPIRV-Headers Vulkan support library. 'spirv_headers_revision': '82becc8a8a92e509d3d8d635889da0a3c17d0606', # Current revision of SPIRV-Tools for Vulkan. - 'spirv_tools_revision': 'cb96abbf7affd986016f17dd09f9f971138a922b', + 'spirv_tools_revision': '2b2b0282af25779a5ae5dfc08a1c4e3be5a8ae17', # Current revision of Khronos Vulkan-Headers. 'vulkan_headers_revision': '76f00ef6cbb1886eb1162d1fa39bee8b51e22ee8', @@ -30,7 +30,7 @@ vars = { 'vulkan_tools_revision': 'ef20059aea7ec24d0842edca2f75255eaa33a7b0', # Current revision of Khronos Vulkan-ValidationLayers. - 'vulkan_validation_revision': '8a6fe16b4a1bb1f26385991d61ab1169d2284776', + 'vulkan_validation_revision': '5896a701e19983eb8663d2a8c3dc5588795489aa', } deps = { diff --git a/third_party/vulkan-deps/spirv-cross/src b/third_party/vulkan-deps/spirv-cross/src -Subproject 779138f39fa33f6fe6dab2e3b21938884f74a4b +Subproject d7cae5e7cd326ca0ebfb2a7ac4e634a63ecfe19 diff --git a/third_party/vulkan-deps/spirv-tools/src/source/opt/folding_rules.cpp b/third_party/vulkan-deps/spirv-tools/src/source/opt/folding_rules.cpp index c879a0c50e..d15ad04375 100644 --- a/third_party/vulkan-deps/spirv-tools/src/source/opt/folding_rules.cpp +++ b/third_party/vulkan-deps/spirv-tools/src/source/opt/folding_rules.cpp @@ -1430,6 +1430,64 @@ FoldingRule FactorAddMuls() { }; } +// Replaces |inst| inplace with an FMA instruction |(x*y)+a|. +void ReplaceWithFma(Instruction* inst, uint32_t x, uint32_t y, uint32_t a) { + uint32_t ext = + inst->context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); + + if (ext == 0) { + inst->context()->AddExtInstImport("GLSL.std.450"); + ext = inst->context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); + assert(ext != 0 && + "Could not add the GLSL.std.450 extended instruction set"); + } + + std::vector<Operand> operands; + operands.push_back({SPV_OPERAND_TYPE_ID, {ext}}); + operands.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, {GLSLstd450Fma}}); + operands.push_back({SPV_OPERAND_TYPE_ID, {x}}); + operands.push_back({SPV_OPERAND_TYPE_ID, {y}}); + operands.push_back({SPV_OPERAND_TYPE_ID, {a}}); + + inst->SetOpcode(SpvOpExtInst); + inst->SetInOperands(std::move(operands)); +} + +// Folds a multiple and add into an Fma. +// +// Cases: +// (x * y) + a = Fma x y a +// a + (x * y) = Fma x y a +bool MergeMulAddArithmetic(IRContext* context, Instruction* inst, + const std::vector<const analysis::Constant*>&) { + assert(inst->opcode() == SpvOpFAdd); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + for (int i = 0; i < 2; i++) { + uint32_t op_id = inst->GetSingleWordInOperand(i); + Instruction* op_inst = def_use_mgr->GetDef(op_id); + + if (op_inst->opcode() != SpvOpFMul) { + continue; + } + + if (!op_inst->IsFloatingPointFoldingAllowed()) { + continue; + } + + uint32_t x = op_inst->GetSingleWordInOperand(0); + uint32_t y = op_inst->GetSingleWordInOperand(1); + uint32_t a = inst->GetSingleWordInOperand((i + 1) % 2); + ReplaceWithFma(inst, x, y, a); + return true; + } + return false; +} + FoldingRule IntMultipleBy1() { return [](IRContext*, Instruction* inst, const std::vector<const analysis::Constant*>& constants) { @@ -2543,6 +2601,7 @@ void FoldingRules::AddFoldingRules() { rules_[SpvOpFAdd].push_back(MergeAddSubArithmetic()); rules_[SpvOpFAdd].push_back(MergeGenericAddSubArithmetic()); rules_[SpvOpFAdd].push_back(FactorAddMuls()); + rules_[SpvOpFAdd].push_back(MergeMulAddArithmetic); rules_[SpvOpFDiv].push_back(RedundantFDiv()); rules_[SpvOpFDiv].push_back(ReciprocalFDiv()); diff --git a/third_party/vulkan-deps/spirv-tools/src/test/opt/fold_test.cpp b/third_party/vulkan-deps/spirv-tools/src/test/opt/fold_test.cpp index 7565ca7f25..2ca32563a7 100644 --- a/third_party/vulkan-deps/spirv-tools/src/test/opt/fold_test.cpp +++ b/third_party/vulkan-deps/spirv-tools/src/test/opt/fold_test.cpp @@ -7108,6 +7108,214 @@ INSTANTIATE_TEST_SUITE_P(VectorShuffleMatchingTest, MatchingInstructionFoldingTe 3, true) )); +INSTANTIATE_TEST_SUITE_P(FmaGenerationMatchingTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: (x * y) + a = Fma(x, y, a) + InstructionFoldingCase<bool>( + Header() + + "; CHECK: [[ext:%\\w+]] = OpExtInstImport \"GLSL.std.450\"\n" + + "; CHECK: OpFunction\n" + + "; CHECK: [[x:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[y:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[a:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[lx:%\\w+]] = OpLoad {{%\\w+}} [[x]]\n" + + "; CHECK: [[ly:%\\w+]] = OpLoad {{%\\w+}} [[y]]\n" + + "; CHECK: [[la:%\\w+]] = OpLoad {{%\\w+}} [[a]]\n" + + "; CHECK: [[fma:%\\w+]] = OpExtInst {{%\\w+}} [[ext]] Fma [[lx]] [[ly]] [[la]]\n" + + "; CHECK: OpStore {{%\\w+}} [[fma]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%lx = OpLoad %float %x\n" + + "%ly = OpLoad %float %y\n" + + "%mul = OpFMul %float %lx %ly\n" + + "%la = OpLoad %float %a\n" + + "%3 = OpFAdd %float %mul %la\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 1: a + (x * y) = Fma(x, y, a) + InstructionFoldingCase<bool>( + Header() + + "; CHECK: [[ext:%\\w+]] = OpExtInstImport \"GLSL.std.450\"\n" + + "; CHECK: OpFunction\n" + + "; CHECK: [[x:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[y:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[a:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[lx:%\\w+]] = OpLoad {{%\\w+}} [[x]]\n" + + "; CHECK: [[ly:%\\w+]] = OpLoad {{%\\w+}} [[y]]\n" + + "; CHECK: [[la:%\\w+]] = OpLoad {{%\\w+}} [[a]]\n" + + "; CHECK: [[fma:%\\w+]] = OpExtInst {{%\\w+}} [[ext]] Fma [[lx]] [[ly]] [[la]]\n" + + "; CHECK: OpStore {{%\\w+}} [[fma]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%lx = OpLoad %float %x\n" + + "%ly = OpLoad %float %y\n" + + "%mul = OpFMul %float %lx %ly\n" + + "%la = OpLoad %float %a\n" + + "%3 = OpFAdd %float %la %mul\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 2: (x * y) + a = Fma(x, y, a) with vectors + InstructionFoldingCase<bool>( + Header() + + "; CHECK: [[ext:%\\w+]] = OpExtInstImport \"GLSL.std.450\"\n" + + "; CHECK: OpFunction\n" + + "; CHECK: [[x:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[y:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[a:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[lx:%\\w+]] = OpLoad {{%\\w+}} [[x]]\n" + + "; CHECK: [[ly:%\\w+]] = OpLoad {{%\\w+}} [[y]]\n" + + "; CHECK: [[la:%\\w+]] = OpLoad {{%\\w+}} [[a]]\n" + + "; CHECK: [[fma:%\\w+]] = OpExtInst {{%\\w+}} [[ext]] Fma [[lx]] [[ly]] [[la]]\n" + + "; CHECK: OpStore {{%\\w+}} [[fma]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_v4float Function\n" + + "%y = OpVariable %_ptr_v4float Function\n" + + "%a = OpVariable %_ptr_v4float Function\n" + + "%lx = OpLoad %v4float %x\n" + + "%ly = OpLoad %v4float %y\n" + + "%mul = OpFMul %v4float %lx %ly\n" + + "%la = OpLoad %v4float %a\n" + + "%3 = OpFAdd %v4float %mul %la\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 3: a + (x * y) = Fma(x, y, a) with vectors + InstructionFoldingCase<bool>( + Header() + + "; CHECK: [[ext:%\\w+]] = OpExtInstImport \"GLSL.std.450\"\n" + + "; CHECK: OpFunction\n" + + "; CHECK: [[x:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[y:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[a:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[lx:%\\w+]] = OpLoad {{%\\w+}} [[x]]\n" + + "; CHECK: [[ly:%\\w+]] = OpLoad {{%\\w+}} [[y]]\n" + + "; CHECK: [[la:%\\w+]] = OpLoad {{%\\w+}} [[a]]\n" + + "; CHECK: [[fma:%\\w+]] = OpExtInst {{%\\w+}} [[ext]] Fma [[lx]] [[ly]] [[la]]\n" + + "; CHECK: OpStore {{%\\w+}} [[fma]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%lx = OpLoad %float %x\n" + + "%ly = OpLoad %float %y\n" + + "%mul = OpFMul %float %lx %ly\n" + + "%la = OpLoad %float %a\n" + + "%3 = OpFAdd %float %la %mul\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test 5: that the OpExtInstImport instruction is generated if it is missing. + InstructionFoldingCase<bool>( + std::string() + + "; CHECK: [[ext:%\\w+]] = OpExtInstImport \"GLSL.std.450\"\n" + + "; CHECK: OpFunction\n" + + "; CHECK: [[x:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[y:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[a:%\\w+]] = OpVariable {{%\\w+}} Function\n" + + "; CHECK: [[lx:%\\w+]] = OpLoad {{%\\w+}} [[x]]\n" + + "; CHECK: [[ly:%\\w+]] = OpLoad {{%\\w+}} [[y]]\n" + + "; CHECK: [[la:%\\w+]] = OpLoad {{%\\w+}} [[a]]\n" + + "; CHECK: [[fma:%\\w+]] = OpExtInst {{%\\w+}} [[ext]] Fma [[lx]] [[ly]] [[la]]\n" + + "; CHECK: OpStore {{%\\w+}} [[fma]]\n" + + "OpCapability Shader\n" + + "OpMemoryModel Logical GLSL450\n" + + "OpEntryPoint Fragment %main \"main\"\n" + + "OpExecutionMode %main OriginUpperLeft\n" + + "OpSource GLSL 140\n" + + "OpName %main \"main\"\n" + + "%void = OpTypeVoid\n" + + "%void_func = OpTypeFunction %void\n" + + "%bool = OpTypeBool\n" + + "%float = OpTypeFloat 32\n" + + "%_ptr_float = OpTypePointer Function %float\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%lx = OpLoad %float %x\n" + + "%ly = OpLoad %float %y\n" + + "%mul = OpFMul %float %lx %ly\n" + + "%la = OpLoad %float %a\n" + + "%3 = OpFAdd %float %mul %la\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test 5: Don't fold if the multiple is marked no contract. + InstructionFoldingCase<bool>( + std::string() + + "OpCapability Shader\n" + + "OpMemoryModel Logical GLSL450\n" + + "OpEntryPoint Fragment %main \"main\"\n" + + "OpExecutionMode %main OriginUpperLeft\n" + + "OpSource GLSL 140\n" + + "OpName %main \"main\"\n" + + "OpDecorate %mul NoContraction\n" + + "%void = OpTypeVoid\n" + + "%void_func = OpTypeFunction %void\n" + + "%bool = OpTypeBool\n" + + "%float = OpTypeFloat 32\n" + + "%_ptr_float = OpTypePointer Function %float\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%lx = OpLoad %float %x\n" + + "%ly = OpLoad %float %y\n" + + "%mul = OpFMul %float %lx %ly\n" + + "%la = OpLoad %float %a\n" + + "%3 = OpFAdd %float %mul %la\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, false), + // Test 6: Don't fold if the add is marked no contract. + InstructionFoldingCase<bool>( + std::string() + + "OpCapability Shader\n" + + "OpMemoryModel Logical GLSL450\n" + + "OpEntryPoint Fragment %main \"main\"\n" + + "OpExecutionMode %main OriginUpperLeft\n" + + "OpSource GLSL 140\n" + + "OpName %main \"main\"\n" + + "OpDecorate %3 NoContraction\n" + + "%void = OpTypeVoid\n" + + "%void_func = OpTypeFunction %void\n" + + "%bool = OpTypeBool\n" + + "%float = OpTypeFloat 32\n" + + "%_ptr_float = OpTypePointer Function %float\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%lx = OpLoad %float %x\n" + + "%ly = OpLoad %float %y\n" + + "%mul = OpFMul %float %lx %ly\n" + + "%la = OpLoad %float %a\n" + + "%3 = OpFAdd %float %mul %la\n" + + "OpStore %a %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, false) +)); + using MatchingInstructionWithNoResultFoldingTest = ::testing::TestWithParam<InstructionFoldingCase<bool>>; diff --git a/third_party/vulkan-deps/vulkan-validation-layers/src b/third_party/vulkan-deps/vulkan-validation-layers/src -Subproject 8a6fe16b4a1bb1f26385991d61ab1169d228477 +Subproject 5896a701e19983eb8663d2a8c3dc5588795489a diff --git a/util/BUILD.gn b/util/BUILD.gn index a1581caacd..a9401220c1 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -51,13 +51,24 @@ if (is_linux) { if (angle_use_x11) { _util_sources += [ - "x11/X11Pixmap.cpp", - "x11/X11Pixmap.h", - "x11/X11Window.cpp", - "x11/X11Window.h", + "linux/x11/X11Pixmap.cpp", + "linux/x11/X11Pixmap.h", + "linux/x11/X11Window.cpp", + "linux/x11/X11Window.h", ] } +if (angle_use_wayland) { + _util_sources += [ + "linux/wayland/WaylandWindow.cpp", + "linux/wayland/WaylandWindow.h", + ] +} + +if (angle_use_x11 || angle_use_wayland) { + _util_sources += [ "linux/LinuxWindow.cpp" ] +} + if (is_fuchsia) { _util_sources += [ "fuchsia/FuchsiaPixmap.cpp", @@ -309,7 +320,12 @@ config("angle_test_util_config") { angle_source_set("angle_test_utils") { public_configs = [ ":angle_test_util_config" ] + public_deps = [ "$angle_root:angle_common" ] + if (angle_use_wayland) { + public_deps += [ "$angle_root:angle_wayland" ] + } + deps = [] sources = [ "Timer.cpp", diff --git a/util/angle_features_autogen.cpp b/util/angle_features_autogen.cpp index 0d6cf87900..d222eecb20 100644 --- a/util/angle_features_autogen.cpp +++ b/util/angle_features_autogen.cpp @@ -16,193 +16,189 @@ namespace angle namespace { constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{ - {Feature::AddAndTrueToLoopCondition, "add_and_true_to_loop_condition"}, - {Feature::AddBaseVertexToVertexID, "vertex_id_does_not_include_base_vertex"}, - {Feature::AddMockTextureNoRenderTarget, "add_mock_texture_no_render_target"}, - {Feature::AdjustSrcDstRegionBlitFramebuffer, "adjust_src_dst_region_for_blitframebuffer"}, + {Feature::AddAndTrueToLoopCondition, "addAndTrueToLoopCondition"}, + {Feature::AddMockTextureNoRenderTarget, "addMockTextureNoRenderTarget"}, + {Feature::AdjustSrcDstRegionForBlitFramebuffer, "adjustSrcDstRegionForBlitFramebuffer"}, {Feature::AllocateNonZeroMemory, "allocateNonZeroMemory"}, - {Feature::AllowBufferReadWrite, "allow_buffer_read_write"}, - {Feature::AllowClearForRobustResourceInit, "allow_clear_for_robust_resource_init"}, - {Feature::AllowCompressedFormats, "allow_compressed_formats"}, - {Feature::AllowES3OnFL10_0, "allowES3OnFL10_0"}, - {Feature::AllowEtcFormats, "allow_etc_formats"}, - {Feature::AllowGenMultipleMipsPerPass, "gen_multiple_mips_per_pass"}, + {Feature::AllowBufferReadWrite, "allowBufferReadWrite"}, + {Feature::AllowClearForRobustResourceInit, "allowClearForRobustResourceInit"}, + {Feature::AllowCompressedFormats, "allowCompressedFormats"}, + {Feature::AllowES3OnFL100, "allowES3OnFL100"}, + {Feature::AllowETCFormats, "allowETCFormats"}, {Feature::AllowGenerateMipmapWithCompute, "allowGenerateMipmapWithCompute"}, - {Feature::AllowInlineConstVertexData, "allow_inline_const_vertex_data"}, - {Feature::AllowMultisampleStoreAndResolve, "allow_msaa_store_and_resolve"}, - {Feature::AllowRuntimeSamplerCompareMode, "allow_runtime_sampler_compare_mode"}, - {Feature::AllowSamplerCompareGradient, "allow_sampler_compare_gradient"}, - {Feature::AllowSamplerCompareLod, "allow_sampler_compare_lod"}, - {Feature::AllowSeparatedDepthStencilBuffers, "allow_separate_depth_stencil_buffers"}, + {Feature::AllowGenMultipleMipsPerPass, "allowGenMultipleMipsPerPass"}, + {Feature::AllowInlineConstVertexData, "allowInlineConstVertexData"}, + {Feature::AllowMultisampleStoreAndResolve, "allowMultisampleStoreAndResolve"}, + {Feature::AllowRuntimeSamplerCompareMode, "allowRuntimeSamplerCompareMode"}, + {Feature::AllowSamplerCompareGradient, "allowSamplerCompareGradient"}, + {Feature::AllowSamplerCompareLod, "allowSamplerCompareLod"}, + {Feature::AllowSeparateDepthStencilBuffers, "allowSeparateDepthStencilBuffers"}, {Feature::AllowTranslateUniformBlockToStructuredBuffer, - "allow_translate_uniform_block_to_structured_buffer"}, - {Feature::AlwaysCallUseProgramAfterLink, "always_call_use_program_after_link"}, - {Feature::AlwaysUnbindFramebufferTexture2D, "always_unbind_framebuffer_texture_2d"}, + "allowTranslateUniformBlockToStructuredBuffer"}, + {Feature::AlwaysCallUseProgramAfterLink, "alwaysCallUseProgramAfterLink"}, + {Feature::AlwaysUnbindFramebufferTexture2D, "alwaysUnbindFramebufferTexture2D"}, {Feature::AsyncCommandQueue, "asyncCommandQueue"}, - {Feature::Avoid1BitAlphaTextureFormats, "avoid_1_bit_alpha_texture_formats"}, + {Feature::Avoid1BitAlphaTextureFormats, "avoid1BitAlphaTextureFormats"}, {Feature::BasicGLLineRasterization, "basicGLLineRasterization"}, {Feature::BindEmptyForUnusedDescriptorSets, "bindEmptyForUnusedDescriptorSets"}, {Feature::BindTransformFeedbackBufferBeforeBindBufferRange, - "bind_transform_feedback_buffer_before_bind_buffer_range"}, + "bindTransformFeedbackBufferBeforeBindBufferRange"}, {Feature::BottomLeftOriginPresentRegionRectangles, "bottomLeftOriginPresentRegionRectangles"}, {Feature::BresenhamLineRasterization, "bresenhamLineRasterization"}, - {Feature::CallClearTwice, "call_clear_twice"}, - {Feature::CaptureLimits, "enable_capture_limits"}, - {Feature::ClampArrayAccess, "clamp_array_access"}, - {Feature::ClampFragDepth, "clamp_frag_depth"}, - {Feature::ClampMscRate, "clamp_msc_rate"}, - {Feature::ClampPointSize, "clamp_point_size"}, - {Feature::ClearToZeroOrOneBroken, "clear_to_zero_or_one_broken"}, - {Feature::ClipSrcRegionBlitFramebuffer, "clip_src_region_for_blitframebuffer"}, - {Feature::CompressVertexData, "compress_vertex_data"}, + {Feature::CallClearTwice, "callClearTwice"}, + {Feature::ClampArrayAccess, "clampArrayAccess"}, + {Feature::ClampFragDepth, "clampFragDepth"}, + {Feature::ClampMscRate, "clampMscRate"}, + {Feature::ClampPointSize, "clampPointSize"}, + {Feature::ClearToZeroOrOneBroken, "clearToZeroOrOneBroken"}, + {Feature::ClipSrcRegionForBlitFramebuffer, "clipSrcRegionForBlitFramebuffer"}, + {Feature::CompressVertexData, "compressVertexData"}, {Feature::CopyIOSurfaceToNonIOSurfaceForReadOptimization, - "copy_iosurface_to_non_iosurface_for_read_optimization"}, + "copyIOSurfaceToNonIOSurfaceForReadOptimization"}, {Feature::CreatePipelineDuringLink, "createPipelineDuringLink"}, + {Feature::DecodeEncodeSRGBForGenerateMipmap, "decodeEncodeSRGBForGenerateMipmap"}, {Feature::DeferFlushUntilEndRenderPass, "deferFlushUntilEndRenderPass"}, - {Feature::DepthClamping, "depth_clamping"}, - {Feature::DepthStencilBlitExtraCopy, "depth_stencil_blit_extra_copy"}, + {Feature::DepthClamping, "depthClamping"}, + {Feature::DepthStencilBlitExtraCopy, "depthStencilBlitExtraCopy"}, {Feature::DirectMetalGeneration, "directMetalGeneration"}, - {Feature::DisableAnisotropicFiltering, "disable_anisotropic_filtering"}, - {Feature::DisableB5G6R5Support, "disable_b5g6r5_support"}, - {Feature::DisableBlendFuncExtended, "disable_blend_func_extended"}, - {Feature::DisableDrawBuffersIndexed, "disable_draw_buffers_indexed"}, + {Feature::DisableAnisotropicFiltering, "disableAnisotropicFiltering"}, + {Feature::DisableB5G6R5Support, "disableB5G6R5Support"}, + {Feature::DisableBlendFuncExtended, "disableBlendFuncExtended"}, + {Feature::DisableDrawBuffersIndexed, "disableDrawBuffersIndexed"}, {Feature::DisableFifoPresentMode, "disableFifoPresentMode"}, {Feature::DisableFlippingBlitWithCommand, "disableFlippingBlitWithCommand"}, - {Feature::DisableGPUSwitchingSupport, "disable_gpu_switching_support"}, - {Feature::DisableMultisampledRenderToTexture, "disable_mutlisampled_render_to_texture"}, - {Feature::DisableNativeParallelCompile, "disable_native_parallel_compile"}, - {Feature::DisableProgramBinary, "disable_program_binary"}, + {Feature::DisableGPUSwitchingSupport, "disableGPUSwitchingSupport"}, + {Feature::DisableMultisampledRenderToTexture, "disableMultisampledRenderToTexture"}, + {Feature::DisableNativeParallelCompile, "disableNativeParallelCompile"}, + {Feature::DisableProgramBinary, "disableProgramBinary"}, {Feature::DisableProgramCachingForTransformFeedback, - "disable_program_caching_for_transform_feedback"}, - {Feature::DisableSemaphoreFd, "disable_semaphore_fd"}, - {Feature::DisableSyncControlSupport, "disable_sync_control_support"}, - {Feature::DisableTimestampQueries, "disable_timestamp_queries"}, - {Feature::DisableWorkerContexts, "disable_worker_contexts"}, + "disableProgramCachingForTransformFeedback"}, + {Feature::DisableSemaphoreFd, "disableSemaphoreFd"}, + {Feature::DisableSyncControlSupport, "disableSyncControlSupport"}, + {Feature::DisableTimestampQueries, "disableTimestampQueries"}, + {Feature::DisableWorkerContexts, "disableWorkerContexts"}, {Feature::DisallowSeamfulCubeMapEmulation, "disallowSeamfulCubeMapEmulation"}, - {Feature::DoWhileGLSLCausesGPUHang, "do_while_glsl_causes_gpu_hang"}, {Feature::DoesSRGBClearsOnLinearFramebufferAttachments, - "does_srgb_clears_on_linear_framebuffer_attachments"}, - {Feature::DontInitializeUninitializedLocals, "dont_initialize_uninitialized_locals"}, - {Feature::DontRelinkProgramsInParallel, "dont_relink_programs_in_parallel"}, - {Feature::DontUseLoopsToInitializeVariables, "dont_use_loops_to_initialize_variables"}, - {Feature::EmulateAbsIntFunction, "emulate_abs_int_function"}, + "doesSRGBClearsOnLinearFramebufferAttachments"}, + {Feature::DontInitializeUninitializedLocals, "dontInitializeUninitializedLocals"}, + {Feature::DontRelinkProgramsInParallel, "dontRelinkProgramsInParallel"}, + {Feature::DontUseLoopsToInitializeVariables, "dontUseLoopsToInitializeVariables"}, + {Feature::DoWhileGLSLCausesGPUHang, "doWhileGLSLCausesGPUHang"}, + {Feature::EmulateAbsIntFunction, "emulateAbsIntFunction"}, {Feature::EmulateAdvancedBlendEquations, "emulateAdvancedBlendEquations"}, - {Feature::EmulateAtan2Float, "emulate_atan_2_float"}, - {Feature::EmulateCopyTexImage2DFromRenderbuffers, "emulate_copyteximage2d_from_renderbuffers"}, + {Feature::EmulateAtan2Float, "emulateAtan2Float"}, + {Feature::EmulateCopyTexImage2DFromRenderbuffers, "emulateCopyTexImage2DFromRenderbuffers"}, {Feature::EmulateDithering, "emulateDithering"}, - {Feature::EmulateImmutableCompressedTexture3D, "emulate_immutable_compressed_texture_3d"}, - {Feature::EmulateIsnanFloat, "emulate_isnan_float"}, - {Feature::EmulateMaxVertexAttribStride, "emulate_max_vertex_attrib_stride"}, - {Feature::EmulatePackSkipRowsAndPackSkipPixels, "emulate_pack_skip_rows_and_pack_skip_pixels"}, - {Feature::EmulatePrimitiveRestartFixedIndex, "emulate_primitive_restart_fixed_index"}, - {Feature::EmulateR32fImageAtomicExchange, "emulateR32fImageAtomicExchange"}, - {Feature::EmulateRGB10, "emulate_rgb10"}, - {Feature::EmulateTinyStencilTextures, "emulate_tiny_stencil_textures"}, - {Feature::EmulateTransformFeedback, "emulateTransformFeedback"}, {Feature::EmulatedPrerotation180, "emulatedPrerotation180"}, {Feature::EmulatedPrerotation270, "emulatedPrerotation270"}, {Feature::EmulatedPrerotation90, "emulatedPrerotation90"}, + {Feature::EmulateImmutableCompressedTexture3D, "emulateImmutableCompressedTexture3D"}, + {Feature::EmulateIsnanFloat, "emulateIsnanFloat"}, + {Feature::EmulateMaxVertexAttribStride, "emulateMaxVertexAttribStride"}, + {Feature::EmulatePackSkipRowsAndPackSkipPixels, "emulatePackSkipRowsAndPackSkipPixels"}, + {Feature::EmulatePrimitiveRestartFixedIndex, "emulatePrimitiveRestartFixedIndex"}, + {Feature::EmulateR32fImageAtomicExchange, "emulateR32fImageAtomicExchange"}, + {Feature::EmulateRGB10, "emulateRGB10"}, + {Feature::EmulateTinyStencilTextures, "emulateTinyStencilTextures"}, + {Feature::EmulateTransformFeedback, "emulateTransformFeedback"}, + {Feature::EnableCaptureLimits, "enableCaptureLimits"}, {Feature::EnableCompressingPipelineCacheInThreadPool, "enableCompressingPipelineCacheInThreadPool"}, {Feature::EnableMultisampledRenderToTexture, "enableMultisampledRenderToTexture"}, - {Feature::EnablePreRotateSurfaces, "enablePreRotateSurfaces"}, {Feature::EnablePrecisionQualifiers, "enablePrecisionQualifiers"}, + {Feature::EnablePreRotateSurfaces, "enablePreRotateSurfaces"}, {Feature::EnableProgramBinaryForCapture, "enableProgramBinaryForCapture"}, - {Feature::EncodeAndDecodeSRGBForGenerateMipmap, "decode_encode_srgb_for_generatemipmap"}, - {Feature::ExpandIntegerPowExpressions, "expand_integer_pow_expressions"}, + {Feature::ExpandIntegerPowExpressions, "expandIntegerPowExpressions"}, {Feature::ExposeNonConformantExtensionsAndVersions, "exposeNonConformantExtensionsAndVersions"}, - {Feature::FinishDoesNotCauseQueriesToBeAvailable, - "finish_does_not_cause_queries_to_be_available"}, - {Feature::FlushAfterEndingTransformFeedback, "flush_after_ending_transform_feedback"}, - {Feature::FlushBeforeDeleteTextureIfCopiedTo, "flush_before_delete_texture_if_copied_to"}, - {Feature::FlushOnFramebufferChange, "flush_on_framebuffer_change"}, - {Feature::ForceAtomicValueResolution, "force_atomic_value_resolution"}, - {Feature::ForceBufferGPUStorage, "force_buffer_gpu_storage"}, + {Feature::FinishDoesNotCauseQueriesToBeAvailable, "finishDoesNotCauseQueriesToBeAvailable"}, + {Feature::FlushAfterEndingTransformFeedback, "flushAfterEndingTransformFeedback"}, + {Feature::FlushBeforeDeleteTextureIfCopiedTo, "flushBeforeDeleteTextureIfCopiedTo"}, + {Feature::FlushOnFramebufferChange, "flushOnFramebufferChange"}, + {Feature::ForceAtomicValueResolution, "forceAtomicValueResolution"}, + {Feature::ForceBufferGPUStorage, "forceBufferGPUStorage"}, {Feature::ForceD16TexFilter, "forceD16TexFilter"}, - {Feature::ForceD24S8AsUnsupported, "force_d24s8_as_unsupported"}, + {Feature::ForceD24S8AsUnsupported, "forceD24S8AsUnsupported"}, {Feature::ForceDriverUniformOverSpecConst, "forceDriverUniformOverSpecConst"}, {Feature::ForceFallbackFormat, "forceFallbackFormat"}, {Feature::ForceFragmentShaderPrecisionHighpToMediump, "forceFragmentShaderPrecisionHighpToMediump"}, {Feature::ForceInitShaderVariables, "forceInitShaderVariables"}, {Feature::ForceMaxUniformBufferSize16KB, "forceMaxUniformBufferSize16KB"}, - {Feature::ForceNearestFiltering, "force_nearest_filtering"}, + {Feature::ForceNearestFiltering, "forceNearestFiltering"}, {Feature::ForceNearestMipFiltering, "forceNearestMipFiltering"}, - {Feature::ForceNonCSBaseMipmapGeneration, "force_non_cs_mipmap_gen"}, + {Feature::ForceNonCSBaseMipmapGeneration, "forceNonCSBaseMipmapGeneration"}, {Feature::ForceRobustResourceInit, "forceRobustResourceInit"}, {Feature::ForceSubmitImmutableTextureUpdates, "forceSubmitImmutableTextureUpdates"}, - {Feature::ForceTextureLodOffset1, "force_texture_lod_offset_1"}, - {Feature::ForceTextureLodOffset2, "force_texture_lod_offset_2"}, - {Feature::ForceTextureLodOffset3, "force_texture_lod_offset_3"}, - {Feature::ForceTextureLodOffset4, "force_texture_lod_offset_4"}, + {Feature::ForceTextureLodOffset1, "forceTextureLodOffset1"}, + {Feature::ForceTextureLodOffset2, "forceTextureLodOffset2"}, + {Feature::ForceTextureLodOffset3, "forceTextureLodOffset3"}, + {Feature::ForceTextureLodOffset4, "forceTextureLodOffset4"}, {Feature::GenerateSPIRVThroughGlslang, "generateSPIRVThroughGlslang"}, - {Feature::GetDimensionsIgnoresBaseLevel, "get_dimensions_ignores_base_level"}, - {Feature::HasBaseVertexInstancedDraw, "has_base_vertex_instanced_draw"}, - {Feature::HasCheapRenderPass, "has_cheap_render_pass_mtl"}, - {Feature::HasDepthAutoResolve, "has_msaa_depth_auto_resolve"}, - {Feature::HasEvents, "has_mtl_events"}, - {Feature::HasExplicitMemBarrier, "has_explicit_mem_barrier_mtl"}, - {Feature::HasNonUniformDispatch, "has_non_uniform_dispatch"}, - {Feature::HasStencilAutoResolve, "has_msaa_stencil_auto_resolve"}, - {Feature::HasStencilOutput, "has_shader_stencil_output"}, - {Feature::HasTextureSwizzle, "has_texture_swizzle"}, - {Feature::InitFragmentOutputVariables, "init_fragment_output_variables"}, - {Feature::InitializeCurrentVertexAttributes, "initialize_current_vertex_attributes"}, - {Feature::IntelDisableFastMath, "intel_disable_fast_math"}, - {Feature::IntelExplicitBoolCastWorkaround, "intel_explicit_bool_cast_workaround"}, - {Feature::KeepBufferShadowCopy, "keep_buffer_shadow_copy"}, - {Feature::LimitMax3dArrayTextureSizeTo1024, "max_3d_array_texture_size_1024"}, - {Feature::LimitMaxMSAASamplesTo4, "max_msaa_sample_count_4"}, - {Feature::LimitMaxTextureSizeTo4096, "max_texture_size_limit_4096"}, + {Feature::GetDimensionsIgnoresBaseLevel, "getDimensionsIgnoresBaseLevel"}, + {Feature::HasBaseVertexInstancedDraw, "hasBaseVertexInstancedDraw"}, + {Feature::HasCheapRenderPass, "hasCheapRenderPass"}, + {Feature::HasDepthAutoResolve, "hasDepthAutoResolve"}, + {Feature::HasEvents, "hasEvents"}, + {Feature::HasExplicitMemBarrier, "hasExplicitMemBarrier"}, + {Feature::HasNonUniformDispatch, "hasNonUniformDispatch"}, + {Feature::HasShaderStencilOutput, "hasShaderStencilOutput"}, + {Feature::HasStencilAutoResolve, "hasStencilAutoResolve"}, + {Feature::HasTextureSwizzle, "hasTextureSwizzle"}, + {Feature::InitFragmentOutputVariables, "initFragmentOutputVariables"}, + {Feature::InitializeCurrentVertexAttributes, "initializeCurrentVertexAttributes"}, + {Feature::IntelDisableFastMath, "intelDisableFastMath"}, + {Feature::IntelExplicitBoolCastWorkaround, "intelExplicitBoolCastWorkaround"}, + {Feature::KeepBufferShadowCopy, "keepBufferShadowCopy"}, + {Feature::LimitMax3dArrayTextureSizeTo1024, "limitMax3dArrayTextureSizeTo1024"}, + {Feature::LimitMaxMSAASamplesTo4, "limitMaxMSAASamplesTo4"}, + {Feature::LimitMaxTextureSizeTo4096, "limitMaxTextureSizeTo4096"}, {Feature::LogMemoryReportCallbacks, "logMemoryReportCallbacks"}, {Feature::LogMemoryReportStats, "logMemoryReportStats"}, - {Feature::LoseContextOnOutOfMemory, "lose_context_on_out_of_memory"}, - {Feature::MrtPerfWorkaround, "mrt_perf_workaround"}, + {Feature::LoseContextOnOutOfMemory, "loseContextOnOutOfMemory"}, + {Feature::MrtPerfWorkaround, "mrtPerfWorkaround"}, {Feature::MultisampleColorFormatShaderReadWorkaround, - "multisample_color_format_shader_read_workaround"}, - {Feature::OverrideSurfaceFormatRGB8toRGBA8, "overrideSurfaceFormatRGB8toRGBA8"}, - {Feature::PackLastRowSeparatelyForPaddingInclusion, - "pack_last_row_separately_for_padding_inclusion"}, - {Feature::PackOverlappingRowsSeparatelyPackBuffer, - "pack_overlapping_rows_separately_pack_buffer"}, + "multisampleColorFormatShaderReadWorkaround"}, + {Feature::OverrideSurfaceFormatRGB8ToRGBA8, "overrideSurfaceFormatRGB8ToRGBA8"}, + {Feature::PackLastRowSeparatelyForPaddingInclusion, "packLastRowSeparatelyForPaddingInclusion"}, + {Feature::PackOverlappingRowsSeparatelyPackBuffer, "packOverlappingRowsSeparatelyPackBuffer"}, {Feature::PadBuffersToMaxVertexAttribStride, "padBuffersToMaxVertexAttribStride"}, {Feature::PerFrameWindowSizeQuery, "perFrameWindowSizeQuery"}, {Feature::PersistentlyMappedBuffers, "persistentlyMappedBuffers"}, - {Feature::PreAddTexelFetchOffsets, "pre_add_texel_fetch_offsets"}, + {Feature::PreAddTexelFetchOffsets, "preAddTexelFetchOffsets"}, {Feature::PreferAggregateBarrierCalls, "preferAggregateBarrierCalls"}, {Feature::PreferCPUForBufferSubData, "preferCPUForBufferSubData"}, {Feature::PreferDrawClearOverVkCmdClearAttachments, "preferDrawClearOverVkCmdClearAttachments"}, {Feature::PreferSkippingInvalidateForEmulatedFormats, "preferSkippingInvalidateForEmulatedFormats"}, {Feature::PreferSubmitAtFBOBoundary, "preferSubmitAtFBOBoundary"}, - {Feature::PromotePackedFormatsTo8BitPerChannel, "promote_packed_formats_to_8_bit_per_channel"}, + {Feature::PromotePackedFormatsTo8BitPerChannel, "promotePackedFormatsTo8BitPerChannel"}, {Feature::ProvokingVertex, "provokingVertex"}, - {Feature::QueryCounterBitsGeneratesErrors, "query_counter_bits_generates_errors"}, + {Feature::QueryCounterBitsGeneratesErrors, "queryCounterBitsGeneratesErrors"}, {Feature::ReadPixelsUsingImplementationColorReadFormatForNorm16, - "read_pixels_using_implementation_color_read_format"}, + "readPixelsUsingImplementationColorReadFormatForNorm16"}, {Feature::ReapplyUBOBindingsAfterUsingBinaryProgram, - "reapply_ubo_bindings_after_using_binary_program"}, - {Feature::RegenerateStructNames, "regenerate_struct_names"}, - {Feature::RemoveDynamicIndexingOfSwizzledVector, "remove_dynamic_indexing_of_swizzled_vector"}, - {Feature::RemoveInvariantAndCentroidForESSL3, "remove_invarient_and_centroid_for_essl3"}, - {Feature::ResetTexImage2DBaseLevel, "reset_teximage2d_base_level"}, - {Feature::RetainSpirvDebugInfo, "retainSpirvDebugInfo"}, - {Feature::RewriteFloatUnaryMinusOperator, "rewrite_float_unary_minus_operator"}, - {Feature::RewriteRepeatedAssignToSwizzled, "rewrite_repeated_assign_to_swizzled"}, - {Feature::RewriteRowMajorMatrices, "rewrite_row_major_matrices"}, - {Feature::RewriteUnaryMinusOperator, "rewrite_unary_minus_operator"}, - {Feature::RgbDXT1TexturesSampleZeroAlpha, "rgb_dxt1_textures_sample_zero_alpha"}, - {Feature::Rgba4IsNotSupportedForColorRendering, "rgba4_is_not_supported_for_color_rendering"}, - {Feature::SanitizeAmdGpuRendererString, "sanitize_amdgpu_renderer_string"}, - {Feature::ScalarizeVecAndMatConstructorArgs, "scalarize_vec_and_mat_constructor_args"}, - {Feature::SelectViewInGeometryShader, "select_view_in_geometry_shader"}, - {Feature::SetDataFasterThanImageUpload, "set_data_faster_than_image_upload"}, + "reapplyUBOBindingsAfterUsingBinaryProgram"}, + {Feature::RegenerateStructNames, "regenerateStructNames"}, + {Feature::RemoveDynamicIndexingOfSwizzledVector, "removeDynamicIndexingOfSwizzledVector"}, + {Feature::RemoveInvariantAndCentroidForESSL3, "removeInvariantAndCentroidForESSL3"}, + {Feature::ResetTexImage2DBaseLevel, "resetTexImage2DBaseLevel"}, + {Feature::RetainSPIRVDebugInfo, "retainSPIRVDebugInfo"}, + {Feature::RewriteFloatUnaryMinusOperator, "rewriteFloatUnaryMinusOperator"}, + {Feature::RewriteRepeatedAssignToSwizzled, "rewriteRepeatedAssignToSwizzled"}, + {Feature::RewriteRowMajorMatrices, "rewriteRowMajorMatrices"}, + {Feature::RewriteUnaryMinusOperator, "rewriteUnaryMinusOperator"}, + {Feature::RGBA4IsNotSupportedForColorRendering, "RGBA4IsNotSupportedForColorRendering"}, + {Feature::RGBDXT1TexturesSampleZeroAlpha, "RGBDXT1TexturesSampleZeroAlpha"}, + {Feature::SanitizeAMDGPURendererString, "sanitizeAMDGPURendererString"}, + {Feature::ScalarizeVecAndMatConstructorArgs, "scalarizeVecAndMatConstructorArgs"}, + {Feature::SelectViewInGeometryShader, "selectViewInGeometryShader"}, + {Feature::SetDataFasterThanImageUpload, "setDataFasterThanImageUpload"}, {Feature::SetPrimitiveRestartFixedIndexForDrawArrays, - "set_primitive_restart_fixed_index_for_draw_arrays"}, - {Feature::SetZeroLevelBeforeGenerateMipmap, "set_zero_level_before_generating_mipmap"}, + "setPrimitiveRestartFixedIndexForDrawArrays"}, + {Feature::SetZeroLevelBeforeGenerateMipmap, "setZeroLevelBeforeGenerateMipmap"}, {Feature::ShadowBuffers, "shadowBuffers"}, - {Feature::ShiftInstancedArrayDataWithExtraOffset, "shift_instanced_array_data_with_offset"}, - {Feature::SkipVSConstantRegisterZero, "skip_vs_constant_register_zero"}, + {Feature::ShiftInstancedArrayDataWithOffset, "shiftInstancedArrayDataWithOffset"}, + {Feature::SkipVSConstantRegisterZero, "skipVSConstantRegisterZero"}, {Feature::SupportsAndroidHardwareBuffer, "supportsAndroidHardwareBuffer"}, {Feature::SupportsAndroidNativeFenceSync, "supportsAndroidNativeFenceSync"}, {Feature::SupportsBlendOperationAdvanced, "supportsBlendOperationAdvanced"}, @@ -219,8 +215,8 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{ {Feature::SupportsExternalSemaphoreFd, "supportsExternalSemaphoreFd"}, {Feature::SupportsExternalSemaphoreFuchsia, "supportsExternalSemaphoreFuchsia"}, {Feature::SupportsFilteringPrecision, "supportsFilteringPrecision"}, - {Feature::SupportsGGPFrameToken, "supportsGGPFrameToken"}, {Feature::SupportsGeometryStreamsCapability, "supportsGeometryStreamsCapability"}, + {Feature::SupportsGGPFrameToken, "supportsGGPFrameToken"}, {Feature::SupportsHostQueryReset, "supportsHostQueryReset"}, {Feature::SupportsImageCubeArray, "supportsImageCubeArray"}, {Feature::SupportsImageFormatList, "supportsImageFormatList"}, @@ -234,9 +230,9 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{ {Feature::SupportsNegativeViewport, "supportsNegativeViewport"}, {Feature::SupportsPipelineStatisticsQuery, "supportsPipelineStatisticsQuery"}, {Feature::SupportsProtectedMemory, "supportsProtectedMemory"}, - {Feature::SupportsRenderPassLoadStoreOpNone, "supportsRenderPassLoadStoreOpNone"}, - {Feature::SupportsRenderPassStoreOpNoneQCOM, "supportsRenderPassStoreOpNoneQCOM"}, {Feature::SupportsRenderpass2, "supportsRenderpass2"}, + {Feature::SupportsRenderPassLoadStoreOpNone, "supportsRenderPassLoadStoreOpNone"}, + {Feature::SupportsRenderPassStoreOpNone, "supportsRenderPassStoreOpNone"}, {Feature::SupportsShaderFloat16, "supportsShaderFloat16"}, {Feature::SupportsShaderFramebufferFetch, "supportsShaderFramebufferFetch"}, {Feature::SupportsShaderFramebufferFetchNonCoherent, @@ -244,30 +240,31 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{ {Feature::SupportsShaderStencilExport, "supportsShaderStencilExport"}, {Feature::SupportsSharedPresentableImageExtension, "supportsSharedPresentableImageExtension"}, {Feature::SupportsSurfaceCapabilities2Extension, "supportsSurfaceCapabilities2Extension"}, + {Feature::SupportsSurfacelessQueryExtension, "supportsSurfacelessQueryExtension"}, {Feature::SupportsSurfaceProtectedCapabilitiesExtension, "supportsSurfaceProtectedCapabilitiesExtension"}, {Feature::SupportsSurfaceProtectedSwapchains, "supportsSurfaceProtectedSwapchains"}, - {Feature::SupportsSurfacelessQueryExtension, "supportsSurfacelessQueryExtension"}, {Feature::SupportsTransformFeedbackExtension, "supportsTransformFeedbackExtension"}, {Feature::SupportsYUVSamplerConversion, "supportsYUVSamplerConversion"}, {Feature::SwapbuffersOnFlushOrFinishWithSingleBuffer, "swapbuffersOnFlushOrFinishWithSingleBuffer"}, - {Feature::SyncVertexArraysToDefault, "sync_vertex_arrays_to_default"}, - {Feature::UnbindFBOOnContextSwitch, "unbind_fbo_before_switching_context"}, - {Feature::UnfoldShortCircuits, "unfold_short_circuits"}, + {Feature::SyncVertexArraysToDefault, "syncVertexArraysToDefault"}, + {Feature::UnbindFBOBeforeSwitchingContext, "unbindFBOBeforeSwitchingContext"}, + {Feature::UnfoldShortCircuits, "unfoldShortCircuits"}, {Feature::UnpackLastRowSeparatelyForPaddingInclusion, - "unpack_last_row_separately_for_padding_inclusion"}, + "unpackLastRowSeparatelyForPaddingInclusion"}, {Feature::UnpackOverlappingRowsSeparatelyUnpackBuffer, - "unpack_overlapping_rows_separately_unpack_buffer"}, - {Feature::UnsizedsRGBReadPixelsDoesntTransform, "unsized_srgb_read_pixels_doesnt_transform"}, - {Feature::UploadTextureDataInChunks, "chunked_texture_upload"}, - {Feature::UseInstancedPointSpriteEmulation, "use_instanced_point_sprite_emulation"}, + "unpackOverlappingRowsSeparatelyUnpackBuffer"}, + {Feature::UnsizedSRGBReadPixelsDoesntTransform, "unsizedSRGBReadPixelsDoesntTransform"}, + {Feature::UploadTextureDataInChunks, "uploadTextureDataInChunks"}, + {Feature::UseInstancedPointSpriteEmulation, "useInstancedPointSpriteEmulation"}, {Feature::UseMultipleDescriptorsForExternalFormats, "useMultipleDescriptorsForExternalFormats"}, - {Feature::UseSystemMemoryForConstantBuffers, "use_system_memory_for_constant_buffers"}, + {Feature::UseSystemMemoryForConstantBuffers, "useSystemMemoryForConstantBuffers"}, {Feature::UseUnusedBlocksWithStandardOrSharedLayout, - "use_unused_blocks_with_standard_or_shared_layout"}, + "useUnusedBlocksWithStandardOrSharedLayout"}, + {Feature::VertexIDDoesNotIncludeBaseVertex, "vertexIDDoesNotIncludeBaseVertex"}, {Feature::WaitIdleBeforeSwapchainRecreation, "waitIdleBeforeSwapchainRecreation"}, - {Feature::ZeroMaxLodWorkaround, "zero_max_lod"}, + {Feature::ZeroMaxLodWorkaround, "zeroMaxLodWorkaround"}, }}; } // anonymous namespace diff --git a/util/angle_features_autogen.h b/util/angle_features_autogen.h index 300b3bff2d..a0205f5d9c 100644 --- a/util/angle_features_autogen.h +++ b/util/angle_features_autogen.h @@ -17,23 +17,22 @@ namespace angle enum class Feature { AddAndTrueToLoopCondition, - AddBaseVertexToVertexID, AddMockTextureNoRenderTarget, - AdjustSrcDstRegionBlitFramebuffer, + AdjustSrcDstRegionForBlitFramebuffer, AllocateNonZeroMemory, AllowBufferReadWrite, AllowClearForRobustResourceInit, AllowCompressedFormats, - AllowES3OnFL10_0, - AllowEtcFormats, - AllowGenMultipleMipsPerPass, + AllowES3OnFL100, + AllowETCFormats, AllowGenerateMipmapWithCompute, + AllowGenMultipleMipsPerPass, AllowInlineConstVertexData, AllowMultisampleStoreAndResolve, AllowRuntimeSamplerCompareMode, AllowSamplerCompareGradient, AllowSamplerCompareLod, - AllowSeparatedDepthStencilBuffers, + AllowSeparateDepthStencilBuffers, AllowTranslateUniformBlockToStructuredBuffer, AlwaysCallUseProgramAfterLink, AlwaysUnbindFramebufferTexture2D, @@ -45,16 +44,16 @@ enum class Feature BottomLeftOriginPresentRegionRectangles, BresenhamLineRasterization, CallClearTwice, - CaptureLimits, ClampArrayAccess, ClampFragDepth, ClampMscRate, ClampPointSize, ClearToZeroOrOneBroken, - ClipSrcRegionBlitFramebuffer, + ClipSrcRegionForBlitFramebuffer, CompressVertexData, CopyIOSurfaceToNonIOSurfaceForReadOptimization, CreatePipelineDuringLink, + DecodeEncodeSRGBForGenerateMipmap, DeferFlushUntilEndRenderPass, DepthClamping, DepthStencilBlitExtraCopy, @@ -75,16 +74,19 @@ enum class Feature DisableTimestampQueries, DisableWorkerContexts, DisallowSeamfulCubeMapEmulation, - DoWhileGLSLCausesGPUHang, DoesSRGBClearsOnLinearFramebufferAttachments, DontInitializeUninitializedLocals, DontRelinkProgramsInParallel, DontUseLoopsToInitializeVariables, + DoWhileGLSLCausesGPUHang, EmulateAbsIntFunction, EmulateAdvancedBlendEquations, EmulateAtan2Float, EmulateCopyTexImage2DFromRenderbuffers, EmulateDithering, + EmulatedPrerotation180, + EmulatedPrerotation270, + EmulatedPrerotation90, EmulateImmutableCompressedTexture3D, EmulateIsnanFloat, EmulateMaxVertexAttribStride, @@ -94,15 +96,12 @@ enum class Feature EmulateRGB10, EmulateTinyStencilTextures, EmulateTransformFeedback, - EmulatedPrerotation180, - EmulatedPrerotation270, - EmulatedPrerotation90, + EnableCaptureLimits, EnableCompressingPipelineCacheInThreadPool, EnableMultisampledRenderToTexture, - EnablePreRotateSurfaces, EnablePrecisionQualifiers, + EnablePreRotateSurfaces, EnableProgramBinaryForCapture, - EncodeAndDecodeSRGBForGenerateMipmap, ExpandIntegerPowExpressions, ExposeNonConformantExtensionsAndVersions, FinishDoesNotCauseQueriesToBeAvailable, @@ -135,8 +134,8 @@ enum class Feature HasEvents, HasExplicitMemBarrier, HasNonUniformDispatch, + HasShaderStencilOutput, HasStencilAutoResolve, - HasStencilOutput, HasTextureSwizzle, InitFragmentOutputVariables, InitializeCurrentVertexAttributes, @@ -151,7 +150,7 @@ enum class Feature LoseContextOnOutOfMemory, MrtPerfWorkaround, MultisampleColorFormatShaderReadWorkaround, - OverrideSurfaceFormatRGB8toRGBA8, + OverrideSurfaceFormatRGB8ToRGBA8, PackLastRowSeparatelyForPaddingInclusion, PackOverlappingRowsSeparatelyPackBuffer, PadBuffersToMaxVertexAttribStride, @@ -172,21 +171,21 @@ enum class Feature RemoveDynamicIndexingOfSwizzledVector, RemoveInvariantAndCentroidForESSL3, ResetTexImage2DBaseLevel, - RetainSpirvDebugInfo, + RetainSPIRVDebugInfo, RewriteFloatUnaryMinusOperator, RewriteRepeatedAssignToSwizzled, RewriteRowMajorMatrices, RewriteUnaryMinusOperator, - RgbDXT1TexturesSampleZeroAlpha, - Rgba4IsNotSupportedForColorRendering, - SanitizeAmdGpuRendererString, + RGBA4IsNotSupportedForColorRendering, + RGBDXT1TexturesSampleZeroAlpha, + SanitizeAMDGPURendererString, ScalarizeVecAndMatConstructorArgs, SelectViewInGeometryShader, SetDataFasterThanImageUpload, SetPrimitiveRestartFixedIndexForDrawArrays, SetZeroLevelBeforeGenerateMipmap, ShadowBuffers, - ShiftInstancedArrayDataWithExtraOffset, + ShiftInstancedArrayDataWithOffset, SkipVSConstantRegisterZero, SupportsAndroidHardwareBuffer, SupportsAndroidNativeFenceSync, @@ -204,8 +203,8 @@ enum class Feature SupportsExternalSemaphoreFd, SupportsExternalSemaphoreFuchsia, SupportsFilteringPrecision, - SupportsGGPFrameToken, SupportsGeometryStreamsCapability, + SupportsGGPFrameToken, SupportsHostQueryReset, SupportsImageCubeArray, SupportsImageFormatList, @@ -218,32 +217,33 @@ enum class Feature SupportsNegativeViewport, SupportsPipelineStatisticsQuery, SupportsProtectedMemory, - SupportsRenderPassLoadStoreOpNone, - SupportsRenderPassStoreOpNoneQCOM, SupportsRenderpass2, + SupportsRenderPassLoadStoreOpNone, + SupportsRenderPassStoreOpNone, SupportsShaderFloat16, SupportsShaderFramebufferFetch, SupportsShaderFramebufferFetchNonCoherent, SupportsShaderStencilExport, SupportsSharedPresentableImageExtension, SupportsSurfaceCapabilities2Extension, + SupportsSurfacelessQueryExtension, SupportsSurfaceProtectedCapabilitiesExtension, SupportsSurfaceProtectedSwapchains, - SupportsSurfacelessQueryExtension, SupportsTransformFeedbackExtension, SupportsYUVSamplerConversion, SwapbuffersOnFlushOrFinishWithSingleBuffer, SyncVertexArraysToDefault, - UnbindFBOOnContextSwitch, + UnbindFBOBeforeSwitchingContext, UnfoldShortCircuits, UnpackLastRowSeparatelyForPaddingInclusion, UnpackOverlappingRowsSeparatelyUnpackBuffer, - UnsizedsRGBReadPixelsDoesntTransform, + UnsizedSRGBReadPixelsDoesntTransform, UploadTextureDataInChunks, UseInstancedPointSpriteEmulation, UseMultipleDescriptorsForExternalFormats, UseSystemMemoryForConstantBuffers, UseUnusedBlocksWithStandardOrSharedLayout, + VertexIDDoesNotIncludeBaseVertex, WaitIdleBeforeSwapchainRecreation, ZeroMaxLodWorkaround, diff --git a/util/display/DisplayWindow.cpp b/util/display/DisplayWindow.cpp index 6cd0053cb4..423fc052bc 100644 --- a/util/display/DisplayWindow.cpp +++ b/util/display/DisplayWindow.cpp @@ -79,7 +79,7 @@ void DisplayWindow::signalTestEvent() } // static -#if defined(ANGLE_USE_VULKAN_DISPLAY) && defined(EGL_NO_X11) +#if defined(ANGLE_USE_VULKAN_DISPLAY) && defined(EGL_NO_X11) && !defined(ANGLE_USE_WAYLAND) OSWindow *OSWindow::New() { return new DisplayWindow(); diff --git a/util/linux/LinuxWindow.cpp b/util/linux/LinuxWindow.cpp new file mode 100644 index 0000000000..27d5271078 --- /dev/null +++ b/util/linux/LinuxWindow.cpp @@ -0,0 +1,40 @@ +// +// Copyright 2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// LinuxWindow.cpp: Implementation of OSWindow::New for Linux + +#include "util/OSWindow.h" + +#if defined(ANGLE_USE_WAYLAND) +# include "wayland/WaylandWindow.h" +#endif + +#if defined(ANGLE_USE_X11) +# include "x11/X11Window.h" +#endif + +// static +#if defined(ANGLE_USE_X11) || defined(ANGLE_USE_WAYLAND) +OSWindow *OSWindow::New() +{ +# if defined(ANGLE_USE_X11) + // Prefer X11 + if (IsX11WindowAvailable()) + { + return new X11Window(); + } +# endif + +# if defined(ANGLE_USE_WAYLAND) + if (IsWaylandWindowAvailable()) + { + return new WaylandWindow(); + } +# endif + + return nullptr; +} +#endif diff --git a/util/linux/wayland/WaylandWindow.cpp b/util/linux/wayland/WaylandWindow.cpp new file mode 100644 index 0000000000..b02b8a3867 --- /dev/null +++ b/util/linux/wayland/WaylandWindow.cpp @@ -0,0 +1,182 @@ +// +// Copyright 2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// WaylandWindow.cpp: Implementation of OSWindow for Wayland + +#include "util/linux/wayland/WaylandWindow.h" + +WaylandWindow::WaylandWindow() + : mDisplay{nullptr}, mCompositor{nullptr}, mSurface{nullptr}, mWindow{nullptr} +{} + +WaylandWindow::~WaylandWindow() +{ + destroy(); +} + +void WaylandWindow::RegistryHandleGlobal(void *data, + struct wl_registry *registry, + uint32_t name, + const char *interface, + uint32_t version) +{ + WaylandWindow *vc = reinterpret_cast<WaylandWindow *>(data); + + if (strcmp(interface, "wl_compositor") == 0) + { + void *compositor = wl_registry_bind(registry, name, &wl_compositor_interface, 1); + vc->mCompositor = reinterpret_cast<wl_compositor *>(compositor); + } +} + +void WaylandWindow::RegistryHandleGlobalRemove(void *data, + struct wl_registry *registry, + uint32_t name) +{} + +const struct wl_registry_listener WaylandWindow::registryListener = { + WaylandWindow::RegistryHandleGlobal, WaylandWindow::RegistryHandleGlobalRemove}; + +bool WaylandWindow::initializeImpl(const std::string &name, int width, int height) +{ + destroy(); + + if (!mDisplay) + { + mDisplay = wl_display_connect(nullptr); + if (!mDisplay) + { + return false; + } + } + + // Not get a window + struct wl_registry *registry = wl_display_get_registry(mDisplay); + wl_registry_add_listener(registry, ®istryListener, this); + + // Round-trip to get globals + wl_display_roundtrip(mDisplay); + if (!mCompositor) + { + return false; + } + + // We don't need this anymore + wl_registry_destroy(registry); + + mSurface = wl_compositor_create_surface(mCompositor); + if (!mSurface) + { + return false; + } + + mWindow = wl_egl_window_create(mSurface, width, height); + if (!mWindow) + { + return false; + } + + fds[0] = {wl_display_get_fd(mDisplay), POLLIN, 0}; + + mY = 0; + mX = 0; + mWidth = width; + mHeight = height; + + return true; +} + +void WaylandWindow::disableErrorMessageDialog() {} + +void WaylandWindow::destroy() +{ + if (mWindow) + { + wl_egl_window_destroy(mWindow); + mWindow = nullptr; + } + + if (mSurface) + { + wl_surface_destroy(mSurface); + mSurface = nullptr; + } + + if (mCompositor) + { + wl_compositor_destroy(mCompositor); + mCompositor = nullptr; + } +} + +void WaylandWindow::resetNativeWindow() {} + +EGLNativeWindowType WaylandWindow::getNativeWindow() const +{ + return reinterpret_cast<EGLNativeWindowType>(mWindow); +} + +EGLNativeDisplayType WaylandWindow::getNativeDisplay() const +{ + return reinterpret_cast<EGLNativeDisplayType>(mDisplay); +} + +void WaylandWindow::messageLoop() +{ + while (wl_display_prepare_read(mDisplay) != 0) + wl_display_dispatch_pending(mDisplay); + if (wl_display_flush(mDisplay) < 0 && errno != EAGAIN) + { + wl_display_cancel_read(mDisplay); + return; + } + if (poll(fds, 1, 0) > 0) + { + wl_display_read_events(mDisplay); + wl_display_dispatch_pending(mDisplay); + } + else + { + wl_display_cancel_read(mDisplay); + } +} + +void WaylandWindow::setMousePosition(int x, int y) {} + +bool WaylandWindow::setOrientation(int width, int height) +{ + return true; +} + +bool WaylandWindow::setPosition(int x, int y) +{ + return true; +} + +bool WaylandWindow::resize(int width, int height) +{ + wl_egl_window_resize(mWindow, width, height, 0, 0); + + mWidth = width; + mHeight = height; + + return true; +} + +void WaylandWindow::setVisible(bool isVisible) {} + +void WaylandWindow::signalTestEvent() {} + +bool IsWaylandWindowAvailable() +{ + wl_display *display = wl_display_connect(nullptr); + if (!display) + { + return false; + } + wl_display_disconnect(display); + return true; +} diff --git a/util/linux/wayland/WaylandWindow.h b/util/linux/wayland/WaylandWindow.h new file mode 100644 index 0000000000..95ed1bb5e0 --- /dev/null +++ b/util/linux/wayland/WaylandWindow.h @@ -0,0 +1,64 @@ +// +// Copyright 2022 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// WaylandWindow.h: Definition of the implementation of OSWindow for Wayland + +#ifndef UTIL_WAYLAND_WINDOW_H +#define UTIL_WAYLAND_WINDOW_H + +#include <poll.h> +#include <wayland-client.h> +#include <wayland-egl-core.h> + +#include "util/OSWindow.h" +#include "util/util_export.h" + +bool IsWaylandWindowAvailable(); + +class ANGLE_UTIL_EXPORT WaylandWindow : public OSWindow +{ + public: + WaylandWindow(); + ~WaylandWindow() override; + + void disableErrorMessageDialog() override; + void destroy() override; + + void resetNativeWindow() override; + EGLNativeWindowType getNativeWindow() const override; + EGLNativeDisplayType getNativeDisplay() const override; + + void messageLoop() override; + + void setMousePosition(int x, int y) override; + bool setOrientation(int width, int height) override; + bool setPosition(int x, int y) override; + bool resize(int width, int height) override; + void setVisible(bool isVisible) override; + + void signalTestEvent() override; + + private: + static void RegistryHandleGlobal(void *data, + struct wl_registry *registry, + uint32_t name, + const char *interface, + uint32_t version); + static void RegistryHandleGlobalRemove(void *data, struct wl_registry *registry, uint32_t name); + + bool initializeImpl(const std::string &name, int width, int height) override; + + static const struct wl_registry_listener registryListener; + + struct wl_display *mDisplay; + struct wl_compositor *mCompositor; + struct wl_surface *mSurface; + struct wl_egl_window *mWindow; + + struct pollfd fds[1]; +}; + +#endif // UTIL_WAYLAND_WINDOW_H diff --git a/util/x11/X11Pixmap.cpp b/util/linux/x11/X11Pixmap.cpp index 534e5a4747..612bc74833 100644 --- a/util/x11/X11Pixmap.cpp +++ b/util/linux/x11/X11Pixmap.cpp @@ -6,7 +6,7 @@ // X11Pixmap.cpp: Implementation of OSPixmap for X11 -#include "util/x11/X11Pixmap.h" +#include "util/linux/x11/X11Pixmap.h" X11Pixmap::X11Pixmap() : mPixmap(0), mDisplay(nullptr) {} diff --git a/util/x11/X11Pixmap.h b/util/linux/x11/X11Pixmap.h index c7b6c96c9f..c7b6c96c9f 100644 --- a/util/x11/X11Pixmap.h +++ b/util/linux/x11/X11Pixmap.h diff --git a/util/x11/X11Window.cpp b/util/linux/x11/X11Window.cpp index 8cdb448968..ae479b9255 100644 --- a/util/x11/X11Window.cpp +++ b/util/linux/x11/X11Window.cpp @@ -6,7 +6,7 @@ // X11Window.cpp: Implementation of OSWindow for X11 -#include "util/x11/X11Window.h" +#include "util/linux/x11/X11Window.h" #include "common/debug.h" #include "util/Timer.h" @@ -722,8 +722,13 @@ void X11Window::processEvent(const XEvent &xEvent) } } -// static -OSWindow *OSWindow::New() +bool IsX11WindowAvailable() { - return new X11Window(); + Display *display = XOpenDisplay(nullptr); + if (!display) + { + return false; + } + XCloseDisplay(display); + return true; } diff --git a/util/x11/X11Window.h b/util/linux/x11/X11Window.h index 0b502e4f3d..4863819fc8 100644 --- a/util/x11/X11Window.h +++ b/util/linux/x11/X11Window.h @@ -17,6 +17,8 @@ #include "util/OSWindow.h" #include "util/util_export.h" +bool IsX11WindowAvailable(); + class ANGLE_UTIL_EXPORT X11Window : public OSWindow { public: |