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:
Marek Olšák
2020-09-21 07:54:12 -04:00
committed by Marge Bot
parent d60930c017
commit c5ae01dcf1
4 changed files with 23 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
GL_EXT_demote_to_helper_invocation on radeonsi GL_EXT_demote_to_helper_invocation on radeonsi
GL_NV_compute_shader_derivatives on radeonsi
EGL_MESA_platform_xcb EGL_MESA_platform_xcb
Removed GL_NV_point_sprite for classic swrast. 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 driconf: remove glx_disable_oml_sync_control, glx_disable_sgi_video_sync, and glx_disable_ext_buffer_age

View File

@@ -1430,7 +1430,9 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, const nir_te
args->level_zero = false; args->level_zero = false;
break; break;
case nir_texop_tex: 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); assert(!args->lod);
args->level_zero = true; args->level_zero = true;
} }

View File

@@ -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_DEMOTE_TO_HELPER_INVOCATION:
case PIPE_CAP_MULTI_DRAW: case PIPE_CAP_MULTI_DRAW:
case PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0: case PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0:
case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:
return 1; return 1;
case PIPE_CAP_GLSL_ZERO_INIT: case PIPE_CAP_GLSL_ZERO_INIT:

View File

@@ -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_system_values);
NIR_PASS_V(nir, nir_lower_compute_system_values, NULL); 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 && if (nir->info.stage == MESA_SHADER_FRAGMENT &&
sscreen->info.has_packed_math_16bit && sscreen->info.has_packed_math_16bit &&
sscreen->b.get_shader_param(&sscreen->b, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_FP16)) sscreen->b.get_shader_param(&sscreen->b, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_FP16))