1 // 2 // Copyright 2019 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // FeaturesMtl.h: Optional features for the Metal renderer. 7 // 8 9 #ifndef ANGLE_PLATFORM_FEATURESMTL_H_ 10 #define ANGLE_PLATFORM_FEATURESMTL_H_ 11 12 #include "platform/Feature.h" 13 14 namespace angle 15 { 16 17 struct FeaturesMtl : FeatureSetBase 18 { 19 // BaseVertex/Instanced draw support: 20 Feature hasBaseVertexInstancedDraw = { 21 "has_base_vertex_instanced_draw", FeatureCategory::MetalFeatures, 22 "The renderer supports base vertex instanced draw", &members}; 23 24 // Support depth texture filtering 25 Feature hasDepthTextureFiltering = { 26 "has_depth_texture_filtering", FeatureCategory::MetalFeatures, 27 "The renderer supports depth texture's filtering other than nearest", &members}; 28 29 // Support explicit memory barrier 30 Feature hasExplicitMemBarrier = {"has_explicit_mem_barrier_mtl", FeatureCategory::MetalFeatures, 31 "The renderer supports explicit memory barrier", &members}; 32 33 // Some renderer can break render pass cheaply, i.e. desktop class GPUs. 34 Feature hasCheapRenderPass = {"has_cheap_render_pass_mtl", FeatureCategory::MetalFeatures, 35 "The renderer can cheaply break a render pass.", &members}; 36 37 // Non-uniform compute shader dispatch support, i.e. Group size is not necessarily to be fixed: 38 Feature hasNonUniformDispatch = { 39 "has_non_uniform_dispatch", FeatureCategory::MetalFeatures, 40 "The renderer supports non uniform compute shader dispatch's group size", &members}; 41 42 // fragment stencil output support 43 Feature hasStencilOutput = {"has_shader_stencil_output", FeatureCategory::MetalFeatures, 44 "The renderer supports stencil output from fragment shader", 45 &members}; 46 47 // Texture swizzle support: 48 Feature hasTextureSwizzle = {"has_texture_swizzle", FeatureCategory::MetalFeatures, 49 "The renderer supports texture swizzle", &members}; 50 51 Feature hasDepthAutoResolve = { 52 "has_msaa_depth_auto_resolve", FeatureCategory::MetalFeatures, 53 "The renderer supports MSAA depth auto resolve at the end of render pass", &members}; 54 55 Feature hasStencilAutoResolve = { 56 "has_msaa_stencil_auto_resolve", FeatureCategory::MetalFeatures, 57 "The renderer supports MSAA stencil auto resolve at the end of render pass", &members}; 58 59 Feature hasEvents = {"has_mtl_events", FeatureCategory::MetalFeatures, 60 "The renderer supports MTL(Shared)Event", &members}; 61 62 Feature allowInlineConstVertexData = { 63 "allow_inline_const_vertex_data", FeatureCategory::MetalFeatures, 64 "The renderer supports using inline constant data for small client vertex data", &members}; 65 66 // On macos, separate depth & stencil buffers are not supproted. However, on iOS devices, 67 // they are supproted: 68 Feature allowSeparatedDepthStencilBuffers = { 69 "allow_separate_depth_stencil_buffers", FeatureCategory::MetalFeatures, 70 "Some Apple platforms such as iOS allows separate depth & stencil buffers, " 71 "whereas others such as macOS don't", 72 &members}; 73 74 Feature allowRuntimeSamplerCompareMode = { 75 "allow_runtime_sampler_compare_mode", FeatureCategory::MetalFeatures, 76 "The renderer supports changing sampler's compare mode outside shaders", &members}; 77 78 Feature allowSamplerCompareGradient = { 79 "allow_sampler_compare_gradient", FeatureCategory::MetalFeatures, 80 "The renderer supports sample_compare with gradients", &members}; 81 82 Feature allowSamplerCompareLod = {"allow_sampler_compare_lod", FeatureCategory::MetalFeatures, 83 "The renderer supports sample_compare with lod", &members}; 84 85 Feature allowBufferReadWrite = {"allow_buffer_read_write", FeatureCategory::MetalFeatures, 86 "The renderer supports buffer read & write in the same shader", 87 &members}; 88 89 Feature allowMultisampleStoreAndResolve = { 90 "allow_msaa_store_and_resolve", FeatureCategory::MetalFeatures, 91 "The renderer supports MSAA store and resolve in the same pass", &members}; 92 93 Feature allowGenMultipleMipsPerPass = { 94 "gen_multiple_mips_per_pass", FeatureCategory::MetalFeatures, 95 "The renderer supports generating multiple mipmaps per pass", &members}; 96 97 Feature forceD24S8AsUnsupported = {"force_d24s8_as_unsupported", FeatureCategory::MetalFeatures, 98 "Force Depth24Stencil8 format as unsupported.", &members}; 99 100 Feature forceBufferGPUStorage = { 101 "force_buffer_gpu_storage", FeatureCategory::MetalFeatures, 102 "On systems that support both buffer' memory allocation on GPU and shared memory (such as " 103 "macOS), force using GPU memory allocation for buffers everytime or not.", 104 &members}; 105 106 // Whether SPIR-V should be generated directly instead of through glslang. Transitory feature 107 // until the work is complete. 108 Feature directSPIRVGeneration = {"directSPIRVGeneration", FeatureCategory::MetalFeatures, 109 "Direct translation to SPIR-V.", &members, 110 "http://anglebug.com/4889"}; 111 112 Feature forceNonCSBaseMipmapGeneration = { 113 "force_non_cs_mipmap_gen", FeatureCategory::MetalFeatures, 114 "Turn this feature on to disallow Compute Shader based mipmap generation. Compute Shader " 115 "based mipmap generation might cause GPU hang on some older iOS devices.", 116 &members}; 117 118 Feature emulateTransformFeedback = { 119 "emulate_transform_feedback", FeatureCategory::MetalFeatures, 120 "Turn this on to allow transform feedback in Metal using a 2-pass VS for GLES3.", &members}; 121 122 // Rewrite row-major matrices as column-major 123 Feature rewriteRowMajorMatrices = {"rewrite_row_major_matrices", FeatureCategory::MetalFeatures, 124 "Rewrite row major matrices in shaders as column major.", 125 &members}; 126 }; 127 128 } // namespace angle 129 130 #endif // ANGLE_PLATFORM_FEATURESMTL_H_ 131