From: Conor McCarthy cmccarthy@codeweavers.com
Check for backend type mismatches resulting from the absence of signedness in SM 6. --- tests/hlsl/uav-rwbuffer.shader_test | 20 ++++++++++++++++++ tests/shader_runner.c | 32 ++++++++++++++++++++--------- tests/shader_runner_gl.c | 1 + tests/utils.h | 1 + 4 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/tests/hlsl/uav-rwbuffer.shader_test b/tests/hlsl/uav-rwbuffer.shader_test index ec8937b33..4c64dbb98 100644 --- a/tests/hlsl/uav-rwbuffer.shader_test +++ b/tests/hlsl/uav-rwbuffer.shader_test @@ -164,6 +164,26 @@ float4 main() : sv_target1 return 0; }
+[uav 1] +format r32g32b32a32 sint +size (buffer, 2) +1 2 3 4 5 6 7 8 + +[pixel shader] +RWBuffer<int4> u : register(u1); + +float4 main() : sv_target +{ + u[0] = int4(11, -12, 13, -14); + u[1] = int4(-15, 16, -17, 18); + return 0; +} + +[test] +todo(sm>=6) draw quad +probe uav 1 (0) rgbasi (11, -12, 13, -14) +probe uav 1 (1) rgbasi (-15, 16, -17, 18) + [uav 2] size (buffer, 1) 0.1 0.2 0.3 0.4 diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 54c3be675..7d4d37586 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -336,6 +336,7 @@ static DXGI_FORMAT parse_format(const char *line, enum texture_data_type *data_t formats[] = { {"r32g32b32a32 float", TEXTURE_DATA_FLOAT, 16, DXGI_FORMAT_R32G32B32A32_FLOAT}, + {"r32g32b32a32 sint", TEXTURE_DATA_SINT, 16, DXGI_FORMAT_R32G32B32A32_SINT}, {"r32g32b32a32 uint", TEXTURE_DATA_UINT, 16, DXGI_FORMAT_R32G32B32A32_UINT}, {"r32g32 float", TEXTURE_DATA_FLOAT, 8, DXGI_FORMAT_R32G32_FLOAT}, {"r32g32 int", TEXTURE_DATA_SINT, 8, DXGI_FORMAT_R32G32_SINT}, @@ -586,7 +587,7 @@ static void set_uniforms(struct shader_runner *runner, size_t offset, size_t cou memcpy(runner->uniforms + offset, uniforms, count * sizeof(*runner->uniforms)); }
-static void read_int(const char **line, int *i) +static void read_int(const char **line, int *i, bool is_uniform) { char *rest; long val; @@ -594,14 +595,14 @@ static void read_int(const char **line, int *i) errno = 0; val = strtol(*line, &rest, 0);
- if (errno != 0 || (*rest != '\0' && !isspace((unsigned char)*rest))) + if (errno != 0 || (is_uniform && *rest != '\0' && !isspace((unsigned char)*rest))) fatal_error("Malformed int constant '%s'.\n", *line);
*i = val; if (*i != val) fatal_error("Out of range int constant '%.*s'.\n", (int)(rest - *line), *line);
- *line = rest; + *line = rest + (!is_uniform && *rest == ','); }
static void read_uint(const char **line, unsigned int *u, bool is_uniform) @@ -622,12 +623,12 @@ static void read_uint(const char **line, unsigned int *u, bool is_uniform) *line = rest + (!is_uniform && *rest == ','); }
-static void read_int4(const char **line, struct ivec4 *v) +static void read_int4(const char **line, struct ivec4 *v, bool is_uniform) { - read_int(line, &v->x); - read_int(line, &v->y); - read_int(line, &v->z); - read_int(line, &v->w); + read_int(line, &v->x, is_uniform); + read_int(line, &v->y, is_uniform); + read_int(line, &v->z, is_uniform); + read_int(line, &v->w, is_uniform); }
static void read_uint4(const char **line, struct uvec4 *v, bool is_uniform) @@ -906,6 +907,17 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) line = close_parentheses(line); todo_if(runner->is_todo) check_readback_data_uvec4(rb, &rect, &v); } + else if (match_string(line, "rgbasi", &line)) + { + struct ivec4 v; + + if (*line != '(') + fatal_error("Malformed probe arguments '%s'.\n", line); + ++line; + read_int4(&line, &v, false); + line = close_parentheses(line); + todo_if(runner->is_todo) check_readback_data_ivec4(rb, &rect, &v); + } else if (match_string(line, "rgba", &line)) { struct vec4 v; @@ -989,7 +1001,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) { struct ivec4 v;
- read_int4(&line, &v); + read_int4(&line, &v, true); set_uniforms(runner, offset, 4, &v); } else if (match_string(line, "uint4", &line)) @@ -1003,7 +1015,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) { int i;
- read_int(&line, &i); + read_int(&line, &i, true); set_uniforms(runner, offset, 1, &i); } else if (match_string(line, "uint", &line)) diff --git a/tests/shader_runner_gl.c b/tests/shader_runner_gl.c index 263d1ba75..6cec33a43 100644 --- a/tests/shader_runner_gl.c +++ b/tests/shader_runner_gl.c @@ -293,6 +293,7 @@ static const struct format_info *get_format_info(enum DXGI_FORMAT format) {DXGI_FORMAT_UNKNOWN, 1, true, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, {DXGI_FORMAT_R32G32B32A32_FLOAT, 4, false, GL_RGBA32F, GL_RGBA, GL_FLOAT}, {DXGI_FORMAT_R32G32B32A32_UINT, 4, true, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, + {DXGI_FORMAT_R32G32B32A32_SINT, 4, true, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, {DXGI_FORMAT_R32G32_FLOAT, 2, false, GL_RG32F, GL_RG, GL_FLOAT}, {DXGI_FORMAT_R32G32_UINT, 2, true, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, {DXGI_FORMAT_R32G32_SINT, 2, true, GL_RG32I, GL_RG_INTEGER, GL_INT}, diff --git a/tests/utils.h b/tests/utils.h index 98dceba84..cd5215fe5 100644 --- a/tests/utils.h +++ b/tests/utils.h @@ -275,6 +275,7 @@ static inline void check_readback_data_vec4_(unsigned int line, const struct res got.x, got.y, got.z, got.w, expected->x, expected->y, expected->z, expected->w, x, y); }
+#define check_readback_data_ivec4(a, b, c) check_readback_data_uvec4_(__LINE__, a, b, (const struct uvec4 *)(c)) #define check_readback_data_uvec4(a, b, c) check_readback_data_uvec4_(__LINE__, a, b, c) static inline void check_readback_data_uvec4_(unsigned int line, const struct resource_readback *rb, const RECT *rect, const struct uvec4 *expected)