diff --git a/docs/features.txt b/docs/features.txt index 694aca28a07..140f5cc0e9a 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -327,6 +327,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve GL_EXT_memory_object DONE (freedreno, radeonsi, llvmpipe, zink, d3d12, iris, crocus/gen7+) GL_EXT_memory_object_fd DONE (freedreno, radeonsi, llvmpipe, zink, iris, crocus/gen7+) GL_EXT_memory_object_win32 DONE (zink, d3d12) + GL_EXT_mesh_shader DONE (zink) GL_EXT_multisampled_render_to_texture DONE (freedreno/a6xx, panfrost, zink, lima) GL_EXT_polygon_offset_clamp DONE (all drivers that support GL_ARB_polygon_offset_clamp) GL_EXT_render_snorm DONE (freedreno/a6xx, r600, radeonsi, softpipe, llvmpipe, virgl, zink, panfrost/v6+, iris, asahi) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 2e93d4eea95..d4c5b44d3af 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -84,3 +84,4 @@ VK_KHR_map_memory2 on pvr VK_EXT_map_memory_placed on pvr VK_KHR_device_group on pvr VK_KHR_buffer_device_address on pvr +GL_EXT_mesh_shader on zink diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 68e82453b9f..a6a166d7b93 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -497,7 +497,7 @@ have_fp32_filter_linear(struct zink_screen *screen) static void zink_init_shader_caps(struct zink_screen *screen) { - for (unsigned i = 0; i <= MESA_SHADER_COMPUTE; i++) { + for (unsigned i = 0; i <= MESA_SHADER_MESH; i++) { struct pipe_shader_caps *caps = (struct pipe_shader_caps *)&screen->base.shader_caps[i]; @@ -512,6 +512,14 @@ zink_init_shader_caps(struct zink_screen *screen) if (!screen->info.feats.features.geometryShader) continue; break; + case MESA_SHADER_TASK: + if (!screen->info.mesh_feats.taskShader) + continue; + break; + case MESA_SHADER_MESH: + if (!screen->info.mesh_feats.meshShader) + continue; + break; default: break; } @@ -529,6 +537,14 @@ zink_init_shader_caps(struct zink_screen *screen) max_in = MIN2(screen->info.props.limits.maxVertexInputAttributes, PIPE_MAX_ATTRIBS); max_out = screen->info.props.limits.maxVertexOutputComponents / 4; break; + case MESA_SHADER_TASK: + max_in = 0; + max_out = 0; + break; + case MESA_SHADER_MESH: + max_in = 0; + max_out = screen->info.mesh_props.maxMeshOutputComponents / 4; + break; case MESA_SHADER_TESS_CTRL: max_in = screen->info.props.limits.maxTessellationControlPerVertexInputComponents / 4; max_out = screen->info.props.limits.maxTessellationControlPerVertexOutputComponents / 4; @@ -558,6 +574,10 @@ zink_init_shader_caps(struct zink_screen *screen) } switch (i) { + case MESA_SHADER_TASK: + case MESA_SHADER_MESH: + /* not applicable */ + break; case MESA_SHADER_VERTEX: case MESA_SHADER_TESS_EVAL: case MESA_SHADER_GEOMETRY: @@ -1166,9 +1186,50 @@ zink_init_screen_caps(struct zink_screen *screen) caps->max_texture_lod_bias = screen->info.props.limits.maxSamplerLodBias; + /* not about to deal with mesh + non-optimal */ + caps->mesh_shader = screen->info.have_EXT_mesh_shader && screen->optimal_keys; + + caps->mesh.max_task_work_group_total_count = screen->info.mesh_props.maxTaskWorkGroupTotalCount; + caps->mesh.max_mesh_work_group_total_count = screen->info.mesh_props.maxMeshWorkGroupTotalCount; + caps->mesh.max_task_work_group_invocations = screen->info.mesh_props.maxTaskWorkGroupInvocations; + caps->mesh.max_mesh_work_group_invocations = screen->info.mesh_props.maxMeshWorkGroupInvocations; + caps->mesh.max_task_payload_size = screen->info.mesh_props.maxTaskPayloadSize; + caps->mesh.max_task_shared_memory_size = screen->info.mesh_props.maxTaskSharedMemorySize; + caps->mesh.max_mesh_shared_memory_size = screen->info.mesh_props.maxMeshSharedMemorySize; + caps->mesh.max_task_payload_and_shared_memory_size = screen->info.mesh_props.maxTaskPayloadAndSharedMemorySize; + caps->mesh.max_mesh_payload_and_shared_memory_size = screen->info.mesh_props.maxMeshPayloadAndSharedMemorySize; + caps->mesh.max_mesh_output_memory_size = screen->info.mesh_props.maxMeshOutputMemorySize; + caps->mesh.max_mesh_payload_and_output_memory_size = screen->info.mesh_props.maxMeshPayloadAndOutputMemorySize; + caps->mesh.max_mesh_output_vertices = screen->info.mesh_props.maxMeshOutputVertices; + caps->mesh.max_mesh_output_primitives = screen->info.mesh_props.maxMeshOutputPrimitives; + caps->mesh.max_mesh_output_components = screen->info.mesh_props.maxMeshOutputComponents; + caps->mesh.max_mesh_output_layers = screen->info.mesh_props.maxMeshOutputLayers; + caps->mesh.max_mesh_multiview_view_count = screen->info.mesh_props.maxMeshMultiviewViewCount; + caps->mesh.mesh_output_per_vertex_granularity = screen->info.mesh_props.meshOutputPerVertexGranularity; + caps->mesh.mesh_output_per_primitive_granularity = screen->info.mesh_props.meshOutputPerPrimitiveGranularity; + + caps->mesh.max_preferred_task_work_group_invocations = screen->info.mesh_props.maxPreferredTaskWorkGroupInvocations; + caps->mesh.max_preferred_mesh_work_group_invocations = screen->info.mesh_props.maxPreferredMeshWorkGroupInvocations; + caps->mesh.mesh_prefers_local_invocation_vertex_output = screen->info.mesh_props.prefersLocalInvocationVertexOutput; + caps->mesh.mesh_prefers_local_invocation_primitive_output = screen->info.mesh_props.prefersLocalInvocationPrimitiveOutput; + caps->mesh.mesh_prefers_compact_vertex_output = screen->info.mesh_props.prefersCompactVertexOutput; + caps->mesh.mesh_prefers_compact_primitive_output = screen->info.mesh_props.prefersCompactPrimitiveOutput; + + for (unsigned i = 0; i < 3; i++) { + caps->mesh.max_task_work_group_count[i] = screen->info.mesh_props.maxTaskWorkGroupCount[i]; + caps->mesh.max_mesh_work_group_count[i] = screen->info.mesh_props.maxMeshWorkGroupCount[i]; + caps->mesh.max_task_work_group_size[i] = screen->info.mesh_props.maxTaskWorkGroupSize[i]; + caps->mesh.max_mesh_work_group_size[i] = screen->info.mesh_props.maxMeshWorkGroupSize[i]; + } + + caps->mesh.pipeline_statistic_queries = screen->info.mesh_feats.meshShaderQueries; + if (screen->info.feats12.subgroupBroadcastDynamicId && screen->info.feats12.shaderSubgroupExtendedTypes && screen->info.feats.features.shaderFloat64) { caps->shader_subgroup_size = screen->info.subgroup.subgroupSize; - caps->shader_subgroup_supported_stages = screen->info.subgroup.supportedStages & BITFIELD_MASK(MESA_SHADER_STAGES); + if (screen->info.have_EXT_mesh_shader) + caps->shader_subgroup_supported_stages = screen->info.subgroup.supportedStages & BITFIELD_MASK(MESA_SHADER_MESH_STAGES); + else + caps->shader_subgroup_supported_stages = screen->info.subgroup.supportedStages & BITFIELD_MASK(MESA_SHADER_STAGES); caps->shader_subgroup_supported_features = screen->info.subgroup.supportedOperations & BITFIELD_MASK(PIPE_SHADER_SUBGROUP_NUM_FEATURES); caps->shader_subgroup_quad_all_stages = screen->info.subgroup.quadOperationsInAllStages; }