Mesa (master): gallium: Add a cap for enabling lowering of image load/store intrinsics.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Feb 24 19:09:43 UTC 2020
Module: Mesa
Branch: master
Commit: 9c90ecf37ffab0978a983e49ecec48faebeb181a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c90ecf37ffab0978a983e49ecec48faebeb181a
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jan 23 10:52:39 2020 -0800
gallium: Add a cap for enabling lowering of image load/store intrinsics.
The deref stuff is hard to handle in a backend supporting dynamic
indexing, while the lowering can easily turn that into the same kind of
dynamic indexing we do for textures, UBOs, and SSBOs.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3728>
---
src/gallium/auxiliary/util/u_screen.c | 2 ++
src/gallium/docs/source/screen.rst | 1 +
src/gallium/include/pipe/p_defines.h | 1 +
src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 ++
4 files changed, 6 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 821bb16d539..372094f77e6 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -407,6 +407,8 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_OPENCL_INTEGER_FUNCTIONS:
case PIPE_CAP_INTEGER_MULTIPLY_32X16:
return 0;
+ case PIPE_CAP_NIR_IMAGES_AS_DEREF:
+ return 1;
case PIPE_CAP_FRONTEND_NOOP:
/* Enables INTEL_blackhole_render */
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 5137418bd7c..6c4a1dd1abf 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -567,6 +567,7 @@ The integer capabilities:
* ``PIPE_CAP_MAX_VERTEX_BUFFERS``: Number of supported vertex buffers.
* ``PIPE_CAP_OPENCL_INTEGER_FUNCTIONS``: Driver supports extended OpenCL-style integer functions. This includes averge, saturating additiong, saturating subtraction, absolute difference, count leading zeros, and count trailing zeros.
* ``PIPE_CAP_INTEGER_MULTIPLY_32X16``: Driver supports integer multiplication between a 32-bit integer and a 16-bit integer. If the second operand is 32-bits, the upper 16-bits are ignored, and the low 16-bits are possibly sign extended as necessary.
+* ``PIPE_CAP_NIR_IMAGES_AS_DEREF``: Whether NIR image load/store intrinsics should be nir_intrinsic_image_deref_* instead of nir_intrinsic_image_*. Defaults to true.
.. _pipe_capf:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index ca6d27e9700..3b1d93528b5 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -914,6 +914,7 @@ enum pipe_cap
PIPE_CAP_INTEGER_MULTIPLY_32X16,
/* Turn draw, dispatch, blit into NOOP */
PIPE_CAP_FRONTEND_NOOP,
+ PIPE_CAP_NIR_IMAGES_AS_DEREF,
};
/**
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index ad104686310..d23719d49e8 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -941,6 +941,8 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
st_nir_lower_uniforms(st, nir);
st_nir_lower_samplers(screen, nir, shader_program, prog);
+ if (!screen->get_param(screen, PIPE_CAP_NIR_IMAGES_AS_DEREF))
+ NIR_PASS_V(nir, gl_nir_lower_images, false);
if (finalize_by_driver && screen->finalize_nir)
screen->finalize_nir(screen, nir, false);
More information about the mesa-commit
mailing list