summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-05 20:50:50 +0200
committerLuca Barbieri <[email protected]>2010-09-14 06:07:41 +0200
commita508d2dddcc67d0f92cc36b9ed6f36a9bbfc579d (patch)
tree54e2cd38f19fdd1b47bbbe5c6d913fcf2e894d77 /src/gallium/drivers/svga
parent309cd4115b7cba669a0bf858e7809cb6dae90ddf (diff)
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3: - Also change trace, which I forgot about Changes in v2: - No longer adds tessellation shaders Currently each shader cap has FS and VS versions. However, we want a version of them for geometry, tessellation control, and tessellation evaluation shaders, and want to be able to easily query a given cap type for a given shader stage. Since having 5 duplicates of each shader cap is unmanageable, add a new get_shader_param function that takes both a shader cap from a new enum and a shader stage. Drivers with non-unified shaders will first switch on the shader and, within each case, switch on the cap. Drivers with unified shaders instead first check whether the shader is supported, and then switch on the cap. MAX_CONST_BUFFERS is now per-stage. The geometry shader cap is removed in favor of checking whether the limit of geometry shader instructions is greater than 0, which is also used for tessellation shaders. WARNING: all drivers changed and compiled but only nvfx tested
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_screen.c127
1 files changed, 76 insertions, 51 deletions
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 077ff9a2cf6..b5fae94f783 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -180,57 +180,6 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
- /*
- * Fragment shader limits
- */
-
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
- return svgascreen->use_ps30 ? 512 : 96;
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
- return SVGA3D_MAX_NESTING_LEVEL;
- case PIPE_CAP_MAX_FS_INPUTS:
- return 10;
- case PIPE_CAP_MAX_FS_CONSTS:
- return svgascreen->use_vs30 ? 224 : 16;
- case PIPE_CAP_MAX_FS_TEMPS:
- if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
- return svgascreen->use_ps30 ? 32 : 12;
- return result.u;
- case PIPE_CAP_MAX_FS_ADDRS:
- return svgascreen->use_ps30 ? 1 : 0;
- case PIPE_CAP_MAX_FS_PREDS:
- return svgascreen->use_ps30 ? 1 : 0;
-
- /*
- * Vertex shader limits
- */
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result))
- return svgascreen->use_vs30 ? 512 : 256;
- return result.u;
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- /* XXX: until we have vertex texture support */
- return 0;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- return SVGA3D_MAX_NESTING_LEVEL;
- case PIPE_CAP_MAX_VS_INPUTS:
- return 16;
- case PIPE_CAP_MAX_VS_CONSTS:
- return 256;
- case PIPE_CAP_MAX_VS_TEMPS:
- if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
- return svgascreen->use_vs30 ? 32 : 12;
- return result.u;
- case PIPE_CAP_MAX_VS_ADDRS:
- return svgascreen->use_vs30 ? 1 : 0;
- case PIPE_CAP_MAX_VS_PREDS:
- return svgascreen->use_vs30 ? 1 : 0;
-
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 1;
@@ -248,6 +197,81 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
return (int) svga_get_paramf( screen, param );
}
+static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ struct svga_screen *svgascreen = svga_screen(screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ SVGA3dDevCapResult result;
+
+ switch (shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ switch (param)
+ {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return svgascreen->use_ps30 ? 512 : 96;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return SVGA3D_MAX_NESTING_LEVEL;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 10;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return svgascreen->use_ps30 ? 224 : 16;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
+ return svgascreen->use_ps30 ? 32 : 12;
+ return result.u;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return svgascreen->use_ps30 ? 1 : 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return svgascreen->use_ps30 ? 1 : 0;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ }
+ break;
+ case PIPE_SHADER_VERTEX:
+ switch (param)
+ {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result))
+ return svgascreen->use_vs30 ? 512 : 256;
+ return result.u;
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ /* XXX: until we have vertex texture support */
+ return 0;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return SVGA3D_MAX_NESTING_LEVEL;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 16;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 256;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
+ return svgascreen->use_vs30 ? 32 : 12;
+ return result.u;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return svgascreen->use_vs30 ? 1 : 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return svgascreen->use_vs30 ? 1 : 0;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
static INLINE SVGA3dDevCapIndex
svga_translate_format_cap(enum pipe_format format)
@@ -449,6 +473,7 @@ svga_screen_create(struct svga_winsys_screen *sws)
screen->get_name = svga_get_name;
screen->get_vendor = svga_get_vendor;
screen->get_param = svga_get_param;
+ screen->get_shader_param = svga_get_shader_param;
screen->get_paramf = svga_get_paramf;
screen->is_format_supported = svga_is_format_supported;
screen->context_create = svga_context_create;