summaryrefslogtreecommitdiff
path: root/lib/mesa/src/compiler/glsl/tests
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-05-29 10:21:21 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-05-29 10:21:21 +0000
commit99b70277b7a71ca729b7723c0be213c9db46702c (patch)
tree756afa5d954f14d117bad3856a5eb9d5ab1b1a0d /lib/mesa/src/compiler/glsl/tests
parent3e40341f9dcd7c1bbc9afb8ddb812304820396cf (diff)
Import Mesa 11.2.2
Diffstat (limited to 'lib/mesa/src/compiler/glsl/tests')
-rw-r--r--lib/mesa/src/compiler/glsl/tests/blob_test.c28
-rw-r--r--lib/mesa/src/compiler/glsl/tests/general_ir_test.cpp2
-rw-r--r--lib/mesa/src/compiler/glsl/tests/lower_jumps/create_test_cases.py42
-rw-r--r--lib/mesa/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp69
-rw-r--r--lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.cpp18
-rw-r--r--lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.h5
-rw-r--r--lib/mesa/src/compiler/glsl/tests/varyings_test.cpp112
7 files changed, 116 insertions, 160 deletions
diff --git a/lib/mesa/src/compiler/glsl/tests/blob_test.c b/lib/mesa/src/compiler/glsl/tests/blob_test.c
index df0e91af3..4806029bc 100644
--- a/lib/mesa/src/compiler/glsl/tests/blob_test.c
+++ b/lib/mesa/src/compiler/glsl/tests/blob_test.c
@@ -23,7 +23,6 @@
/* A collection of unit tests for blob.c */
-#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -50,10 +49,7 @@ static void
expect_equal(uint64_t expected, uint64_t actual, const char *test)
{
if (actual != expected) {
- fprintf(stderr,
- "Error: Test '%s' failed: "
- "Expected=%" PRIu64 ", "
- "Actual=%" PRIu64 "\n",
+ fprintf (stderr, "Error: Test '%s' failed: Expected=%ld, Actual=%ld\n",
test, expected, actual);
error = true;
}
@@ -63,9 +59,7 @@ static void
expect_unequal(uint64_t expected, uint64_t actual, const char *test)
{
if (actual == expected) {
- fprintf(stderr,
- "Error: Test '%s' failed: Result=%" PRIu64 ", "
- "but expected something different.\n",
+ fprintf (stderr, "Error: Test '%s' failed: Result=%ld, but expected something different.\n",
test, actual);
error = true;
}
@@ -118,13 +112,14 @@ expect_equal_bytes(uint8_t *expected, uint8_t *actual,
static void
test_write_and_read_functions (void)
{
+ void *ctx = ralloc_context(NULL);
struct blob *blob;
struct blob_reader reader;
uint8_t *reserved;
size_t str_offset, uint_offset;
uint8_t reserve_buf[sizeof(reserve_test_str)];
- blob = blob_create();
+ blob = blob_create(ctx);
/*** Test blob by writing one of every possible kind of value. */
@@ -184,19 +179,20 @@ test_write_and_read_functions (void)
"read_consumes_all_bytes");
expect_equal(false, reader.overrun, "read_does_not_overrun");
- blob_destroy(blob);
+ ralloc_free(ctx);
}
/* Test that data values are written and read with proper alignment. */
static void
test_alignment(void)
{
+ void *ctx = ralloc_context(NULL);
struct blob *blob;
struct blob_reader reader;
uint8_t bytes[] = "ABCDEFGHIJKLMNOP";
size_t delta, last, num_bytes;
- blob = blob_create();
+ blob = blob_create(ctx);
/* First, write an intptr value to the blob and capture that size. This is
* the expected offset between any pair of intptr values (if written with
@@ -242,18 +238,19 @@ test_alignment(void)
"aligned read of intptr_t");
}
- blob_destroy(blob);
+ ralloc_free(ctx);
}
/* Test that we detect overrun. */
static void
test_overrun(void)
{
+ void *ctx =ralloc_context(NULL);
struct blob *blob;
struct blob_reader reader;
uint32_t value = 0xdeadbeef;
- blob = blob_create();
+ blob = blob_create(ctx);
blob_write_uint32(blob, value);
@@ -264,7 +261,7 @@ test_overrun(void)
expect_equal(0, blob_read_uint32(&reader), "read at overrun");
expect_equal(true, reader.overrun, "overrun flag set");
- blob_destroy(blob);
+ ralloc_free(ctx);
}
/* Test that we can read and write some large objects, (exercising the code in
@@ -281,7 +278,7 @@ test_big_objects(void)
size_t i;
char *buf;
- blob = blob_create();
+ blob = blob_create(ctx);
/* Initialize our buffer. */
buf = ralloc_size(ctx, size);
@@ -308,7 +305,6 @@ test_big_objects(void)
expect_equal(false, reader.overrun,
"overrun flag not set reading large objects");
- blob_destroy(blob);
ralloc_free(ctx);
}
diff --git a/lib/mesa/src/compiler/glsl/tests/general_ir_test.cpp b/lib/mesa/src/compiler/glsl/tests/general_ir_test.cpp
index 57917f337..217305bf8 100644
--- a/lib/mesa/src/compiler/glsl/tests/general_ir_test.cpp
+++ b/lib/mesa/src/compiler/glsl/tests/general_ir_test.cpp
@@ -38,7 +38,6 @@ TEST(ir_variable_constructor, interface)
glsl_type::get_interface_instance(f,
ARRAY_SIZE(f),
GLSL_INTERFACE_PACKING_STD140,
- false,
"simple_interface");
static const char name[] = "named_instance";
@@ -64,7 +63,6 @@ TEST(ir_variable_constructor, interface_array)
glsl_type::get_interface_instance(f,
ARRAY_SIZE(f),
GLSL_INTERFACE_PACKING_STD140,
- false,
"simple_interface");
const glsl_type *const interface_array =
diff --git a/lib/mesa/src/compiler/glsl/tests/lower_jumps/create_test_cases.py b/lib/mesa/src/compiler/glsl/tests/lower_jumps/create_test_cases.py
index 623487eb4..3be1079bc 100644
--- a/lib/mesa/src/compiler/glsl/tests/lower_jumps/create_test_cases.py
+++ b/lib/mesa/src/compiler/glsl/tests/lower_jumps/create_test_cases.py
@@ -21,7 +21,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
-import argparse
import os
import os.path
import re
@@ -31,8 +30,6 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # For access to sexps.py, which is in parent dir
from sexps import *
-runner = ":"
-outdir = "."
def make_test_case(f_name, ret_type, body):
"""Create a simple optimization test case consisting of a single
function with the given name, return type, and body.
@@ -239,13 +236,6 @@ def if_execute_flag(statements):
check_sexp(statements)
return [['if', ['var_ref', 'execute_flag'], statements, []]]
-def if_return_flag(then_statements, else_statements):
- """Wrap statements in an if test with return_flag as the condition.
- """
- check_sexp(then_statements)
- check_sexp(else_statements)
- return [['if', ['var_ref', 'return_flag'], then_statements, else_statements]]
-
def if_not_return_flag(statements):
"""Wrap statements in an if test so that they will only execute if
return_flag is False.
@@ -298,15 +288,15 @@ def create_test_case(doc_string, input_sexp, expected_sexp, test_name,
'do_lower_jumps({0:d}, {1:d}, {2:d}, {3:d}, {4:d})'.format(
pull_out_jumps, lower_sub_return, lower_main_return,
lower_continue, lower_break))
- args = [runner, 'optpass', '--quiet', '--input-ir', optimization]
- test_file = os.path.join(outdir, '{0}.opt_test'.format(test_name))
+ args = ['../../glsl_test', 'optpass', '--quiet', '--input-ir', optimization]
+ test_file = '{0}.opt_test'.format(test_name)
with open(test_file, 'w') as f:
f.write('#!/usr/bin/env bash\n#\n# This file was generated by create_test_cases.py.\n#\n')
f.write(doc_string)
f.write('{0} <<EOF\n'.format(bash_quote(*args)))
f.write('{0}\nEOF\n'.format(input_str))
os.chmod(test_file, 0774)
- expected_file = os.path.join(outdir, '{0}.opt_test.expected'.format(test_name))
+ expected_file = '{0}.opt_test.expected'.format(test_name)
with open(expected_file, 'w') as f:
f.write('{0}\n'.format(expected_output))
@@ -462,10 +452,7 @@ def test_lower_pulled_out_jump():
loop(simple_if('b', simple_if('c', [], continue_()),
lowered_return_simple()) +
break_()) +
-
- if_return_flag(assign_x('return_flag', const_bool(1)) +
- assign_x('execute_flag', const_bool(0)),
- assign_x('d', const_float(1))))
+ if_not_return_flag(assign_x('d', const_float(1))))
))
create_test_case(doc_string, input_sexp, expected_sexp, 'lower_pulled_out_jump',
lower_main_return=True, pull_out_jumps=True)
@@ -596,14 +583,11 @@ def test_lower_return_void_at_end_of_loop():
assign_x('b', const_float(2))
))
expected_sexp = make_test_case('main', 'void', (
- declare_execute_flag() +
declare_return_flag() +
loop(assign_x('a', const_float(1)) +
lowered_return_simple() +
break_()) +
- if_return_flag(assign_x('return_flag', const_bool(1)) +
- assign_x('execute_flag', const_bool(0)),
- assign_x('b', const_float(2)))
+ if_not_return_flag(assign_x('b', const_float(2)))
))
create_test_case(doc_string, input_sexp, input_sexp, 'return_void_at_end_of_loop_lower_nothing')
create_test_case(doc_string, input_sexp, expected_sexp, 'return_void_at_end_of_loop_lower_return',
@@ -628,10 +612,7 @@ def test_lower_return_non_void_at_end_of_loop():
loop(assign_x('a', const_float(1)) +
lowered_return_simple(const_float(2)) +
break_()) +
- if_return_flag(assign_x('return_value', '(var_ref return_value)') +
- assign_x('return_flag', const_bool(1)) +
- assign_x('execute_flag', const_bool(0)),
- assign_x('b', const_float(3)) +
+ if_not_return_flag(assign_x('b', const_float(3)) +
lowered_return(const_float(4))) +
final_return()
))
@@ -642,17 +623,6 @@ def test_lower_return_non_void_at_end_of_loop():
lower_sub_return=True, lower_break=True)
if __name__ == '__main__':
- parser = argparse.ArgumentParser()
- parser.add_argument('--runner',
- help='The glsl_test runner',
- required=True)
- parser.add_argument('--outdir',
- help='Directory to put the generated files in',
- required=True)
- args = parser.parse_args()
- runner = args.runner
- outdir = args.outdir
-
test_lower_returns_main()
test_lower_returns_sub()
test_lower_returns_1()
diff --git a/lib/mesa/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp b/lib/mesa/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp
index d30abc320..0b1f66cb3 100644
--- a/lib/mesa/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp
+++ b/lib/mesa/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp
@@ -25,7 +25,6 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "util/ralloc.h"
-#include "util/string_to_uint_map.h"
#include "uniform_initializer_utils.h"
namespace linker {
@@ -70,7 +69,6 @@ set_uniform_initializer::SetUp()
{
this->mem_ctx = ralloc_context(NULL);
this->prog = rzalloc(NULL, struct gl_shader_program);
- this->prog->data = rzalloc(this->prog, struct gl_shader_program_data);
/* Set default values used by the test cases.
*/
@@ -110,49 +108,62 @@ establish_uniform_storage(struct gl_shader_program *prog, unsigned num_storage,
+ type->components()));
const unsigned red_zone_components = total_components - data_components;
- prog->UniformHash = new string_to_uint_map;
- prog->data->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
- num_storage);
- prog->data->NumUniformStorage = num_storage;
+ prog->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
+ num_storage);
+ prog->NumUniformStorage = num_storage;
- prog->data->UniformStorage[index_to_set].name = (char *) name;
- prog->data->UniformStorage[index_to_set].type = type;
- prog->data->UniformStorage[index_to_set].array_elements = array_size;
+ prog->UniformStorage[index_to_set].name = (char *) name;
+ prog->UniformStorage[index_to_set].type = type;
+ prog->UniformStorage[index_to_set].array_elements = array_size;
+ prog->UniformStorage[index_to_set].initialized = false;
for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
- prog->data->UniformStorage[index_to_set].opaque[sh].index = ~0;
- prog->data->UniformStorage[index_to_set].opaque[sh].active = false;
+ prog->UniformStorage[index_to_set].opaque[sh].index = ~0;
+ prog->UniformStorage[index_to_set].opaque[sh].active = false;
}
- prog->data->UniformStorage[index_to_set].num_driver_storage = 0;
- prog->data->UniformStorage[index_to_set].driver_storage = NULL;
- prog->data->UniformStorage[index_to_set].storage =
+ prog->UniformStorage[index_to_set].num_driver_storage = 0;
+ prog->UniformStorage[index_to_set].driver_storage = NULL;
+ prog->UniformStorage[index_to_set].storage =
rzalloc_array(prog, union gl_constant_value, total_components);
- fill_storage_array_with_sentinels(prog->data->UniformStorage[index_to_set].storage,
+ fill_storage_array_with_sentinels(prog->UniformStorage[index_to_set].storage,
data_components,
red_zone_components);
- prog->UniformHash->put(index_to_set,
- prog->data->UniformStorage[index_to_set].name);
-
for (unsigned i = 0; i < num_storage; i++) {
if (i == index_to_set)
continue;
- prog->data->UniformStorage[i].name = (char *) "invalid slot";
- prog->data->UniformStorage[i].type = glsl_type::void_type;
- prog->data->UniformStorage[i].array_elements = 0;
+ prog->UniformStorage[i].name = (char *) "invalid slot";
+ prog->UniformStorage[i].type = glsl_type::void_type;
+ prog->UniformStorage[i].array_elements = 0;
+ prog->UniformStorage[i].initialized = false;
for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
- prog->data->UniformStorage[i].opaque[sh].index = ~0;
- prog->data->UniformStorage[i].opaque[sh].active = false;
+ prog->UniformStorage[i].opaque[sh].index = ~0;
+ prog->UniformStorage[i].opaque[sh].active = false;
}
- prog->data->UniformStorage[i].num_driver_storage = 0;
- prog->data->UniformStorage[i].driver_storage = NULL;
- prog->data->UniformStorage[i].storage = NULL;
+ prog->UniformStorage[i].num_driver_storage = 0;
+ prog->UniformStorage[i].driver_storage = NULL;
+ prog->UniformStorage[i].storage = NULL;
}
return red_zone_components;
}
+/**
+ * Verify that the correct uniform is marked as having been initialized.
+ */
+static void
+verify_initialization(struct gl_shader_program *prog, unsigned actual_index)
+{
+ for (unsigned i = 0; i < prog->NumUniformStorage; i++) {
+ if (i == actual_index) {
+ EXPECT_TRUE(prog->UniformStorage[actual_index].initialized);
+ } else {
+ EXPECT_FALSE(prog->UniformStorage[i].initialized);
+ }
+ }
+}
+
static void
non_array_test(void *mem_ctx, struct gl_shader_program *prog,
unsigned actual_index, const char *name,
@@ -170,7 +181,8 @@ non_array_test(void *mem_ctx, struct gl_shader_program *prog,
linker::set_uniform_initializer(mem_ctx, prog, name, type, val, 0xF00F);
- verify_data(prog->data->UniformStorage[actual_index].storage, 0, val,
+ verify_initialization(prog, actual_index);
+ verify_data(prog->UniformStorage[actual_index].storage, 0, val,
red_zone_components, 0xF00F);
}
@@ -326,7 +338,8 @@ array_test(void *mem_ctx, struct gl_shader_program *prog,
linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val,
0xF00F);
- verify_data(prog->data->UniformStorage[actual_index].storage, array_size,
+ verify_initialization(prog, actual_index);
+ verify_data(prog->UniformStorage[actual_index].storage, array_size,
val, red_zone_components, 0xF00F);
}
diff --git a/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.cpp b/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.cpp
index 2a1a16839..ec64be18c 100644
--- a/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.cpp
+++ b/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.cpp
@@ -96,12 +96,6 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
case GLSL_TYPE_DOUBLE:
data.d[i] = double(values[idx]);
break;
- case GLSL_TYPE_UINT64:
- data.u64[i] = (uint64_t) values[idx];
- break;
- case GLSL_TYPE_INT64:
- data.i64[i] = (int64_t) values[idx];
- break;
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_ARRAY:
@@ -136,12 +130,6 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
case GLSL_TYPE_DOUBLE:
ASSERT_EQ(data.d[i], val->value.d[i]);
break;
- case GLSL_TYPE_UINT64:
- ASSERT_EQ(data.u64[i], val->value.u64[i]);
- break;
- case GLSL_TYPE_INT64:
- ASSERT_EQ(data.i64[i], val->value.i64[i]);
- break;
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_ARRAY:
@@ -248,12 +236,6 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size,
case GLSL_TYPE_DOUBLE:
EXPECT_EQ(val->value.d[i], *(double *)&storage[i*2].i);
break;
- case GLSL_TYPE_UINT64:
- EXPECT_EQ(val->value.u64[i], *(uint64_t *)&storage[i*2].i);
- break;
- case GLSL_TYPE_INT64:
- EXPECT_EQ(val->value.i64[i], *(int64_t *)&storage[i*2].i);
- break;
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_ARRAY:
diff --git a/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.h b/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.h
index f65254cdc..b4d0c1022 100644
--- a/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.h
+++ b/lib/mesa/src/compiler/glsl/tests/uniform_initializer_utils.h
@@ -21,8 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef GLSL_UNIFORM_INITIALIZER_UTILS_H
-#define GLSL_UNIFORM_INITIALIZER_UTILS_H
+#pragma once
#include "program/prog_parameter.h"
#include "ir.h"
@@ -47,5 +46,3 @@ extern void
verify_data(gl_constant_value *storage, unsigned storage_array_size,
ir_constant *val, unsigned red_zone_size,
unsigned int boolean_true);
-
-#endif /* GLSL_UNIFORM_INITIALIZER_UTILS_H */
diff --git a/lib/mesa/src/compiler/glsl/tests/varyings_test.cpp b/lib/mesa/src/compiler/glsl/tests/varyings_test.cpp
index eb134c9e8..9be5e8344 100644
--- a/lib/mesa/src/compiler/glsl/tests/varyings_test.cpp
+++ b/lib/mesa/src/compiler/glsl/tests/varyings_test.cpp
@@ -26,7 +26,7 @@
#include "main/macros.h"
#include "util/ralloc.h"
#include "ir.h"
-#include "util/hash_table.h"
+#include "program/hash_table.h"
/**
* \file varyings_test.cpp
@@ -35,7 +35,7 @@
*/
namespace linker {
-void
+bool
populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
hash_table *consumer_inputs,
hash_table *consumer_interface_inputs,
@@ -83,7 +83,6 @@ link_varyings::link_varyings()
glsl_type::get_interface_instance(f,
ARRAY_SIZE(f),
GLSL_INTERFACE_PACKING_STD140,
- false,
"simple_interface");
}
@@ -93,13 +92,11 @@ link_varyings::SetUp()
this->mem_ctx = ralloc_context(NULL);
this->ir.make_empty();
- this->consumer_inputs =
- _mesa_hash_table_create(NULL, _mesa_key_hash_string,
- _mesa_key_string_equal);
+ this->consumer_inputs
+ = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
- this->consumer_interface_inputs =
- _mesa_hash_table_create(NULL, _mesa_key_hash_string,
- _mesa_key_string_equal);
+ this->consumer_interface_inputs
+ = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
}
void
@@ -108,12 +105,47 @@ link_varyings::TearDown()
ralloc_free(this->mem_ctx);
this->mem_ctx = NULL;
- _mesa_hash_table_destroy(this->consumer_inputs, NULL);
+ hash_table_dtor(this->consumer_inputs);
this->consumer_inputs = NULL;
- _mesa_hash_table_destroy(this->consumer_interface_inputs, NULL);
+ hash_table_dtor(this->consumer_interface_inputs);
this->consumer_interface_inputs = NULL;
}
+/**
+ * Hash table callback function that counts the elements in the table
+ *
+ * \sa num_elements
+ */
+static void
+ht_count_callback(const void *, void *, void *closure)
+{
+ unsigned int *counter = (unsigned int *) closure;
+
+ (*counter)++;
+}
+
+/**
+ * Helper function to count the number of elements in a hash table.
+ */
+static unsigned
+num_elements(hash_table *ht)
+{
+ unsigned int counter = 0;
+
+ hash_table_call_foreach(ht, ht_count_callback, (void *) &counter);
+
+ return counter;
+}
+
+/**
+ * Helper function to determine whether a hash table is empty.
+ */
+static bool
+is_empty(hash_table *ht)
+{
+ return num_elements(ht) == 0;
+}
+
TEST_F(link_varyings, single_simple_input)
{
ir_variable *const v =
@@ -130,10 +162,9 @@ TEST_F(link_varyings, single_simple_input)
consumer_interface_inputs,
junk);
- hash_entry *entry = _mesa_hash_table_search(consumer_inputs, "a");
- EXPECT_EQ((void *) v, entry->data);
- EXPECT_EQ(1u, consumer_inputs->entries);
- EXPECT_TRUE(consumer_interface_inputs->entries == 0);
+ EXPECT_EQ((void *) v, hash_table_find(consumer_inputs, "a"));
+ EXPECT_EQ(1u, num_elements(consumer_inputs));
+ EXPECT_TRUE(is_empty(consumer_interface_inputs));
}
TEST_F(link_varyings, gl_ClipDistance)
@@ -159,35 +190,8 @@ TEST_F(link_varyings, gl_ClipDistance)
junk);
EXPECT_EQ(clipdistance, junk[VARYING_SLOT_CLIP_DIST0]);
- EXPECT_TRUE(consumer_inputs->entries == 0);
- EXPECT_TRUE(consumer_interface_inputs->entries == 0);
-}
-
-TEST_F(link_varyings, gl_CullDistance)
-{
- const glsl_type *const array_8_of_float =
- glsl_type::get_array_instance(glsl_type::vec(1), 8);
-
- ir_variable *const culldistance =
- new(mem_ctx) ir_variable(array_8_of_float,
- "gl_CullDistance",
- ir_var_shader_in);
-
- culldistance->data.explicit_location = true;
- culldistance->data.location = VARYING_SLOT_CULL_DIST0;
- culldistance->data.explicit_index = 0;
-
- ir.push_tail(culldistance);
-
- linker::populate_consumer_input_sets(mem_ctx,
- &ir,
- consumer_inputs,
- consumer_interface_inputs,
- junk);
-
- EXPECT_EQ(culldistance, junk[VARYING_SLOT_CULL_DIST0]);
- EXPECT_TRUE(consumer_inputs->entries == 0);
- EXPECT_TRUE(consumer_interface_inputs->entries == 0);
+ EXPECT_TRUE(is_empty(consumer_inputs));
+ EXPECT_TRUE(is_empty(consumer_interface_inputs));
}
TEST_F(link_varyings, single_interface_input)
@@ -208,11 +212,9 @@ TEST_F(link_varyings, single_interface_input)
junk);
char *const full_name = interface_field_name(simple_interface);
- hash_entry *entry = _mesa_hash_table_search(consumer_interface_inputs,
- full_name);
- EXPECT_EQ((void *) v, entry->data);
- EXPECT_EQ(1u, consumer_interface_inputs->entries);
- EXPECT_TRUE(consumer_inputs->entries == 0);
+ EXPECT_EQ((void *) v, hash_table_find(consumer_interface_inputs, full_name));
+ EXPECT_EQ(1u, num_elements(consumer_interface_inputs));
+ EXPECT_TRUE(is_empty(consumer_inputs));
}
TEST_F(link_varyings, one_interface_and_one_simple_input)
@@ -242,14 +244,12 @@ TEST_F(link_varyings, one_interface_and_one_simple_input)
char *const iface_field_name = interface_field_name(simple_interface);
- hash_entry *entry = _mesa_hash_table_search(consumer_interface_inputs,
- iface_field_name);
- EXPECT_EQ((void *) iface, entry->data);
- EXPECT_EQ(1u, consumer_interface_inputs->entries);
+ EXPECT_EQ((void *) iface, hash_table_find(consumer_interface_inputs,
+ iface_field_name));
+ EXPECT_EQ(1u, num_elements(consumer_interface_inputs));
- entry = _mesa_hash_table_search(consumer_inputs, "a");
- EXPECT_EQ((void *) v, entry->data);
- EXPECT_EQ(1u, consumer_inputs->entries);
+ EXPECT_EQ((void *) v, hash_table_find(consumer_inputs, "a"));
+ EXPECT_EQ(1u, num_elements(consumer_inputs));
}
TEST_F(link_varyings, interface_field_doesnt_match_noninterface)