[Mesa-dev] [PATCH 01/11] gallium: define the maximum number of shader arrays
Marek Olšák
maraeo at gmail.com
Sun May 24 04:19:20 PDT 2015
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeon/radeon_llvm.h | 3 +--
src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 4 ++--
src/gallium/include/pipe/p_state.h | 1 +
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 11 +++--------
4 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h
index 8612ef8..f249ca6 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -33,7 +33,6 @@
#define RADEON_LLVM_MAX_INPUTS 32 * 4
#define RADEON_LLVM_MAX_OUTPUTS 32 * 4
-#define RADEON_LLVM_MAX_ARRAYS 16
#define RADEON_LLVM_INITIAL_CF_DEPTH 4
@@ -130,7 +129,7 @@ struct radeon_llvm_context {
unsigned loop_depth;
unsigned loop_depth_max;
- struct tgsi_declaration_range arrays[RADEON_LLVM_MAX_ARRAYS];
+ struct tgsi_declaration_range arrays[PIPE_MAX_SHADER_ARRAYS];
unsigned num_arrays;
LLVMValueRef main_fn;
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 8638537..2bef4b2 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -86,7 +86,7 @@ get_array_range(struct lp_build_tgsi_context *bld_base,
{
struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
if (File != TGSI_FILE_TEMPORARY || reg->ArrayID == 0 ||
- reg->ArrayID > RADEON_LLVM_MAX_ARRAYS) {
+ reg->ArrayID > PIPE_MAX_SHADER_ARRAYS) {
struct tgsi_declaration_range range;
range.First = 0;
range.Last = bld_base->info->file_max[File];
@@ -252,7 +252,7 @@ static void emit_declaration(
}
case TGSI_FILE_TEMPORARY:
- if (decl->Declaration.Array && decl->Array.ArrayID <= RADEON_LLVM_MAX_ARRAYS)
+ if (decl->Declaration.Array && decl->Array.ArrayID <= PIPE_MAX_SHADER_ARRAYS)
ctx->arrays[decl->Array.ArrayID - 1] = decl->Range;
if (uses_temp_indirect_addressing(bld_base)) {
lp_emit_declaration_soa(bld_base, decl);
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index e01c62c..ad1404c 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -53,6 +53,7 @@ extern "C" {
/**
* Implementation limits
*/
+#define PIPE_MAX_SHADER_ARRAYS 256 /* maximum number of array declarations */
#define PIPE_MAX_ATTRIBS 32
#define PIPE_MAX_CLIP_PLANES 8
#define PIPE_MAX_COLOR_BUFS 8
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f0f2a77..e308c55 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -57,11 +57,6 @@
(1 << PROGRAM_CONSTANT) | \
(1 << PROGRAM_UNIFORM))
-/**
- * Maximum number of arrays
- */
-#define MAX_ARRAYS 256
-
#define MAX_GLSL_TEXTURE_OFFSET 4
class st_src_reg;
@@ -317,7 +312,7 @@ public:
int next_temp;
- unsigned array_sizes[MAX_ARRAYS];
+ unsigned array_sizes[PIPE_MAX_SHADER_ARRAYS];
unsigned next_array;
int num_address_regs;
@@ -4362,7 +4357,7 @@ struct st_translate {
unsigned temps_size;
struct ureg_dst *temps;
- struct ureg_dst arrays[MAX_ARRAYS];
+ struct ureg_dst arrays[PIPE_MAX_SHADER_ARRAYS];
struct ureg_src *constants;
int num_constants;
struct ureg_src *immediates;
@@ -4373,7 +4368,7 @@ struct st_translate {
struct ureg_src samplers[PIPE_MAX_SAMPLERS];
struct ureg_src systemValues[SYSTEM_VALUE_MAX];
struct tgsi_texture_offset tex_offsets[MAX_GLSL_TEXTURE_OFFSET];
- unsigned array_sizes[MAX_ARRAYS];
+ unsigned array_sizes[PIPE_MAX_SHADER_ARRAYS];
const GLuint *inputMapping;
const GLuint *outputMapping;
--
2.1.0
More information about the mesa-dev
mailing list