diff options
author | Axel Davy <[email protected]> | 2015-01-07 12:01:50 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2015-02-06 00:07:18 +0100 |
commit | 1f3b7d40392c2a9e0b80c56e199c4c9ffd0c88a0 (patch) | |
tree | 0f79a6ebccb133a440de98221d0f787ac63d45a9 /src/gallium/state_trackers | |
parent | d0aeb4422bcc9f2d257d046935243f7cdf9bc620 (diff) |
st/nine: Check for the correct number of constants.
This removes unneeded hack for Anno 1404.
This app is not checking the number of supporting
constants, and rely on the shader compilation to fail
if it puts too many constants.
This patch also checks for the correct number of constants for ps.
Note that we don't check the official limitations for old vs and ps
versions. The restrictions were fixed, unlike for the number of vertex
shader constants for later versions. Likely apps use the correct number,
and it's not a problem for us if it wants use more.
Reviewed-by: Tiziano Bacocco <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_shader.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 6cc3ca3984f..13630f0f55a 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -504,6 +504,7 @@ struct shader_translator #define IS_VS (tx->processor == TGSI_PROCESSOR_VERTEX) #define IS_PS (tx->processor == TGSI_PROCESSOR_FRAGMENT) +#define NINE_MAX_CONST_F_SHADER (tx->processor == TGSI_PROCESSOR_VERTEX ? NINE_MAX_CONST_F : NINE_MAX_CONST_F_PS3) #define FAILURE_VOID(cond) if ((cond)) {tx->failure=1;return;} @@ -526,7 +527,7 @@ static boolean tx_lconstf(struct shader_translator *tx, struct ureg_src *src, INT index) { INT i; - if (index < 0 || index >= (NINE_MAX_CONST_F * 2)) { + if (index < 0 || index >= NINE_MAX_CONST_F_SHADER) { tx->failure = TRUE; return FALSE; } @@ -566,9 +567,8 @@ tx_set_lconstf(struct shader_translator *tx, INT index, float f[4]) { unsigned n; - /* Anno1404 sets out of range constants. */ - FAILURE_VOID(index < 0 || index >= (NINE_MAX_CONST_F * 2)) - if (index >= NINE_MAX_CONST_F) + FAILURE_VOID(index < 0 || index >= NINE_MAX_CONST_F_SHADER) + if (IS_VS && index >= NINE_MAX_CONST_F_SHADER) WARN("lconstf index %i too high, indirect access won't work\n", index); for (n = 0; n < tx->num_lconstf; ++n) diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index 927bfe18cdd..028e57df264 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -80,6 +80,7 @@ #define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4 +#define NINE_MAX_CONST_F_PS3 224 #define NINE_MAX_CONST_F 256 #define NINE_MAX_CONST_I 16 #define NINE_MAX_CONST_B 16 |