diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/angle/checkout/include/platform | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/angle/checkout/include/platform')
-rw-r--r-- | gfx/angle/checkout/include/platform/Feature.h | 196 | ||||
-rw-r--r-- | gfx/angle/checkout/include/platform/FeaturesD3D_autogen.h | 198 | ||||
-rw-r--r-- | gfx/angle/checkout/include/platform/FeaturesGL_autogen.h | 501 | ||||
-rw-r--r-- | gfx/angle/checkout/include/platform/FeaturesMtl_autogen.h | 242 | ||||
-rw-r--r-- | gfx/angle/checkout/include/platform/FeaturesVk_autogen.h | 786 | ||||
-rw-r--r-- | gfx/angle/checkout/include/platform/FrontendFeatures_autogen.h | 115 | ||||
-rw-r--r-- | gfx/angle/checkout/include/platform/PlatformMethods.h | 334 |
7 files changed, 2372 insertions, 0 deletions
diff --git a/gfx/angle/checkout/include/platform/Feature.h b/gfx/angle/checkout/include/platform/Feature.h new file mode 100644 index 0000000000..c1de314e80 --- /dev/null +++ b/gfx/angle/checkout/include/platform/Feature.h @@ -0,0 +1,196 @@ +// +// Copyright 2019 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. +// +// Feature.h: Definition of structs to hold feature/workaround information. +// + +#ifndef ANGLE_PLATFORM_FEATURE_H_ +#define ANGLE_PLATFORM_FEATURE_H_ + +#include <map> +#include <string> +#include <vector> + +#define ANGLE_FEATURE_CONDITION(set, feature, cond) \ + do \ + { \ + (set)->feature.enabled = cond; \ + (set)->feature.condition = ANGLE_STRINGIFY(cond); \ + } while (0) + +namespace angle +{ + +enum class FeatureCategory +{ + FrontendFeatures, + FrontendWorkarounds, + OpenGLWorkarounds, + OpenGLFeatures, + D3DWorkarounds, + VulkanFeatures, + VulkanWorkarounds, + VulkanAppWorkarounds, + MetalFeatures, + MetalWorkarounds, +}; + +constexpr char kFeatureCategoryFrontendWorkarounds[] = "Frontend workarounds"; +constexpr char kFeatureCategoryFrontendFeatures[] = "Frontend features"; +constexpr char kFeatureCategoryOpenGLWorkarounds[] = "OpenGL workarounds"; +constexpr char kFeatureCategoryOpenGLFeatures[] = "OpenGL features"; +constexpr char kFeatureCategoryD3DWorkarounds[] = "D3D workarounds"; +constexpr char kFeatureCategoryVulkanAppWorkarounds[] = "Vulkan app workarounds"; +constexpr char kFeatureCategoryVulkanWorkarounds[] = "Vulkan workarounds"; +constexpr char kFeatureCategoryVulkanFeatures[] = "Vulkan features"; +constexpr char kFeatureCategoryMetalFeatures[] = "Metal features"; +constexpr char kFeatureCategoryMetalWorkarounds[] = "Metal workarounds"; +constexpr char kFeatureCategoryUnknown[] = "Unknown"; + +inline const char *FeatureCategoryToString(const FeatureCategory &fc) +{ + switch (fc) + { + case FeatureCategory::FrontendFeatures: + return kFeatureCategoryFrontendFeatures; + break; + + case FeatureCategory::FrontendWorkarounds: + return kFeatureCategoryFrontendWorkarounds; + break; + + case FeatureCategory::OpenGLWorkarounds: + return kFeatureCategoryOpenGLWorkarounds; + break; + + case FeatureCategory::OpenGLFeatures: + return kFeatureCategoryOpenGLFeatures; + break; + + case FeatureCategory::D3DWorkarounds: + return kFeatureCategoryD3DWorkarounds; + break; + + case FeatureCategory::VulkanFeatures: + return kFeatureCategoryVulkanFeatures; + break; + + case FeatureCategory::VulkanWorkarounds: + return kFeatureCategoryVulkanWorkarounds; + break; + + case FeatureCategory::VulkanAppWorkarounds: + return kFeatureCategoryVulkanAppWorkarounds; + break; + + case FeatureCategory::MetalFeatures: + return kFeatureCategoryMetalFeatures; + break; + + case FeatureCategory::MetalWorkarounds: + return kFeatureCategoryMetalWorkarounds; + break; + + default: + return kFeatureCategoryUnknown; + break; + } +} + +constexpr char kFeatureStatusEnabled[] = "enabled"; +constexpr char kFeatureStatusDisabled[] = "disabled"; + +inline const char *FeatureStatusToString(const bool &status) +{ + if (status) + { + return kFeatureStatusEnabled; + } + return kFeatureStatusDisabled; +} + +struct FeatureInfo; + +using FeatureMap = std::map<std::string, FeatureInfo *>; +using FeatureList = std::vector<const FeatureInfo *>; + +struct FeatureInfo +{ + FeatureInfo(const FeatureInfo &other); + FeatureInfo(const char *name, + const FeatureCategory &category, + const char *description, + FeatureMap *const mapPtr, + const char *bug); + ~FeatureInfo(); + + // The name of the workaround, lowercase, camel_case + const char *const name; + + // The category that the workaround belongs to. Eg. "Vulkan workarounds" + const FeatureCategory category; + + // A short description to be read by the user. + const char *const description; + + // A link to the bug, if any + const char *const bug; + + // Whether the workaround is enabled or not. Determined by heuristics like vendor ID and + // version, but may be overriden to any value. + bool enabled = false; + + // A stringified version of the condition used to set 'enabled'. ie "IsNvidia() && IsApple()" + const char *condition; +}; + +inline FeatureInfo::FeatureInfo(const FeatureInfo &other) = default; +inline FeatureInfo::FeatureInfo(const char *name, + const FeatureCategory &category, + const char *description, + FeatureMap *const mapPtr, + const char *bug = "") + : name(name), + category(category), + description(description), + bug(bug), + enabled(false), + condition("") +{ + if (mapPtr != nullptr) + { + (*mapPtr)[std::string(name)] = this; + } +} + +inline FeatureInfo::~FeatureInfo() = default; + +struct FeatureSetBase +{ + public: + FeatureSetBase(); + ~FeatureSetBase(); + + private: + // Non-copyable + FeatureSetBase(const FeatureSetBase &other) = delete; + FeatureSetBase &operator=(const FeatureSetBase &other) = delete; + + protected: + FeatureMap members = FeatureMap(); + + public: + void overrideFeatures(const std::vector<std::string> &featureNames, bool enabled); + void populateFeatureList(FeatureList *features) const; + + const FeatureMap &getFeatures() const { return members; } +}; + +inline FeatureSetBase::FeatureSetBase() = default; +inline FeatureSetBase::~FeatureSetBase() = default; + +} // namespace angle + +#endif // ANGLE_PLATFORM_WORKAROUND_H_ diff --git a/gfx/angle/checkout/include/platform/FeaturesD3D_autogen.h b/gfx/angle/checkout/include/platform/FeaturesD3D_autogen.h new file mode 100644 index 0000000000..0df072b497 --- /dev/null +++ b/gfx/angle/checkout/include/platform/FeaturesD3D_autogen.h @@ -0,0 +1,198 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_features.py using data from d3d_features.json. +// +// 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. +// +// FeaturesD3D_autogen.h: Features and workarounds for D3D driver bugs and other issues. + +#ifndef ANGLE_PLATFORM_FEATURESD3D_H_ +#define ANGLE_PLATFORM_FEATURESD3D_H_ + +#include "platform/Feature.h" + +namespace angle +{ + +struct FeaturesD3D : FeatureSetBase +{ + FeaturesD3D(); + ~FeaturesD3D(); + + FeatureInfo mrtPerfWorkaround = { + "mrtPerfWorkaround", + FeatureCategory::D3DWorkarounds, + "Some drivers have a bug where they ignore null render targets", + &members, + }; + + FeatureInfo setDataFasterThanImageUpload = { + "setDataFasterThanImageUpload", + FeatureCategory::D3DWorkarounds, + "Set data faster than image upload", + &members, + }; + + FeatureInfo setDataFasterThanImageUploadOn128bitFormats = { + "setDataFasterThanImageUploadOn128bitFormats", + FeatureCategory::D3DWorkarounds, + "Set data faster than image upload on 128bit formats", + &members, + }; + + FeatureInfo zeroMaxLodWorkaround = { + "zeroMaxLodWorkaround", + FeatureCategory::D3DWorkarounds, + "Missing an option to disable mipmaps on a mipmapped texture", + &members, + }; + + FeatureInfo useInstancedPointSpriteEmulation = { + "useInstancedPointSpriteEmulation", + FeatureCategory::D3DWorkarounds, + "Some D3D11 renderers do not support geometry shaders for pointsprite emulation", + &members, + }; + + FeatureInfo depthStencilBlitExtraCopy = { + "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 = { + "expandIntegerPowExpressions", + FeatureCategory::D3DWorkarounds, + "The HLSL optimizer has a bug with optimizing 'pow' in certain integer-valued expressions", + &members, + }; + + FeatureInfo flushAfterEndingTransformFeedback = { + "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", + &members, + }; + + FeatureInfo getDimensionsIgnoresBaseLevel = { + "getDimensionsIgnoresBaseLevel", + FeatureCategory::D3DWorkarounds, + "Some drivers do not take into account the base level of the " + "texture in the results of the HLSL GetDimensions builtin", + &members, + }; + + FeatureInfo preAddTexelFetchOffsets = { + "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", + &members, + }; + + FeatureInfo emulateTinyStencilTextures = { + "emulateTinyStencilTextures", + FeatureCategory::D3DWorkarounds, + "1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly", + &members, + }; + + FeatureInfo disableB5G6R5Support = { + "disableB5G6R5Support", + FeatureCategory::D3DWorkarounds, + "Textures with the format " + "DXGI_FORMAT_B5G6R5_UNORM have incorrect data", + &members, + }; + + FeatureInfo rewriteUnaryMinusOperator = { + "rewriteUnaryMinusOperator", + FeatureCategory::D3DWorkarounds, + "Evaluating unary minus operator on integer may get wrong answer in vertex shaders", + &members, + }; + + FeatureInfo emulateIsnanFloat = {"emulateIsnanFloat", FeatureCategory::D3DWorkarounds, + "Using isnan() on highp float will get wrong answer", &members, + "https://crbug.com/650547"}; + + FeatureInfo callClearTwice = {"callClearTwice", FeatureCategory::D3DWorkarounds, + "Using clear() may not take effect", &members, + "https://crbug.com/655534"}; + + FeatureInfo emulateClearViewAfterDualSourceBlending = { + "emulateClearViewAfterDualSourceBlending", FeatureCategory::D3DWorkarounds, + "On Sandybridge, calling ClearView after using dual source blending causes hardware to " + "hang", + &members, "https://bugzilla.mozilla.org/show_bug.cgi?id=1633628"}; + + FeatureInfo scissoredClearArtifacts = { + "scissoredClearArtifacts", FeatureCategory::D3DWorkarounds, + "On Skylake, calling ClearView with a scissor rect that is not a multiple of 8x4 pixels " + "causes corruption of pixels in the 8x4 pixel tiles along the edge which resembles a " + "square wave", + &members, "https://bugzilla.mozilla.org/show_bug.cgi?id=1817240"}; + + FeatureInfo useSystemMemoryForConstantBuffers = { + "useSystemMemoryForConstantBuffers", FeatureCategory::D3DWorkarounds, + "Copying from staging storage to constant buffer " + "storage does not work", + &members, "https://crbug.com/593024"}; + + FeatureInfo selectViewInGeometryShader = { + "selectViewInGeometryShader", + FeatureCategory::D3DWorkarounds, + "The viewport or render target slice will be selected in the geometry shader stage for " + "the ANGLE_multiview extension", + &members, + }; + + FeatureInfo addMockTextureNoRenderTarget = { + "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 = { + "skipVSConstantRegisterZero", + FeatureCategory::D3DWorkarounds, + "In specific cases the driver doesn't handle constant register zero correctly", + &members, + }; + + FeatureInfo forceAtomicValueResolution = { + "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 = { + "allowClearForRobustResourceInit", FeatureCategory::D3DWorkarounds, + "Some drivers corrupt texture data when clearing for robust resource initialization.", + &members, "http://crbug.com/941620"}; + + FeatureInfo allowTranslateUniformBlockToStructuredBuffer = { + "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 allowES3OnFL100 = { + "allowES3OnFL100", + FeatureCategory::D3DWorkarounds, + "Allow ES3 on 10.0 devices", + &members, + }; + + FeatureInfo disableRasterizerOrderViews = { + "disableRasterizerOrderViews", FeatureCategory::D3DWorkarounds, "Disable ROVs for testing", + &members, "http://anglebug.com/7279"}; +}; + +inline FeaturesD3D::FeaturesD3D() = default; +inline FeaturesD3D::~FeaturesD3D() = default; + +} // namespace angle + +#endif // ANGLE_PLATFORM_FEATURESD3D_H_ diff --git a/gfx/angle/checkout/include/platform/FeaturesGL_autogen.h b/gfx/angle/checkout/include/platform/FeaturesGL_autogen.h new file mode 100644 index 0000000000..5376f3400a --- /dev/null +++ b/gfx/angle/checkout/include/platform/FeaturesGL_autogen.h @@ -0,0 +1,501 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_features.py using data from gl_features.json. +// +// 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. +// +// FeaturesGL_autogen.h: angle::Features and workarounds for GL driver bugs and other issues. + +#ifndef ANGLE_PLATFORM_FEATURESGL_H_ +#define ANGLE_PLATFORM_FEATURESGL_H_ + +#include "platform/Feature.h" + +namespace angle +{ + +struct FeaturesGL : FeatureSetBase +{ + FeaturesGL(); + ~FeaturesGL(); + + FeatureInfo avoid1BitAlphaTextureFormats = { + "avoid1BitAlphaTextureFormats", + FeatureCategory::OpenGLWorkarounds, + "Issue with 1-bit alpha framebuffer formats", + &members, + }; + + FeatureInfo RGBA4IsNotSupportedForColorRendering = { + "RGBA4IsNotSupportedForColorRendering", + FeatureCategory::OpenGLWorkarounds, + "GL_RGBA4 is not color renderable", + &members, + }; + + FeatureInfo allowETCFormats = { + "allowETCFormats", + FeatureCategory::OpenGLWorkarounds, + "Enable ETC2/EAC on desktop OpenGL", + &members, + }; + + FeatureInfo allowAstcFormats = { + "allowAstcFormats", + FeatureCategory::OpenGLWorkarounds, + "Enable ASTC on desktop OpenGL", + &members, + }; + + FeatureInfo doesSRGBClearsOnLinearFramebufferAttachments = { + "doesSRGBClearsOnLinearFramebufferAttachments", + FeatureCategory::OpenGLWorkarounds, + "Issue clearing framebuffers with linear attachments when GL_FRAMEBUFFER_SRGB is enabled", + &members, + }; + + FeatureInfo doWhileGLSLCausesGPUHang = { + "doWhileGLSLCausesGPUHang", FeatureCategory::OpenGLWorkarounds, + "Some GLSL constructs involving do-while loops cause GPU hangs", &members, + "http://crbug.com/644669"}; + + FeatureInfo vertexIDDoesNotIncludeBaseVertex = { + "vertexIDDoesNotIncludeBaseVertex", + FeatureCategory::OpenGLWorkarounds, + "gl_VertexID in GLSL vertex shader doesn't include base vertex value", + &members, + }; + + FeatureInfo finishDoesNotCauseQueriesToBeAvailable = { + "finishDoesNotCauseQueriesToBeAvailable", + FeatureCategory::OpenGLWorkarounds, + "glFinish doesn't cause all queries to report available result", + &members, + }; + + FeatureInfo alwaysCallUseProgramAfterLink = { + "alwaysCallUseProgramAfterLink", FeatureCategory::OpenGLWorkarounds, + "Always call useProgram after a successful link to avoid a driver bug", &members, + "http://crbug.com/110263"}; + + FeatureInfo unpackOverlappingRowsSeparatelyUnpackBuffer = { + "unpackOverlappingRowsSeparatelyUnpackBuffer", + FeatureCategory::OpenGLWorkarounds, + "In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row", + &members, + }; + + FeatureInfo packOverlappingRowsSeparatelyPackBuffer = { + "packOverlappingRowsSeparatelyPackBuffer", + FeatureCategory::OpenGLWorkarounds, + "In the case of packing to a pixel pack buffer, pack overlapping rows row by row", + &members, + }; + + FeatureInfo initializeCurrentVertexAttributes = { + "initializeCurrentVertexAttributes", + FeatureCategory::OpenGLWorkarounds, + "During initialization, assign the current vertex attributes to the spec-mandated defaults", + &members, + }; + + FeatureInfo emulateAbsIntFunction = {"emulateAbsIntFunction", + FeatureCategory::OpenGLWorkarounds, + "abs(i) where i is an integer returns unexpected result", + &members, "http://crbug.com/642227"}; + + FeatureInfo addAndTrueToLoopCondition = { + "addAndTrueToLoopCondition", + FeatureCategory::OpenGLWorkarounds, + "Calculation of loop conditions in for and while loop has bug", + &members, + }; + + FeatureInfo unpackLastRowSeparatelyForPaddingInclusion = { + "unpackLastRowSeparatelyForPaddingInclusion", FeatureCategory::OpenGLWorkarounds, + "When uploading textures from an unpack buffer, some drivers count an extra row padding", + &members, "http://anglebug.com/1512"}; + + FeatureInfo packLastRowSeparatelyForPaddingInclusion = { + "packLastRowSeparatelyForPaddingInclusion", FeatureCategory::OpenGLWorkarounds, + "When uploading textures from an pack buffer, some drivers count an extra row padding", + &members, "http://anglebug.com/1512"}; + + FeatureInfo emulateIsnanFloat = {"emulateIsnanFloat", FeatureCategory::OpenGLWorkarounds, + "Using isnan() on highp float will get wrong answer", &members, + "http://crbug.com/650547"}; + + FeatureInfo useUnusedBlocksWithStandardOrSharedLayout = { + "useUnusedBlocksWithStandardOrSharedLayout", + FeatureCategory::OpenGLWorkarounds, + "Unused std140 or shared uniform blocks will be treated as inactive", + &members, + }; + + FeatureInfo removeInvariantAndCentroidForESSL3 = { + "removeInvariantAndCentroidForESSL3", + FeatureCategory::OpenGLWorkarounds, + "Fix spec difference between GLSL 4.1 or lower and ESSL3", + &members, + }; + + FeatureInfo rewriteFloatUnaryMinusOperator = { + "rewriteFloatUnaryMinusOperator", FeatureCategory::OpenGLWorkarounds, + "Using '-<float>' will get wrong answer", &members, "http://crbug.com/308366"}; + + FeatureInfo emulateAtan2Float = {"emulateAtan2Float", FeatureCategory::OpenGLWorkarounds, + "atan(y, x) may return a wrong answer", &members, + "http://crbug.com/672380"}; + + FeatureInfo reapplyUBOBindingsAfterUsingBinaryProgram = { + "reapplyUBOBindingsAfterUsingBinaryProgram", FeatureCategory::OpenGLWorkarounds, + "Some drivers forget about UBO bindings when using program binaries", &members, + "http://anglebug.com/1637"}; + + FeatureInfo emulateMaxVertexAttribStride = { + "emulateMaxVertexAttribStride", FeatureCategory::OpenGLWorkarounds, + "Some drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members, + "http://anglebug.com/1936"}; + + FeatureInfo dontInitializeUninitializedLocals = { + "dontInitializeUninitializedLocals", FeatureCategory::OpenGLWorkarounds, + "Initializing uninitialized locals caused odd behavior in a few WebGL 2 tests", &members, + "http://anglebug.com/2046"}; + + FeatureInfo clampPointSize = { + "clampPointSize", + FeatureCategory::OpenGLWorkarounds, + "The point size range reported from the API is inconsistent with the actual behavior", + &members, + }; + + FeatureInfo dontUseLoopsToInitializeVariables = { + "dontUseLoopsToInitializeVariables", FeatureCategory::OpenGLWorkarounds, + "For loops used to initialize variables hit native GLSL compiler bugs", &members, + "http://crbug.com/809422"}; + + FeatureInfo clampFragDepth = { + "clampFragDepth", + FeatureCategory::OpenGLWorkarounds, + "gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer", + &members, + }; + + FeatureInfo rewriteRepeatedAssignToSwizzled = { + "rewriteRepeatedAssignToSwizzled", + FeatureCategory::OpenGLWorkarounds, + "Repeated assignment to swizzled values inside a " + "GLSL user-defined function have incorrect results", + &members, + }; + + FeatureInfo disableBlendFuncExtended = { + "disableBlendFuncExtended", FeatureCategory::OpenGLWorkarounds, + "ARB_blend_func_extended does not pass the tests", &members, "http://anglebug.com/1085"}; + + 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 = { + "queryCounterBitsGeneratesErrors", FeatureCategory::OpenGLWorkarounds, + "Drivers generate errors when querying the number of bits in timer queries", &members, + "http://anglebug.com/3027"}; + + FeatureInfo dontRelinkProgramsInParallel = { + "dontRelinkProgramsInParallel", FeatureCategory::OpenGLWorkarounds, + "Relinking a program in parallel is buggy", &members, "http://anglebug.com/3045"}; + + FeatureInfo disableWorkerContexts = {"disableWorkerContexts", + FeatureCategory::OpenGLWorkarounds, + "Some tests have been seen to fail using worker contexts", + &members, "http://crbug.com/849576"}; + + FeatureInfo limitWebglMaxTextureSizeTo4096 = { + "limitWebglMaxTextureSizeTo4096", FeatureCategory::OpenGLWorkarounds, + "Limit webgl max texture size to 4096 to avoid frequent " + "out-of-memory errors", + &members, "http://crbug.com/927470"}; + + FeatureInfo limitMaxMSAASamplesTo4 = { + "limitMaxMSAASamplesTo4", FeatureCategory::OpenGLWorkarounds, + "Various rendering bugs have been observed when using higher MSAA counts", &members, + "http://crbug.com/797243"}; + + FeatureInfo allowClearForRobustResourceInit = { + "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 = {"clampArrayAccess", FeatureCategory::OpenGLWorkarounds, + "Clamp uniform array access to avoid reading invalid memory.", + &members, "http://anglebug.com/2978"}; + + FeatureInfo resetTexImage2DBaseLevel = { + "resetTexImage2DBaseLevel", FeatureCategory::OpenGLWorkarounds, + "Reset texture base level before calling glTexImage2D to " + "work around pixel comparison failure.", + &members, "https://crbug.com/705865"}; + + FeatureInfo clearToZeroOrOneBroken = { + "clearToZeroOrOneBroken", FeatureCategory::OpenGLWorkarounds, + "Clears when the clear color is all zeros or ones do not work.", &members, + "https://crbug.com/710443"}; + + FeatureInfo limitMax3dArrayTextureSizeTo1024 = { + "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 adjustSrcDstRegionForBlitFramebuffer = { + "adjustSrcDstRegionForBlitFramebuffer", FeatureCategory::OpenGLWorkarounds, + "Many platforms have issues with blitFramebuffer when the parameters are large.", &members, + "http://crbug.com/830046"}; + + FeatureInfo clipSrcRegionForBlitFramebuffer = { + "clipSrcRegionForBlitFramebuffer", FeatureCategory::OpenGLWorkarounds, + "Issues with blitFramebuffer when the parameters don't match the framebuffer size.", + &members, "http://crbug.com/830046"}; + + FeatureInfo RGBDXT1TexturesSampleZeroAlpha = { + "RGBDXT1TexturesSampleZeroAlpha", FeatureCategory::OpenGLWorkarounds, + "Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac.", &members, + "http://anglebug.com/3729"}; + + FeatureInfo unfoldShortCircuits = { + "unfoldShortCircuits", FeatureCategory::OpenGLWorkarounds, + "Mac incorrectly executes both sides of && and || expressions when they should " + "short-circuit.", + &members, "http://anglebug.com/482"}; + + FeatureInfo emulatePrimitiveRestartFixedIndex = { + "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 = { + "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 = { + "removeDynamicIndexingOfSwizzledVector", FeatureCategory::OpenGLWorkarounds, + "Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.", + &members, "http://crbug.com/709351"}; + + FeatureInfo preAddTexelFetchOffsets = { + "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, " + "position + offset, lod).", + &members, "http://crbug.com/642605"}; + + FeatureInfo regenerateStructNames = { + "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 = { + "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 = { + "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 = { + "rewriteRowMajorMatrices", FeatureCategory::OpenGLWorkarounds, + "Rewrite row major matrices in shaders as column major as a driver bug workaround", + &members, "http://anglebug.com/2273"}; + + FeatureInfo disableDrawBuffersIndexed = { + "disableDrawBuffersIndexed", + FeatureCategory::OpenGLWorkarounds, + "Disable OES_draw_buffers_indexed extension.", + &members, + }; + + FeatureInfo disableSemaphoreFd = {"disableSemaphoreFd", FeatureCategory::OpenGLWorkarounds, + "Disable GL_EXT_semaphore_fd extension", &members, + "https://crbug.com/1046462"}; + + FeatureInfo disableTimestampQueries = { + "disableTimestampQueries", FeatureCategory::OpenGLWorkarounds, + "Disable GL_EXT_disjoint_timer_query extension", &members, "https://crbug.com/811661"}; + + FeatureInfo decodeEncodeSRGBForGenerateMipmap = { + "decodeEncodeSRGBForGenerateMipmap", FeatureCategory::OpenGLWorkarounds, + "Decode and encode before generateMipmap for srgb format textures.", &members, + "http://anglebug.com/4646"}; + + FeatureInfo emulateCopyTexImage2D = { + "emulateCopyTexImage2D", + FeatureCategory::OpenGLWorkarounds, + "Replace CopyTexImage2D with TexImage2D + CopyTexSubImage2D.", + &members, + }; + + FeatureInfo emulateCopyTexImage2DFromRenderbuffers = { + "emulateCopyTexImage2DFromRenderbuffers", FeatureCategory::OpenGLWorkarounds, + "CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers.", + &members, "https://anglebug.com/4674"}; + + FeatureInfo disableGPUSwitchingSupport = { + "disableGPUSwitchingSupport", FeatureCategory::OpenGLWorkarounds, + "Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.", + &members, "https://crbug.com/1091824"}; + + FeatureInfo disableNativeParallelCompile = { + "disableNativeParallelCompile", FeatureCategory::OpenGLWorkarounds, + "Do not use native KHR_parallel_shader_compile even when available.", &members, + "http://crbug.com/1094869"}; + + FeatureInfo emulatePackSkipRowsAndPackSkipPixels = { + "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 = { + "clampMscRate", FeatureCategory::OpenGLWorkarounds, + "Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz", &members, + "https://crbug.com/1042393"}; + + FeatureInfo bindTransformFeedbackBufferBeforeBindBufferRange = { + "bindTransformFeedbackBufferBeforeBindBufferRange", FeatureCategory::OpenGLWorkarounds, + "Bind transform feedback buffers to the generic binding point before calling " + "glBindBufferBase or glBindBufferRange.", + &members, "https://anglebug.com/5140"}; + + FeatureInfo disableSyncControlSupport = { + "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 = { + "keepBufferShadowCopy", + FeatureCategory::OpenGLWorkarounds, + "Maintain a shadow copy of buffer data when the GL API does not permit reading data back.", + &members, + }; + + FeatureInfo setZeroLevelBeforeGenerateMipmap = { + "setZeroLevelBeforeGenerateMipmap", + FeatureCategory::OpenGLWorkarounds, + "glGenerateMipmap fails if the zero texture level is not set on some Mac drivers.", + &members, + }; + + FeatureInfo promotePackedFormatsTo8BitPerChannel = { + "promotePackedFormatsTo8BitPerChannel", FeatureCategory::OpenGLWorkarounds, + "Packed color formats are buggy on Macs with AMD GPUs", &members, + "http://anglebug.com/5469"}; + + FeatureInfo initFragmentOutputVariables = { + "initFragmentOutputVariables", FeatureCategory::OpenGLWorkarounds, + "No init gl_FragColor causes context lost", &members, "http://crbug.com/1171371"}; + + FeatureInfo shiftInstancedArrayDataWithOffset = { + "shiftInstancedArrayDataWithOffset", FeatureCategory::OpenGLWorkarounds, + "glDrawArraysInstanced is buggy on certain new Mac Intel GPUs", &members, + "http://crbug.com/1144207"}; + + FeatureInfo syncVertexArraysToDefault = { + "syncVertexArraysToDefault", FeatureCategory::OpenGLWorkarounds, + "Only use the default VAO because of missing support or driver bugs", &members, + "http://anglebug.com/5577"}; + + FeatureInfo sanitizeAMDGPURendererString = { + "sanitizeAMDGPURendererString", FeatureCategory::OpenGLWorkarounds, + "Strip precise kernel and DRM version information from amdgpu renderer strings.", &members, + "http://crbug.com/1181193"}; + + FeatureInfo unbindFBOBeforeSwitchingContext = { + "unbindFBOBeforeSwitchingContext", FeatureCategory::OpenGLWorkarounds, + "Imagination GL drivers are buggy with context switching.", &members, + "http://crbug.com/1181193"}; + + 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 = { + "disableMultisampledRenderToTexture", FeatureCategory::OpenGLWorkarounds, + "Many drivers have bugs when using GL_EXT_multisampled_render_to_texture", &members, + "http://anglebug.com/2894"}; + + FeatureInfo uploadTextureDataInChunks = { + "uploadTextureDataInChunks", FeatureCategory::OpenGLWorkarounds, + "Upload texture data in <120kb chunks to work around Mac driver hangs and crashes.", + &members, "http://crbug.com/1181068"}; + + FeatureInfo emulateImmutableCompressedTexture3D = { + "emulateImmutableCompressedTexture3D", FeatureCategory::OpenGLWorkarounds, + "Use non-immutable texture allocation to work around a driver bug.", &members, + "https://crbug.com/1060012"}; + + FeatureInfo emulateRGB10 = {"emulateRGB10", FeatureCategory::OpenGLWorkarounds, + "Emulate RGB10 support using RGB10_A2.", &members, + "https://crbug.com/1300575"}; + + FeatureInfo alwaysUnbindFramebufferTexture2D = { + "alwaysUnbindFramebufferTexture2D", FeatureCategory::OpenGLWorkarounds, + "Force unbind framebufferTexture2D before binding renderbuffer to work around driver bug.", + &members, "https://anglebug.com/5536"}; + + FeatureInfo disableTextureClampToBorder = { + "disableTextureClampToBorder", FeatureCategory::OpenGLWorkarounds, + "Imagination devices generate INVALID_ENUM when setting the texture border color.", + &members, "https://anglebug.com/7405"}; + + FeatureInfo passHighpToPackUnormSnormBuiltins = { + "passHighpToPackUnormSnormBuiltins", FeatureCategory::OpenGLWorkarounds, + "packUnorm4x8 fails on Pixel 4 if it is not passed a highp vec4.", &members, + "http://anglebug.com/7527"}; + + FeatureInfo supportsFragmentShaderInterlockNV = { + "supportsFragmentShaderInterlockNV", FeatureCategory::OpenGLFeatures, + "Backend GL context supports NV_fragment_shader_interlock extension", &members, + "http://anglebug.com/7279"}; + + FeatureInfo supportsFragmentShaderOrderingINTEL = { + "supportsFragmentShaderOrderingINTEL", FeatureCategory::OpenGLFeatures, + "Backend GL context supports GL_INTEL_fragment_shader_ordering extension", &members, + "http://anglebug.com/7279"}; + + FeatureInfo supportsFragmentShaderInterlockARB = { + "supportsFragmentShaderInterlockARB", FeatureCategory::OpenGLFeatures, + "Backend GL context supports ARB_fragment_shader_interlock extension", &members, + "http://anglebug.com/7279"}; + + FeatureInfo supportsShaderFramebufferFetchEXT = { + "supportsShaderFramebufferFetchEXT", FeatureCategory::OpenGLFeatures, + "Backend GL context supports EXT_shader_framebuffer_fetch extension", &members, + "http://anglebug.com/7279"}; + + FeatureInfo supportsShaderFramebufferFetchNonCoherentEXT = { + "supportsShaderFramebufferFetchNonCoherentEXT", FeatureCategory::OpenGLFeatures, + "Backend GL context supports EXT_shader_framebuffer_fetch_non_coherent extension", &members, + "http://anglebug.com/7279"}; +}; + +inline FeaturesGL::FeaturesGL() = default; +inline FeaturesGL::~FeaturesGL() = default; + +} // namespace angle + +#endif // ANGLE_PLATFORM_FEATURESGL_H_ diff --git a/gfx/angle/checkout/include/platform/FeaturesMtl_autogen.h b/gfx/angle/checkout/include/platform/FeaturesMtl_autogen.h new file mode 100644 index 0000000000..116a0ee8d7 --- /dev/null +++ b/gfx/angle/checkout/include/platform/FeaturesMtl_autogen.h @@ -0,0 +1,242 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_features.py using data from mtl_features.json. +// +// 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. +// +// FeaturesMtl_autogen.h: Optional features for the Metal renderer. + +#ifndef ANGLE_PLATFORM_FEATURESMTL_H_ +#define ANGLE_PLATFORM_FEATURESMTL_H_ + +#include "platform/Feature.h" + +namespace angle +{ + +struct FeaturesMtl : FeatureSetBase +{ + FeaturesMtl(); + ~FeaturesMtl(); + + FeatureInfo hasBaseVertexInstancedDraw = { + "hasBaseVertexInstancedDraw", + FeatureCategory::MetalFeatures, + "The renderer supports base vertex instanced draw", + &members, + }; + + FeatureInfo hasExplicitMemBarrier = { + "hasExplicitMemBarrier", + FeatureCategory::MetalFeatures, + "The renderer supports explicit memory barrier", + &members, + }; + + FeatureInfo hasCheapRenderPass = { + "hasCheapRenderPass", + FeatureCategory::MetalFeatures, + "The renderer can cheaply break a render pass.", + &members, + }; + + FeatureInfo hasNonUniformDispatch = { + "hasNonUniformDispatch", + FeatureCategory::MetalFeatures, + "The renderer supports non uniform compute shader dispatch's group size", + &members, + }; + + FeatureInfo hasShaderStencilOutput = { + "hasShaderStencilOutput", + FeatureCategory::MetalFeatures, + "The renderer supports stencil output from fragment shader", + &members, + }; + + FeatureInfo hasTextureSwizzle = { + "hasTextureSwizzle", + FeatureCategory::MetalFeatures, + "The renderer supports texture swizzle", + &members, + }; + + FeatureInfo hasDepthAutoResolve = { + "hasDepthAutoResolve", + FeatureCategory::MetalFeatures, + "The renderer supports MSAA depth auto resolve at the end of render pass", + &members, + }; + + FeatureInfo hasStencilAutoResolve = { + "hasStencilAutoResolve", + FeatureCategory::MetalFeatures, + "The renderer supports MSAA stencil auto resolve at the end of render pass", + &members, + }; + + FeatureInfo hasEvents = { + "hasEvents", + FeatureCategory::MetalFeatures, + "The renderer supports MTL(Shared)Event", + &members, + }; + + FeatureInfo allowInlineConstVertexData = { + "allowInlineConstVertexData", + FeatureCategory::MetalFeatures, + "The renderer supports using inline constant data for small client vertex data", + &members, + }; + + FeatureInfo allowSeparateDepthStencilBuffers = { + "allowSeparateDepthStencilBuffers", + FeatureCategory::MetalFeatures, + "Some Apple platforms such as iOS allows separate depth and stencil buffers, " + "whereas others such as macOS don't", + &members, + }; + + FeatureInfo allowRuntimeSamplerCompareMode = { + "allowRuntimeSamplerCompareMode", + FeatureCategory::MetalFeatures, + "The renderer supports changing sampler's compare mode outside shaders", + &members, + }; + + FeatureInfo allowSamplerCompareGradient = { + "allowSamplerCompareGradient", + FeatureCategory::MetalFeatures, + "The renderer supports sample_compare with gradients", + &members, + }; + + FeatureInfo allowSamplerCompareLod = { + "allowSamplerCompareLod", + FeatureCategory::MetalFeatures, + "The renderer supports sample_compare with lod", + &members, + }; + + FeatureInfo allowBufferReadWrite = { + "allowBufferReadWrite", + FeatureCategory::MetalFeatures, + "The renderer supports buffer read and write in the same shader", + &members, + }; + + FeatureInfo allowMultisampleStoreAndResolve = { + "allowMultisampleStoreAndResolve", + FeatureCategory::MetalFeatures, + "The renderer supports MSAA store and resolve in the same pass", + &members, + }; + + FeatureInfo allowGenMultipleMipsPerPass = { + "allowGenMultipleMipsPerPass", + FeatureCategory::MetalFeatures, + "The renderer supports generating multiple mipmaps per pass", + &members, + }; + + FeatureInfo forceD24S8AsUnsupported = { + "forceD24S8AsUnsupported", + FeatureCategory::MetalFeatures, + "Force Depth24Stencil8 format as unsupported.", + &members, + }; + + FeatureInfo forceBufferGPUStorage = { + "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.", + &members, + }; + + FeatureInfo directMetalGeneration = {"directMetalGeneration", FeatureCategory::MetalFeatures, + "Direct translation to Metal.", &members, + "http://anglebug.com/5505"}; + + FeatureInfo forceNonCSBaseMipmapGeneration = { + "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.", + &members, + }; + + FeatureInfo emulateTransformFeedback = { + "emulateTransformFeedback", + FeatureCategory::MetalFeatures, + "Turn this on to allow transform feedback in Metal using a 2-pass VS for GLES3.", + &members, + }; + + FeatureInfo rewriteRowMajorMatrices = { + "rewriteRowMajorMatrices", + FeatureCategory::MetalFeatures, + "Rewrite row major matrices in shaders as column major.", + &members, + }; + + FeatureInfo intelExplicitBoolCastWorkaround = { + "intelExplicitBoolCastWorkaround", + FeatureCategory::MetalWorkarounds, + "Insert explicit casts for float/double/unsigned/signed int on macOS 10.15 with Intel " + "driver", + &members, + }; + + FeatureInfo intelDisableFastMath = { + "intelDisableFastMath", + FeatureCategory::MetalWorkarounds, + "Disable fast math in atan and invariance cases when running below macOS 12.0", + &members, + }; + + FeatureInfo multisampleColorFormatShaderReadWorkaround = { + "multisampleColorFormatShaderReadWorkaround", FeatureCategory::MetalWorkarounds, + "Add shaderRead usage to some multisampled texture formats", &members, + "http://anglebug.com/7049"}; + + FeatureInfo copyIOSurfaceToNonIOSurfaceForReadOptimization = { + "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 http://anglebug.com/7573"}; + + FeatureInfo copyTextureToBufferForReadOptimization = { + "copyTextureToBufferForReadOptimization", FeatureCategory::MetalWorkarounds, + "some GPUs are faster to read a texture by first copying the texture to a buffer", &members, + "http://anglebug.com/7117"}; + + FeatureInfo limitMaxDrawBuffersForTesting = { + "limitMaxDrawBuffersForTesting", FeatureCategory::MetalFeatures, + "Used to check the backend works when the device's advertized limit is less than the " + "code's limit", + &members, "http://anglebug.com/7280"}; + + FeatureInfo limitMaxColorTargetBitsForTesting = { + "limitMaxColorTargetBitsForTesting", FeatureCategory::MetalFeatures, + "Metal iOS has a limit on the number of color target bits per pixel.", &members, + "http://anglebug.com/7280"}; + + FeatureInfo preemptivelyStartProvokingVertexCommandBuffer = { + "preemptivelyStartProvokingVertexCommandBuffer", FeatureCategory::MetalFeatures, + "AMD Metal Drivers appear to have a bug this works around", &members, + "http://anglebug.com/7635"}; + + FeatureInfo uploadDataToIosurfacesWithStagingBuffers = { + "uploadDataToIosurfacesWithStagingBuffers", FeatureCategory::MetalWorkarounds, + "When uploading data to IOSurface-backed textures, use a staging buffer.", &members, + "http://anglebug.com/7573"}; +}; + +inline FeaturesMtl::FeaturesMtl() = default; +inline FeaturesMtl::~FeaturesMtl() = default; + +} // namespace angle + +#endif // ANGLE_PLATFORM_FEATURESMTL_H_ diff --git a/gfx/angle/checkout/include/platform/FeaturesVk_autogen.h b/gfx/angle/checkout/include/platform/FeaturesVk_autogen.h new file mode 100644 index 0000000000..dadd64c49b --- /dev/null +++ b/gfx/angle/checkout/include/platform/FeaturesVk_autogen.h @@ -0,0 +1,786 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_features.py using data from vk_features.json. +// +// 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. +// +// FeaturesVk_autogen.h: Optional features for the Vulkan renderer. + +#ifndef ANGLE_PLATFORM_FEATURESVK_H_ +#define ANGLE_PLATFORM_FEATURESVK_H_ + +#include "platform/Feature.h" + +namespace angle +{ + +struct FeaturesVk : FeatureSetBase +{ + FeaturesVk(); + ~FeaturesVk(); + + FeatureInfo bresenhamLineRasterization = { + "bresenhamLineRasterization", + FeatureCategory::VulkanFeatures, + "Enable Bresenham line rasterization via VK_EXT_line_rasterization extension", + &members, + }; + + FeatureInfo provokingVertex = { + "provokingVertex", + FeatureCategory::VulkanFeatures, + "Enable provoking vertex mode via VK_EXT_provoking_vertex extension", + &members, + }; + + FeatureInfo forceFallbackFormat = { + "forceFallbackFormat", + FeatureCategory::VulkanWorkarounds, + "Force a fallback format for angle_end2end_tests", + &members, + }; + + FeatureInfo clampPointSize = { + "clampPointSize", FeatureCategory::VulkanWorkarounds, + "The point size range reported from the API is inconsistent with the actual behavior", + &members, "http://anglebug.com/2970"}; + + FeatureInfo depthClamping = { + "depthClamping", FeatureCategory::VulkanWorkarounds, + "The depth value is not clamped to [0,1] for floating point depth buffers.", &members, + "http://anglebug.com/3970"}; + + FeatureInfo mutableMipmapTextureUpload = { + "mutableMipmapTextureUpload", FeatureCategory::VulkanFeatures, + "Enable uploading the previously defined mutable mipmap texture.", &members, + "https://anglebug.com/7308"}; + + FeatureInfo supportsRenderpass2 = { + "supportsRenderpass2", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_create_renderpass2 extension", + &members, + }; + + FeatureInfo supportsIncrementalPresent = { + "supportsIncrementalPresent", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_incremental_present extension", + &members, + }; + + FeatureInfo supportsAndroidHardwareBuffer = { + "supportsAndroidHardwareBuffer", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer extension", + &members, + }; + + FeatureInfo supportsGGPFrameToken = { + "supportsGGPFrameToken", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_GGP_frame_token extension", + &members, + }; + + FeatureInfo supportsExternalMemoryFd = { + "supportsExternalMemoryFd", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_external_memory_fd extension", + &members, + }; + + FeatureInfo supportsExternalMemoryFuchsia = { + "supportsExternalMemoryFuchsia", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_FUCHSIA_external_memory extension", + &members, + }; + + FeatureInfo supportsFilteringPrecision = { + "supportsFilteringPrecision", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_GOOGLE_sampler_filtering_precision extension", + &members, + }; + + FeatureInfo supportsExternalFenceCapabilities = { + "supportsExternalFenceCapabilities", + FeatureCategory::VulkanFeatures, + "VkInstance supports the VK_KHR_external_fence_capabilities extension", + &members, + }; + + FeatureInfo supportsExternalSemaphoreCapabilities = { + "supportsExternalSemaphoreCapabilities", + FeatureCategory::VulkanFeatures, + "VkInstance supports the VK_KHR_external_semaphore_capabilities extension", + &members, + }; + + FeatureInfo supportsExternalSemaphoreFd = { + "supportsExternalSemaphoreFd", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_external_semaphore_fd extension", + &members, + }; + + FeatureInfo supportsExternalSemaphoreFuchsia = { + "supportsExternalSemaphoreFuchsia", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_FUCHSIA_external_semaphore extension", + &members, + }; + + FeatureInfo supportsExternalFenceFd = { + "supportsExternalFenceFd", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_external_fence_fd extension", &members, + "http://anglebug.com/2517"}; + + FeatureInfo supportsAndroidNativeFenceSync = { + "supportsAndroidNativeFenceSync", FeatureCategory::VulkanFeatures, + "VkDevice supports the EGL_ANDROID_native_fence_sync extension", &members, + "http://anglebug.com/2517"}; + + FeatureInfo supportsImageCubeArray = {"supportsImageCubeArray", FeatureCategory::VulkanFeatures, + "VkDevice supports the imageCubeArray feature properly", + &members, "http://anglebug.com/3584"}; + + FeatureInfo supportsPipelineStatisticsQuery = { + "supportsPipelineStatisticsQuery", FeatureCategory::VulkanFeatures, + "VkDevice supports the pipelineStatisticsQuery feature", &members, + "http://anglebug.com/5430"}; + + FeatureInfo supportsShaderStencilExport = { + "supportsShaderStencilExport", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_shader_stencil_export extension", + &members, + }; + + FeatureInfo supportsYUVSamplerConversion = { + "supportsYUVSamplerConversion", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_sampler_ycbcr_conversion extension", + &members, + }; + + FeatureInfo emulateTransformFeedback = { + "emulateTransformFeedback", FeatureCategory::VulkanFeatures, + "Emulate transform feedback as the VK_EXT_transform_feedback is not present.", &members, + "http://anglebug.com/3205"}; + + FeatureInfo supportsTransformFeedbackExtension = { + "supportsTransformFeedbackExtension", FeatureCategory::VulkanFeatures, + "Transform feedback uses the VK_EXT_transform_feedback extension.", &members, + "http://anglebug.com/3206"}; + + FeatureInfo supportsGeometryStreamsCapability = { + "supportsGeometryStreamsCapability", FeatureCategory::VulkanFeatures, + "Implementation supports the GeometryStreams SPIR-V capability.", &members, + "http://anglebug.com/3206"}; + + FeatureInfo supportsIndexTypeUint8 = {"supportsIndexTypeUint8", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_index_type_uint8 extension", + &members, "http://anglebug.com/4405"}; + + FeatureInfo supportsCustomBorderColor = { + "supportsCustomBorderColor", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_custom_border_color extension", &members, + "http://anglebug.com/3577"}; + + FeatureInfo supportsMultiDrawIndirect = { + "supportsMultiDrawIndirect", FeatureCategory::VulkanFeatures, + "VkDevice supports the multiDrawIndirect extension", &members, "http://anglebug.com/6439"}; + + FeatureInfo supportsDepthStencilResolve = {"supportsDepthStencilResolve", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_depth_stencil_resolve " + "extension with the independentResolveNone feature", + &members, "http://anglebug.com/4836"}; + + FeatureInfo supportsMultisampledRenderToSingleSampledGOOGLEX = { + "supportsMultisampledRenderToSingleSampledGOOGLEX", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_GOOGLEX_multisampled_render_to_single_sampled extension", + &members, "http://anglebug.com/4836"}; + + FeatureInfo supportsMultisampledRenderToSingleSampled = { + "supportsMultisampledRenderToSingleSampled", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_multisampled_render_to_single_sampled extension", &members, + "http://anglebug.com/4836"}; + + FeatureInfo supportsMultiview = {"supportsMultiview", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_multiview extension", &members, + "http://anglebug.com/6048"}; + + FeatureInfo disableFifoPresentMode = { + "disableFifoPresentMode", FeatureCategory::VulkanWorkarounds, + "VK_PRESENT_MODE_FIFO_KHR causes random timeouts", &members, "http://anglebug.com/3153"}; + + FeatureInfo forceD16TexFilter = { + "forceD16TexFilter", FeatureCategory::VulkanWorkarounds, + "VK_FORMAT_D16_UNORM does not support VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, " + "which prevents OES_depth_texture from being supported.", + &members, "http://anglebug.com/3452"}; + + FeatureInfo disableFlippingBlitWithCommand = { + "disableFlippingBlitWithCommand", FeatureCategory::VulkanWorkarounds, + "vkCmdBlitImage with flipped coordinates blits incorrectly.", &members, + "http://anglebug.com/3498"}; + + FeatureInfo perFrameWindowSizeQuery = { + "perFrameWindowSizeQuery", FeatureCategory::VulkanWorkarounds, + "Vulkan swapchain is not returning VK_ERROR_OUT_OF_DATE when window resizing", &members, + "http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625"}; + + FeatureInfo padBuffersToMaxVertexAttribStride = { + "padBuffersToMaxVertexAttribStride", FeatureCategory::VulkanWorkarounds, + "Vulkan considers vertex attribute accesses to count up to the last multiple of the " + "stride. This additional access supports AMD's robust buffer access implementation. " + "AMDVLK in particular will return incorrect values when the vertex access extends into " + "the range that would be the stride padding and the buffer is too small. " + "This workaround limits GL_MAX_VERTEX_ATTRIB_STRIDE to a maximum value and " + "pads up every buffer allocation size to be a multiple of the maximum stride.", + &members, "http://anglebug.com/4428"}; + + FeatureInfo supportsExternalMemoryDmaBufAndModifiers = { + "supportsExternalMemoryDmaBufAndModifiers", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_external_memory_dma_buf and VK_EXT_image_drm_format_modifier " + "extensions", + &members, "http://anglebug.com/6248"}; + + FeatureInfo supportsExternalMemoryHost = { + "supportsExternalMemoryHost", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_external_memory_host extension", + &members, + }; + + FeatureInfo allocateNonZeroMemory = { + "allocateNonZeroMemory", FeatureCategory::VulkanFeatures, + "Fill new allocations with non-zero values to flush out errors.", &members, + "http://anglebug.com/4384"}; + + FeatureInfo logMemoryReportCallbacks = { + "logMemoryReportCallbacks", + FeatureCategory::VulkanFeatures, + "Log each callback from VK_EXT_device_memory_report", + &members, + }; + + FeatureInfo logMemoryReportStats = { + "logMemoryReportStats", + FeatureCategory::VulkanFeatures, + "Log stats from VK_EXT_device_memory_report each swap", + &members, + }; + + FeatureInfo shadowBuffers = { + "shadowBuffers", FeatureCategory::VulkanFeatures, + "Allocate a shadow buffer for GL buffer objects to reduce glMap* latency.", &members, + "http://anglebug.com/4339"}; + + FeatureInfo preferCPUForBufferSubData = { + "preferCPUForBufferSubData", FeatureCategory::VulkanFeatures, + "Prefer use CPU to do bufferSubData instead of staged update.", &members, + "http://issuetracker.google.com/200067929"}; + + FeatureInfo persistentlyMappedBuffers = { + "persistentlyMappedBuffers", FeatureCategory::VulkanFeatures, + "Persistently map buffer memory to reduce map/unmap IOCTL overhead.", &members, + "http://anglebug.com/2162"}; + + FeatureInfo enablePreRotateSurfaces = {"enablePreRotateSurfaces", + FeatureCategory::VulkanFeatures, + "Enable Android pre-rotation for landscape applications", + &members, "http://anglebug.com/3502"}; + + FeatureInfo enablePrecisionQualifiers = { + "enablePrecisionQualifiers", FeatureCategory::VulkanFeatures, + "Enable precision qualifiers in shaders", &members, "http://anglebug.com/3078"}; + + FeatureInfo preferAggregateBarrierCalls = { + "preferAggregateBarrierCalls", FeatureCategory::VulkanWorkarounds, + "Single barrier call is preferred over multiple calls with " + "fine grained pipeline stage dependency information", + &members, "http://anglebug.com/4633"}; + + FeatureInfo preferSkippingInvalidateForEmulatedFormats = { + "preferSkippingInvalidateForEmulatedFormats", FeatureCategory::VulkanWorkarounds, + "Skipping invalidate is preferred for emulated formats that have extra channels over " + "re-clearing the image", + &members, "http://anglebug.com/6860"}; + + FeatureInfo asyncCommandQueue = {"asyncCommandQueue", FeatureCategory::VulkanFeatures, + "Use CommandQueue worker thread to dispatch work to GPU.", + &members, "http://anglebug.com/4324"}; + + FeatureInfo supportsShaderFloat16 = { + "supportsShaderFloat16", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_KHR_shader_float16_int8 extension " + "and has the shaderFloat16 feature", + &members, "http://anglebug.com/4551"}; + + FeatureInfo allowGenerateMipmapWithCompute = { + "allowGenerateMipmapWithCompute", FeatureCategory::VulkanFeatures, + "Use the compute path to generate mipmaps on devices that meet the minimum requirements, " + "and the performance is better.", + &members, "http://anglebug.com/4551"}; + + FeatureInfo supportsRenderPassStoreOpNone = { + "supportsRenderPassStoreOpNone", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_QCOM_render_pass_store_ops extension.", &members, + "http://anglebug.com/5055"}; + + FeatureInfo supportsRenderPassLoadStoreOpNone = { + "supportsRenderPassLoadStoreOpNone", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_load_store_op_none extension.", &members, + "http://anglebug.com/5371"}; + + FeatureInfo disallowMixedDepthStencilLoadOpNoneAndLoad = { + "disallowMixedDepthStencilLoadOpNoneAndLoad", FeatureCategory::VulkanWorkarounds, + "Disallow use of LOAD_OP_NONE for only one of the depth or stencil aspects of a " + "depth/stencil attachment", + &members, "http://anglebug.com/7370"}; + + FeatureInfo supportsDepthClipControl = { + "supportsDepthClipControl", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_depth_clip_control extension.", &members, + "http://anglebug.com/5421"}; + + FeatureInfo supportsPrimitiveTopologyListRestart = { + "supportsPrimitiveTopologyListRestart", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_primitive_topology_list_restart extension.", &members, + "http://anglebug.com/3832"}; + + FeatureInfo supportsBlendOperationAdvanced = { + "supportsBlendOperationAdvanced", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_blend_operation_advanced extension.", &members, + "http://anglebug.com/3586"}; + + FeatureInfo forceMaxUniformBufferSize16KB = { + "forceMaxUniformBufferSize16KB", FeatureCategory::VulkanWorkarounds, + "Force max uniform buffer size to 16K on some device due to bug", &members, + "https://issuetracker.google.com/161903006"}; + + FeatureInfo supportsImageFormatList = { + "supportsImageFormatList", FeatureCategory::VulkanFeatures, + "Enable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT by default for ICDs " + "that support VK_KHR_image_format_list", + &members, "http://anglebug.com/5281"}; + + FeatureInfo enableMultisampledRenderToTexture = { + "enableMultisampledRenderToTexture", FeatureCategory::VulkanWorkarounds, + "Expose EXT_multisampled_render_to_texture", &members, "http://anglebug.com/4937"}; + + FeatureInfo deferFlushUntilEndRenderPass = { + "deferFlushUntilEndRenderPass", FeatureCategory::VulkanWorkarounds, + "Allow glFlush to be deferred until renderpass ends", &members, + "https://issuetracker.google.com/issues/166475273"}; + + FeatureInfo waitIdleBeforeSwapchainRecreation = { + "waitIdleBeforeSwapchainRecreation", FeatureCategory::VulkanWorkarounds, + "Before passing an oldSwapchain to VkSwapchainCreateInfoKHR, wait for queue to be idle. " + "Works around a bug on platforms which destroy oldSwapchain in vkCreateSwapchainKHR.", + &members, "http://anglebug.com/5061"}; + + FeatureInfo forceTextureLodOffset1 = { + "forceTextureLodOffset1", + FeatureCategory::VulkanWorkarounds, + "Increase the minimum texture level-of-detail by 1 when sampling.", + &members, + }; + + FeatureInfo forceTextureLodOffset2 = { + "forceTextureLodOffset2", + FeatureCategory::VulkanWorkarounds, + "Increase the minimum texture level-of-detail by 2 when sampling.", + &members, + }; + + FeatureInfo forceTextureLodOffset3 = { + "forceTextureLodOffset3", + FeatureCategory::VulkanWorkarounds, + "Increase the minimum texture level-of-detail by 3 when sampling.", + &members, + }; + + FeatureInfo forceTextureLodOffset4 = { + "forceTextureLodOffset4", + FeatureCategory::VulkanWorkarounds, + "Increase the minimum texture level-of-detail by 4 when sampling.", + &members, + }; + + FeatureInfo forceNearestFiltering = { + "forceNearestFiltering", + FeatureCategory::VulkanWorkarounds, + "Force nearest filtering when sampling.", + &members, + }; + + FeatureInfo forceNearestMipFiltering = { + "forceNearestMipFiltering", + FeatureCategory::VulkanWorkarounds, + "Force nearest mip filtering when sampling.", + &members, + }; + + FeatureInfo compressVertexData = { + "compressVertexData", + FeatureCategory::VulkanWorkarounds, + "Compress vertex data to smaller data types when " + "possible. Using this feature makes ANGLE non-conformant.", + &members, + }; + + FeatureInfo preferDrawClearOverVkCmdClearAttachments = { + "preferDrawClearOverVkCmdClearAttachments", FeatureCategory::VulkanWorkarounds, + "On some hardware, clear using a draw call instead of vkCmdClearAttachments in the middle " + "of render pass due to bugs", + &members, "https://issuetracker.google.com/166809097"}; + + FeatureInfo emulatedPrerotation90 = {"emulatedPrerotation90", FeatureCategory::VulkanFeatures, + "Emulate 90-degree prerotation.", &members, + "http://anglebug.com/4901"}; + + FeatureInfo emulatedPrerotation180 = {"emulatedPrerotation180", FeatureCategory::VulkanFeatures, + "Emulate 180-degree prerotation.", &members, + "http://anglebug.com/4901"}; + + FeatureInfo emulatedPrerotation270 = {"emulatedPrerotation270", FeatureCategory::VulkanFeatures, + "Emulate 270-degree prerotation.", &members, + "http://anglebug.com/4901"}; + + FeatureInfo generateSPIRVThroughGlslang = { + "generateSPIRVThroughGlslang", FeatureCategory::VulkanFeatures, + "Translate SPIR-V through glslang.", &members, "http://anglebug.com/4889"}; + + FeatureInfo preferDriverUniformOverSpecConst = { + "preferDriverUniformOverSpecConst", FeatureCategory::VulkanFeatures, + "Prefer using driver uniforms instead of specialization constants.", &members, + "http://anglebug.com/7406"}; + + FeatureInfo exposeNonConformantExtensionsAndVersions = { + "exposeNonConformantExtensionsAndVersions", FeatureCategory::VulkanWorkarounds, + "Expose GLES versions and extensions that are not conformant.", &members, + "http://anglebug.com/5375"}; + + FeatureInfo emulateR32fImageAtomicExchange = { + "emulateR32fImageAtomicExchange", FeatureCategory::VulkanWorkarounds, + "Emulate r32f images with r32ui to support imageAtomicExchange.", &members, + "http://anglebug.com/5535"}; + + FeatureInfo supportsNegativeViewport = { + "supportsNegativeViewport", + FeatureCategory::VulkanFeatures, + "The driver supports inverting the viewport with a negative height.", + &members, + }; + + FeatureInfo forceFragmentShaderPrecisionHighpToMediump = { + "forceFragmentShaderPrecisionHighpToMediump", FeatureCategory::VulkanWorkarounds, + "Forces highp precision in fragment shader to mediump.", &members, + "https://issuetracker.google.com/184850002"}; + + FeatureInfo preferSubmitAtFBOBoundary = { + "preferSubmitAtFBOBoundary", FeatureCategory::VulkanWorkarounds, + "Submit commands to driver at each FBO boundary for performance improvements.", &members, + "https://issuetracker.google.com/187425444"}; + + FeatureInfo useMultipleDescriptorsForExternalFormats = { + "useMultipleDescriptorsForExternalFormats", FeatureCategory::VulkanWorkarounds, + "Return a default descriptor count for external formats.", &members, + "http://anglebug.com/6141"}; + + FeatureInfo supportsProtectedMemory = { + "supportsProtectedMemory", FeatureCategory::VulkanFeatures, + "VkDevice supports protected memory", &members, "http://anglebug.com/3965"}; + + FeatureInfo supportsHostQueryReset = {"supportsHostQueryReset", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_host_query_reset extension", + &members, "http://anglebug.com/6692"}; + + FeatureInfo supportsPipelineCreationCacheControl = { + "supportsPipelineCreationCacheControl", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_pipeline_creation_cache_control extension", &members, + "http://anglebug.com/5881"}; + + FeatureInfo supportsPipelineCreationFeedback = { + "supportsPipelineCreationFeedback", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_pipeline_creation_feedback extension", &members, + "http://anglebug.com/5881"}; + + FeatureInfo supportsPrimitivesGeneratedQuery = { + "supportsPrimitivesGeneratedQuery", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_primitives_generated_query extension", &members, + "http://anglebug.com/5430"}; + + FeatureInfo supportsSurfaceCapabilities2Extension = { + "supportsSurfaceCapabilities2Extension", + FeatureCategory::VulkanFeatures, + "VkInstance supports the VK_KHR_get_surface_capabilities2 extension", + &members, + }; + + FeatureInfo supportsSurfaceProtectedCapabilitiesExtension = { + "supportsSurfaceProtectedCapabilitiesExtension", + FeatureCategory::VulkanFeatures, + "VkInstance supports the VK_KHR_surface_protected_capabilities extension", + &members, + }; + + FeatureInfo supportsSurfacelessQueryExtension = { + "supportsSurfacelessQueryExtension", + FeatureCategory::VulkanFeatures, + "VkInstance supports the VK_GOOGLE_surfaceless_query extension", + &members, + }; + + FeatureInfo supportsSurfaceProtectedSwapchains = { + "supportsSurfaceProtectedSwapchains", + FeatureCategory::VulkanFeatures, + "VkSurface supportsProtected for protected swapchains", + &members, + }; + + FeatureInfo overrideSurfaceFormatRGB8ToRGBA8 = { + "overrideSurfaceFormatRGB8ToRGBA8", FeatureCategory::VulkanWorkarounds, + "Override surface format GL_RGB8 to GL_RGBA8", &members, "http://anglebug.com/6651"}; + + FeatureInfo supportsSharedPresentableImageExtension = { + "supportsSharedPresentableImageExtension", + FeatureCategory::VulkanFeatures, + "VkSurface supports the VK_KHR_shared_presentable_images extension", + &members, + }; + + FeatureInfo supportsShaderFramebufferFetch = { + "supportsShaderFramebufferFetch", + FeatureCategory::VulkanFeatures, + "Whether the Vulkan backend supports coherent framebuffer fetch", + &members, + }; + + FeatureInfo supportsShaderFramebufferFetchNonCoherent = { + "supportsShaderFramebufferFetchNonCoherent", + FeatureCategory::VulkanFeatures, + "Whether the Vulkan backend supports non-coherent framebuffer fetch", + &members, + }; + + FeatureInfo permanentlySwitchToFramebufferFetchMode = { + "permanentlySwitchToFramebufferFetchMode", + FeatureCategory::VulkanFeatures, + "Whether the context should permanently switch to framebuffer fetch mode on first" + "encounter", + &members, + }; + + FeatureInfo supportsLockSurfaceExtension = { + "supportsLockSurfaceExtension", + FeatureCategory::VulkanFeatures, + "Surface supports the EGL_KHR_lock_surface3 extension", + &members, + }; + + FeatureInfo swapbuffersOnFlushOrFinishWithSingleBuffer = { + "swapbuffersOnFlushOrFinishWithSingleBuffer", FeatureCategory::VulkanFeatures, + "Bypass deferredFlush with calling swapbuffers on flush or finish when in Shared " + "Present mode", + &members, "http://anglebug.com/6878"}; + + FeatureInfo emulateDithering = {"emulateDithering", FeatureCategory::VulkanFeatures, + "Emulate OpenGL dithering", &members, + "http://anglebug.com/6755"}; + + FeatureInfo roundOutputAfterDithering = { + "roundOutputAfterDithering", FeatureCategory::VulkanWorkarounds, + "Round output after dithering to workaround a driver bug that rounds the output up", + &members, "http://anglebug.com/6953"}; + + FeatureInfo emulateAdvancedBlendEquations = { + "emulateAdvancedBlendEquations", FeatureCategory::VulkanFeatures, + "Emulate GL_KHR_blend_equation_advanced", &members, "http://anglebug.com/3586"}; + + FeatureInfo precisionSafeDivision = { + "precisionSafeDivision", + FeatureCategory::VulkanWorkarounds, + "Special case handling for platforms that do not generate 1.0f even when the dividend and" + "divisor have the same value", + &members, + }; + + FeatureInfo bottomLeftOriginPresentRegionRectangles = { + "bottomLeftOriginPresentRegionRectangles", + FeatureCategory::VulkanWorkarounds, + "On some platforms present region rectangles are expected to have a bottom-left origin, " + "instead of top-left origin as from spec", + &members, + }; + + FeatureInfo forceSubmitImmutableTextureUpdates = { + "forceSubmitImmutableTextureUpdates", FeatureCategory::VulkanAppWorkarounds, + "Force submit updates to immutable textures", &members, "http://anglebug.com/6929"}; + + FeatureInfo retainSPIRVDebugInfo = {"retainSPIRVDebugInfo", FeatureCategory::VulkanFeatures, + "Retain debug info in SPIR-V blob.", &members, + "http://anglebug.com/5901"}; + + FeatureInfo warmUpPipelineCacheAtLink = { + "warmUpPipelineCacheAtLink", FeatureCategory::VulkanFeatures, + "Warm up the Vulkan pipeline cache at link time", &members, "http://anglebug.com/5881"}; + + FeatureInfo preferDeviceLocalMemoryHostVisible = { + "preferDeviceLocalMemoryHostVisible", FeatureCategory::VulkanFeatures, + "Prefer adding HOST_VISIBLE flag for DEVICE_LOCAL memory when picking memory types", + &members, "http://anglebug.com/7047"}; + + FeatureInfo forceStaticVertexStrideState = { + "forceStaticVertexStrideState", FeatureCategory::VulkanWorkarounds, + "Force static state for VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT due to" + "driver bugs", + &members, "https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=107106"}; + + FeatureInfo supportsExtendedDynamicState = { + "supportsExtendedDynamicState", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_extended_dynamic_state extension", &members, + "http://anglebug.com/5906"}; + + FeatureInfo supportsExtendedDynamicState2 = { + "supportsExtendedDynamicState2", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_extended_dynamic_state2 extension", &members, + "http://anglebug.com/5906"}; + + FeatureInfo supportsLogicOpDynamicState = { + "supportsLogicOpDynamicState", FeatureCategory::VulkanFeatures, + "VkDevice supports the logicOp feature of VK_EXT_extended_dynamic_state2 extension", + &members, "http://anglebug.com/3862"}; + + FeatureInfo supportsFragmentShadingRate = { + "supportsFragmentShadingRate", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_KHR_fragment_shading_rate extension", &members, + "http://anglebug.com/7172"}; + + FeatureInfo supportsFragmentShaderPixelInterlock = { + "supportsFragmentShaderPixelInterlock", + FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_fragment_shader_interlock extension " + "and has the fragmentShaderPixelInterlock feature", + &members, + }; + + FeatureInfo explicitlyEnablePerSampleShading = { + "explicitlyEnablePerSampleShading", FeatureCategory::VulkanWorkarounds, + "Explicitly enable per-sample shading if the fragment shader contains the " + "sample qualifier", + &members, "http://anglebug.com/6876"}; + + FeatureInfo forceContinuousRefreshOnSharedPresent = { + "forceContinuousRefreshOnSharedPresent", FeatureCategory::VulkanFeatures, + "Force to create vulkan swapchain with continuous refresh on shared present", &members, + "https://issuetracker.google.com/229267970"}; + + FeatureInfo supportsImage2dViewOf3d = { + "supportsImage2dViewOf3d", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_image_2d_view_of_3d", &members, "https://anglebug.com/7320"}; + + FeatureInfo supportsImagelessFramebuffer = { + "supportsImagelessFramebuffer", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_KHR_imageless_framebuffer extension", &members, + "http://anglebug.com/7553"}; + + FeatureInfo preferLinearFilterForYUV = { + "preferLinearFilterForYUV", FeatureCategory::VulkanFeatures, + "Prefer to use VK_FILTER_LINEAR for VkSamplerYcbcrConversion", &members, + "https://anglebug.com/7382"}; + + FeatureInfo supportsYuvTarget = { + "supportsYuvTarget", + FeatureCategory::VulkanFeatures, + "VkDevice supports VK_ANDROID_render_to_external_format and VK_EXT_ycbcr_attachment", + &members, + }; + + FeatureInfo useNonZeroStencilWriteMaskStaticState = { + "useNonZeroStencilWriteMaskStaticState", FeatureCategory::VulkanWorkarounds, + "Work around a driver bug where 0 in stencil write mask static state would make the" + "corresponding dynamic state malfunction in the presence of discard or alpha to coverage", + &members, "http://anglebug.com/7556"}; + + FeatureInfo mapUnspecifiedColorSpaceToPassThrough = { + "mapUnspecifiedColorSpaceToPassThrough", + FeatureCategory::VulkanFeatures, + "Use VK_COLOR_SPACE_PASS_THROUGH_EXT for EGL_NONE or unspecifed color " + "spaces", + &members, + }; + + FeatureInfo supportsTimestampSurfaceAttribute = { + "supportsTimestampSurfaceAttribute", FeatureCategory::VulkanFeatures, + "Platform supports setting frame timestamp surface attribute", &members, + "https://anglebug.com/7489"}; + + FeatureInfo supportsRasterizationOrderAttachmentAccess = { + "supportsRasterizationOrderAttachmentAccess", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_rasterization_order_attachment_access extension", &members, + "https://anglebug.com/7604"}; + + FeatureInfo eglColorspaceAttributePassthrough = { + "eglColorspaceAttributePassthrough", FeatureCategory::VulkanFeatures, + "Support passthrough of EGL colorspace attribute values", &members, + "https://anglebug.com/7319"}; + + FeatureInfo supportsPipelineRobustness = { + "supportsPipelineRobustness", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_pipeline_robustness extension", &members, + "https://anglebug.com/5845"}; + + FeatureInfo supportsVertexInputDynamicState = { + "supportsVertexInputDynamicState", FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_vertex_input_dynamic_state extension", &members, + "https://anglebug.com/7162"}; + + FeatureInfo supportsColorWriteEnable = {"supportsColorWriteEnable", + FeatureCategory::VulkanFeatures, + "VkDevice supports VK_EXT_color_write_enable extension", + &members, "https://anglebug.com/7161"}; + + FeatureInfo supportsPresentation = { + "supportsPresentation", + FeatureCategory::VulkanFeatures, + "VkDisplay supports presentation through a present family queue", + &members, + }; + + FeatureInfo supportsComputeTranscodeEtcToBc = { + "supportsComputeTranscodeEtcToBc", + FeatureCategory::VulkanFeatures, + "supports compute shader transcode etc format to bc format", + &members, + }; + + FeatureInfo supportsGraphicsPipelineLibrary = { + "supportsGraphicsPipelineLibrary", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_graphics_pipeline_library extension", &members, + "https://anglebug.com/7369"}; + + FeatureInfo supportsPipelineProtectedAccess = { + "supportsPipelineProtectedAccess", FeatureCategory::VulkanFeatures, + "VkDevice supports the VK_EXT_pipeline_protected_access extension", &members, + "https://anglebug.com/7714"}; + + FeatureInfo preferSubmitOnAnySamplesPassedQueryEnd = { + "preferSubmitOnAnySamplesPassedQueryEnd", FeatureCategory::VulkanWorkarounds, + "Submit commands to driver when last GL_ANY_SAMPLES_PASSED query is made for performance " + "improvements.", + &members, "https://issuetracker.google.com/250706693"}; +}; + +inline FeaturesVk::FeaturesVk() = default; +inline FeaturesVk::~FeaturesVk() = default; + +} // namespace angle + +#endif // ANGLE_PLATFORM_FEATURESVK_H_ diff --git a/gfx/angle/checkout/include/platform/FrontendFeatures_autogen.h b/gfx/angle/checkout/include/platform/FrontendFeatures_autogen.h new file mode 100644 index 0000000000..4cb5fa8afa --- /dev/null +++ b/gfx/angle/checkout/include/platform/FrontendFeatures_autogen.h @@ -0,0 +1,115 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_features.py using data from frontend_features.json. +// +// 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. +// +// FrontendFeatures_autogen.h: Features/workarounds for driver bugs and other behaviors seen +// on all platforms. + +#ifndef ANGLE_PLATFORM_FRONTENDFEATURES_H_ +#define ANGLE_PLATFORM_FRONTENDFEATURES_H_ + +#include "platform/Feature.h" + +namespace angle +{ + +struct FrontendFeatures : FeatureSetBase +{ + FrontendFeatures(); + ~FrontendFeatures(); + + FeatureInfo loseContextOnOutOfMemory = { + "loseContextOnOutOfMemory", + FeatureCategory::FrontendWorkarounds, + "Some users rely on a lost context notification if a GL_OUT_OF_MEMORY error occurs", + &members, + }; + + FeatureInfo disableProgramCachingForTransformFeedback = { + "disableProgramCachingForTransformFeedback", + FeatureCategory::FrontendWorkarounds, + "On some GPUs, program binaries don't contain transform feedback varyings", + &members, + }; + + FeatureInfo scalarizeVecAndMatConstructorArgs = { + "scalarizeVecAndMatConstructorArgs", FeatureCategory::FrontendWorkarounds, + "Always rewrite vec/mat constructors to be consistent", &members, + "http://crbug.com/1165751"}; + + FeatureInfo disableProgramBinary = {"disableProgramBinary", FeatureCategory::FrontendFeatures, + "Disable support for GL_OES_get_program_binary", &members, + "http://anglebug.com/5007"}; + + FeatureInfo disableDrawBuffersIndexed = { + "disableDrawBuffersIndexed", FeatureCategory::FrontendFeatures, + "Disable support for OES_draw_buffers_indexed and EXT_draw_buffers_indexed", &members, + "http://anglebug.com/7724"}; + + FeatureInfo disableAnisotropicFiltering = { + "disableAnisotropicFiltering", + FeatureCategory::FrontendWorkarounds, + "Disable support for anisotropic filtering", + &members, + }; + + FeatureInfo allowCompressedFormats = { + "allowCompressedFormats", + FeatureCategory::FrontendWorkarounds, + "Allow compressed formats", + &members, + }; + + FeatureInfo forceDepthAttachmentInitOnClear = { + "forceDepthAttachmentInitOnClear", FeatureCategory::FrontendWorkarounds, + "Force depth attachment initialization on clear ops", &members, + "https://anglebug.com/7246"}; + + FeatureInfo enableCaptureLimits = {"enableCaptureLimits", FeatureCategory::FrontendFeatures, + "Set the context limits like frame capturing was enabled", + &members, "http://anglebug.com/5750"}; + + FeatureInfo enableCompressingPipelineCacheInThreadPool = { + "enableCompressingPipelineCacheInThreadPool", FeatureCategory::FrontendWorkarounds, + "Enable compressing pipeline cache in thread pool.", &members, "http://anglebug.com/4722"}; + + FeatureInfo forceRobustResourceInit = { + "forceRobustResourceInit", FeatureCategory::FrontendFeatures, + "Force-enable robust resource init", &members, "http://anglebug.com/6041"}; + + FeatureInfo forceInitShaderVariables = { + "forceInitShaderVariables", + FeatureCategory::FrontendFeatures, + "Force-enable shader variable initialization", + &members, + }; + + FeatureInfo enableProgramBinaryForCapture = { + "enableProgramBinaryForCapture", FeatureCategory::FrontendFeatures, + "Even if FrameCapture is enabled, enable GL_OES_get_program_binary", &members, + "http://anglebug.com/5658"}; + + FeatureInfo forceGlErrorChecking = { + "forceGlErrorChecking", FeatureCategory::FrontendFeatures, + "Force GL error checking (i.e. prevent applications from disabling error checking", + &members, "https://issuetracker.google.com/220069903"}; + + FeatureInfo emulatePixelLocalStorage = { + "emulatePixelLocalStorage", FeatureCategory::FrontendFeatures, + "Emulate ANGLE_shader_pixel_local_storage using shader images", &members, + "http://anglebug.com/7279"}; + + FeatureInfo cacheCompiledShader = {"cacheCompiledShader", FeatureCategory::FrontendFeatures, + "Enable to cache compiled shaders", &members, + "http://anglebug.com/7036"}; +}; + +inline FrontendFeatures::FrontendFeatures() = default; +inline FrontendFeatures::~FrontendFeatures() = default; + +} // namespace angle + +#endif // ANGLE_PLATFORM_FRONTENDFEATURES_H_ diff --git a/gfx/angle/checkout/include/platform/PlatformMethods.h b/gfx/angle/checkout/include/platform/PlatformMethods.h new file mode 100644 index 0000000000..48ef335796 --- /dev/null +++ b/gfx/angle/checkout/include/platform/PlatformMethods.h @@ -0,0 +1,334 @@ +// +// Copyright 2015 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. + +// PlatformMethods.h: The public interface ANGLE exposes to the API layer, for +// doing platform-specific tasks like gathering data, or for tracing. + +#ifndef ANGLE_PLATFORMMETHODS_H +#define ANGLE_PLATFORMMETHODS_H + +#include <stdint.h> +#include <stdlib.h> +#include <array> + +#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x6AFB + +#if !defined(ANGLE_PLATFORM_EXPORT) +# if defined(_WIN32) +# if !defined(LIBANGLE_IMPLEMENTATION) +# define ANGLE_PLATFORM_EXPORT __declspec(dllimport) +# else +# define ANGLE_PLATFORM_EXPORT __declspec(dllexport) +# endif +# elif defined(__GNUC__) || defined(__clang__) +# define ANGLE_PLATFORM_EXPORT __attribute__((visibility("default"))) +# endif +#endif +#if !defined(ANGLE_PLATFORM_EXPORT) +# define ANGLE_PLATFORM_EXPORT +#endif + +#if defined(_WIN32) +# define ANGLE_APIENTRY __stdcall +#else +# define ANGLE_APIENTRY +#endif + +namespace angle +{ +struct FeaturesD3D; +struct FeaturesVk; +struct FeaturesMtl; +using TraceEventHandle = uint64_t; +using EGLDisplayType = void *; +struct PlatformMethods; + +// Use a C-like API to not trigger undefined calling behaviour. +// Avoid using decltype here to work around sanitizer limitations. +// TODO(jmadill): Use decltype here if/when UBSAN is fixed. + +// System -------------------------------------------------------------- + +// Wall clock time in seconds since the epoch. +// TODO(jmadill): investigate using an ANGLE internal time library +using CurrentTimeFunc = double (*)(PlatformMethods *platform); +inline double DefaultCurrentTime(PlatformMethods *platform) +{ + return 0.0; +} + +// Monotonically increasing time in seconds from an arbitrary fixed point in the past. +// This function is expected to return at least millisecond-precision values. For this reason, +// it is recommended that the fixed point be no further in the past than the epoch. +using MonotonicallyIncreasingTimeFunc = double (*)(PlatformMethods *platform); +inline double DefaultMonotonicallyIncreasingTime(PlatformMethods *platform) +{ + return 0.0; +} + +// Logging ------------------------------------------------------------ + +// Log an error message within the platform implementation. +using LogErrorFunc = void (*)(PlatformMethods *platform, const char *errorMessage); +inline void DefaultLogError(PlatformMethods *platform, const char *errorMessage) {} + +// Log a warning message within the platform implementation. +using LogWarningFunc = void (*)(PlatformMethods *platform, const char *warningMessage); +inline void DefaultLogWarning(PlatformMethods *platform, const char *warningMessage) {} + +// Log an info message within the platform implementation. +using LogInfoFunc = void (*)(PlatformMethods *platform, const char *infoMessage); +inline void DefaultLogInfo(PlatformMethods *platform, const char *infoMessage) {} + +// Tracing -------- + +// Get a pointer to the enabled state of the given trace category. The +// embedder can dynamically change the enabled state as trace event +// recording is started and stopped by the application. Only long-lived +// literal strings should be given as the category name. The implementation +// expects the returned pointer to be held permanently in a local static. If +// the unsigned char is non-zero, tracing is enabled. If tracing is enabled, +// addTraceEvent is expected to be called by the trace event macros. +using GetTraceCategoryEnabledFlagFunc = const unsigned char *(*)(PlatformMethods *platform, + const char *categoryName); +inline const unsigned char *DefaultGetTraceCategoryEnabledFlag(PlatformMethods *platform, + const char *categoryName) +{ + return nullptr; +} + +// +// Add a trace event to the platform tracing system. Depending on the actual +// enabled state, this event may be recorded or dropped. +// - phase specifies the type of event: +// - BEGIN ('B'): Marks the beginning of a scoped event. +// - END ('E'): Marks the end of a scoped event. +// - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't +// need a matching END event. Instead, at the end of the scope, +// updateTraceEventDuration() must be called with the TraceEventHandle +// returned from addTraceEvent(). +// - INSTANT ('I'): Standalone, instantaneous event. +// - START ('S'): Marks the beginning of an asynchronous event (the end +// event can occur in a different scope or thread). The id parameter is +// used to match START/FINISH pairs. +// - FINISH ('F'): Marks the end of an asynchronous event. +// - COUNTER ('C'): Used to trace integer quantities that change over +// time. The argument values are expected to be of type int. +// - METADATA ('M'): Reserved for internal use. +// - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag. +// - name is the name of the event. Also used to match BEGIN/END and +// START/FINISH pairs. +// - id optionally allows events of the same name to be distinguished from +// each other. For example, to trace the construction and destruction of +// objects, specify the pointer as the id parameter. +// - timestamp should be a time value returned from monotonicallyIncreasingTime. +// - numArgs specifies the number of elements in argNames, argTypes, and +// argValues. +// - argNames is the array of argument names. Use long-lived literal strings +// or specify the COPY flag. +// - argTypes is the array of argument types: +// - BOOL (1): bool +// - UINT (2): unsigned long long +// - INT (3): long long +// - DOUBLE (4): double +// - POINTER (5): void* +// - STRING (6): char* (long-lived null-terminated char* string) +// - COPY_STRING (7): char* (temporary null-terminated char* string) +// - CONVERTABLE (8): WebConvertableToTraceFormat +// - argValues is the array of argument values. Each value is the unsigned +// long long member of a union of all supported types. +// - flags can be 0 or one or more of the following, ORed together: +// - COPY (0x1): treat all strings (name, argNames and argValues of type +// string) as temporary so that they will be copied by addTraceEvent. +// - HAS_ID (0x2): use the id argument to uniquely identify the event for +// matching with other events of the same name. +// - MANGLE_ID (0x4): specify this flag if the id parameter is the value +// of a pointer. +using AddTraceEventFunc = angle::TraceEventHandle (*)(PlatformMethods *platform, + char phase, + const unsigned char *categoryEnabledFlag, + const char *name, + unsigned long long id, + double timestamp, + int numArgs, + const char **argNames, + const unsigned char *argTypes, + const unsigned long long *argValues, + unsigned char flags); +inline angle::TraceEventHandle DefaultAddTraceEvent(PlatformMethods *platform, + char phase, + const unsigned char *categoryEnabledFlag, + const char *name, + unsigned long long id, + double timestamp, + int numArgs, + const char **argNames, + const unsigned char *argTypes, + const unsigned long long *argValues, + unsigned char flags) +{ + return 0; +} + +// Set the duration field of a COMPLETE trace event. +using UpdateTraceEventDurationFunc = void (*)(PlatformMethods *platform, + const unsigned char *categoryEnabledFlag, + const char *name, + angle::TraceEventHandle eventHandle); +inline void DefaultUpdateTraceEventDuration(PlatformMethods *platform, + const unsigned char *categoryEnabledFlag, + const char *name, + angle::TraceEventHandle eventHandle) +{} + +// Callbacks for reporting histogram data. +// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 +// would do. +using HistogramCustomCountsFunc = void (*)(PlatformMethods *platform, + const char *name, + int sample, + int min, + int max, + int bucketCount); +inline void DefaultHistogramCustomCounts(PlatformMethods *platform, + const char *name, + int sample, + int min, + int max, + int bucketCount) +{} +// Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample +// value. +using HistogramEnumerationFunc = void (*)(PlatformMethods *platform, + const char *name, + int sample, + int boundaryValue); +inline void DefaultHistogramEnumeration(PlatformMethods *platform, + const char *name, + int sample, + int boundaryValue) +{} +// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets. +using HistogramSparseFunc = void (*)(PlatformMethods *platform, const char *name, int sample); +inline void DefaultHistogramSparse(PlatformMethods *platform, const char *name, int sample) {} +// Boolean histograms track two-state variables. +using HistogramBooleanFunc = void (*)(PlatformMethods *platform, const char *name, bool sample); +inline void DefaultHistogramBoolean(PlatformMethods *platform, const char *name, bool sample) {} + +// Callback on a successful program link with the program binary. Can be used to store +// shaders to disk. Keys are a 160-bit SHA-1 hash. +using ProgramKeyType = std::array<uint8_t, 20>; +using CacheProgramFunc = void (*)(PlatformMethods *platform, + const ProgramKeyType &key, + size_t programSize, + const uint8_t *programBytes); +inline void DefaultCacheProgram(PlatformMethods *platform, + const ProgramKeyType &key, + size_t programSize, + const uint8_t *programBytes) +{} + +using PostWorkerTaskCallback = void (*)(void *userData); +using PostWorkerTaskFunc = void (*)(PlatformMethods *platform, + PostWorkerTaskCallback callback, + void *userData); +constexpr PostWorkerTaskFunc DefaultPostWorkerTask = nullptr; + +// Placeholder values where feature override callbacks used to be. They are deprecated in favor of +// EGL_ANGLE_feature_control. The placeholders are there to keep the layout of the PlatformMethods +// constant to support drop-in replacement of ANGLE's .so files in applications built with an older +// header. +using PlaceholderCallbackFunc = void (*)(...); +inline void DefaultPlaceholderCallback(...) {} + +// Platform methods are enumerated here once. +#define ANGLE_PLATFORM_OP(OP) \ + OP(currentTime, CurrentTime) \ + OP(monotonicallyIncreasingTime, MonotonicallyIncreasingTime) \ + OP(logError, LogError) \ + OP(logWarning, LogWarning) \ + OP(logInfo, LogInfo) \ + OP(getTraceCategoryEnabledFlag, GetTraceCategoryEnabledFlag) \ + OP(addTraceEvent, AddTraceEvent) \ + OP(updateTraceEventDuration, UpdateTraceEventDuration) \ + OP(histogramCustomCounts, HistogramCustomCounts) \ + OP(histogramEnumeration, HistogramEnumeration) \ + OP(histogramSparse, HistogramSparse) \ + OP(histogramBoolean, HistogramBoolean) \ + OP(placeholder1, PlaceholderCallback) \ + OP(placeholder2, PlaceholderCallback) \ + OP(cacheProgram, CacheProgram) \ + OP(placeholder3, PlaceholderCallback) \ + OP(postWorkerTask, PostWorkerTask) + +#define ANGLE_PLATFORM_METHOD_DEF(Name, CapsName) CapsName##Func Name = Default##CapsName; + +struct ANGLE_PLATFORM_EXPORT PlatformMethods +{ + inline PlatformMethods(); + + // User data pointer for any implementation specific members. Put it at the start of the + // platform structure so it doesn't become overwritten if one version of the platform + // adds or removes new members. + void *context = 0; + + ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_DEF) +}; + +inline PlatformMethods::PlatformMethods() = default; + +#undef ANGLE_PLATFORM_METHOD_DEF + +// Subtract one to account for the context pointer. +constexpr unsigned int g_NumPlatformMethods = (sizeof(PlatformMethods) / sizeof(uintptr_t)) - 1; + +// No further uses of platform methods is allowed. EGL extensions should be used instead. While +// methods are being removed, use PlaceholderCallback to keep the layout of PlatformMethods +// constant. +static_assert(g_NumPlatformMethods == 17, "Avoid adding methods to PlatformMethods"); + +#define ANGLE_PLATFORM_METHOD_STRING(Name) #Name +#define ANGLE_PLATFORM_METHOD_STRING2(Name, CapsName) ANGLE_PLATFORM_METHOD_STRING(Name), + +constexpr const char *const g_PlatformMethodNames[g_NumPlatformMethods] = { + ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_STRING2)}; + +#undef ANGLE_PLATFORM_METHOD_STRING2 +#undef ANGLE_PLATFORM_METHOD_STRING + +} // namespace angle + +extern "C" { + +// Gets the platform methods on the passed-in EGL display. If the method name signature does not +// match the compiled signature for this ANGLE, false is returned. On success true is returned. +// The application should set any platform methods it cares about on the returned pointer. +// If display is not valid, behaviour is undefined. + +ANGLE_PLATFORM_EXPORT bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display, + const char *const methodNames[], + unsigned int methodNameCount, + void *context, + void *platformMethodsOut); + +// Sets the platform methods back to their defaults. +// If display is not valid, behaviour is undefined. +ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDisplayType display); +} // extern "C" + +namespace angle +{ +typedef bool(ANGLE_APIENTRY *GetDisplayPlatformFunc)(angle::EGLDisplayType, + const char *const *, + unsigned int, + void *, + void *); +typedef void(ANGLE_APIENTRY *ResetDisplayPlatformFunc)(angle::EGLDisplayType); +} // namespace angle + +// This function is not exported +angle::PlatformMethods *ANGLEPlatformCurrent(); + +#endif // ANGLE_PLATFORMMETHODS_H |