mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
lavapipe: Implement VK_KHR_compute_shader_derivatives
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31056>
This commit is contained in:
parent
eac613bc70
commit
16f4b93cac
2 changed files with 27 additions and 3 deletions
|
|
@ -741,9 +741,25 @@ generate_compute(struct llvmpipe_context *lp,
|
|||
LLVMValueRef block_x_size_vec = lp_build_broadcast_scalar(&bld, block_x_size_arg);
|
||||
LLVMValueRef block_y_size_vec = lp_build_broadcast_scalar(&bld, block_y_size_arg);
|
||||
|
||||
system_values.thread_id[0] = LLVMBuildURem(gallivm->builder, invocation_index, block_x_size_vec, "");
|
||||
system_values.thread_id[1] = LLVMBuildUDiv(gallivm->builder, invocation_index, block_x_size_vec, "");
|
||||
system_values.thread_id[1] = LLVMBuildURem(gallivm->builder, system_values.thread_id[1], block_y_size_vec, "");
|
||||
if (nir->info.derivative_group == DERIVATIVE_GROUP_QUADS) {
|
||||
/* x = (invocation_index / 4 * 2 + invocation_index % 2) % block_width */
|
||||
LLVMValueRef quad_x = LLVMBuildAnd(builder, invocation_index, lp_build_const_int_vec(gallivm, bld.type, ~3u), "");
|
||||
quad_x = LLVMBuildUDiv(builder, quad_x, lp_build_const_int_vec(gallivm, bld.type, 2), "");
|
||||
LLVMValueRef quad_sub_x = LLVMBuildURem(builder, invocation_index, lp_build_const_int_vec(gallivm, bld.type, 2), "");
|
||||
system_values.thread_id[0] = LLVMBuildAdd(builder, quad_x, quad_sub_x, "");
|
||||
system_values.thread_id[0] = LLVMBuildURem(builder, system_values.thread_id[0], block_x_size_vec, "");
|
||||
/* y = (invocation_index / block_width / 2 * 2 + (invocation_index / 2) % 2) % block_height */
|
||||
LLVMValueRef quad_y = LLVMBuildUDiv(builder, invocation_index, block_x_size_vec, "");
|
||||
quad_y = LLVMBuildAnd(builder, quad_y, lp_build_const_int_vec(gallivm, bld.type, ~1u), "");
|
||||
LLVMValueRef quad_sub_y = LLVMBuildUDiv(builder, invocation_index, lp_build_const_int_vec(gallivm, bld.type, 2), "");
|
||||
quad_sub_y = LLVMBuildURem(builder, quad_sub_y, lp_build_const_int_vec(gallivm, bld.type, 2), "");
|
||||
system_values.thread_id[1] = LLVMBuildAdd(builder, quad_y, quad_sub_y, "");
|
||||
system_values.thread_id[1] = LLVMBuildURem(builder, system_values.thread_id[1], block_y_size_vec, "");
|
||||
} else {
|
||||
system_values.thread_id[0] = LLVMBuildURem(gallivm->builder, invocation_index, block_x_size_vec, "");
|
||||
system_values.thread_id[1] = LLVMBuildUDiv(gallivm->builder, invocation_index, block_x_size_vec, "");
|
||||
system_values.thread_id[1] = LLVMBuildURem(gallivm->builder, system_values.thread_id[1], block_y_size_vec, "");
|
||||
}
|
||||
system_values.thread_id[2] = LLVMBuildUDiv(gallivm->builder, invocation_index, block_x_size_vec, "");
|
||||
system_values.thread_id[2] = LLVMBuildUDiv(gallivm->builder, system_values.thread_id[2], block_y_size_vec, "");
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported =
|
|||
.KHR_bind_memory2 = true,
|
||||
.KHR_buffer_device_address = true,
|
||||
.KHR_create_renderpass2 = true,
|
||||
.KHR_compute_shader_derivatives = true,
|
||||
.KHR_copy_commands2 = true,
|
||||
.KHR_dedicated_allocation = true,
|
||||
.KHR_deferred_host_operations = true,
|
||||
|
|
@ -750,6 +751,10 @@ lvp_get_features(const struct lvp_physical_device *pdevice,
|
|||
|
||||
/* KHR_shader_float_controls2 */
|
||||
.shaderFloatControls2 = true,
|
||||
|
||||
/* VK_KHR_compute_shader_derivatives */
|
||||
.computeDerivativeGroupQuads = true,
|
||||
.computeDerivativeGroupLinear = true,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1217,6 +1222,9 @@ lvp_get_properties(const struct lvp_physical_device *device, struct vk_propertie
|
|||
.maxRayDispatchInvocationCount = 1024 * 1024 * 64,
|
||||
.shaderGroupHandleAlignment = 16,
|
||||
.maxRayHitAttributeSize = LVP_RAY_HIT_ATTRIBS_SIZE,
|
||||
|
||||
/* VK_KHR_compute_shader_derivatives */
|
||||
.meshAndTaskShaderDerivatives = true,
|
||||
};
|
||||
|
||||
/* Vulkan 1.0 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue