[Mesa-dev] [PATCH 05/17] gallium: reserve one shader buffer for shared storage
Samuel Pitoiset
samuel.pitoiset at gmail.com
Sun Jan 24 13:09:40 PST 2016
At least, one shader buffer must be available for compute shaders.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/gallium/include/pipe/p_state.h | 2 +-
src/mesa/state_tracker/st_extensions.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 2e4d283..051856e 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -61,7 +61,7 @@ extern "C" {
#define PIPE_MAX_SHADER_INPUTS 80 /* 32 GENERIC + 32 PATCH + 16 others */
#define PIPE_MAX_SHADER_OUTPUTS 80 /* 32 GENERIC + 32 PATCH + 16 others */
#define PIPE_MAX_SHADER_SAMPLER_VIEWS 32
-#define PIPE_MAX_SHADER_BUFFERS 32
+#define PIPE_MAX_SHADER_BUFFERS 33
#define PIPE_MAX_SHADER_IMAGES 32
#define PIPE_MAX_TEXTURE_LEVELS 16
#define PIPE_MAX_SO_BUFFERS 4
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index d066784..c198892 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -219,8 +219,10 @@ void st_init_limits(struct pipe_screen *screen,
pc->MaxUniformBlocks);
pc->MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
- pc->MaxAtomicBuffers = screen->get_shader_param(
- screen, sh, PIPE_SHADER_CAP_MAX_SHADER_BUFFERS) / 2;
+ pc->MaxAtomicBuffers =
+ _clamp(screen->get_shader_param(screen, sh,
+ PIPE_SHADER_CAP_MAX_SHADER_BUFFERS),
+ 0, PIPE_MAX_SHADER_BUFFERS - 1) / 2;
pc->MaxShaderStorageBlocks = pc->MaxAtomicBuffers;
/* Gallium doesn't really care about local vs. env parameters so use the
--
2.6.4
More information about the mesa-dev
mailing list