diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.h | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.h | 30 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_caps.c | 27 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_caps.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 1 |
5 files changed, 64 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 4c780e4dcb4..4f0d30123a4 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -39,6 +39,7 @@ #include "pipe/p_state.h" +#include "tgsi/tgsi_exec.h" struct pipe_context; struct draw_context; @@ -225,4 +226,16 @@ boolean draw_need_pipeline(const struct draw_context *draw, const struct pipe_rasterizer_state *rasterizer, unsigned prim ); +static INLINE int +draw_get_shader_param(unsigned shader, enum pipe_cap param) +{ + switch(shader) { + case PIPE_SHADER_VERTEX: + case PIPE_SHADER_GEOMETRY: + return tgsi_exec_get_shader_param(param); + default: + return 0; + } +} + #endif /* DRAW_CONTEXT_H */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 6dee362d589..9d62c1d7e7e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -377,6 +377,36 @@ tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach, const unsigned *buf_sizes); +static INLINE int +tgsi_exec_get_shader_param(enum pipe_shader_cap param) +{ + 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 INT_MAX; + case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: + return TGSI_EXEC_MAX_NESTING; + case PIPE_SHADER_CAP_MAX_INPUTS: + return TGSI_EXEC_MAX_INPUT_ATTRIBS; + case PIPE_SHADER_CAP_MAX_CONSTS: + return TGSI_EXEC_MAX_CONST_BUFFER; + case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: + return PIPE_MAX_CONSTANT_BUFFERS; + case PIPE_SHADER_CAP_MAX_TEMPS: + return TGSI_EXEC_NUM_TEMPS; + case PIPE_SHADER_CAP_MAX_ADDRS: + return TGSI_EXEC_NUM_ADDRS; + case PIPE_SHADER_CAP_MAX_PREDS: + return TGSI_EXEC_NUM_PREDS; + case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: + return 1; + default: + return 0; + } +} + #if defined __cplusplus } /* extern "C" */ #endif diff --git a/src/gallium/auxiliary/util/u_caps.c b/src/gallium/auxiliary/util/u_caps.c index 94d5bd30278..f6a87869c76 100644 --- a/src/gallium/auxiliary/util/u_caps.c +++ b/src/gallium/auxiliary/util/u_caps.c @@ -75,6 +75,13 @@ util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out) return FALSE; } break; + case UTIL_CAPS_CHECK_SHADER: + tmpi = screen->get_shader_param(screen, list[i] >> 24, list[i] & ((1 << 24) - 1)); + ++i; + if (tmpi < (int)list[i++]) { + *out = i - 3; + return FALSE; + } case UTIL_CAPS_CHECK_UNIMPLEMENTED: *out = i - 1; return FALSE; @@ -188,17 +195,17 @@ static unsigned caps_opengl_2_1[] = { /* Shader Model 3 */ static unsigned caps_sm3[] = { - UTIL_CHECK_INT(MAX_FS_INSTRUCTIONS, 512), - UTIL_CHECK_INT(MAX_FS_INPUTS, 10), - UTIL_CHECK_INT(MAX_FS_TEMPS, 32), - UTIL_CHECK_INT(MAX_FS_ADDRS, 1), - UTIL_CHECK_INT(MAX_FS_CONSTS, 224), + UTIL_CHECK_SHADER(FRAGMENT, MAX_INSTRUCTIONS, 512), + UTIL_CHECK_SHADER(FRAGMENT, MAX_INPUTS, 10), + UTIL_CHECK_SHADER(FRAGMENT, MAX_TEMPS, 32), + UTIL_CHECK_SHADER(FRAGMENT, MAX_ADDRS, 1), + UTIL_CHECK_SHADER(FRAGMENT, MAX_CONSTS, 224), - UTIL_CHECK_INT(MAX_VS_INSTRUCTIONS, 512), - UTIL_CHECK_INT(MAX_VS_INPUTS, 16), - UTIL_CHECK_INT(MAX_VS_TEMPS, 32), - UTIL_CHECK_INT(MAX_VS_ADDRS, 2), - UTIL_CHECK_INT(MAX_VS_CONSTS, 256), + UTIL_CHECK_SHADER(VERTEX, MAX_INSTRUCTIONS, 512), + UTIL_CHECK_SHADER(VERTEX, MAX_INPUTS, 16), + UTIL_CHECK_SHADER(VERTEX, MAX_TEMPS, 32), + UTIL_CHECK_SHADER(VERTEX, MAX_ADDRS, 2), + UTIL_CHECK_SHADER(VERTEX, MAX_CONSTS, 256), UTIL_CHECK_TERMINATE }; diff --git a/src/gallium/auxiliary/util/u_caps.h b/src/gallium/auxiliary/util/u_caps.h index b1074f9eb21..7bd23800414 100644 --- a/src/gallium/auxiliary/util/u_caps.h +++ b/src/gallium/auxiliary/util/u_caps.h @@ -38,6 +38,7 @@ enum u_caps_check_enum { UTIL_CAPS_CHECK_INT, UTIL_CAPS_CHECK_FLOAT, UTIL_CAPS_CHECK_FORMAT, + UTIL_CAPS_CHECK_SHADER, UTIL_CAPS_CHECK_UNIMPLEMENTED, }; @@ -54,6 +55,9 @@ enum u_caps_check_enum { #define UTIL_CHECK_FORMAT(format) \ UTIL_CAPS_CHECK_FORMAT, PIPE_FORMAT_##format +#define UTIL_CHECK_SHADER(shader, cap, higher) \ + UTIL_CAPS_CHECK_SHADER, (PIPE_SHADER_##shader << 24) | PIPE_SHADER_CAP_##cap, (unsigned)(higher) + #define UTIL_CHECK_UNIMPLEMENTED \ UTIL_CAPS_CHECK_UNIMPLEMENTED diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 78473bf35ac..6ed39561fbe 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -399,7 +399,6 @@ static INLINE boolean util_get_offset( } } - #ifdef __cplusplus } #endif |