ac,radeonsi: implement GL_NV_compute_shader_derivatives
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6799>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
GL_EXT_demote_to_helper_invocation on radeonsi
|
||||
GL_NV_compute_shader_derivatives on radeonsi
|
||||
EGL_MESA_platform_xcb
|
||||
Removed GL_NV_point_sprite for classic swrast.
|
||||
driconf: remove glx_disable_oml_sync_control, glx_disable_sgi_video_sync, and glx_disable_ext_buffer_age
|
||||
|
@@ -1430,7 +1430,9 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, const nir_te
|
||||
args->level_zero = false;
|
||||
break;
|
||||
case nir_texop_tex:
|
||||
if (ctx->stage != MESA_SHADER_FRAGMENT) {
|
||||
if (ctx->stage != MESA_SHADER_FRAGMENT &&
|
||||
(ctx->stage != MESA_SHADER_COMPUTE ||
|
||||
ctx->info->cs.derivative_group == DERIVATIVE_GROUP_NONE)) {
|
||||
assert(!args->lod);
|
||||
args->level_zero = true;
|
||||
}
|
||||
|
@@ -166,6 +166,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION:
|
||||
case PIPE_CAP_MULTI_DRAW:
|
||||
case PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0:
|
||||
case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_GLSL_ZERO_INIT:
|
||||
|
@@ -676,6 +676,24 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
|
||||
NIR_PASS_V(nir, nir_lower_system_values);
|
||||
NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_COMPUTE) {
|
||||
if (nir->info.cs.derivative_group == DERIVATIVE_GROUP_QUADS) {
|
||||
/* If we are shuffling local_invocation_id for quad derivatives, we
|
||||
* need to derive local_invocation_index from local_invocation_id
|
||||
* first, so that the value corresponds to the shuffled
|
||||
* local_invocation_id.
|
||||
*/
|
||||
nir_lower_compute_system_values_options options = {0};
|
||||
options.lower_local_invocation_index = true;
|
||||
NIR_PASS_V(nir, nir_lower_compute_system_values, &options);
|
||||
}
|
||||
|
||||
nir_opt_cse(nir); /* CSE load_local_invocation_id */
|
||||
nir_lower_compute_system_values_options options = {0};
|
||||
options.shuffle_local_ids_for_quad_derivatives = true;
|
||||
NIR_PASS_V(nir, nir_lower_compute_system_values, &options);
|
||||
}
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT &&
|
||||
sscreen->info.has_packed_math_16bit &&
|
||||
sscreen->b.get_shader_param(&sscreen->b, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_FP16))
|
||||
|
Reference in New Issue
Block a user