15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_mesh_shader 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName String 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_mesh_shader 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Christoph Kubisch, NVIDIA (ckubisch 'at' nvidia.com) 125bd8deadSopenharmony_ci Pat Brown, NVIDIA (pbrown 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciContributors 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Yury Uralsky, NVIDIA 175bd8deadSopenharmony_ci Tyson Smith, NVIDIA 185bd8deadSopenharmony_ci Pyarelal Knowles, NVIDIA 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciStatus 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Shipping 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciVersion 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Last Modified Date: September 5, 2019 275bd8deadSopenharmony_ci NVIDIA Revision: 5 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciNumber 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci OpenGL Extension #527 325bd8deadSopenharmony_ci OpenGL ES Extension #312 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciDependencies 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci This extension is written against the OpenGL 4.5 Specification 375bd8deadSopenharmony_ci (Compatibility Profile), dated June 29, 2017. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci OpenGL 4.5 or OpenGL ES 3.2 is required. 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci This extension requires support for the OpenGL Shading Language (GLSL) 425bd8deadSopenharmony_ci extension "NV_mesh_shader", which can be found at the Khronos Group Github 435bd8deadSopenharmony_ci site here: 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci https://github.com/KhronosGroup/GLSL 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci This extension interacts with ARB_indirect_parameters and OpenGL 4.6. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci This extension interacts with NV_command_list. 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci This extension interacts with ARB_draw_indirect and 525bd8deadSopenharmony_ci NV_vertex_buffer_unified_memory. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci This extension interacts with OVR_multiview 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciOverview 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci This extension provides a new mechanism allowing applications to use two 605bd8deadSopenharmony_ci new programmable shader types -- the task and mesh shader -- to generate 615bd8deadSopenharmony_ci collections of geometric primitives to be processed by fixed-function 625bd8deadSopenharmony_ci primitive assembly and rasterization logic. When the task and mesh 635bd8deadSopenharmony_ci shaders are drawn, they replace the standard programmable vertex 645bd8deadSopenharmony_ci processing pipeline, including vertex array attribute fetching, vertex 655bd8deadSopenharmony_ci shader processing, tessellation, and the geometry shader processing. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ciNew Procedures and Functions 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci void DrawMeshTasksNV(uint first, uint count); 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci void DrawMeshTasksIndirectNV(intptr indirect); 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci void MultiDrawMeshTasksIndirectNV(intptr indirect, 745bd8deadSopenharmony_ci sizei drawcount, 755bd8deadSopenharmony_ci sizei stride); 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci void MultiDrawMeshTasksIndirectCountNV( intptr indirect, 785bd8deadSopenharmony_ci intptr drawcount, 795bd8deadSopenharmony_ci sizei maxdrawcount, 805bd8deadSopenharmony_ci sizei stride); 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ciNew Tokens 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci Accepted by the <type> parameter of CreateShader and returned by the 855bd8deadSopenharmony_ci <params> parameter of GetShaderiv: 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci MESH_SHADER_NV 0x9559 885bd8deadSopenharmony_ci TASK_SHADER_NV 0x955A 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, GetFloatv, 915bd8deadSopenharmony_ci GetDoublev and GetInteger64v: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci MAX_MESH_UNIFORM_BLOCKS_NV 0x8E60 945bd8deadSopenharmony_ci MAX_MESH_TEXTURE_IMAGE_UNITS_NV 0x8E61 955bd8deadSopenharmony_ci MAX_MESH_IMAGE_UNIFORMS_NV 0x8E62 965bd8deadSopenharmony_ci MAX_MESH_UNIFORM_COMPONENTS_NV 0x8E63 975bd8deadSopenharmony_ci MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV 0x8E64 985bd8deadSopenharmony_ci MAX_MESH_ATOMIC_COUNTERS_NV 0x8E65 995bd8deadSopenharmony_ci MAX_MESH_SHADER_STORAGE_BLOCKS_NV 0x8E66 1005bd8deadSopenharmony_ci MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV 0x8E67 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci MAX_TASK_UNIFORM_BLOCKS_NV 0x8E68 1035bd8deadSopenharmony_ci MAX_TASK_TEXTURE_IMAGE_UNITS_NV 0x8E69 1045bd8deadSopenharmony_ci MAX_TASK_IMAGE_UNIFORMS_NV 0x8E6A 1055bd8deadSopenharmony_ci MAX_TASK_UNIFORM_COMPONENTS_NV 0x8E6B 1065bd8deadSopenharmony_ci MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV 0x8E6C 1075bd8deadSopenharmony_ci MAX_TASK_ATOMIC_COUNTERS_NV 0x8E6D 1085bd8deadSopenharmony_ci MAX_TASK_SHADER_STORAGE_BLOCKS_NV 0x8E6E 1095bd8deadSopenharmony_ci MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV 0x8E6F 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci MAX_MESH_WORK_GROUP_INVOCATIONS_NV 0x95A2 1125bd8deadSopenharmony_ci MAX_TASK_WORK_GROUP_INVOCATIONS_NV 0x95A3 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci MAX_MESH_TOTAL_MEMORY_SIZE_NV 0x9536 1155bd8deadSopenharmony_ci MAX_TASK_TOTAL_MEMORY_SIZE_NV 0x9537 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci MAX_MESH_OUTPUT_VERTICES_NV 0x9538 1185bd8deadSopenharmony_ci MAX_MESH_OUTPUT_PRIMITIVES_NV 0x9539 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci MAX_TASK_OUTPUT_COUNT_NV 0x953A 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci MAX_DRAW_MESH_TASKS_COUNT_NV 0x953D 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci MAX_MESH_VIEWS_NV 0x9557 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 0x92DF 1275bd8deadSopenharmony_ci MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV 0x9543 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetIntegeri_v, GetBooleani_v, 1315bd8deadSopenharmony_ci GetFloati_v, GetDoublei_v and GetInteger64i_v: 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci MAX_MESH_WORK_GROUP_SIZE_NV 0x953B 1345bd8deadSopenharmony_ci MAX_TASK_WORK_GROUP_SIZE_NV 0x953C 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramiv: 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci MESH_WORK_GROUP_SIZE_NV 0x953E 1405bd8deadSopenharmony_ci TASK_WORK_GROUP_SIZE_NV 0x953F 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci MESH_VERTICES_OUT_NV 0x9579 1435bd8deadSopenharmony_ci MESH_PRIMITIVES_OUT_NV 0x957A 1445bd8deadSopenharmony_ci MESH_OUTPUT_TYPE_NV 0x957B 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetActiveUniformBlockiv: 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C 1495bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E 1545bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci Accepted in the <props> array of GetProgramResourceiv: 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci REFERENCED_BY_MESH_SHADER_NV 0x95A0 1595bd8deadSopenharmony_ci REFERENCED_BY_TASK_SHADER_NV 0x95A1 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci Accepted by the <programInterface> parameter of GetProgramInterfaceiv, 1625bd8deadSopenharmony_ci GetProgramResourceIndex, GetProgramResourceName, GetProgramResourceiv, 1635bd8deadSopenharmony_ci GetProgramResourceLocation, and GetProgramResourceLocationIndex: 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci MESH_SUBROUTINE_NV 0x957C 1665bd8deadSopenharmony_ci TASK_SUBROUTINE_NV 0x957D 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci MESH_SUBROUTINE_UNIFORM_NV 0x957E 1695bd8deadSopenharmony_ci TASK_SUBROUTINE_UNIFORM_NV 0x957F 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci Accepted by the <stages> parameter of UseProgramStages: 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci MESH_SHADER_BIT_NV 0x00000040 1745bd8deadSopenharmony_ci TASK_SHADER_BIT_NV 0x00000080 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ciModifications to the OpenGL 4.5 Specification (Compatibility Profile) 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci Modify Chapter 3, Dataflow Model, p. 33 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci (insert at the end of the section after Figure 3.1, p. 35) 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci Figure 3.2 shows a block diagram of the alternate mesh processing pipeline 1835bd8deadSopenharmony_ci of GL. This pipeline produces a set of output primitives similar to the 1845bd8deadSopenharmony_ci primitives produced by the conventional GL vertex processing pipeline. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci Work on the mesh pipeline is initiated by the application drawing a 1875bd8deadSopenharmony_ci set of mesh tasks via an API command. If an optional task shader is 1885bd8deadSopenharmony_ci active, each task triggers the execution of a task shader work group that 1895bd8deadSopenharmony_ci will generate a new set of tasks upon completion. Each of these spawned 1905bd8deadSopenharmony_ci tasks, or each of the original drawn tasks if no task shader is 1915bd8deadSopenharmony_ci present, triggers the execution of a mesh shader work group that produces 1925bd8deadSopenharmony_ci an output mesh with a variable-sized number of primitives assembled from 1935bd8deadSopenharmony_ci vertices in the output mesh. The primitives from these output meshes are 1945bd8deadSopenharmony_ci processed by the rasterization, fragment shader, per-fragment-operations, 1955bd8deadSopenharmony_ci and framebuffer pipeline stages in the same manner as primitives produced 1965bd8deadSopenharmony_ci from draw calls sent to the conventional vertex processing pipeline 1975bd8deadSopenharmony_ci depicted in Figure 3.1. 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci Conventional From Application 2005bd8deadSopenharmony_ci Vertex | 2015bd8deadSopenharmony_ci Pipeline v 2025bd8deadSopenharmony_ci Draw Mesh Tasks <----- Draw Indirect Buffer 2035bd8deadSopenharmony_ci (Fig 3.1) | 2045bd8deadSopenharmony_ci | +---+-----+ 2055bd8deadSopenharmony_ci | | | 2065bd8deadSopenharmony_ci | | | 2075bd8deadSopenharmony_ci | | Task Shader ---+ 2085bd8deadSopenharmony_ci | | | | 2095bd8deadSopenharmony_ci | | v | 2105bd8deadSopenharmony_ci | | Task Generation | Image Load/Store 2115bd8deadSopenharmony_ci | | | | Atomic Counter 2125bd8deadSopenharmony_ci | +---+-----+ |<--> Shader Storage 2135bd8deadSopenharmony_ci | | | Texture Fetch 2145bd8deadSopenharmony_ci | v | Uniform Block 2155bd8deadSopenharmony_ci | Mesh Shader ----------+ 2165bd8deadSopenharmony_ci | | | 2175bd8deadSopenharmony_ci +-------------> + | 2185bd8deadSopenharmony_ci | | 2195bd8deadSopenharmony_ci v | 2205bd8deadSopenharmony_ci Rasterization | 2215bd8deadSopenharmony_ci | | 2225bd8deadSopenharmony_ci v | 2235bd8deadSopenharmony_ci Fragment Shader ------+ 2245bd8deadSopenharmony_ci | 2255bd8deadSopenharmony_ci v 2265bd8deadSopenharmony_ci Per-Fragment Operations 2275bd8deadSopenharmony_ci | 2285bd8deadSopenharmony_ci v 2295bd8deadSopenharmony_ci Framebuffer 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci Figure 3.2, GL Mesh Processing Pipeline 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci Modify Chapter 7, Programs and Shaders, p. 84 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci (Change the sentence starting with "Shader stages including vertex shaders") 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci Shader stages including vertex shaders, tessellation control shaders, 2395bd8deadSopenharmony_ci tessellation evaluation shaders, geometry shaders, mesh shaders, task 2405bd8deadSopenharmony_ci shaders, fragment shaders, and compute shaders can be created, compiled, and 2415bd8deadSopenharmony_ci linked into program objects 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci (replace the sentence starting with "A single program 2445bd8deadSopenharmony_ci object can contain all of these shaders, or any subset thereof.") 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci Mesh and Task shaders affect the assembly of primitives from 2475bd8deadSopenharmony_ci groups of shader invocations (see chapter X). 2485bd8deadSopenharmony_ci A single program object cannot mix mesh and task shader stages 2495bd8deadSopenharmony_ci with vertex, tessellation or geometry shader stages. Furthermore 2505bd8deadSopenharmony_ci a task shader stage cannot be combined with a fragment shader stage 2515bd8deadSopenharmony_ci when the mesh shader stage is omitted. Other combinations as well 2525bd8deadSopenharmony_ci as their subsets are possible. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci Modify Section 7.1, Shader Objects, p. 85 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci (add following entries to table 7.1) 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci type | Shader Stage 2595bd8deadSopenharmony_ci =================|=============== 2605bd8deadSopenharmony_ci TASK_SHADER_NV | Task shader 2615bd8deadSopenharmony_ci MESH_SHADER_NV | Mesh shader 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci Modify Section 7.3, Program Objects, p.89 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ci (add to the list of reasons why LinkProgram can fail, p. 92) 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci * <program> contains objects to form either a mesh or task shader (see 2685bd8deadSopenharmony_ci chapter X), and 2695bd8deadSopenharmony_ci - the program also contains objects to form vertex, tessellation 2705bd8deadSopenharmony_ci control, tessellation evaluation, or geometry shaders. 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci * <program> contains objects to form a task shader (see chapter X), and 2735bd8deadSopenharmony_ci - the program is not separable and contains no objects to form a mesh 2745bd8deadSopenharmony_ci shader. 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci Modify Section 7.3.1 Program Interfaces, p.96 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci (add to the list starting with VERTEX_SUBROUTINE, after GEOMETRY_SUBROUTINE) 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci TASK_SUBROUTINE_NV, MESH_SUBROUTINE_NV, 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci (add to the list starting with VERTEX_SUBROUTINE_UNIFORM, after 2835bd8deadSopenharmony_ci GEOMETRY_SUBROUTINE_UNIFORM) 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci TASK_SUBROUTINE_UNIFORM_NV, MESH_SUBROUTINE_UNIFORM_NV, 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci (add to the list of errors for GetProgramInterfaceiv, p 102, 2885bd8deadSopenharmony_ci after GEOMETRY_SUBROUTINE_UNIFORM) 2895bd8deadSopenharmony_ci 2905bd8deadSopenharmony_ci TASK_SUBROUTINE_UNIFORM_NV, MESH_SUBROUTINE_UNIFORM_NV, 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ci (modify entries for table 7.2 for GetProgramResourceiv, p. 105) 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci Property | Supported Interfaces 2955bd8deadSopenharmony_ci ==================================|================================= 2965bd8deadSopenharmony_ci ARRAY_SIZE | ..., TASK_SUBROUTINE_UNIFORM_NV, 2975bd8deadSopenharmony_ci | MESH_SUBROUTINE_UNIFORM_NV 2985bd8deadSopenharmony_ci ----------------------------------|----------------------------- 2995bd8deadSopenharmony_ci NUM_COMPATIBLE_SUBROUTINES, | ..., TASK_SUBROUTINE_UNIFORM_NV, 3005bd8deadSopenharmony_ci COMPATIBLE_SUBROUTINES | MESH_SUBROUTINE_UNIFORM_NV 3015bd8deadSopenharmony_ci ----------------------------------|----------------------------- 3025bd8deadSopenharmony_ci LOCATION | 3035bd8deadSopenharmony_ci ----------------------------------|----------------------------- 3045bd8deadSopenharmony_ci REFERENCED_BY_VERTEX_SHADER, ... | ATOMIC_COUNTER_BUFFER, ... 3055bd8deadSopenharmony_ci REFERENCED_BY_TASK_SHADER_NV, | 3065bd8deadSopenharmony_ci REFERENCED_BY_MESH_SHADER_NV | 3075bd8deadSopenharmony_ci ----------------------------------|----------------------------- 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci (add to list of the sentence starting with "For the properties 3105bd8deadSopenharmony_ci REFERENCED_BY_VERTEX_SHADER", after REFERENCED_BY_GEOMETRY_SHADER, p. 108) 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci REFERENCED_BY_TASK_SHADER_NV, REFERENCED_BY_MESH_SHADER_NV 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci (for the description of GetProgramResourceLocation and 3155bd8deadSopenharmony_ci GetProgramResourceLocationIndex, add to the list of the sentence 3165bd8deadSopenharmony_ci starting with "For GetProgramResourceLocation, programInterface must 3175bd8deadSopenharmony_ci be one of UNIFORM,", after GEOMETRY_SUBROUTINE_UNIFORM, p. 114) 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci TASK_SUBROUTINE_UNIFORM_NV, MESH_SUBROUTINE_UNIFORM_NV, 3205bd8deadSopenharmony_ci 3215bd8deadSopenharmony_ci Modify Section 7.4, Program Pipeline Objects, p. 115 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci (modify the first paragraph, p. 118, to add new shader stage bits for mesh 3245bd8deadSopenharmony_ci and task shaders) 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci The bits set in <stages> indicate the program stages for which the program 3275bd8deadSopenharmony_ci object named by <program> becomes current. These stages may include 3285bd8deadSopenharmony_ci compute, vertex, tessellation control, tessellation evaluation, geometry, 3295bd8deadSopenharmony_ci fragment, mesh, and task shaders, indicated respectively by 3305bd8deadSopenharmony_ci COMPUTE_SHADER_BIT, VERTEX_SHADER_BIT, TESS_CONTROL_SHADER_BIT, 3315bd8deadSopenharmony_ci TESS_EVALUATION_SHADER_BIT, GEOMETRY_SHADER_BIT, FRAGMENT_SHADER_BIT, 3325bd8deadSopenharmony_ci MESH_SHADER_BIT_NV, and TASK_SHADER_BIT_NV, respectively. The constant 3335bd8deadSopenharmony_ci ALL_SHADER_BITS indicates <program> is to be made current for all shader 3345bd8deadSopenharmony_ci stages. 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci (modify the first error in "Errors" for UseProgramStages, p. 118 to allow 3375bd8deadSopenharmony_ci the use of mesh and task shader bits) 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci An INVALID_VALUE error is generated if stages is not the special value 3405bd8deadSopenharmony_ci ALL_SHADER_BITS, and has any bits set other than VERTEX_SHADER_BIT, 3415bd8deadSopenharmony_ci COMPUTE_SHADER_BIT, TESS_CONTROL_SHADER_BIT, TESS_EVALUATION_SHADER_BIT, 3425bd8deadSopenharmony_ci GEOMETRY_SHADER_BIT, FRAGMENT_SHADER_BIT, MESH_SHADER_BIT_NV, and 3435bd8deadSopenharmony_ci TASK_SHADER_BIT_NV. 3445bd8deadSopenharmony_ci 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci Modify Section 7.6, Uniform Variables, p. 125 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci (add entries to table 7.4, p. 126) 3495bd8deadSopenharmony_ci 3505bd8deadSopenharmony_ci Shader Stage | pname for querying default uniform 3515bd8deadSopenharmony_ci | block storage, in components 3525bd8deadSopenharmony_ci =====================|===================================== 3535bd8deadSopenharmony_ci Task (see chapter X) | MAX_TASK_UNIFORM_COMPONENTS_NV 3545bd8deadSopenharmony_ci Mesh (see chapter X) | MAX_MESH_UNIFORM_COMPONENTS_NV 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci (add entries to table 7.5, p. 127) 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci Shader Stage | pname for querying combined uniform 3595bd8deadSopenharmony_ci | block storage, in components 3605bd8deadSopenharmony_ci =====================|======================================== 3615bd8deadSopenharmony_ci Task (see chapter X) | MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV 3625bd8deadSopenharmony_ci Mesh (see chapter X) | MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci (add entries to table 7.7, p. 131) 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci pname | prop 3675bd8deadSopenharmony_ci ===========================================|============================= 3685bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV | REFERENCED_BY_TASK_SHADER_NV 3695bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV | REFERENCED_BY_MESH_SHADER_NV 3705bd8deadSopenharmony_ci 3715bd8deadSopenharmony_ci (add entries to table 7.8, p. 132) 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci pname | prop 3745bd8deadSopenharmony_ci ===========================================|============================= 3755bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER_REFERENCED_- | REFERENCED_BY_TASK_SHADER_NV 3765bd8deadSopenharmony_ci BY_TASK_SHADER_NV | 3775bd8deadSopenharmony_ci -------------------------------------------|----------------------------- 3785bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER_REFERENCED_- | REFERENCED_BY_MESH_SHADER_NV 3795bd8deadSopenharmony_ci BY_MESH_SHADER_NV | 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ci (modify the sentence starting with "The limits for vertex" in 7.6.2 3825bd8deadSopenharmony_ci Uniform Blocks, p. 136) 3835bd8deadSopenharmony_ci ... geometry, task, mesh, fragment... 3845bd8deadSopenharmony_ci MAX_GEOMETRY_UNIFORM_BLOCKS, MAX_TASK_UNIFORM_BLOCKS_NV, MAX_MESH_UNIFORM_- 3855bd8deadSopenharmony_ci BLOCKS_NV, MAX_FRAGMENT_UNIFORM_BLOCKS... 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci (modify the sentence starting with "The limits for vertex", in 3885bd8deadSopenharmony_ci 7.7 Atomic Counter Buffers, p. 141) 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci ... geometry, task, mesh, fragment... 3915bd8deadSopenharmony_ci MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS, MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV, 3925bd8deadSopenharmony_ci MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV, MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS, ... 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci Modify Section 7.8 Shader Buffer Variables and Shader Storage Blocks, p. 142 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci (modify the sentences starting with "The limits for vertex", p. 143) 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci ... geometry, task, mesh, fragment... 4005bd8deadSopenharmony_ci MAX_GEOMETRY_SHADER_STORAGE_BLOCKS, MAX_TASK_SHADER_STORAGE_BLOCKS_NV, 4015bd8deadSopenharmony_ci MAX_MESH_SHADER_STORAGE_BLOCKS_NV, MAX_FRAGMENT_SHADER_STORAGE_BLOCKS,... 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci Modify Section 7.9 Subroutine Uniform Variables, p. 144 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci (modify table 7.9, p. 145) 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci Interface | Shader Type 4085bd8deadSopenharmony_ci ====================|=============== 4095bd8deadSopenharmony_ci TASK_SUBROUTINE_NV | TASK_SHADER_NV 4105bd8deadSopenharmony_ci MESH_SUBROUTINE_NV | MESH_SHADER_NV 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci (modify table 7.10, p. 146) 4135bd8deadSopenharmony_ci 4145bd8deadSopenharmony_ci Interface | Shader Type 4155bd8deadSopenharmony_ci ============================|=============== 4165bd8deadSopenharmony_ci TASK_SUBROUTINE_UNIFORM_NV | TASK_SHADER_NV 4175bd8deadSopenharmony_ci MESH_SUBROUTINE_UNIFORM_NV | MESH_SHADER_NV 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ci Modify Section 7.13 Shader, Program, and Program Pipeline Queries, p. 157 4215bd8deadSopenharmony_ci 4225bd8deadSopenharmony_ci (add to the list of queries for GetProgramiv, p. 157) 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci If <pname> is TASK_WORK_GROUP_SIZE_NV, an array of three integers 4255bd8deadSopenharmony_ci containing the local work group size of the task shader 4265bd8deadSopenharmony_ci (see chapter X), as specified by its input layout qualifier(s), is returned. 4275bd8deadSopenharmony_ci If <pname> is MESH_WORK_GROUP_SIZE_NV, an array of three integers 4285bd8deadSopenharmony_ci containing the local work group size of the mesh shader 4295bd8deadSopenharmony_ci (see chapter X), as specified by its input layout qualifier(s), is returned. 4305bd8deadSopenharmony_ci If <pname> is MESH_VERTICES_OUT_NV, the maximum number of vertices the 4315bd8deadSopenharmony_ci mesh shader (see chapter X) will output is returned. 4325bd8deadSopenharmony_ci If <pname> is MESH_PRIMITIVES_OUT_NV, the maximum number of primitives 4335bd8deadSopenharmony_ci the mesh shader (see chapter X) will output is returned. 4345bd8deadSopenharmony_ci If <pname> is MESH_OUTPUT_TYPE_NV, the mesh shader output type, 4355bd8deadSopenharmony_ci which must be one of POINTS, LINES or TRIANGLES, is returned. 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ci (add to the list of errors for GetProgramiv, p. 159) 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if TASK_WORK_- 4405bd8deadSopenharmony_ci GROUP_SIZE is queried for a program which has not been linked successfully, 4415bd8deadSopenharmony_ci or which does not contain objects to form a task shader. 4425bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if MESH_VERTICES_OUT_NV, 4435bd8deadSopenharmony_ci MESH_PRIMITIVES_OUT_NV, MESH_OUTPUT_TYPE_NV, or MESH_WORK_GROUP_SIZE_NV 4445bd8deadSopenharmony_ci are queried for a program which has not been linked 4455bd8deadSopenharmony_ci successfully, or which does not contain objects to form a mesh shader. 4465bd8deadSopenharmony_ci 4475bd8deadSopenharmony_ci 4485bd8deadSopenharmony_ci Add new language extending the edits to Section 9.2.8 (Attaching Textures 4495bd8deadSopenharmony_ci to a Framebuffer) from the OVR_multiview extension that describe how 4505bd8deadSopenharmony_ci various drawing commands are processed for when multiview rendering is 4515bd8deadSopenharmony_ci enabled: 4525bd8deadSopenharmony_ci 4535bd8deadSopenharmony_ci When multiview rendering is enabled, the DrawMeshTasks* commands (section 4545bd8deadSopenharmony_ci X.6) will not spawn separate task and mesh shader invocations for each 4555bd8deadSopenharmony_ci view. Instead, the primitives produced by each mesh shader local work 4565bd8deadSopenharmony_ci group will be processed separately for each view. For per-vertex and 4575bd8deadSopenharmony_ci per-primitive mesh shader outputs not qualified with "perviewNV", the 4585bd8deadSopenharmony_ci single value written for each vertex or primitive will be used for the 4595bd8deadSopenharmony_ci output when processing each view. For mesh shader outputs qualified with 4605bd8deadSopenharmony_ci "perviewNV", the output is arrayed and the mesh shader is responsible for 4615bd8deadSopenharmony_ci writing separate values for each view. When processing output primitives 4625bd8deadSopenharmony_ci for a view numbered <V>, outputs qualified with "perviewNV" will assume 4635bd8deadSopenharmony_ci the values for array element <V>. 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci Modify Section 10.3.11 Indirect Commands in Buffer Objects, p. 400 4675bd8deadSopenharmony_ci 4685bd8deadSopenharmony_ci (after "and to DispatchComputeIndirect (see section 19)" add) 4695bd8deadSopenharmony_ci 4705bd8deadSopenharmony_ci and to DrawMeshTasksIndirectNV, MultiDrawMeshTasksIndirectNV, 4715bd8deadSopenharmony_ci MultiDrawMeshTasksIndirectCountNV (see chapter X) 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci (add following entries to the table 10.7) 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci Indirect Command Name | Indirect Buffer target 4765bd8deadSopenharmony_ci ====================================|======================== 4775bd8deadSopenharmony_ci DrawMeshTasksIndirectNV | DRAW_INDIRECT_BUFFER 4785bd8deadSopenharmony_ci MultiDrawMeshTasksIndirectNV | DRAW_INDIRECT_BUFFER 4795bd8deadSopenharmony_ci MultiDrawMeshTasksIndirectCountNV | DRAW_INDIRECT_BUFFER 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci 4825bd8deadSopenharmony_ci Modify Section 11.1.3 Shader Execution, p. 437 4835bd8deadSopenharmony_ci 4845bd8deadSopenharmony_ci (add after the first paragraph in section 11.1.3, p 437) 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci If there is an active program object present for the task or 4875bd8deadSopenharmony_ci mesh shader stages, the executable code for these 4885bd8deadSopenharmony_ci active programs is used to process incoming work groups (see 4895bd8deadSopenharmony_ci chapter X). 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci (add to the list of constants, 11.1.3.5 Texture Access, p. 441) 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci * MAX_TASK_TEXTURE_IMAGE_UNITS_NV (for task shaders) 4945bd8deadSopenharmony_ci 4955bd8deadSopenharmony_ci * MAX_MESH_TEXTURE_IMAGE_UNITS_NV (for mesh shaders) 4965bd8deadSopenharmony_ci 4975bd8deadSopenharmony_ci (add to the list of constants, 11.1.3.6 Atomic Counter Access, p. 443) 4985bd8deadSopenharmony_ci 4995bd8deadSopenharmony_ci * MAX_TASK_ATOMIC_COUNTERS_NV (for task shaders) 5005bd8deadSopenharmony_ci 5015bd8deadSopenharmony_ci * MAX_MESH_ATOMIC_COUNTERS_NV (for mesh shaders) 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci (add to the list of constants, 11.1.3.7 Image Access, p. 444) 5045bd8deadSopenharmony_ci 5055bd8deadSopenharmony_ci * MAX_TASK_IMAGE_UNIFORMS_NV (for task shaders) 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci * MAX_MESH_IMAGE_UNIFORMS_NV (for mesh shaders) 5085bd8deadSopenharmony_ci 5095bd8deadSopenharmony_ci (add to the list of constants, 11.1.3.8 Shader Storage Buffer Access, 5105bd8deadSopenharmony_ci p. 444) 5115bd8deadSopenharmony_ci 5125bd8deadSopenharmony_ci * MAX_TASK_SHADER_STORAGE_BLOCKS_NV (for task shaders) 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci * MAX_MESH_SHADER_STORAGE_BLOCKS_NV (for mesh shaders) 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci (modify the sentence of 11.3.10 Shader Outputs, p. 445) 5175bd8deadSopenharmony_ci 5185bd8deadSopenharmony_ci A vertex and mesh shader can write to ... 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci Insert a new chapter X before Chapter 13, Fixed-Function Vertex 5235bd8deadSopenharmony_ci Post-Processing, p. 505 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci Chapter X, Programmable Mesh Processing 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci In addition to the programmable vertex processing pipeline described in 5285bd8deadSopenharmony_ci Chapters 10 and 11 [[compatibility profile only: and the fixed-function 5295bd8deadSopenharmony_ci vertex processing pipeline in Chapter 12]], applications may use the mesh 5305bd8deadSopenharmony_ci pipeline to generate primitives for rasterization. The mesh pipeline 5315bd8deadSopenharmony_ci generates a collection of meshes using the programmable task and mesh 5325bd8deadSopenharmony_ci shaders. Task and mesh shaders are created as described in section 7.1 5335bd8deadSopenharmony_ci using a type parameter of TASK_SHADER_NV and MESH_SHADER_NV, respectively. 5345bd8deadSopenharmony_ci They are attached to and used in program objects as described in section 5355bd8deadSopenharmony_ci 7.3. 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci Mesh and task shader workloads are formed from groups of work items called 5385bd8deadSopenharmony_ci work groups and processed by the executable code for a mesh or task shader 5395bd8deadSopenharmony_ci program. A work group is a collection of shader invocations that execute 5405bd8deadSopenharmony_ci the same code, potentially in parallel. An invocation within a work group 5415bd8deadSopenharmony_ci may share data with other members of the same work group through shared 5425bd8deadSopenharmony_ci variables (see section 4.3.8, "Shared Variables", of the OpenGL Shading 5435bd8deadSopenharmony_ci Language Specification) and issue memory and control barriers to 5445bd8deadSopenharmony_ci synchronize with other members of the same work group. 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci X.1 Task Shader Variables 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci Task shaders can access uniform variables belonging to the current 5495bd8deadSopenharmony_ci program object. Limits on uniform storage and methods for manipulating 5505bd8deadSopenharmony_ci uniforms are described in section 7.6. 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci There is a limit to the total amount of memory consumed by output 5535bd8deadSopenharmony_ci variables in a single task shader work group. This limit, expressed in 5545bd8deadSopenharmony_ci basic machine units, may be queried by calling GetIntegerv with the value 5555bd8deadSopenharmony_ci MAX_TASK_TOTAL_MEMORY_SIZE_NV. 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci X.2 Task Shader Outputs 5585bd8deadSopenharmony_ci 5595bd8deadSopenharmony_ci Each task shader work group can define how many mesh work groups 5605bd8deadSopenharmony_ci should be generated by writing to gl_TaskCountNV. The maximum 5615bd8deadSopenharmony_ci number can be queried by GetIntergev using MAX_TASK_OUTPUT_COUNT_NV. 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ci Furthermore the task work group can output data (qualified with "taskNV") 5645bd8deadSopenharmony_ci that can be accessed by to the generated mesh work groups. 5655bd8deadSopenharmony_ci 5665bd8deadSopenharmony_ci X.3 Mesh Shader Variables 5675bd8deadSopenharmony_ci 5685bd8deadSopenharmony_ci Mesh shaders can access uniform variables belonging to the current 5695bd8deadSopenharmony_ci program object. Limits on uniform storage and methods for manipulating 5705bd8deadSopenharmony_ci uniforms are described in section 7.6. 5715bd8deadSopenharmony_ci There is a limit to the total size of all variables declared as shared 5725bd8deadSopenharmony_ci as well as output attributes in a single mesh stage. This limit, expressed 5735bd8deadSopenharmony_ci in units of basic machine units, may be queried as the value of 5745bd8deadSopenharmony_ci MAX_MESH_TOTAL_MEMORY_SIZE_NV. 5755bd8deadSopenharmony_ci 5765bd8deadSopenharmony_ci X.4 Mesh Shader Inputs 5775bd8deadSopenharmony_ci 5785bd8deadSopenharmony_ci When each mesh shader work group runs, its invocations have access to 5795bd8deadSopenharmony_ci built-in variables describing the work group and invocation and also the 5805bd8deadSopenharmony_ci task shader outputs (qualified with "taskNV") written the task shader that 5815bd8deadSopenharmony_ci generated the work group. When no task shader is active, the mesh shader 5825bd8deadSopenharmony_ci has no access to task shader outputs. 5835bd8deadSopenharmony_ci 5845bd8deadSopenharmony_ci X.5 Mesh Shader Outputs 5855bd8deadSopenharmony_ci 5865bd8deadSopenharmony_ci When each mesh shader work group completes, it emits an output mesh 5875bd8deadSopenharmony_ci consisting of 5885bd8deadSopenharmony_ci 5895bd8deadSopenharmony_ci * a primitive count, written to the built-in output gl_PrimitiveCountNV; 5905bd8deadSopenharmony_ci 5915bd8deadSopenharmony_ci * a collection of vertex attributes, where each vertex in the mesh has a 5925bd8deadSopenharmony_ci set of built-in and user-defined per-vertex output variables and blocks; 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci * a collection of per-primitive attributes, where each of the 5955bd8deadSopenharmony_ci gl_PrimitiveCountNV primitives in the mesh has a set of built-in and 5965bd8deadSopenharmony_ci user-defined per-primitive output variables and blocks; and 5975bd8deadSopenharmony_ci 5985bd8deadSopenharmony_ci * an array of vertex index values written to the built-in output array 5995bd8deadSopenharmony_ci gl_PrimitiveIndicesNV, where each output primitive has a set of one, 6005bd8deadSopenharmony_ci two, or three indices that identify the output vertices in the mesh used 6015bd8deadSopenharmony_ci to form the primitive. 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci This data is used to generate primitives of one of three types. The 6045bd8deadSopenharmony_ci supported output primitive types are points (POINTS), lines (LINES), and 6055bd8deadSopenharmony_ci triangles (TRIANGLES). The vertices output by the mesh shader are assembled 6065bd8deadSopenharmony_ci into points, lines, or triangles based on the output primitive type in the 6075bd8deadSopenharmony_ci DrawElements manner described in section 10.4, with the 6085bd8deadSopenharmony_ci gl_PrimitiveIndicesNV array content serving as index values, and the 6095bd8deadSopenharmony_ci local vertex attribute arrays as vertex arrays. 6105bd8deadSopenharmony_ci 6115bd8deadSopenharmony_ci The output arrays are sized depending on the compile-time provided 6125bd8deadSopenharmony_ci values ("max_vertices" and "max_primitives"), which must be below 6135bd8deadSopenharmony_ci their appropriate maxima that can be queried via GetIntegerv and 6145bd8deadSopenharmony_ci MAX_MESH_OUTPUT_PRIMITIVES_NV as well as MAX_MESH_OUTPUT_VERTICES_NV. 6155bd8deadSopenharmony_ci 6165bd8deadSopenharmony_ci The output attributes are allocated at an implementation-dependent 6175bd8deadSopenharmony_ci granularity that can be queried via MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 6185bd8deadSopenharmony_ci and MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV. The total amount of memory 6195bd8deadSopenharmony_ci consumed for per-vertex and per-primitive output variables must not exceed 6205bd8deadSopenharmony_ci an implementation-dependent total memory limit that can be queried by 6215bd8deadSopenharmony_ci calling GetIntegerv with the enum MAX_MESH_TOTAL_MEMORY_SIZE_NV. The 6225bd8deadSopenharmony_ci memory consumed by the gl_PrimitiveIndicesNV[] array does not count 6235bd8deadSopenharmony_ci against this limit. 6245bd8deadSopenharmony_ci 6255bd8deadSopenharmony_ci X.6 Mesh Tasks Drawing Commands 6265bd8deadSopenharmony_ci 6275bd8deadSopenharmony_ci One or more work groups is launched by calling 6285bd8deadSopenharmony_ci 6295bd8deadSopenharmony_ci void DrawMeshTasksNV( uint first, uint count ); 6305bd8deadSopenharmony_ci 6315bd8deadSopenharmony_ci If there is an active program object for the task shader stage, 6325bd8deadSopenharmony_ci <count> work groups are processed by the active program for the task 6335bd8deadSopenharmony_ci shader stage. If there is no active program object for the task shader 6345bd8deadSopenharmony_ci stage, <count> work groups are instead processed by the active 6355bd8deadSopenharmony_ci program for the mesh shader stage. The active program for both shader 6365bd8deadSopenharmony_ci stages will be determined in the same manner as the active program for other 6375bd8deadSopenharmony_ci pipeline stages, as described in section 7.3. While the individual shader 6385bd8deadSopenharmony_ci invocations within a work group are executed as a unit, work groups are 6395bd8deadSopenharmony_ci executed completely independently and in unspecified order. 6405bd8deadSopenharmony_ci The x component of gl_WorkGroupID of the first active stage will be within 6415bd8deadSopenharmony_ci the range of [<first> , <first + count - 1>]. The y and z component of 6425bd8deadSopenharmony_ci gl_WorkGroupID within all stages will be set to zero. 6435bd8deadSopenharmony_ci 6445bd8deadSopenharmony_ci The maximum number of task or mesh shader work groups that 6455bd8deadSopenharmony_ci may be dispatched at one time may be determined by calling GetIntegerv 6465bd8deadSopenharmony_ci with <target> set to MAX_DRAW_MESH_TASKS_COUNT_NV. 6475bd8deadSopenharmony_ci 6485bd8deadSopenharmony_ci The local work size in each dimension is specified at compile time using 6495bd8deadSopenharmony_ci an input layout qualifier in one or more of the task or mesh shaders 6505bd8deadSopenharmony_ci attached to the program; see the OpenGL Shading Language Specification for 6515bd8deadSopenharmony_ci more information. After the program has been linked, the local work group 6525bd8deadSopenharmony_ci size of the task or mesh shader may be queried by calling GetProgramiv 6535bd8deadSopenharmony_ci with <pname> set to TASK_WORK_GROUP_SIZE_NV or MESH_WORK_GROUP_SIZE_NV, as 6545bd8deadSopenharmony_ci described in section 7.13. 6555bd8deadSopenharmony_ci 6565bd8deadSopenharmony_ci The maximum size of a task or mesh shader local work group may be 6575bd8deadSopenharmony_ci determined by calling GetIntegeri_v with <target> set to 6585bd8deadSopenharmony_ci MAX_TASK_WORK_GROUP_SIZE_NV or MAX_MESH_WORK_GROUP_SIZE_NV, and <index> 6595bd8deadSopenharmony_ci set to 0, 1, or 2 to retrieve the maximum work size in the X, Y and Z 6605bd8deadSopenharmony_ci dimension, respectively. Furthermore, the maximum number of invocations 6615bd8deadSopenharmony_ci in a single local work group (i.e., the product of the three dimensions) 6625bd8deadSopenharmony_ci may be determined by calling GetIntegerv with pname set to 6635bd8deadSopenharmony_ci MAX_TASK_WORK_GROUP_INVOCATIONS_NV or MAX_MESH_WORK_GROUP_INVOCATIONS_NV. 6645bd8deadSopenharmony_ci 6655bd8deadSopenharmony_ci Errors 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if there is no active 6685bd8deadSopenharmony_ci program for the mesh shader stage. 6695bd8deadSopenharmony_ci 6705bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <count> exceeds 6715bd8deadSopenharmony_ci MAX_DRAW_MESH_TASKS_COUNT_NV. 6725bd8deadSopenharmony_ci 6735bd8deadSopenharmony_ci 6745bd8deadSopenharmony_ci If there is an active program on the task shader stage, each task shader 6755bd8deadSopenharmony_ci work group writes a task count to the built-in task shader output 6765bd8deadSopenharmony_ci gl_TaskCountNV. If this count is non-zero upon completion of the task 6775bd8deadSopenharmony_ci shader, then gl_TaskCountNV work groups are generated and processed by the 6785bd8deadSopenharmony_ci active program for the mesh shader stage. If this count is zero, no work 6795bd8deadSopenharmony_ci groups are generated. If the count is greater than MAX_TASK_OUTPUT_COUNT_NV 6805bd8deadSopenharmony_ci the number of mesh shader work groups generated is undefined. 6815bd8deadSopenharmony_ci The built-in variables available to the generated mesh shader work groups 6825bd8deadSopenharmony_ci are identical to those that would be generated if DrawMeshTasksNV were 6835bd8deadSopenharmony_ci called with no task shader active and with a <count> of gl_TaskCountNV. 6845bd8deadSopenharmony_ci 6855bd8deadSopenharmony_ci The primitives of the mesh are then processed by the pipeline stages 6865bd8deadSopenharmony_ci described in subsequent chapters in the same manner as primitives produced 6875bd8deadSopenharmony_ci by the conventional vertex processing pipeline described in previous 6885bd8deadSopenharmony_ci chapters. 6895bd8deadSopenharmony_ci 6905bd8deadSopenharmony_ci The command 6915bd8deadSopenharmony_ci 6925bd8deadSopenharmony_ci void DrawMeshTasksIndirectNV(intptr indirect); 6935bd8deadSopenharmony_ci 6945bd8deadSopenharmony_ci typedef struct { 6955bd8deadSopenharmony_ci uint count; 6965bd8deadSopenharmony_ci uint first; 6975bd8deadSopenharmony_ci } DrawMeshTasksIndirectCommandNV; 6985bd8deadSopenharmony_ci 6995bd8deadSopenharmony_ci is equivalent to calling DrawMeshTasksNV with the parameters sourced from a 7005bd8deadSopenharmony_ci a DrawMeshTasksIndirectCommandNV struct stored in the buffer currently 7015bd8deadSopenharmony_ci bound to the DRAW_INDIRECT_BUFFER binding at an offset, in basic machine 7025bd8deadSopenharmony_ci units, specified by <indirect>. If the <count> read from the indirect 7035bd8deadSopenharmony_ci draw buffer is greater than MAX_DRAW_MESH_TASKS_COUNT_NV, then the results 7045bd8deadSopenharmony_ci of this command are undefined. 7055bd8deadSopenharmony_ci 7065bd8deadSopenharmony_ci Errors 7075bd8deadSopenharmony_ci 7085bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if there is no active program 7095bd8deadSopenharmony_ci for the mesh shader stage. 7105bd8deadSopenharmony_ci 7115bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <indirect> is negative or is 7125bd8deadSopenharmony_ci not a multiple of the size, in basic machine units, of uint. 7135bd8deadSopenharmony_ci 7145bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the command would source 7155bd8deadSopenharmony_ci data beyond the end of the buffer object. 7165bd8deadSopenharmony_ci 7175bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if zero is bound to the 7185bd8deadSopenharmony_ci DRAW_INDIRECT_BUFFER binding. 7195bd8deadSopenharmony_ci 7205bd8deadSopenharmony_ci The command 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci void MultiDrawMeshTasksIndirectNV(intptr indirect, 7235bd8deadSopenharmony_ci sizei drawcount, 7245bd8deadSopenharmony_ci sizei stride); 7255bd8deadSopenharmony_ci 7265bd8deadSopenharmony_ci behaves identically to DrawMeshTasksIndirectNV, except that <indirect> is 7275bd8deadSopenharmony_ci treated as an array of <drawcount> DrawMeshTasksIndirectCommandNV 7285bd8deadSopenharmony_ci structures. <indirect> contains the offset of the first element of the 7295bd8deadSopenharmony_ci array within the buffer currently bound to the DRAW_INDIRECT buffer 7305bd8deadSopenharmony_ci binding. <stride> specifies the distance, in basic machine units, between 7315bd8deadSopenharmony_ci the elements of the array. If <stride> is zero, the array elements are 7325bd8deadSopenharmony_ci treated as tightly packed. <stride> must be a multiple of four, otherwise 7335bd8deadSopenharmony_ci an INVALID_VALUE error is generated. 7345bd8deadSopenharmony_ci 7355bd8deadSopenharmony_ci <drawcount> must be positive, otherwise an INVALID_VALUE error will be 7365bd8deadSopenharmony_ci generated. 7375bd8deadSopenharmony_ci 7385bd8deadSopenharmony_ci Errors 7395bd8deadSopenharmony_ci 7405bd8deadSopenharmony_ci In addition to errors that would be generated by 7415bd8deadSopenharmony_ci DrawMeshTasksIndirect: 7425bd8deadSopenharmony_ci 7435bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <stride> is neither zero nor a 7445bd8deadSopenharmony_ci multiple of four. 7455bd8deadSopenharmony_ci 7465bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <stride> is non-zero and less 7475bd8deadSopenharmony_ci than the size of DrawMeshTasksIndirectCommandNV. 7485bd8deadSopenharmony_ci 7495bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <drawcount> is not positive. 7505bd8deadSopenharmony_ci 7515bd8deadSopenharmony_ci The command 7525bd8deadSopenharmony_ci 7535bd8deadSopenharmony_ci void MultiDrawMeshTasksIndirectCountNV( intptr indirect, 7545bd8deadSopenharmony_ci intptr drawcount, 7555bd8deadSopenharmony_ci sizei maxdrawcount, 7565bd8deadSopenharmony_ci sizei stride); 7575bd8deadSopenharmony_ci 7585bd8deadSopenharmony_ci behaves similarly to MultiDrawMeshTasksIndirectNV, except that <drawcount> 7595bd8deadSopenharmony_ci defines an offset (in bytes) into the buffer object bound to the 7605bd8deadSopenharmony_ci PARAMETER_BUFFER_ARB binding point at which a single <sizei> typed value 7615bd8deadSopenharmony_ci is stored, which contains the draw count. <maxdrawcount> specifies the 7625bd8deadSopenharmony_ci maximum number of draws that are expected to be stored in the buffer. 7635bd8deadSopenharmony_ci If the value stored at <drawcount> into the buffer is greater than 7645bd8deadSopenharmony_ci <maxdrawcount>, an implementation stop processing draws after 7655bd8deadSopenharmony_ci <maxdrawcount> parameter sets. 7665bd8deadSopenharmony_ci 7675bd8deadSopenharmony_ci Errors 7685bd8deadSopenharmony_ci 7695bd8deadSopenharmony_ci In addition to errors that would be generated by 7705bd8deadSopenharmony_ci MultiDrawMeshTasksIndirectNV: 7715bd8deadSopenharmony_ci 7725bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if no buffer is bound to the 7735bd8deadSopenharmony_ci PARAMETER_BUFFER binding point. 7745bd8deadSopenharmony_ci 7755bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <drawcount> (the offset of the 7765bd8deadSopenharmony_ci memory holding the actual draw count) is not a multiple of four. 7775bd8deadSopenharmony_ci 7785bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if reading a sizei typed value 7795bd8deadSopenharmony_ci from the buffer bound to the PARAMETER_BUFFER target at the offset 7805bd8deadSopenharmony_ci specified by drawcount would result in an out-of-bounds access. 7815bd8deadSopenharmony_ci 7825bd8deadSopenharmony_ci 7835bd8deadSopenharmony_ciNew Implementation Dependent State 7845bd8deadSopenharmony_ci 7855bd8deadSopenharmony_ci Add to Table 23.43, "Program Object State" 7865bd8deadSopenharmony_ci 7875bd8deadSopenharmony_ci +----------------------------------------------------+-----------+-------------------------+---------------+--------------------------------------------------------+---------+ 7885bd8deadSopenharmony_ci | Get Value | Type | Get Command | Initial Value | Description | Sec. | 7895bd8deadSopenharmony_ci +----------------------------------------------------+-----------+-------------------------+---------------+--------------------------------------------------------+---------+ 7905bd8deadSopenharmony_ci | TASK_WORK_GROUP_SIZE_NV | 3 x Z+ | GetProgramiv | { 0, ... } | Local work size of a linked mesh stage | 7.13 | 7915bd8deadSopenharmony_ci | MESH_WORK_GROUP_SIZE_NV | 3 x Z+ | GetProgramiv | { 0, ... } | Local work size of a linked task stage | 7.13 | 7925bd8deadSopenharmony_ci | MESH_VERTICES_OUT_NV | Z+ | GetProgramiv | 0 | max_vertices size of a linked mesh stage | 7.13 | 7935bd8deadSopenharmony_ci | MESH_PRIMITIVES_OUT_NV | Z+ | GetProgramiv | 0 | max_primitives size of a linked mesh stage | 7.13 | 7945bd8deadSopenharmony_ci | MESH_OUTPUT_TYPE_NV | Z+ | GetProgramiv | POINTS | Primitive output type of a linked mesh stage | 7.13 | 7955bd8deadSopenharmony_ci | UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV | B | GetActiveUniformBlockiv | FALSE | True if uniform block is referenced by the task stage | 7.6.2 | 7965bd8deadSopenharmony_ci | UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV | B | GetActiveUniformBlockiv | FALSE | True if uniform block is referenced by the mesh stage | 7.6.2 | 7975bd8deadSopenharmony_ci | ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV | B | GetActiveAtomicCounter- | FALSE | AACB has a counter used by task shaders | 7.7 | 7985bd8deadSopenharmony_ci | | | Bufferiv | | | | 7995bd8deadSopenharmony_ci | ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV | B | GetActiveAtomicCounter- | FALSE | AACB has a counter used by mesh shaders | 7.7 | 8005bd8deadSopenharmony_ci | | | Bufferiv | | | | 8015bd8deadSopenharmony_ci +----------------------------------------------------+-----------+-------------------------+---------------+--------------------------------------------------------+---------+ 8025bd8deadSopenharmony_ci 8035bd8deadSopenharmony_ci Add to Table 23.53, "Program Object Resource State" 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ci +----------------------------------------------------+-----------+-------------------------+---------------+--------------------------------------------------------+---------+ 8065bd8deadSopenharmony_ci | Get Value | Type | Get Command | Initial Value | Description | Sec. | 8075bd8deadSopenharmony_ci +----------------------------------------------------+-----------+-------------------------+---------------+--------------------------------------------------------+---------+ 8085bd8deadSopenharmony_ci | REFERENCED_BY_TASK_SHADER_NV | Z+ | GetProgramResourceiv | - | Active resource used by task shader | 7.3.1 | 8095bd8deadSopenharmony_ci | REFERENCED_BY_MESH_SHADER_NV | Z+ | GetProgramResourceiv | - | Active resource used by mesh shader | 7.3.1 | 8105bd8deadSopenharmony_ci +----------------------------------------------------+-----------+-------------------------+---------------+--------------------------------------------------------+---------+ 8115bd8deadSopenharmony_ci 8125bd8deadSopenharmony_ci Add to Table 23.67, "Implementation Dependent Values" 8135bd8deadSopenharmony_ci 8145bd8deadSopenharmony_ci +------------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+--------+ 8155bd8deadSopenharmony_ci | Get Value | Type | Get Command | Minimum Value | Description | Sec. | 8165bd8deadSopenharmony_ci +------------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+--------+ 8175bd8deadSopenharmony_ci | MAX_DRAW_MESH_TASKS_COUNT_NV | Z+ | GetIntegerv | 2^16 - 1 | Maximum number of work groups that may be drawn by a single | X.6 | 8185bd8deadSopenharmony_ci | | | | | draw mesh tasks command | | 8195bd8deadSopenharmony_ci | MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV | Z+ | GetIntegerv | - | Per-vertex output allocation granularity for mesh shaders | X.3 | 8205bd8deadSopenharmony_ci | MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV | Z+ | GetIntegerv | - | Per-primitive output allocation granularity for mesh shaders | X.3 | 8215bd8deadSopenharmony_ci +------------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+--------+ 8225bd8deadSopenharmony_ci 8235bd8deadSopenharmony_ci Insert Table 23.75, "Implementation Dependent Task Shader Limits" 8245bd8deadSopenharmony_ci 8255bd8deadSopenharmony_ci +-----------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+----------+ 8265bd8deadSopenharmony_ci | Get Value | Type | Get Command | Minimum Value | Description | Sec. | 8275bd8deadSopenharmony_ci +-----------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+----------+ 8285bd8deadSopenharmony_ci | MAX_TASK_WORK_GROUP_SIZE_NV | 3 x Z+ | GetIntegeri_v | 32 (x), 1 (y,z) | Maximum local size of a task work group (per dimension) | X.6 | 8295bd8deadSopenharmony_ci | MAX_TASK_WORK_GROUP_INVOCATIONS_NV | Z+ | GetIntegerv | 32 | Maximum total task shader invocations in a single local work group | X.6 | 8305bd8deadSopenharmony_ci | MAX_TASK_UNIFORM_BLOCKS_NV | Z+ | GetIntegerv | 12 | Maximum number of uniform blocks per task program | 7.6.2 | 8315bd8deadSopenharmony_ci | MAX_TASK_TEXTURE_IMAGE_UNITS_NV | Z+ | GetIntegerv | 16 | Maximum number of texture image units accessible by a task program | 11.1.3.5 | 8325bd8deadSopenharmony_ci | MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV | Z+ | GetIntegerv | 8 | Number of atomic counter buffers accessed by a task program | 7.7 | 8335bd8deadSopenharmony_ci | MAX_TASK_ATOMIC_COUNTERS_NV | Z+ | GetIntegerv | 8 | Number of atomic counters accessed by a task program | 11.1.3.6 | 8345bd8deadSopenharmony_ci | MAX_TASK_IMAGE_UNIFORMS_NV | Z+ | GetIntegerv | 8 | Number of image variables in task program | 11.1.3.7 | 8355bd8deadSopenharmony_ci | MAX_TASK_SHADER_STORAGE_BLOCKS_NV | Z+ | GetIntegerv | 12 | Maximum number of storage buffer blocks per task program | 7.8 | 8365bd8deadSopenharmony_ci | MAX_TASK_UNIFORM_COMPONENTS_NV | Z+ | GetIntegerv | 512 | Number of components for task shader uniform variables | 7.6 | 8375bd8deadSopenharmony_ci | MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV | Z+ | GetIntegerv | * | Number of words for task shader uniform variables in all uniform | 7.6 | 8385bd8deadSopenharmony_ci | | | | | blocks, including the default | | 8395bd8deadSopenharmony_ci | MAX_TASK_TOTAL_MEMORY_SIZE_NV | Z+ | GetIntegerv | 16384 | Maximum total storage size of all variables declared as <shared> and | X.1 | 8405bd8deadSopenharmony_ci | | | | | <out> in all task shaders linked into a single program object | | 8415bd8deadSopenharmony_ci | MAX_TASK_OUTPUT_COUNT_NV | Z+ | GetIntegerv | 65535 | Maximum number of child mesh work groups a single task shader | X.2 | 8425bd8deadSopenharmony_ci | | | | | work group can emit | | 8435bd8deadSopenharmony_ci +-----------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+----------+ 8445bd8deadSopenharmony_ci 8455bd8deadSopenharmony_ci Insert Table 23.76, "Implementation Dependent Mesh Shader Limits", 8465bd8deadSopenharmony_ci renumber subsequent tables. 8475bd8deadSopenharmony_ci 8485bd8deadSopenharmony_ci +-----------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+----------+ 8495bd8deadSopenharmony_ci | Get Value | Type | Get Command | Minimum Value | Description | Sec. | 8505bd8deadSopenharmony_ci +-----------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+----------+ 8515bd8deadSopenharmony_ci | MAX_MESH_WORK_GROUP_SIZE_NV | 3 x Z+ | GetIntegeri_v | 32 (x), 1 (y,z) | Maximum local size of a mesh work group (per dimension) | X.6 | 8525bd8deadSopenharmony_ci | MAX_MESH_WORK_GROUP_INVOCATIONS_NV | Z+ | GetIntegerv | 32 | Maximum total mesh shader invocations in a single local work group | X.6 | 8535bd8deadSopenharmony_ci | MAX_MESH_UNIFORM_BLOCKS_NV | Z+ | GetIntegerv | 12 | Maximum number of uniform blocks per mesh program | 7.6.2 | 8545bd8deadSopenharmony_ci | MAX_MESH_TEXTURE_IMAGE_UNITS_NV | Z+ | GetIntegerv | 16 | Maximum number of texture image units accessible by a mesh shader | 11.1.3.5 | 8555bd8deadSopenharmony_ci | MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV | Z+ | GetIntegerv | 8 | Number of atomic counter buffers accessed by a mesh shader | 7.7 | 8565bd8deadSopenharmony_ci | MAX_MESH_ATOMIC_COUNTERS_NV | Z+ | GetIntegerv | 8 | Number of atomic counters accessed by a mesh shader | 11.1.3.6 | 8575bd8deadSopenharmony_ci | MAX_MESH_IMAGE_UNIFORMS_NV | Z+ | GetIntegerv | 8 | Number of image variables in mesh shaders | 11.1.3.7 | 8585bd8deadSopenharmony_ci | MAX_MESH_SHADER_STORAGE_BLOCKS_NV | Z+ | GetIntegerv | 12 | Maximum number of storage buffer blocks per task program | 7.8 | 8595bd8deadSopenharmony_ci | MAX_MESH_UNIFORM_COMPONENTS_NV | Z+ | GetIntegerv | 512 | Number of components for mesh shader uniform variables | 7.6 | 8605bd8deadSopenharmony_ci | MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV | Z+ | GetIntegerv | * | Number of words for mesh shader uniform variables in all uniform | 7.6 | 8615bd8deadSopenharmony_ci | | | | | blocks, including the default | | 8625bd8deadSopenharmony_ci | MAX_MESH_TOTAL_MEMORY_SIZE_NV | Z+ | GetIntegerv | 16384 | Maximum total storage size of all variables declared as <shared> and | X.3 | 8635bd8deadSopenharmony_ci | | | | | <out> in all mesh shaders linked into a single program object | | 8645bd8deadSopenharmony_ci | MAX_MESH_OUTPUT_PRIMITIVES_NV | Z+ | GetIntegerv | 256 | Maximum number of primitives a single mesh work group can emit | X.5 | 8655bd8deadSopenharmony_ci | MAX_MESH_OUTPUT_VERTICES_NV | Z+ | GetIntegerv | 256 | Maximum number of vertices a single mesh work group can emit | X.5 | 8665bd8deadSopenharmony_ci | MAX_MESH_VIEWS_NV | Z+ | GetIntegerv | 1 | Maximum number of multi-view views that can be used in a mesh shader | | 8675bd8deadSopenharmony_ci +-----------------------------------------+-----------+---------------+---------------------+-----------------------------------------------------------------------+----------+ 8685bd8deadSopenharmony_ci 8695bd8deadSopenharmony_ci 8705bd8deadSopenharmony_ciInteractions with ARB_indirect_parameters and OpenGL 4.6 8715bd8deadSopenharmony_ci 8725bd8deadSopenharmony_ci If none of ARB_indirect_parameters or OpenGL 4.6 are supported, remove the 8735bd8deadSopenharmony_ci MultiDrawMeshTasksIndirectCountNV function. 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ciInteractions with NV_command_list 8765bd8deadSopenharmony_ci 8775bd8deadSopenharmony_ci Modify the subsection 10.X.1 State Objects 8785bd8deadSopenharmony_ci 8795bd8deadSopenharmony_ci (add after the first paragraph of the description of the StateCaptureNV 8805bd8deadSopenharmony_ci command) 8815bd8deadSopenharmony_ci 8825bd8deadSopenharmony_ci When programs with active mesh or task stages are used, the 8835bd8deadSopenharmony_ci base primitive mode must be set to GL_POINTS. 8845bd8deadSopenharmony_ci 8855bd8deadSopenharmony_ci (add to the list of errors) 8865bd8deadSopenharmony_ci 8875bd8deadSopenharmony_ci INVALID_OPERATION is generated if <basicmode> is not GL_POINTS 8885bd8deadSopenharmony_ci when the mesh or task shaders are active. 8895bd8deadSopenharmony_ci 8905bd8deadSopenharmony_ci Modify subsection 10.X.2 Drawing with Commands 8915bd8deadSopenharmony_ci 8925bd8deadSopenharmony_ci (add a new paragraph before "None of the commands called by") 8935bd8deadSopenharmony_ci 8945bd8deadSopenharmony_ci When mesh or task shaders are active the DRAW_ARRAYS_COMMAND_NV 8955bd8deadSopenharmony_ci must be used to draw mesh tasks. The fields of the 8965bd8deadSopenharmony_ci DrawArraysCommandNV will be interpreted as follows: 8975bd8deadSopenharmony_ci 8985bd8deadSopenharmony_ci DrawMeshTasksNV(cmd->first, cmd->count); 8995bd8deadSopenharmony_ci 9005bd8deadSopenharmony_ciInteractions with ARB_draw_indirect and NV_vertex_buffer_unified_memory 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ci When the ARB_draw_indirect and NV_vertex_buffer_unified_memory extensions 9035bd8deadSopenharmony_ci are supported, applications can enable DRAW_INDIRECT_UNIFIED_NV to specify 9045bd8deadSopenharmony_ci that indirect draw data are sourced from a pre-programmed memory range. For 9055bd8deadSopenharmony_ci such implementations, we add a paragraph to spec language for 9065bd8deadSopenharmony_ci DrawMeshTasksIndirectNV, also inherited by MultiDrawMeshTasksIndirectNV and 9075bd8deadSopenharmony_ci MultiDrawMeshTasksIndirectCountNV: 9085bd8deadSopenharmony_ci 9095bd8deadSopenharmony_ci While DRAW_INDIRECT_UNIFIED_NV is enabled, DrawMeshTasksIndirectNV 9105bd8deadSopenharmony_ci sources its arguments from the address specified by the command 9115bd8deadSopenharmony_ci BufferAddressRange where <pname> is DRAW_INDIRECT_ADDRESS_NV and 9125bd8deadSopenharmony_ci <index> is zero, added to the <indirect> parameter. If the draw 9135bd8deadSopenharmony_ci indirect address range does not belong to a buffer object that is 9145bd8deadSopenharmony_ci resident at the time of the Draw, undefined results, possibly 9155bd8deadSopenharmony_ci including program termination, may occur. 9165bd8deadSopenharmony_ci 9175bd8deadSopenharmony_ci Additionally, the errors specified for DRAW_INDIRECT_BUFFER accesses for 9185bd8deadSopenharmony_ci DrawMeshTasksIndirectNV are modified as follows: 9195bd8deadSopenharmony_ci 9205bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if DRAW_INDIRECT_UNIFIED_NV is 9215bd8deadSopenharmony_ci disabled and zero is bound to the DRAW_INDIRECT_BUFFER binding. 9225bd8deadSopenharmony_ci 9235bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if DRAW_INDIRECT_UNIFIED_NV is 9245bd8deadSopenharmony_ci disabled and the command would source data beyond the end of the 9255bd8deadSopenharmony_ci DRAW_INDIRECT_BUFFER binding. 9265bd8deadSopenharmony_ci 9275bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if DRAW_INDIRECT_UNIFIED_NV is 9285bd8deadSopenharmony_ci enabled and the command would source data beyond the end of the 9295bd8deadSopenharmony_ci DRAW_INDIRECT_ADDRESS_NV buffer address range. 9305bd8deadSopenharmony_ci 9315bd8deadSopenharmony_ci 9325bd8deadSopenharmony_ciInteractions with OVR_multiview 9335bd8deadSopenharmony_ci 9345bd8deadSopenharmony_ci Modify the new section "9.2.2.2 (Multiview Images)" 9355bd8deadSopenharmony_ci 9365bd8deadSopenharmony_ci (insert a new entry to the list following 9375bd8deadSopenharmony_ci "In this mode there are several restrictions:") 9385bd8deadSopenharmony_ci 9395bd8deadSopenharmony_ci - in mesh shaders only the appropriate per-view outputs are 9405bd8deadSopenharmony_ci used. 9415bd8deadSopenharmony_ci 9425bd8deadSopenharmony_ciInteractions with OpenGL ES 3.2 9435bd8deadSopenharmony_ci 9445bd8deadSopenharmony_ci If implemented in OpenGL ES, remove all references to 9455bd8deadSopenharmony_ci MESH_SUBROUTINE_NV, TASK_SUBROUTINE_NV, MESH_SUBROUTINE_UNIFORM_NV, 9465bd8deadSopenharmony_ci TASK_SUBROUTINE_UNIFORM_NV, 9475bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV, 9485bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV, GetDoublev, GetDoublei_v 9495bd8deadSopenharmony_ci and MultiDrawMeshTasksIndirectCountNV. 9505bd8deadSopenharmony_ci 9515bd8deadSopenharmony_ci Modify Section 7.3, Program Objects, p. 71 ES 3.2 9525bd8deadSopenharmony_ci 9535bd8deadSopenharmony_ci (replace the reason why LinkProgram can fail with "program contains objects 9545bd8deadSopenharmony_ci to form either a vertex shader or fragment shader", p. 73 ES 3.2) 9555bd8deadSopenharmony_ci 9565bd8deadSopenharmony_ci * <program> contains objects to form either a vertex shader or fragment 9575bd8deadSopenharmony_ci shader but not a mesh shader, and 9585bd8deadSopenharmony_ci 9595bd8deadSopenharmony_ci - <program> is not separable, and does not contain objects to form both a 9605bd8deadSopenharmony_ci vertex shader and fragment shader. 9615bd8deadSopenharmony_ci 9625bd8deadSopenharmony_ci (add to the list of reasons why LinkProgram can fail, p. 74 ES 3.2) 9635bd8deadSopenharmony_ci 9645bd8deadSopenharmony_ci * program contains objects to form either a mesh or task shader (see 9655bd8deadSopenharmony_ci chapter X) but no fragment shader. 9665bd8deadSopenharmony_ci 9675bd8deadSopenharmony_ciIssues 9685bd8deadSopenharmony_ci 9695bd8deadSopenharmony_ci (1) Should we use a new command to specify work to be processed by task 9705bd8deadSopenharmony_ci and mesh shaders? 9715bd8deadSopenharmony_ci 9725bd8deadSopenharmony_ci RESOLVED: Yes. Using a separate draw call helps to clearly 9735bd8deadSopenharmony_ci differentiate task and mesh shader processing for the existing vertex 9745bd8deadSopenharmony_ci processing performed by the standard OpenGL vertex processing pipeline 9755bd8deadSopenharmony_ci with its vertex, tessellation, and geometry shaders. 9765bd8deadSopenharmony_ci 9775bd8deadSopenharmony_ci (2) What name should we use for the draw calls that spawn task and mesh 9785bd8deadSopenharmony_ci shaders? 9795bd8deadSopenharmony_ci 9805bd8deadSopenharmony_ci RESOLVED: For basic draws, we use the following command: 9815bd8deadSopenharmony_ci 9825bd8deadSopenharmony_ci void DrawMeshTasksNV(uint first, uint count); 9835bd8deadSopenharmony_ci 9845bd8deadSopenharmony_ci The first <first> and <count> parameters specifying a range of mesh task 9855bd8deadSopenharmony_ci numbers to process by the task and/or mesh shaders. 9865bd8deadSopenharmony_ci 9875bd8deadSopenharmony_ci Since the programming model of mesh and task shaders is very similar to 9885bd8deadSopenharmony_ci that of compute shaders, we considered using an interface similar to 9895bd8deadSopenharmony_ci DispatchCompute(), such as: 9905bd8deadSopenharmony_ci 9915bd8deadSopenharmony_ci void DrawWorkGroupsNV(uint num_groups_x, uint num_groups_y, 9925bd8deadSopenharmony_ci uint num_groups_z); 9935bd8deadSopenharmony_ci 9945bd8deadSopenharmony_ci We ultimately decided to not use such a generic name. It might be 9955bd8deadSopenharmony_ci useful in the future to give compute shaders the ability to spawn 9965bd8deadSopenharmony_ci "draws" in the future, and it's not clear that the programming model for 9975bd8deadSopenharmony_ci such a design would look anything like mesh and task shaders. 9985bd8deadSopenharmony_ci 9995bd8deadSopenharmony_ci The existing graphics draw calls DrawArrays() and DrawElements() 10005bd8deadSopenharmony_ci directly or indirectly refer to elements of a vertex array. Since the 10015bd8deadSopenharmony_ci programming model here spawns generic work that ultimately produces a 10025bd8deadSopenharmony_ci set of (likely connected) output primitives, we use the word "mesh" to 10035bd8deadSopenharmony_ci refer to the output of this pipeline and "tasks" to refer to the fact 10045bd8deadSopenharmony_ci that the draw call is spawning generic work groups to produce such these 10055bd8deadSopenharmony_ci "meshes". 10065bd8deadSopenharmony_ci 10075bd8deadSopenharmony_ci NOTE: In order to minimize divergence from the programming model for 10085bd8deadSopenharmony_ci compute shaders, mesh shaders use the same three-dimensional local work 10095bd8deadSopenharmony_ci group concept used by compute shaders. However, the hardware used for 10105bd8deadSopenharmony_ci task and mesh shaders is more limited and supports only one-dimensional 10115bd8deadSopenharmony_ci work groups. We decided to only use one "dimension" in the draw call to 10125bd8deadSopenharmony_ci keep the API simple and reflect the limitation. 10135bd8deadSopenharmony_ci 10145bd8deadSopenharmony_ci (3) Should we be able to dispatch a range of work groups that doesn't 10155bd8deadSopenharmony_ci start at zero? 10165bd8deadSopenharmony_ci 10175bd8deadSopenharmony_ci RESOLVED: Yes. When porting application code from using regular vertex 10185bd8deadSopenharmony_ci processing to mesh shader processing, the use of an implicit offset via 10195bd8deadSopenharmony_ci the <first> parameter should be helpful as it is in standard DrawArrays 10205bd8deadSopenharmony_ci calls. We think it's likely that applications will store information 10215bd8deadSopenharmony_ci about tasks to process in a single array with global task numbers. In 10225bd8deadSopenharmony_ci this case, the draw call with an offset allows applications to specify a 10235bd8deadSopenharmony_ci range of this array of tasks to process. 10245bd8deadSopenharmony_ci 10255bd8deadSopenharmony_ci (4) Should we support separable program objects with mesh and task 10265bd8deadSopenharmony_ci shaders, where one program provides a task shader and a second 10275bd8deadSopenharmony_ci program provides a mesh shader that interfaces with it? 10285bd8deadSopenharmony_ci 10295bd8deadSopenharmony_ci RESOLVED: Yes. Supporting separable program objects is not difficult 10305bd8deadSopenharmony_ci and may be useful in some cases. For example, one might use a single 10315bd8deadSopenharmony_ci task shader that could be used for common processing of different types 10325bd8deadSopenharmony_ci of geometry (e.g., evaluating visibililty via a bounding box) while 10335bd8deadSopenharmony_ci using different mesh shaders to generate different types of primitives. 10345bd8deadSopenharmony_ci 10355bd8deadSopenharmony_ci (5) Should we have queryable limits on the total amount of output memory 10365bd8deadSopenharmony_ci consumed by mesh or task shaders? 10375bd8deadSopenharmony_ci 10385bd8deadSopenharmony_ci RESOLVED: Yes. We have implementation-dependent limits on the total 10395bd8deadSopenharmony_ci amount of output memory consumed by mesh and task shaders that can be 10405bd8deadSopenharmony_ci queried using MAX_MESH_TOTAL_MEMORY_SIZE_NV and 10415bd8deadSopenharmony_ci MAX_TASK_TOTAL_MEMORY_SIZE_NV. For each per-vertex or per-primitive 10425bd8deadSopenharmony_ci output attribute in a mesh shader, memory is allocated separately for 10435bd8deadSopenharmony_ci each vertex or primitive allocated by the shader. The total number of 10445bd8deadSopenharmony_ci vertices or primitives used for this allocation is determined by taking 10455bd8deadSopenharmony_ci the maximum vertex and primitive counts declared in the mesh shader and 10465bd8deadSopenharmony_ci padding to implementation-dependent granularities that can be queried 10475bd8deadSopenharmony_ci using MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV and 10485bd8deadSopenharmony_ci MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV. 10495bd8deadSopenharmony_ci 10505bd8deadSopenharmony_ci (6) Should we have any MultiDrawMeshTasksIndirectNV, to draw 10515bd8deadSopenharmony_ci multiple sets of mesh tasks in one call? 10525bd8deadSopenharmony_ci 10535bd8deadSopenharmony_ci RESOLVED: Yes, we support "multi-draw" APIs to for consistency with 10545bd8deadSopenharmony_ci the standard vertex pipeline. When using these APIs, each individual 10555bd8deadSopenharmony_ci "draw" has its own structure stored in a buffer object. If mesh or task 10565bd8deadSopenharmony_ci shaders need to determine which draw is being processed, the built-in 10575bd8deadSopenharmony_ci gl_DrawIDARB can be used for that purpose. 10585bd8deadSopenharmony_ci 10595bd8deadSopenharmony_ci (7) Do we support transform feedback with mesh shaders? 10605bd8deadSopenharmony_ci 10615bd8deadSopenharmony_ci RESOLVED: No. In the initial implementation of this extension, the 10625bd8deadSopenharmony_ci hardware doesn't support it. 10635bd8deadSopenharmony_ci 10645bd8deadSopenharmony_ci (8) When using multi-view (OVR_multiview), how do we broadcast the 10655bd8deadSopenharmony_ci primitive to multiple layers or viewports? 10665bd8deadSopenharmony_ci 10675bd8deadSopenharmony_ci RESOLVED: When the OVR_multiview extension is enabled in a vertex 10685bd8deadSopenharmony_ci shader, the layout qualifier: 10695bd8deadSopenharmony_ci 10705bd8deadSopenharmony_ci layout(num_views = 2) in; 10715bd8deadSopenharmony_ci 10725bd8deadSopenharmony_ci indicates that the vertex shader should be run separately for two views, 10735bd8deadSopenharmony_ci where the shader can use the built-in input gl_ViewIDOVR to determine 10745bd8deadSopenharmony_ci which view is being processed. A separate set of primitives is 10755bd8deadSopenharmony_ci generated for each view, and each is rasterized into a separate 10765bd8deadSopenharmony_ci framebuffer layer. 10775bd8deadSopenharmony_ci 10785bd8deadSopenharmony_ci When the "num_views" layout qualifier for the OVR_multiview extension is 10795bd8deadSopenharmony_ci enabled in a mesh shader, the semantics are slightly different. Instead 10805bd8deadSopenharmony_ci of running a separate mesh shader invocation for each view, a single 10815bd8deadSopenharmony_ci invocation is generated to process all views. The view count from the 10825bd8deadSopenharmony_ci layout qualifier indicates the size of the extra array dimension for 10835bd8deadSopenharmony_ci "arrayed" per-vertex and per-primitive outputs qualified with 10845bd8deadSopenharmony_ci "perviewNV". The set of primitives generated by the mesh shader will be 10855bd8deadSopenharmony_ci broadcast separately to each view. For per-vertex or per-primitive 10865bd8deadSopenharmony_ci outputs not qualified with "perviewNV", the single value written by the 10875bd8deadSopenharmony_ci mesh shader for each vertex/primitive will be used for each view. For 10885bd8deadSopenharmony_ci outputs qualified with "perviewNV", each view will use a separate value 10895bd8deadSopenharmony_ci from the corresponding "arrayed" output. 10905bd8deadSopenharmony_ci 10915bd8deadSopenharmony_ci (9) Should we support NV_gpu_program5-style assembly programs for mesh 10925bd8deadSopenharmony_ci and task shaders? 10935bd8deadSopenharmony_ci 10945bd8deadSopenharmony_ci RESOLVED: No. We do provide a GLSL extension, also called 10955bd8deadSopenharmony_ci "GL_NV_mesh_shader". 10965bd8deadSopenharmony_ci 10975bd8deadSopenharmony_ci Also, please refer to issues in the GLSL extension specification. 10985bd8deadSopenharmony_ci 10995bd8deadSopenharmony_ciRevision History 11005bd8deadSopenharmony_ci 11015bd8deadSopenharmony_ci Revision 5 (pdaniell) 11025bd8deadSopenharmony_ci - Fix minimum implementation limit of MAX_DRAW_MESH_TASKS_COUNT_NV. 11035bd8deadSopenharmony_ci 11045bd8deadSopenharmony_ci Revision 4 (pknowles) 11055bd8deadSopenharmony_ci - Add ES interactions. 11065bd8deadSopenharmony_ci 11075bd8deadSopenharmony_ci Revision 3, January 14, 2019 (pbrown) 11085bd8deadSopenharmony_ci - Fix a typo in language prohibiting use of a task shader without a mesh 11095bd8deadSopenharmony_ci shader. 11105bd8deadSopenharmony_ci 11115bd8deadSopenharmony_ci Revision 2, September 17, 2018 (pbrown) 11125bd8deadSopenharmony_ci - Prepare specification for publication. 11135bd8deadSopenharmony_ci 11145bd8deadSopenharmony_ci Revision 1 (ckubsich) 11155bd8deadSopenharmony_ci - Internal revisions. 1116