[PATCH 2/2] gallium: Add new fine grained PIPE_CAP_xx for shader limits.
José Fonseca
jfonseca at vmware.com
Tue May 11 03:40:04 PDT 2010
PIPE_CAP_GLSL and PIPE_CAP_SM3 not removed yet, as opcode support is not
yet covered.
---
src/gallium/drivers/llvmpipe/lp_screen.c | 30 ++++++++
src/gallium/include/pipe/p_defines.h | 22 ++++++
src/mesa/state_tracker/st_extensions.c | 108 +++++------------------------
3 files changed, 71 insertions(+), 89 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 1b4d21c..7946794 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -34,6 +34,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "gallivm/lp_bld_limits.h"
#include "lp_texture.h"
#include "lp_fence.h"
#include "lp_jit.h"
@@ -133,7 +134,35 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 0;
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ /* There is no limit in number of instructions beyond available memory */
+ return 32768;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ return LP_MAX_TGSI_NESTING;
+ case PIPE_CAP_MAX_VS_INPUTS:
+ case PIPE_CAP_MAX_FS_INPUTS:
+ return PIPE_MAX_ATTRIBS;
+ case PIPE_CAP_MAX_FS_CONSTS:
+ case PIPE_CAP_MAX_VS_CONSTS:
+ /* There is no limit in number of constants beyond available memory */
+ return 32768;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ case PIPE_CAP_MAX_FS_TEMPS:
+ return LP_MAX_TGSI_TEMPS;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ case PIPE_CAP_MAX_FS_ADDRS:
+ return LP_MAX_TGSI_ADDRS;
+ case PIPE_CAP_MAX_VS_PREDS:
+ case PIPE_CAP_MAX_FS_PREDS:
+ return LP_MAX_TGSI_PREDS;
default:
+ assert(0);
return 0;
}
}
@@ -156,6 +185,7 @@ llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
return 16.0; /* arbitrary */
default:
+ assert(0);
return 0;
}
}
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 7e43edc..1354322 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -457,6 +457,28 @@ enum pipe_cap {
PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
+
+ /*
+ * Shader limits.
+ */
+ PIPE_CAP_MAX_VS_INSTRUCTIONS,
+ PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS,
+ PIPE_CAP_MAX_VS_TEX_INDIRECTIONS,
+ PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH,
+ PIPE_CAP_MAX_VS_INPUTS,
+ PIPE_CAP_MAX_VS_CONSTS,
+ PIPE_CAP_MAX_VS_TEMPS,
+ PIPE_CAP_MAX_VS_ADDRS,
+ PIPE_CAP_MAX_VS_PREDS,
+ PIPE_CAP_MAX_FS_INSTRUCTIONS,
+ PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS,
+ PIPE_CAP_MAX_FS_TEX_INDIRECTIONS,
+ PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH,
+ PIPE_CAP_MAX_FS_INPUTS,
+ PIPE_CAP_MAX_FS_CONSTS,
+ PIPE_CAP_MAX_FS_TEMPS,
+ PIPE_CAP_MAX_FS_ADDRS,
+ PIPE_CAP_MAX_FS_PREDS
};
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 5b2e49c..7ae08bb 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -142,95 +142,25 @@ void st_init_limits(struct st_context *st)
/* Quads always follow GL provoking rules. */
c->QuadsFollowProvokingVertexConvention = GL_FALSE;
- if (screen->get_param(screen, PIPE_CAP_GLSL)) {
- /*
- * In the lack of more fine grained capabilities, if the pipe driver supports
- * GLSL then assume native limits match Mesa software limits.
- */
-
- pc = &c->FragmentProgram;
- pc->MaxNativeInstructions = pc->MaxInstructions;
- pc->MaxNativeAluInstructions = pc->MaxAluInstructions;
- pc->MaxNativeTexInstructions = pc->MaxTexInstructions;
- pc->MaxNativeTexIndirections = pc->MaxTexIndirections;
- pc->MaxNativeAttribs = pc->MaxAttribs;
- pc->MaxNativeTemps = pc->MaxTemps;
- pc->MaxNativeAddressRegs = pc->MaxAddressRegs;
- pc->MaxNativeParameters = pc->MaxParameters;
-
- pc = &c->VertexProgram;
- pc->MaxNativeInstructions = pc->MaxInstructions;
- pc->MaxNativeAluInstructions = pc->MaxAluInstructions;
- pc->MaxNativeTexInstructions = pc->MaxTexInstructions;
- pc->MaxNativeTexIndirections = pc->MaxTexIndirections;
- pc->MaxNativeAttribs = pc->MaxAttribs;
- pc->MaxNativeTemps = pc->MaxTemps;
- pc->MaxNativeAddressRegs = pc->MaxAddressRegs;
- pc->MaxNativeParameters = pc->MaxParameters;
- } else if (screen->get_param(screen, PIPE_CAP_SM3)) {
- /*
- * Assume the hardware meets the minimum requirements
- * for Shader Model 3.
- *
- * See also:
- * - http://msdn.microsoft.com/en-us/library/bb172920(VS.85).aspx
- * - http://msdn.microsoft.com/en-us/library/bb172963(VS.85).aspx
- */
-
- pc = &c->FragmentProgram;
- pc->MaxNativeInstructions = 512; /* D3DMIN30SHADERINSTRUCTIONS */
- pc->MaxNativeAluInstructions = pc->MaxNativeInstructions;
- pc->MaxNativeTexInstructions = pc->MaxNativeInstructions;
- pc->MaxNativeTexIndirections = pc->MaxNativeTexInstructions;
- pc->MaxNativeAttribs = 10;
- pc->MaxNativeTemps = 32;
- pc->MaxNativeAddressRegs = 1; /* aL */
- pc->MaxNativeParameters = 224;
-
- pc = &c->VertexProgram;
- pc->MaxNativeInstructions = 512; /* D3DMIN30SHADERINSTRUCTIONS */
- pc->MaxNativeAluInstructions = pc->MaxNativeInstructions;
- pc->MaxNativeTexInstructions = pc->MaxNativeInstructions;
- pc->MaxNativeTexIndirections = pc->MaxNativeTexInstructions;
- pc->MaxNativeAttribs = 16;
- pc->MaxNativeTemps = 32;
- pc->MaxNativeAddressRegs = 2; /* a0 and aL */
- pc->MaxNativeParameters = 256;
- } else {
- /*
- * Assume the hardware meets the minimum requirements
- * for Shader Model 2.
- *
- * See also:
- * - http://msdn.microsoft.com/en-us/library/bb172918(VS.85).aspx
- * - http://msdn.microsoft.com/en-us/library/bb172961(VS.85).aspx
- */
-
- pc = &c->FragmentProgram;
- pc->MaxNativeInstructions = 96; /* D3DPS20_MIN_NUMINSTRUCTIONSLOTS */
- pc->MaxNativeAluInstructions = 64;
- pc->MaxNativeTexInstructions = 32;
- pc->MaxNativeTexIndirections = pc->MaxNativeTexInstructions;
- pc->MaxNativeAttribs = 10; /* 2 color + 8 texture coord */
- pc->MaxNativeTemps = 12; /* D3DPS20_MIN_NUMTEMPS */
- pc->MaxNativeAddressRegs = 0;
- pc->MaxNativeParameters = 16;
-
- pc = &c->VertexProgram;
- pc->MaxNativeInstructions = 256;
- pc->MaxNativeAluInstructions = 256;
- pc->MaxNativeTexInstructions = 0;
- pc->MaxNativeTexIndirections = 0;
- pc->MaxNativeAttribs = 16;
- pc->MaxNativeTemps = 12; /* D3DVS20_MIN_NUMTEMPS */
- pc->MaxNativeAddressRegs = 2; /* a0 and aL */
- pc->MaxNativeParameters = 256;
- }
-
- if (!screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS)) {
- c->VertexProgram.MaxNativeTexInstructions = 0;
- c->VertexProgram.MaxNativeTexIndirections = 0;
- }
+ pc = &c->FragmentProgram;
+ pc->MaxNativeInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_INSTRUCTIONS);
+ pc->MaxNativeAluInstructions = pc->MaxAluInstructions;
+ pc->MaxNativeTexInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS);
+ pc->MaxNativeTexIndirections = screen->get_param(screen, PIPE_CAP_MAX_FS_TEX_INDIRECTIONS);
+ pc->MaxNativeAttribs = screen->get_param(screen, PIPE_CAP_MAX_FS_INPUTS);
+ pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_FS_TEMPS);
+ pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_FS_ADDRS);
+ pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_FS_CONSTS);
+
+ pc = &c->VertexProgram;
+ pc->MaxNativeInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_INSTRUCTIONS);
+ pc->MaxNativeAluInstructions = pc->MaxAluInstructions;
+ pc->MaxNativeTexInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS);
+ pc->MaxNativeTexIndirections = screen->get_param(screen, PIPE_CAP_MAX_VS_TEX_INDIRECTIONS);
+ pc->MaxNativeAttribs = screen->get_param(screen, PIPE_CAP_MAX_VS_INPUTS);
+ pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_VS_TEMPS);
+ pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_VS_ADDRS);
+ pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_VS_CONSTS);
}
--
1.7.0.3
--=-m3vy/wH2tlAFKIHzTTPF--
More information about the mesa-dev
mailing list