//1// Copyright 2014 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56#ifndef LIBANGLE_CAPS_H_7#define LIBANGLE_CAPS_H_89#include "angle_gl.h"10#include "libANGLE/Version.h"11#include "libANGLE/angletypes.h"12#include "libANGLE/renderer/Format.h"1314#include <array>15#include <map>16#include <set>17#include <string>18#include <vector>1920namespace gl21{2223struct Extensions;2425struct TextureCaps26{27TextureCaps();28TextureCaps(const TextureCaps &other);29TextureCaps &operator=(const TextureCaps &other);3031~TextureCaps();3233// Supports for basic texturing: glTexImage, glTexSubImage, etc34bool texturable = false;3536// Support for linear or anisotropic filtering37bool filterable = false;3839// Support for being used as a framebuffer attachment, i.e. glFramebufferTexture2D40bool textureAttachment = false;4142// Support for being used as a renderbuffer format, i.e. glFramebufferRenderbuffer43bool renderbuffer = false;4445// Support for blend modes while being used as a framebuffer attachment46bool blendable = false;4748// Set of supported sample counts, only guaranteed to be valid in ES3.49SupportedSampleSet sampleCounts;5051// Get the maximum number of samples supported52GLuint getMaxSamples() const;5354// Get the number of supported samples that is at least as many as requested. Returns 0 if55// there are no sample counts available56GLuint getNearestSamples(GLuint requestedSamples) const;57};5859TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,60const Version &clientVersion,61const Extensions &extensions);6263class TextureCapsMap final : angle::NonCopyable64{65public:66TextureCapsMap();67~TextureCapsMap();6869// These methods are deprecated. Please use angle::Format for new features.70void insert(GLenum internalFormat, const TextureCaps &caps);71const TextureCaps &get(GLenum internalFormat) const;7273void clear();7475// Prefer using angle::Format methods.76const TextureCaps &get(angle::FormatID formatID) const;77void set(angle::FormatID formatID, const TextureCaps &caps);7879private:80TextureCaps &get(angle::FormatID formatID);8182// Indexed by angle::FormatID83angle::FormatMap<TextureCaps> mFormatData;84};8586void InitMinimumTextureCapsMap(const Version &clientVersion,87const Extensions &extensions,88TextureCapsMap *capsMap);8990// Returns true if all the formats required to support GL_ANGLE_compressed_texture_etc are91// present. Does not determine if they are natively supported without decompression.92bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps);9394struct Extensions95{96Extensions();97Extensions(const Extensions &other);9899Extensions &operator=(const Extensions &other);100101// Generate a vector of supported extension strings102std::vector<std::string> getStrings() const;103104// Set all texture related extension support based on the supported textures.105// Determines support for:106// GL_OES_packed_depth_stencil107// GL_OES_rgb8_rgba8108// GL_EXT_texture_format_BGRA8888109// GL_EXT_color_buffer_half_float,110// GL_OES_texture_half_float, GL_OES_texture_half_float_linear111// GL_OES_texture_float, GL_OES_texture_float_linear112// GL_EXT_texture_rg113// GL_EXT_texture_type_2_10_10_10_REV114// GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3,115// GL_ANGLE_texture_compression_dxt5116// GL_KHR_texture_compression_astc_ldr, GL_OES_texture_compression_astc.117// NOTE: GL_KHR_texture_compression_astc_hdr must be enabled separately. Support for the118// HDR profile cannot be determined from the format enums alone.119// GL_OES_compressed_ETC1_RGB8_texture120// GL_EXT_sRGB121// GL_ANGLE_depth_texture, GL_OES_depth32122// GL_EXT_color_buffer_float123// GL_EXT_texture_norm16124// GL_EXT_texture_compression_bptc125// GL_EXT_texture_compression_rgtc126void setTextureExtensionSupport(const TextureCapsMap &textureCaps);127128// indicate if any depth texture extension is available129bool depthTextureAny() const { return (depthTextureANGLE || depthTextureOES); }130131// ES2 Extension support132133// GL_OES_element_index_uint134bool elementIndexUintOES = false;135136// GL_OES_packed_depth_stencil137bool packedDepthStencilOES = false;138139// GL_NV_read_depth140bool readDepthNV = false;141142// GL_NV_read_stencil143bool readStencilNV = false;144145// GL_NV_depth_buffer_float2146bool depthBufferFloat2NV = false;147148// GL_OES_get_program_binary149bool getProgramBinaryOES = false;150151// GL_OES_rgb8_rgba8152// Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist153bool rgb8rgba8OES = false;154155// GL_EXT_texture_format_BGRA8888156// Implies that TextureCaps for GL_BGRA8 exist157bool textureFormatBGRA8888 = false;158159// GL_EXT_read_format_bgra160bool readFormatBGRA = false;161162// GL_NV_pixel_buffer_object163bool pixelBufferObjectNV = false;164165// GL_ARB_sync166bool glSyncARB = false;167168// GL_OES_mapbuffer and GL_EXT_map_buffer_range169bool mapBufferOES = false;170bool mapBufferRange = false;171172// GL_EXT_color_buffer_half_float173// Together with GL_OES_texture_half_float in a GLES 2.0 context, implies that half-float174// textures are renderable.175bool colorBufferHalfFloat = false;176177// GL_OES_texture_half_float and GL_OES_texture_half_float_linear178// Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and179// GL_LUMINANCE_ALPHA32F_EXT exist180bool textureHalfFloat = false;181bool textureHalfFloatLinear = false;182183// GL_OES_texture_float and GL_OES_texture_float_linear184// Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and185// GL_LUMINANCE_ALPHA16F_EXT exist186bool textureFloatOES = false;187bool textureFloatLinearOES = false;188189// GL_EXT_texture_rg190// Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if191// floating point extensions are also present) exist192bool textureRG = false;193194// GL_EXT_texture_type_2_10_10_10_REV195bool textureFormat2101010REV = false;196197// GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and198// GL_ANGLE_texture_compression_dxt5 Implies that TextureCaps exist for199// GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT200// GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE201bool textureCompressionDXT1 = false;202bool textureCompressionDXT3 = false;203bool textureCompressionDXT5 = false;204205// GL_EXT_texture_compression_s3tc_srgb206// Implies that TextureCaps exist for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,207// GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and208// GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT209bool textureCompressionS3TCsRGB = false;210211// GL_KHR_texture_compression_astc_ldr212bool textureCompressionASTCLDRKHR = false;213214// GL_KHR_texture_compression_astc_hdr215bool textureCompressionASTCHDRKHR = false;216217// GL_OES_texture_compression_astc218bool textureCompressionASTCOES = false;219220// GL_KHR_texture_compression_astc_sliced_3d221bool textureCompressionSliced3dASTCKHR = false;222223// GL_EXT_texture_compression_bptc224bool textureCompressionBPTC = false;225226// GL_EXT_texture_compression_rgtc227bool textureCompressionRGTC = false;228229// GL_OES_compressed_ETC1_RGB8_texture230// Implies that TextureCaps for GL_ETC1_RGB8_OES exist231bool compressedETC1RGB8TextureOES = false;232233// GL_EXT_compressed_ETC1_RGB8_sub_texture234bool compressedETC1RGB8SubTexture = false;235236// OES_compressed_ETC2_RGB8_texture237bool compressedETC2RGB8TextureOES = false;238239// OES_compressed_ETC2_sRGB8_texture240bool compressedETC2sRGB8TextureOES = false;241242// OES_compressed_ETC2_punchthroughA_RGBA8_texture243bool compressedETC2PunchthroughARGB8TextureOES = false;244245// OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture246bool compressedETC2PunchthroughAsRGB8AlphaTextureOES = false;247248// OES_compressed_ETC2_RGBA8_texture249bool compressedETC2RGBA8TextureOES = false;250251// OES_compressed_ETC2_sRGB8_alpha8_texture252bool compressedETC2sRGB8Alpha8TextureOES = false;253254// OES_compressed_EAC_R11_unsigned_texture255bool compressedEACR11UnsignedTextureOES = false;256257// OES_compressed_EAC_R11_signed_texture258bool compressedEACR11SignedTextureOES = false;259260// OES_compressed_EAC_RG11_unsigned_texture261bool compressedEACRG11UnsignedTextureOES = false;262263// OES_compressed_EAC_RG11_signed_texture264bool compressedEACRG11SignedTextureOES = false;265266// ANGLE_compressed_texture_etc267// ONLY exposed if ETC texture formats are natively supported without decompression268// Backends should enable this extension explicitly. It is not enabled with269// setTextureExtensionSupport, use DetermineCompressedTextureETCSupport to check if all of the270// individual formats required to support this extension are available.271bool compressedTextureETC = false;272273// GL_IMG_texture_compression_pvrtc274bool compressedTexturePVRTC = false;275276// GL_EXT_pvrtc_sRGB277bool compressedTexturePVRTCsRGB = false;278279// GL_EXT_sRGB280// Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist281// TODO: Don't advertise this extension in ES3282bool sRGB = false;283284// GL_EXT_texture_sRGB_R8285bool sRGBR8EXT = false;286287// GL_EXT_texture_sRGB_RG8288bool sRGBRG8EXT = false;289290// GL_ANGLE_depth_texture291bool depthTextureANGLE = false;292293// OES_depth_texture294bool depthTextureOES = false;295296// GL_OES_depth_texture_cube_map297bool depthTextureCubeMapOES = false;298299// GL_OES_depth24300// Allows DEPTH_COMPONENT24_OES as a valid Renderbuffer format.301bool depth24OES = false;302303// GL_OES_depth32304// Allows DEPTH_COMPONENT32_OES as a valid Renderbuffer format.305bool depth32OES = false;306307// GL_OES_texture_3D308bool texture3DOES = false;309310// GL_EXT_texture_storage311bool textureStorage = false;312313// GL_OES_texture_npot314bool textureNPOTOES = false;315316// GL_EXT_draw_buffers317bool drawBuffers = false;318319// GL_EXT_draw_buffers_indexed320bool drawBuffersIndexedEXT = false;321322// GL_OES_draw_buffers_indexed323bool drawBuffersIndexedOES = false;324325// Any version of the draw_buffers_indexed326bool drawBuffersIndexedAny() const { return (drawBuffersIndexedEXT || drawBuffersIndexedOES); }327328// GL_EXT_texture_filter_anisotropic329bool textureFilterAnisotropic = false;330GLfloat maxTextureAnisotropy = 0.0f;331332// GL_EXT_occlusion_query_boolean333bool occlusionQueryBoolean = false;334335// GL_NV_fence336bool fenceNV = false;337338// GL_EXT_disjoint_timer_query339bool disjointTimerQuery = false;340GLuint queryCounterBitsTimeElapsed = 0;341GLuint queryCounterBitsTimestamp = 0;342343// GL_EXT_robustness344bool robustness = false;345346// GL_KHR_robust_buffer_access_behavior347bool robustBufferAccessBehavior = false;348349// GL_EXT_blend_minmax350bool blendMinMax = false;351352// GL_ANGLE_framebuffer_blit353bool framebufferBlitANGLE = false;354// GL_NV_framebuffer_blit355bool framebufferBlitNV = false;356// Any version of the framebuffer_blit extension357bool framebufferBlitAny() const { return (framebufferBlitANGLE || framebufferBlitNV); }358359// GL_ANGLE_framebuffer_multisample360bool framebufferMultisample = false;361362// GL_EXT_multisampled_render_to_texture363bool multisampledRenderToTexture = false;364365// GL_EXT_multisampled_render_to_texture2366bool multisampledRenderToTexture2 = false;367368// GL_ANGLE_instanced_arrays369bool instancedArraysANGLE = false;370// GL_EXT_instanced_arrays371bool instancedArraysEXT = false;372// Any version of the instanced arrays extension373bool instancedArraysAny() const { return (instancedArraysANGLE || instancedArraysEXT); }374375// GL_ANGLE_pack_reverse_row_order376bool packReverseRowOrder = false;377378// GL_OES_standard_derivatives379bool standardDerivativesOES = false;380381// GL_EXT_shader_texture_lod382bool shaderTextureLOD = false;383384// GL_EXT_shader_framebuffer_fetch_non_coherent385bool shaderFramebufferFetchNonCoherentEXT = false;386387// GL_EXT_frag_depth388bool fragDepth = false;389390// OVR_multiview391bool multiview = false;392GLuint maxViews = 1;393394// OVR_multiview2395bool multiview2 = false;396397// GL_ANGLE_texture_usage398bool textureUsage = false;399400// GL_ANGLE_translated_shader_source401bool translatedShaderSource = false;402403// GL_OES_fbo_render_mipmap404bool fboRenderMipmapOES = false;405406// GL_EXT_discard_framebuffer407bool discardFramebuffer = false;408409// EXT_debug_marker410bool debugMarker = false;411412// EXT_debug_label413bool debugLabel = false;414415// GL_OES_EGL_image416bool eglImageOES = false;417418// GL_OES_EGL_image_external419bool eglImageExternalOES = false;420421// GL_OES_EGL_image_external_essl3422bool eglImageExternalEssl3OES = false;423424// GL_EXT_EGL_image_external_wrap_modes425bool eglImageExternalWrapModesEXT = false;426427// GL_OES_EGL_sync428bool eglSyncOES = false;429430// GL_EXT_memory_object431bool memoryObject = false;432433// GL_EXT_memory_object_fd434bool memoryObjectFd = false;435436// GL_ANGLE_memory_object_flags437bool memoryObjectFlagsANGLE = false;438439// GL_ANGLE_memory_object_fuchsia440bool memoryObjectFuchsiaANGLE = false;441442// GL_EXT_semaphore443bool semaphore = false;444445// GL_EXT_semaphore_fd446bool semaphoreFd = false;447448// GL_ANGLE_semaphore_fuchsia449bool semaphoreFuchsiaANGLE = false;450451// NV_EGL_stream_consumer_external452bool eglStreamConsumerExternalNV = false;453454// EXT_unpack_subimage455bool unpackSubimage = false;456457// NV_pack_subimage458bool packSubimage = false;459460// GL_NV_shader_noperspective_interpolation461bool noperspectiveInterpolationNV = false;462463// GL_OES_vertex_half_float464bool vertexHalfFloatOES = false;465466// GL_OES_vertex_array_object467bool vertexArrayObjectOES = false;468469// GL_OES_vertex_type_10_10_10_2470bool vertexAttribType1010102OES = false;471472// GL_KHR_debug473bool debug = false;474GLuint maxDebugMessageLength = 0;475GLuint maxDebugLoggedMessages = 0;476GLuint maxDebugGroupStackDepth = 0;477GLuint maxLabelLength = 0;478479// KHR_no_error480bool noError = false;481482// GL_ANGLE_lossy_etc_decode483bool lossyETCDecode = false;484485// GL_CHROMIUM_bind_uniform_location486bool bindUniformLocation = false;487488// GL_CHROMIUM_sync_query489bool syncQuery = false;490491// GL_CHROMIUM_copy_texture492bool copyTexture = false;493494// GL_CHROMIUM_copy_compressed_texture495bool copyCompressedTexture = false;496497// GL_ANGLE_copy_texture_3d498bool copyTexture3d = false;499500// GL_ANGLE_webgl_compatibility501bool webglCompatibility = false;502503// GL_ANGLE_request_extension504bool requestExtension = false;505506// GL_CHROMIUM_bind_generates_resource507bool bindGeneratesResource = false;508509// GL_ANGLE_robust_client_memory510bool robustClientMemory = false;511512// GL_OES_texture_border_clamp513bool textureBorderClampOES = false;514515// GL_EXT_texture_border_clamp516bool textureBorderClampEXT = false;517518// Any version of the texture border clamp extension519bool textureBorderClampAny() const { return (textureBorderClampOES || textureBorderClampEXT); }520521// GL_EXT_texture_sRGB_decode522bool textureSRGBDecode = false;523524// GL_EXT_texture_format_sRGB_override525bool textureSRGBOverride = false;526527// GL_EXT_sRGB_write_control528bool sRGBWriteControl = false;529530// GL_CHROMIUM_color_buffer_float_rgb531bool colorBufferFloatRGB = false;532533// GL_CHROMIUM_color_buffer_float_rgba534bool colorBufferFloatRGBA = false;535536// GL_EXT_EGL_image_array537bool eglImageArray = false;538539// ES3 Extension support540541// GL_EXT_color_buffer_float542bool colorBufferFloat = false;543544// GL_EXT_multisample_compatibility.545// written against ES 3.1 but can apply to earlier versions.546bool multisampleCompatibility = false;547548// GL_CHROMIUM_framebuffer_mixed_samples549bool framebufferMixedSamples = false;550551// GL_EXT_texture_norm16552// written against ES 3.1 but can apply to ES 3.0 as well.553bool textureNorm16 = false;554555// GL_OES_surfaceless_context556bool surfacelessContextOES = false;557558// GL_ANGLE_client_arrays559bool clientArrays = false;560561// GL_ANGLE_robust_resource_initialization562bool robustResourceInitialization = false;563564// GL_ANGLE_program_cache_control565bool programCacheControl = false;566567// GL_ANGLE_texture_rectangle568bool textureRectangle = false;569570// GL_EXT_geometry_shader571bool geometryShaderEXT = false;572// GL_OES_geometry_shader573bool geometryShaderOES = false;574// Any version of the geometry shader extension575bool geometryShaderAny() const { return (geometryShaderEXT || geometryShaderOES); }576577// GLES1 emulation: GLES1 extensions578// GL_OES_point_size_array579bool pointSizeArrayOES = false;580581// GL_OES_texture_cube_map582bool textureCubeMapOES = false;583584// GL_OES_point_sprite585bool pointSpriteOES = false;586587// GL_OES_draw_texture588bool drawTextureOES = false;589590// GL_OES_framebuffer_object591bool framebufferObjectOES = false;592593// GL_KHR_parallel_shader_compile594bool parallelShaderCompile = false;595596// GL_EXT_separate_shader_objects597bool separateShaderObjects = false;598599// GL_OES_texture_storage_multisample_2d_array600bool textureStorageMultisample2DArrayOES = false;601602// GL_ANGLE_multiview_multisample603bool multiviewMultisample = false;604605// GL_KHR_blend_equation_advanced606bool blendEquationAdvancedKHR = false;607608// GL_EXT_blend_func_extended609bool blendFuncExtended = false;610GLuint maxDualSourceDrawBuffers = 0;611612// GL_EXT_float_blend613bool floatBlend = false;614615// GL_ANGLE_memory_size616bool memorySize = false;617618// GL_ANGLE_texture_multisample619bool textureMultisample = false;620621// GL_ANGLE_multi_draw622bool multiDraw = false;623624// GL_ANGLE_provoking_vertex625bool provokingVertex = false;626627// GL_CHROMIUM_texture_filtering_hint628bool textureFilteringCHROMIUM = false;629630// GL_CHROMIUM_lose_context631bool loseContextCHROMIUM = false;632633// GL_ANGLE_texture_external_update634bool textureExternalUpdateANGLE = false;635636// GL_ANGLE_base_vertex_base_instance637bool baseVertexBaseInstance = false;638639// GL_ANGLE_get_image640bool getImageANGLE = false;641642// GL_OES_draw_elements_base_vertex643bool drawElementsBaseVertexOES = false;644// GL_EXT_draw_elements_base_vertex645bool drawElementsBaseVertexEXT = false;646// Any version of the base vertex extension647bool drawElementsBaseVertexAny() const648{649return (drawElementsBaseVertexOES || drawElementsBaseVertexEXT);650}651652// GL_EXT_shader_non_constant_global_initializers653bool shaderNonConstGlobalInitializersEXT = false;654655// GL_OES_shader_io_blocks656bool shaderIoBlocksOES = false;657// GL_EXT_shader_io_blocks658bool shaderIoBlocksEXT = false;659// Any version of shader io block extension660bool shaderIoBlocksAny() const { return (shaderIoBlocksOES || shaderIoBlocksEXT); }661662// GL_EXT_gpu_shader5663bool gpuShader5EXT = false;664// WEBGL_video_texture665bool webglVideoTexture = false;666667// GL_APPLE_clip_distance668bool clipDistanceAPPLE = false;669670// GL_EXT_clip_control671bool clipControlEXT = false;672673// GL_OES_texture_cube_map_array674bool textureCubeMapArrayOES = false;675// GL_EXT_texture_cube_map_array676bool textureCubeMapArrayEXT = false;677// Any version of the texture cube map array extension678bool textureCubeMapArrayAny() const679{680return (textureCubeMapArrayOES || textureCubeMapArrayEXT);681}682683// GL_EXT_shadow_samplers684bool shadowSamplersEXT = false;685686// GL_EXT_buffer_storage687bool bufferStorageEXT = false;688689// GL_EXT_external_buffer690bool externalBufferEXT = false;691692// GL_OES_texture_stencil8693bool stencilIndex8 = false;694695// GL_OES_sample_shading696bool sampleShadingOES = false;697698// OES_shader_multisample_interpolation699bool multisampleInterpolationOES = false;700701// GL_OES_shader_image_atomic702bool shaderImageAtomicOES = false;703704// GL_OES_sample_variables705bool sampleVariablesOES = false;706707// GL_NV_robustness_video_memory_purge708bool robustnessVideoMemoryPurgeNV = false;709710// GL_ANGLE_get_tex_level_parameter711bool getTexLevelParameterANGLE = false;712713// GL_EXT_tessellation_shader714bool tessellationShaderEXT = false;715716// GL_EXT_copy_image717bool copyImageEXT = false;718719// GL_OES_texture_buffer720bool textureBufferOES = false;721// GL_EXT_texture_buffer722bool textureBufferEXT = false;723// Any version of the texture buffer extension724bool textureBufferAny() const { return (textureBufferOES || textureBufferEXT); }725726// GL_EXT_YUV_target727bool yuvTargetEXT = false;728729// GL_EXT_clip_cull_distance730bool clipCullDistanceEXT = false;731732// GL_ANGLE_get_serialized_context_string733bool getSerializedContextStringANGLE = false;734735// GL_EXT_primitive_bounding_box736bool primitiveBoundingBoxEXT = false;737738// GL_ANGLE_relaxed_vertex_attribute_type739bool relaxedVertexAttributeTypeANGLE = false;740741// GL_ANGLE_yuv_internal_format742bool yuvInternalFormatANGLE = false;743744// GL_EXT_protected_textures745bool protectedTexturesEXT = false;746};747748// Pointer to a boolean memeber of the Extensions struct749using ExtensionBool = bool Extensions::*;750751struct ExtensionInfo752{753// If this extension can be enabled or disabled with glRequestExtension754// (GL_ANGLE_request_extension)755bool Requestable = false;756bool Disablable = false;757758// Pointer to a boolean member of the Extensions struct759ExtensionBool ExtensionsMember = nullptr;760};761762using ExtensionInfoMap = std::map<std::string, ExtensionInfo>;763const ExtensionInfoMap &GetExtensionInfoMap();764765struct Limitations766{767Limitations();768Limitations(const Limitations &other);769770Limitations &operator=(const Limitations &other);771772// Renderer doesn't support gl_FrontFacing in fragment shaders773bool noFrontFacingSupport = false;774775// Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE776bool noSampleAlphaToCoverageSupport = false;777778// In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor779bool attributeZeroRequiresZeroDivisorInEXT = false;780781// Unable to support different values for front and back faces for stencil refs and masks782bool noSeparateStencilRefsAndMasks = false;783784// Renderer doesn't support non-constant indexing loops in fragment shader785bool shadersRequireIndexedLoopValidation = false;786787// Renderer doesn't support Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA788// and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR blend functions.789bool noSimultaneousConstantColorAndAlphaBlendFunc = false;790791// D3D9 does not support flexible varying register packing.792bool noFlexibleVaryingPacking = false;793794// D3D does not support having multiple transform feedback outputs go to the same buffer.795bool noDoubleBoundTransformFeedbackBuffers = false;796797// D3D does not support vertex attribute aliasing798bool noVertexAttributeAliasing = false;799800// Renderer doesn't support GL_TEXTURE_COMPARE_MODE=GL_NONE on a shadow sampler.801// TODO(http://anglebug.com/5231): add validation code to front-end.802bool noShadowSamplerCompareModeNone = false;803804// PVRTC1 textures must be squares.805bool squarePvrtc1 = false;806807// ETC1 texture support is emulated.808bool emulatedEtc1 = false;809810// No compressed TEXTURE_3D support.811bool noCompressedTexture3D = false;812};813814struct TypePrecision815{816TypePrecision();817TypePrecision(const TypePrecision &other);818819TypePrecision &operator=(const TypePrecision &other);820821void setIEEEFloat();822void setTwosComplementInt(unsigned int bits);823void setSimulatedFloat(unsigned int range, unsigned int precision);824void setSimulatedInt(unsigned int range);825826void get(GLint *returnRange, GLint *returnPrecision) const;827828std::array<GLint, 2> range = {0, 0};829GLint precision = 0;830};831832struct Caps833{834Caps();835Caps(const Caps &other);836Caps &operator=(const Caps &other);837838~Caps();839840// If the values could be got by using GetIntegeri_v, they should841// be GLint instead of GLuint and call LimitToInt() to ensure842// they will not overflow.843844GLfloat minInterpolationOffset = 0;845GLfloat maxInterpolationOffset = 0;846GLint subPixelInterpolationOffsetBits = 0;847848// ES 3.1 (April 29, 2015) 20.39: implementation dependent values849GLint64 maxElementIndex = 0;850GLint max3DTextureSize = 0;851GLint max2DTextureSize = 0;852GLint maxRectangleTextureSize = 0;853GLint maxArrayTextureLayers = 0;854GLfloat maxLODBias = 0.0f;855GLint maxCubeMapTextureSize = 0;856GLint maxRenderbufferSize = 0;857GLfloat minAliasedPointSize = 1.0f;858GLfloat maxAliasedPointSize = 1.0f;859GLfloat minAliasedLineWidth = 0.0f;860GLfloat maxAliasedLineWidth = 0.0f;861862// ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)863GLint maxDrawBuffers = 0;864GLint maxFramebufferWidth = 0;865GLint maxFramebufferHeight = 0;866GLint maxFramebufferSamples = 0;867GLint maxColorAttachments = 0;868GLint maxViewportWidth = 0;869GLint maxViewportHeight = 0;870GLint maxSampleMaskWords = 0;871GLint maxColorTextureSamples = 0;872GLint maxDepthTextureSamples = 0;873GLint maxIntegerSamples = 0;874GLint64 maxServerWaitTimeout = 0;875876// ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)877GLint maxVertexAttribRelativeOffset = 0;878GLint maxVertexAttribBindings = 0;879GLint maxVertexAttribStride = 0;880GLint maxElementsIndices = 0;881GLint maxElementsVertices = 0;882std::vector<GLenum> compressedTextureFormats;883std::vector<GLenum> programBinaryFormats;884std::vector<GLenum> shaderBinaryFormats;885TypePrecision vertexHighpFloat;886TypePrecision vertexMediumpFloat;887TypePrecision vertexLowpFloat;888TypePrecision vertexHighpInt;889TypePrecision vertexMediumpInt;890TypePrecision vertexLowpInt;891TypePrecision fragmentHighpFloat;892TypePrecision fragmentMediumpFloat;893TypePrecision fragmentLowpFloat;894TypePrecision fragmentHighpInt;895TypePrecision fragmentMediumpInt;896TypePrecision fragmentLowpInt;897898// Implementation dependent limits required on all shader types.899// TODO([email protected]): organize all such limits into ShaderMap.900// ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits901// ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits902// ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits903// GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader904// limits905// GL_EXT_geometry_shader (May 31, 2016) Table 20.46: Implementation dependent aggregate shader906// limits907ShaderMap<GLint> maxShaderUniformBlocks = {};908ShaderMap<GLint> maxShaderTextureImageUnits = {};909ShaderMap<GLint> maxShaderStorageBlocks = {};910ShaderMap<GLint> maxShaderUniformComponents = {};911ShaderMap<GLint> maxShaderAtomicCounterBuffers = {};912ShaderMap<GLint> maxShaderAtomicCounters = {};913ShaderMap<GLint> maxShaderImageUniforms = {};914// Note that we can query MAX_COMPUTE_UNIFORM_COMPONENTS and MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT915// by GetIntegerv, but we can only use GetInteger64v on MAX_VERTEX_UNIFORM_COMPONENTS and916// MAX_FRAGMENT_UNIFORM_COMPONENTS. Currently we use GLuint64 to store all these values so that917// we can put them together into one ShaderMap.918ShaderMap<GLint64> maxCombinedShaderUniformComponents = {};919920// ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits921GLint maxVertexAttributes = 0;922GLint maxVertexUniformVectors = 0;923GLint maxVertexOutputComponents = 0;924925// ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits926GLint maxFragmentUniformVectors = 0;927GLint maxFragmentInputComponents = 0;928GLint minProgramTextureGatherOffset = 0;929GLint maxProgramTextureGatherOffset = 0;930GLint minProgramTexelOffset = 0;931GLint maxProgramTexelOffset = 0;932933// ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits934std::array<GLint, 3> maxComputeWorkGroupCount = {0, 0, 0};935std::array<GLint, 3> maxComputeWorkGroupSize = {0, 0, 0};936GLint maxComputeWorkGroupInvocations = 0;937GLint maxComputeSharedMemorySize = 0;938939// ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits940GLint maxUniformBufferBindings = 0;941GLint64 maxUniformBlockSize = 0;942GLint uniformBufferOffsetAlignment = 0;943GLint maxCombinedUniformBlocks = 0;944GLint maxVaryingComponents = 0;945GLint maxVaryingVectors = 0;946GLint maxCombinedTextureImageUnits = 0;947GLint maxCombinedShaderOutputResources = 0;948949// ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)950GLint maxUniformLocations = 0;951GLint maxAtomicCounterBufferBindings = 0;952GLint maxAtomicCounterBufferSize = 0;953GLint maxCombinedAtomicCounterBuffers = 0;954GLint maxCombinedAtomicCounters = 0;955GLint maxImageUnits = 0;956GLint maxCombinedImageUniforms = 0;957GLint maxShaderStorageBufferBindings = 0;958GLint64 maxShaderStorageBlockSize = 0;959GLint maxCombinedShaderStorageBlocks = 0;960GLint shaderStorageBufferOffsetAlignment = 0;961962// ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits963GLint maxTransformFeedbackInterleavedComponents = 0;964GLint maxTransformFeedbackSeparateAttributes = 0;965GLint maxTransformFeedbackSeparateComponents = 0;966967// ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values968GLint maxSamples = 0;969970// GL_EXT_geometry_shader (May 31, 2016) Table 20.40: Implementation-Dependent Values (cont.)971GLint maxFramebufferLayers = 0;972GLint layerProvokingVertex = 0;973974// GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader975// limits976GLint maxGeometryInputComponents = 0;977GLint maxGeometryOutputComponents = 0;978GLint maxGeometryOutputVertices = 0;979GLint maxGeometryTotalOutputComponents = 0;980GLint maxGeometryShaderInvocations = 0;981982// GL_EXT_tessellation_shader983GLint maxTessControlInputComponents = 0;984GLint maxTessControlOutputComponents = 0;985GLint maxTessControlTotalOutputComponents = 0;986987GLint maxTessPatchComponents = 0;988GLint maxPatchVertices = 0;989GLint maxTessGenLevel = 0;990991GLint maxTessEvaluationInputComponents = 0;992GLint maxTessEvaluationOutputComponents = 0;993994GLuint subPixelBits = 4;995996// GL_APPLE_clip_distance/GL_EXT_clip_cull_distance997GLuint maxClipDistances = 0;998GLuint maxCullDistances = 0;999GLuint maxCombinedClipAndCullDistances = 0;10001001// GLES1 emulation: Caps for ES 1.1. Taken from Table 6.20 / 6.22 in the OpenGL ES 1.1 spec.1002GLuint maxMultitextureUnits = 0;1003GLuint maxClipPlanes = 0;1004GLuint maxLights = 0;1005static constexpr int GlobalMatrixStackDepth = 16;1006GLuint maxModelviewMatrixStackDepth = 0;1007GLuint maxProjectionMatrixStackDepth = 0;1008GLuint maxTextureMatrixStackDepth = 0;1009GLfloat minSmoothPointSize = 0.0f;1010GLfloat maxSmoothPointSize = 0.0f;1011GLfloat minSmoothLineWidth = 0.0f;1012GLfloat maxSmoothLineWidth = 0.0f;10131014// ES 3.2 Table 20.41: Implementation Dependent Values (cont.)1015GLint maxTextureBufferSize = 0;1016GLint textureBufferOffsetAlignment = 0;10171018// Direct-to-metal constants:1019GLuint driverUniformsBindingIndex = 0;1020GLuint defaultUniformsBindingIndex = 0;1021GLuint UBOArgumentBufferBindingIndex = 0;1022};10231024Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions);1025} // namespace gl10261027namespace egl1028{10291030struct Caps1031{1032Caps();10331034// Support for NPOT surfaces1035bool textureNPOT;10361037// Support for Stencil8 configs1038bool stencil8;1039};10401041struct DisplayExtensions1042{1043DisplayExtensions();10441045// Generate a vector of supported extension strings1046std::vector<std::string> getStrings() const;10471048// EGL_EXT_create_context_robustness1049bool createContextRobustness = false;10501051// EGL_ANGLE_d3d_share_handle_client_buffer1052bool d3dShareHandleClientBuffer = false;10531054// EGL_ANGLE_d3d_texture_client_buffer1055bool d3dTextureClientBuffer = false;10561057// EGL_ANGLE_surface_d3d_texture_2d_share_handle1058bool surfaceD3DTexture2DShareHandle = false;10591060// EGL_ANGLE_query_surface_pointer1061bool querySurfacePointer = false;10621063// EGL_ANGLE_window_fixed_size1064bool windowFixedSize = false;10651066// EGL_ANGLE_keyed_mutex1067bool keyedMutex = false;10681069// EGL_ANGLE_surface_orientation1070bool surfaceOrientation = false;10711072// EGL_NV_post_sub_buffer1073bool postSubBuffer = false;10741075// EGL_KHR_create_context1076bool createContext = false;10771078// EGL_KHR_image1079bool image = false;10801081// EGL_KHR_image_base1082bool imageBase = false;10831084// EGL_KHR_image_pixmap1085bool imagePixmap = false;10861087// EGL_KHR_gl_texture_2D_image1088bool glTexture2DImage = false;10891090// EGL_KHR_gl_texture_cubemap_image1091bool glTextureCubemapImage = false;10921093// EGL_KHR_gl_texture_3D_image1094bool glTexture3DImage = false;10951096// EGL_KHR_gl_renderbuffer_image1097bool glRenderbufferImage = false;10981099// EGL_KHR_get_all_proc_addresses1100bool getAllProcAddresses = false;11011102// EGL_ANGLE_flexible_surface_compatibility1103bool flexibleSurfaceCompatibility = false;11041105// EGL_ANGLE_direct_composition1106bool directComposition = false;11071108// EGL_ANGLE_windows_ui_composition1109bool windowsUIComposition = false;11101111// KHR_create_context_no_error1112bool createContextNoError = false;11131114// EGL_KHR_stream1115bool stream = false;11161117// EGL_KHR_stream_consumer_gltexture1118bool streamConsumerGLTexture = false;11191120// EGL_NV_stream_consumer_gltexture_yuv1121bool streamConsumerGLTextureYUV = false;11221123// EGL_ANGLE_stream_producer_d3d_texture1124bool streamProducerD3DTexture = false;11251126// EGL_KHR_fence_sync1127bool fenceSync = false;11281129// EGL_KHR_wait_sync1130bool waitSync = false;11311132// EGL_ANGLE_create_context_webgl_compatibility1133bool createContextWebGLCompatibility = false;11341135// EGL_CHROMIUM_create_context_bind_generates_resource1136bool createContextBindGeneratesResource = false;11371138// EGL_CHROMIUM_sync_control1139bool syncControlCHROMIUM = false;11401141// EGL_ANGLE_sync_control_rate1142bool syncControlRateANGLE = false;11431144// EGL_KHR_swap_buffers_with_damage1145bool swapBuffersWithDamage = false;11461147// EGL_EXT_pixel_format_float1148bool pixelFormatFloat = false;11491150// EGL_KHR_surfaceless_context1151bool surfacelessContext = false;11521153// EGL_ANGLE_display_texture_share_group1154bool displayTextureShareGroup = false;11551156// EGL_ANGLE_display_semaphore_share_group1157bool displaySemaphoreShareGroup = false;11581159// EGL_ANGLE_create_context_client_arrays1160bool createContextClientArrays = false;11611162// EGL_ANGLE_program_cache_control1163bool programCacheControl = false;11641165// EGL_ANGLE_robust_resource_initialization1166bool robustResourceInitialization = false;11671168// EGL_ANGLE_iosurface_client_buffer1169bool iosurfaceClientBuffer = false;11701171// EGL_ANGLE_metal_texture_client_buffer1172bool mtlTextureClientBuffer = false;11731174// EGL_ANGLE_create_context_extensions_enabled1175bool createContextExtensionsEnabled = false;11761177// EGL_ANDROID_presentation_time1178bool presentationTime = false;11791180// EGL_ANDROID_blob_cache1181bool blobCache = false;11821183// EGL_ANDROID_image_native_buffer1184bool imageNativeBuffer = false;11851186// EGL_ANDROID_get_frame_timestamps1187bool getFrameTimestamps = false;11881189// EGL_ANDROID_recordable1190bool recordable = false;11911192// EGL_ANGLE_power_preference1193bool powerPreference = false;11941195// EGL_ANGLE_image_d3d11_texture1196bool imageD3D11Texture = false;11971198// EGL_ANDROID_get_native_client_buffer1199bool getNativeClientBufferANDROID = false;12001201// EGL_ANDROID_create_native_client_buffer1202bool createNativeClientBufferANDROID = false;12031204// EGL_ANDROID_native_fence_sync1205bool nativeFenceSyncANDROID = false;12061207// EGL_ANGLE_create_context_backwards_compatible1208bool createContextBackwardsCompatible = false;12091210// EGL_KHR_no_config_context1211bool noConfigContext = false;12121213// EGL_IMG_context_priority1214bool contextPriority = false;12151216// EGL_ANGLE_ggp_stream_descriptor1217bool ggpStreamDescriptor = false;12181219// EGL_ANGLE_swap_with_frame_token1220bool swapWithFrameToken = false;12211222// EGL_KHR_gl_colorspace1223bool glColorspace = false;12241225// EGL_EXT_gl_colorspace_display_p3_linear1226bool glColorspaceDisplayP3Linear = false;12271228// EGL_EXT_gl_colorspace_display_p31229bool glColorspaceDisplayP3 = false;12301231// EGL_EXT_gl_colorspace_scrgb1232bool glColorspaceScrgb = false;12331234// EGL_EXT_gl_colorspace_scrgb_linear1235bool glColorspaceScrgbLinear = false;12361237// EGL_EXT_gl_colorspace_display_p3_passthrough1238bool glColorspaceDisplayP3Passthrough = false;12391240// EGL_ANDROID_framebuffer_target1241bool framebufferTargetANDROID = false;12421243// EGL_EXT_image_gl_colorspace1244bool imageGlColorspace = false;12451246// EGL_EXT_image_dma_buf_import1247bool imageDmaBufImportEXT = false;12481249// EGL_EXT_image_dma_buf_import_modifiers1250bool imageDmaBufImportModifiersEXT = false;12511252// EGL_NOK_texture_from_pixmap1253bool textureFromPixmapNOK = false;12541255// EGL_NV_robustness_video_memory_purge1256bool robustnessVideoMemoryPurgeNV = false;12571258// EGL_KHR_reusable_sync1259bool reusableSyncKHR = false;12601261// EGL_ANGLE_external_context_and_surface1262bool externalContextAndSurface = false;12631264// EGL_EXT_buffer_age1265bool bufferAgeEXT = false;12661267// EGL_KHR_mutable_render_buffer1268bool mutableRenderBufferKHR = false;12691270// EGL_EXT_protected_content1271bool protectedContentEXT = false;12721273// EGL_ANGLE_create_surface_swap_interval1274bool createSurfaceSwapIntervalANGLE = false;1275};12761277struct DeviceExtensions1278{1279DeviceExtensions();12801281// Generate a vector of supported extension strings1282std::vector<std::string> getStrings() const;12831284// EGL_ANGLE_device_d3d1285bool deviceD3D = false;12861287// EGL_ANGLE_device_cgl1288bool deviceCGL = false;12891290// EGL_ANGLE_device_eagl1291bool deviceEAGL = false;12921293// EGL_ANGLE_device_metal1294bool deviceMetal = false;1295};12961297struct ClientExtensions1298{1299ClientExtensions();1300ClientExtensions(const ClientExtensions &other);13011302// Generate a vector of supported extension strings1303std::vector<std::string> getStrings() const;13041305// EGL_EXT_client_extensions1306bool clientExtensions = false;13071308// EGL_EXT_platform_base1309bool platformBase = false;13101311// EGL_EXT_platform_device1312bool platformDevice = false;13131314// EGL_ANGLE_platform_angle1315bool platformANGLE = false;13161317// EGL_ANGLE_platform_angle_d3d1318bool platformANGLED3D = false;13191320// EGL_ANGLE_platform_angle_d3d11on121321bool platformANGLED3D11ON12 = false;13221323// EGL_ANGLE_platform_angle_opengl1324bool platformANGLEOpenGL = false;13251326// EGL_ANGLE_platform_angle_null1327bool platformANGLENULL = false;13281329// EGL_ANGLE_platform_angle_vulkan1330bool platformANGLEVulkan = false;13311332// EGL_ANGLE_platform_angle_metal1333bool platformANGLEMetal = false;13341335// EGL_ANGLE_platform_angle_context_virtualization1336bool platformANGLEContextVirtualization = false;13371338// EGL_ANGLE_platform_angle_device_context_volatile_eagl1339bool platformANGLEDeviceContextVolatileEagl = false;13401341// EGL_ANGLE_platform_angle_device_context_volatile_cgl1342bool platformANGLEDeviceContextVolatileCgl = false;13431344// EGL_ANGLE_device_creation1345bool deviceCreation = false;13461347// EGL_ANGLE_device_creation_d3d111348bool deviceCreationD3D11 = false;13491350// EGL_ANGLE_x11_visual1351bool x11Visual = false;13521353// EGL_ANGLE_experimental_present_path1354bool experimentalPresentPath = false;13551356// EGL_KHR_client_get_all_proc_addresses1357bool clientGetAllProcAddresses = false;13581359// EGL_KHR_debug1360bool debug = false;13611362// EGL_ANGLE_feature_control1363bool featureControlANGLE = false;13641365// EGL_ANGLE_platform_angle_device_type_swiftshader1366bool platformANGLEDeviceTypeSwiftShader = false;13671368// EGL_ANGLE_platform_angle_device_type_egl_angle1369bool platformANGLEDeviceTypeEGLANGLE = false;13701371// EGL_EXT_device_query1372bool deviceQueryEXT = false;1373};13741375} // namespace egl13761377#endif // LIBANGLE_CAPS_H_137813791380