diff options
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_screen.c | 127 |
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 077ff9a2cf..b5fae94f78 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; |