diff options
Diffstat (limited to 'src/glsl/tests')
-rw-r--r-- | src/glsl/tests/copy_constant_to_storage_tests.cpp | 28 | ||||
-rw-r--r-- | src/glsl/tests/set_uniform_initializer_tests.cpp | 11 | ||||
-rw-r--r-- | src/glsl/tests/uniform_initializer_utils.cpp | 7 | ||||
-rw-r--r-- | src/glsl/tests/uniform_initializer_utils.h | 3 |
4 files changed, 29 insertions, 20 deletions
diff --git a/src/glsl/tests/copy_constant_to_storage_tests.cpp b/src/glsl/tests/copy_constant_to_storage_tests.cpp index 65a9d502d47..acf2789f2b5 100644 --- a/src/glsl/tests/copy_constant_to_storage_tests.cpp +++ b/src/glsl/tests/copy_constant_to_storage_tests.cpp @@ -32,7 +32,8 @@ extern void copy_constant_to_storage(union gl_constant_value *storage, const ir_constant *val, const enum glsl_base_type base_type, - const unsigned int elements); + const unsigned int elements, + unsigned int boolean_true); } class copy_constant_to_storage : public ::testing::Test { @@ -77,9 +78,10 @@ copy_constant_to_storage::int_test(unsigned rows) linker::copy_constant_to_storage(storage, val, val->type->base_type, - val->type->components()); + val->type->components(), + 0xF00F); - verify_data(storage, 0, val, red_zone_size); + verify_data(storage, 0, val, red_zone_size, 0xF00F); } void @@ -96,9 +98,10 @@ copy_constant_to_storage::uint_test(unsigned rows) linker::copy_constant_to_storage(storage, val, val->type->base_type, - val->type->components()); + val->type->components(), + 0xF00F); - verify_data(storage, 0, val, red_zone_size); + verify_data(storage, 0, val, red_zone_size, 0xF00F); } void @@ -115,9 +118,10 @@ copy_constant_to_storage::float_test(unsigned columns, unsigned rows) linker::copy_constant_to_storage(storage, val, val->type->base_type, - val->type->components()); + val->type->components(), + 0xF00F); - verify_data(storage, 0, val, red_zone_size); + verify_data(storage, 0, val, red_zone_size, 0xF00F); } void @@ -134,9 +138,10 @@ copy_constant_to_storage::bool_test(unsigned rows) linker::copy_constant_to_storage(storage, val, val->type->base_type, - val->type->components()); + val->type->components(), + 0xF00F); - verify_data(storage, 0, val, red_zone_size); + verify_data(storage, 0, val, red_zone_size, 0xF00F); } /** @@ -158,9 +163,10 @@ copy_constant_to_storage::sampler_test(void) linker::copy_constant_to_storage(storage, val, GLSL_TYPE_SAMPLER, - val->type->components()); + val->type->components(), + 0xF00F); - verify_data(storage, 0, val, red_zone_size); + verify_data(storage, 0, val, red_zone_size, 0xF00F); } TEST_F(copy_constant_to_storage, bool_uniform) diff --git a/src/glsl/tests/set_uniform_initializer_tests.cpp b/src/glsl/tests/set_uniform_initializer_tests.cpp index 1d4169b037a..d3fdeb3a844 100644 --- a/src/glsl/tests/set_uniform_initializer_tests.cpp +++ b/src/glsl/tests/set_uniform_initializer_tests.cpp @@ -31,7 +31,7 @@ namespace linker { extern void set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, const char *name, const glsl_type *type, - ir_constant *val); + ir_constant *val, unsigned int boolean_true); } class set_uniform_initializer : public ::testing::Test { @@ -179,11 +179,11 @@ non_array_test(void *mem_ctx, struct gl_shader_program *prog, ir_constant *val; generate_data(mem_ctx, base_type, columns, rows, val); - linker::set_uniform_initializer(mem_ctx, prog, name, type, val); + linker::set_uniform_initializer(mem_ctx, prog, name, type, val, 0xF00F); verify_initialization(prog, actual_index); verify_data(prog->UniformStorage[actual_index].storage, 0, val, - red_zone_components); + red_zone_components, 0xF00F); } TEST_F(set_uniform_initializer, int_uniform) @@ -335,11 +335,12 @@ array_test(void *mem_ctx, struct gl_shader_program *prog, generate_array_data(mem_ctx, base_type, columns, rows, array_size + excess_data_size, val); - linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val); + linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val, + 0xF00F); verify_initialization(prog, actual_index); verify_data(prog->UniformStorage[actual_index].storage, array_size, - val, red_zone_components); + val, red_zone_components, 0xF00F); } TEST_F(set_uniform_initializer, int_array_uniform) diff --git a/src/glsl/tests/uniform_initializer_utils.cpp b/src/glsl/tests/uniform_initializer_utils.cpp index c61ef0d71cb..6f47acd4cad 100644 --- a/src/glsl/tests/uniform_initializer_utils.cpp +++ b/src/glsl/tests/uniform_initializer_utils.cpp @@ -187,14 +187,15 @@ generate_array_data(void *mem_ctx, enum glsl_base_type base_type, */ void verify_data(gl_constant_value *storage, unsigned storage_array_size, - ir_constant *val, unsigned red_zone_size) + ir_constant *val, unsigned red_zone_size, + unsigned int boolean_true) { if (val->type->base_type == GLSL_TYPE_ARRAY) { const glsl_type *const element_type = val->array_elements[0]->type; for (unsigned i = 0; i < storage_array_size; i++) { verify_data(storage + (i * element_type->components()), 0, - val->array_elements[i], 0); + val->array_elements[i], 0, boolean_true); } const unsigned components = element_type->components(); @@ -217,7 +218,7 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size, EXPECT_EQ(val->value.f[i], storage[i].f); break; case GLSL_TYPE_BOOL: - EXPECT_EQ(int(val->value.b[i]), storage[i].i); + EXPECT_EQ(val->value.b[i] ? boolean_true : 0, storage[i].i); break; case GLSL_TYPE_ATOMIC_UINT: case GLSL_TYPE_STRUCT: diff --git a/src/glsl/tests/uniform_initializer_utils.h b/src/glsl/tests/uniform_initializer_utils.h index f8c06d29c55..b4d0c10220f 100644 --- a/src/glsl/tests/uniform_initializer_utils.h +++ b/src/glsl/tests/uniform_initializer_utils.h @@ -44,4 +44,5 @@ generate_array_data(void *mem_ctx, enum glsl_base_type base_type, extern void verify_data(gl_constant_value *storage, unsigned storage_array_size, - ir_constant *val, unsigned red_zone_size); + ir_constant *val, unsigned red_zone_size, + unsigned int boolean_true); |