summaryrefslogtreecommitdiff
path: root/dist/Mesa/src/glsl/tests
diff options
context:
space:
mode:
Diffstat (limited to 'dist/Mesa/src/glsl/tests')
-rw-r--r--dist/Mesa/src/glsl/tests/builtin_variable_test.cpp41
-rw-r--r--dist/Mesa/src/glsl/tests/copy_constant_to_storage_tests.cpp30
-rw-r--r--dist/Mesa/src/glsl/tests/general_ir_test.cpp1
-rw-r--r--dist/Mesa/src/glsl/tests/invalidate_locations_test.cpp2
-rw-r--r--dist/Mesa/src/glsl/tests/lower_jumps/create_test_cases.py2
-rwxr-xr-xdist/Mesa/src/glsl/tests/optimization-test8
-rw-r--r--dist/Mesa/src/glsl/tests/sampler_types_test.cpp1
-rw-r--r--dist/Mesa/src/glsl/tests/set_uniform_initializer_tests.cpp13
-rw-r--r--dist/Mesa/src/glsl/tests/uniform_initializer_utils.cpp9
-rw-r--r--dist/Mesa/src/glsl/tests/uniform_initializer_utils.h3
-rw-r--r--dist/Mesa/src/glsl/tests/varyings_test.cpp2
11 files changed, 49 insertions, 63 deletions
diff --git a/dist/Mesa/src/glsl/tests/builtin_variable_test.cpp b/dist/Mesa/src/glsl/tests/builtin_variable_test.cpp
index 11e384a07..3fdfce57d 100644
--- a/dist/Mesa/src/glsl/tests/builtin_variable_test.cpp
+++ b/dist/Mesa/src/glsl/tests/builtin_variable_test.cpp
@@ -25,6 +25,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
+#include "ralloc.h"
#include "ir.h"
#include "glsl_parser_extras.h"
#include "glsl_symbol_table.h"
@@ -97,8 +98,8 @@ common_builtin::string_starts_with_prefix(const char *str, const char *prefix)
void
common_builtin::names_start_with_gl()
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
string_starts_with_prefix(var->name, "gl_");
}
@@ -107,8 +108,8 @@ common_builtin::names_start_with_gl()
void
common_builtin::uniforms_and_system_values_dont_have_explicit_location()
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_uniform && var->data.mode != ir_var_system_value)
continue;
@@ -121,8 +122,8 @@ common_builtin::uniforms_and_system_values_dont_have_explicit_location()
void
common_builtin::constants_are_constant()
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_auto)
continue;
@@ -136,8 +137,8 @@ common_builtin::constants_are_constant()
void
common_builtin::no_invalid_variable_modes()
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
switch (var->data.mode) {
case ir_var_auto:
@@ -173,8 +174,8 @@ TEST_F(vertex_builtin, names_start_with_gl)
TEST_F(vertex_builtin, inputs_have_explicit_location)
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_shader_in)
continue;
@@ -188,8 +189,8 @@ TEST_F(vertex_builtin, inputs_have_explicit_location)
TEST_F(vertex_builtin, outputs_have_explicit_location)
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_shader_out)
continue;
@@ -241,8 +242,8 @@ TEST_F(fragment_builtin, names_start_with_gl)
TEST_F(fragment_builtin, inputs_have_explicit_location)
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_shader_in)
continue;
@@ -261,8 +262,8 @@ TEST_F(fragment_builtin, inputs_have_explicit_location)
TEST_F(fragment_builtin, outputs_have_explicit_location)
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_shader_out)
continue;
@@ -312,8 +313,8 @@ TEST_F(geometry_builtin, names_start_with_gl)
TEST_F(geometry_builtin, inputs_have_explicit_location)
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_shader_in)
continue;
@@ -358,8 +359,8 @@ TEST_F(geometry_builtin, inputs_have_explicit_location)
TEST_F(geometry_builtin, outputs_have_explicit_location)
{
- foreach_in_list(ir_instruction, node, &this->ir) {
- ir_variable *const var = node->as_variable();
+ foreach_list(node, &this->ir) {
+ ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var->data.mode != ir_var_shader_out)
continue;
diff --git a/dist/Mesa/src/glsl/tests/copy_constant_to_storage_tests.cpp b/dist/Mesa/src/glsl/tests/copy_constant_to_storage_tests.cpp
index acf2789f2..6ab20841e 100644
--- a/dist/Mesa/src/glsl/tests/copy_constant_to_storage_tests.cpp
+++ b/dist/Mesa/src/glsl/tests/copy_constant_to_storage_tests.cpp
@@ -24,7 +24,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
-#include "util/ralloc.h"
+#include "ralloc.h"
#include "uniform_initializer_utils.h"
namespace linker {
@@ -32,8 +32,7 @@ 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,
- unsigned int boolean_true);
+ const unsigned int elements);
}
class copy_constant_to_storage : public ::testing::Test {
@@ -78,10 +77,9 @@ copy_constant_to_storage::int_test(unsigned rows)
linker::copy_constant_to_storage(storage,
val,
val->type->base_type,
- val->type->components(),
- 0xF00F);
+ val->type->components());
- verify_data(storage, 0, val, red_zone_size, 0xF00F);
+ verify_data(storage, 0, val, red_zone_size);
}
void
@@ -98,10 +96,9 @@ copy_constant_to_storage::uint_test(unsigned rows)
linker::copy_constant_to_storage(storage,
val,
val->type->base_type,
- val->type->components(),
- 0xF00F);
+ val->type->components());
- verify_data(storage, 0, val, red_zone_size, 0xF00F);
+ verify_data(storage, 0, val, red_zone_size);
}
void
@@ -118,10 +115,9 @@ copy_constant_to_storage::float_test(unsigned columns, unsigned rows)
linker::copy_constant_to_storage(storage,
val,
val->type->base_type,
- val->type->components(),
- 0xF00F);
+ val->type->components());
- verify_data(storage, 0, val, red_zone_size, 0xF00F);
+ verify_data(storage, 0, val, red_zone_size);
}
void
@@ -138,10 +134,9 @@ copy_constant_to_storage::bool_test(unsigned rows)
linker::copy_constant_to_storage(storage,
val,
val->type->base_type,
- val->type->components(),
- 0xF00F);
+ val->type->components());
- verify_data(storage, 0, val, red_zone_size, 0xF00F);
+ verify_data(storage, 0, val, red_zone_size);
}
/**
@@ -163,10 +158,9 @@ copy_constant_to_storage::sampler_test(void)
linker::copy_constant_to_storage(storage,
val,
GLSL_TYPE_SAMPLER,
- val->type->components(),
- 0xF00F);
+ val->type->components());
- verify_data(storage, 0, val, red_zone_size, 0xF00F);
+ verify_data(storage, 0, val, red_zone_size);
}
TEST_F(copy_constant_to_storage, bool_uniform)
diff --git a/dist/Mesa/src/glsl/tests/general_ir_test.cpp b/dist/Mesa/src/glsl/tests/general_ir_test.cpp
index 882642d14..862fa19ab 100644
--- a/dist/Mesa/src/glsl/tests/general_ir_test.cpp
+++ b/dist/Mesa/src/glsl/tests/general_ir_test.cpp
@@ -24,6 +24,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
+#include "ralloc.h"
#include "ir.h"
TEST(ir_variable_constructor, interface)
diff --git a/dist/Mesa/src/glsl/tests/invalidate_locations_test.cpp b/dist/Mesa/src/glsl/tests/invalidate_locations_test.cpp
index ba94d7e3a..997592fc9 100644
--- a/dist/Mesa/src/glsl/tests/invalidate_locations_test.cpp
+++ b/dist/Mesa/src/glsl/tests/invalidate_locations_test.cpp
@@ -24,7 +24,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
-#include "util/ralloc.h"
+#include "ralloc.h"
#include "ir.h"
#include "linker.h"
diff --git a/dist/Mesa/src/glsl/tests/lower_jumps/create_test_cases.py b/dist/Mesa/src/glsl/tests/lower_jumps/create_test_cases.py
index 3be1079bc..9974681e0 100644
--- a/dist/Mesa/src/glsl/tests/lower_jumps/create_test_cases.py
+++ b/dist/Mesa/src/glsl/tests/lower_jumps/create_test_cases.py
@@ -126,7 +126,7 @@ def loop(statements):
body.
"""
check_sexp(statements)
- return [['loop', statements]]
+ return [['loop', [], [], [], [], statements]]
def declare_temp(var_type, var_name):
"""Create a declaration of the form
diff --git a/dist/Mesa/src/glsl/tests/optimization-test b/dist/Mesa/src/glsl/tests/optimization-test
index 26a51be69..8ca777691 100755
--- a/dist/Mesa/src/glsl/tests/optimization-test
+++ b/dist/Mesa/src/glsl/tests/optimization-test
@@ -9,14 +9,6 @@ fi
total=0
pass=0
-echo "====== Generating tests ======"
-for dir in tests/*/; do
- if [ -e "${dir}create_test_cases.py" ]; then
- cd $dir; $PYTHON2 create_test_cases.py; cd ..
- fi
- echo "$dir"
-done
-
echo "====== Testing optimization passes ======"
for test in `find . -iname '*.opt_test'`; do
echo -n "Testing $test..."
diff --git a/dist/Mesa/src/glsl/tests/sampler_types_test.cpp b/dist/Mesa/src/glsl/tests/sampler_types_test.cpp
index 04dd65e6e..86d329a83 100644
--- a/dist/Mesa/src/glsl/tests/sampler_types_test.cpp
+++ b/dist/Mesa/src/glsl/tests/sampler_types_test.cpp
@@ -24,6 +24,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
+#include "ralloc.h"
#include "ir.h"
/**
diff --git a/dist/Mesa/src/glsl/tests/set_uniform_initializer_tests.cpp b/dist/Mesa/src/glsl/tests/set_uniform_initializer_tests.cpp
index d3fdeb3a8..be202b3d5 100644
--- a/dist/Mesa/src/glsl/tests/set_uniform_initializer_tests.cpp
+++ b/dist/Mesa/src/glsl/tests/set_uniform_initializer_tests.cpp
@@ -24,14 +24,14 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
-#include "util/ralloc.h"
+#include "ralloc.h"
#include "uniform_initializer_utils.h"
namespace linker {
extern void
set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
const char *name, const glsl_type *type,
- ir_constant *val, unsigned int boolean_true);
+ ir_constant *val);
}
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, 0xF00F);
+ linker::set_uniform_initializer(mem_ctx, prog, name, type, val);
verify_initialization(prog, actual_index);
verify_data(prog->UniformStorage[actual_index].storage, 0, val,
- red_zone_components, 0xF00F);
+ red_zone_components);
}
TEST_F(set_uniform_initializer, int_uniform)
@@ -335,12 +335,11 @@ 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,
- 0xF00F);
+ linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val);
verify_initialization(prog, actual_index);
verify_data(prog->UniformStorage[actual_index].storage, array_size,
- val, red_zone_components, 0xF00F);
+ val, red_zone_components);
}
TEST_F(set_uniform_initializer, int_array_uniform)
diff --git a/dist/Mesa/src/glsl/tests/uniform_initializer_utils.cpp b/dist/Mesa/src/glsl/tests/uniform_initializer_utils.cpp
index 6f47acd4c..5e86c2432 100644
--- a/dist/Mesa/src/glsl/tests/uniform_initializer_utils.cpp
+++ b/dist/Mesa/src/glsl/tests/uniform_initializer_utils.cpp
@@ -23,7 +23,7 @@
#include <gtest/gtest.h>
#include "main/mtypes.h"
#include "main/macros.h"
-#include "util/ralloc.h"
+#include "ralloc.h"
#include "uniform_initializer_utils.h"
#include <stdio.h>
@@ -187,15 +187,14 @@ 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,
- unsigned int boolean_true)
+ ir_constant *val, unsigned red_zone_size)
{
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, boolean_true);
+ val->array_elements[i], 0);
}
const unsigned components = element_type->components();
@@ -218,7 +217,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(val->value.b[i] ? boolean_true : 0, storage[i].i);
+ EXPECT_EQ(int(val->value.b[i]), storage[i].i);
break;
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_STRUCT:
diff --git a/dist/Mesa/src/glsl/tests/uniform_initializer_utils.h b/dist/Mesa/src/glsl/tests/uniform_initializer_utils.h
index b4d0c1022..f8c06d29c 100644
--- a/dist/Mesa/src/glsl/tests/uniform_initializer_utils.h
+++ b/dist/Mesa/src/glsl/tests/uniform_initializer_utils.h
@@ -44,5 +44,4 @@ 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,
- unsigned int boolean_true);
+ ir_constant *val, unsigned red_zone_size);
diff --git a/dist/Mesa/src/glsl/tests/varyings_test.cpp b/dist/Mesa/src/glsl/tests/varyings_test.cpp
index 4573529f6..662fc0e40 100644
--- a/dist/Mesa/src/glsl/tests/varyings_test.cpp
+++ b/dist/Mesa/src/glsl/tests/varyings_test.cpp
@@ -24,7 +24,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
-#include "util/ralloc.h"
+#include "ralloc.h"
#include "ir.h"
#include "program/hash_table.h"