summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-04-17 15:23:18 -0700
committerJason Ekstrand <[email protected]>2015-04-22 16:00:32 -0700
commita921475c22fe88fb6921a1f628d3ea05d55ba43b (patch)
tree79b6b0318bd83cca59fe8b17ca8026dd29208838 /src
parentceb6e5eebe13b85f57cf5a7a22371c10170943a3 (diff)
i965: Do better fake context setup in unit tests
In future tests, we will start relying on devinfo and not just brw in the compiler. Changing this now keeps these tests from failing in the future. Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/test_eu_compact.c5
-rw-r--r--src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp6
5 files changed, 24 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/test_eu_compact.c b/src/mesa/drivers/dri/i965/test_eu_compact.c
index d95d2c04771..f461654794f 100644
--- a/src/mesa/drivers/dri/i965/test_eu_compact.c
+++ b/src/mesa/drivers/dri/i965/test_eu_compact.c
@@ -291,7 +291,10 @@ int
main(int argc, char **argv)
{
struct brw_context *brw = calloc(1, sizeof(*brw));
- brw->gen = 6;
+ struct brw_device_info *devinfo = calloc(1, sizeof(*devinfo));
+ brw->intelScreen = calloc(1, sizeof(*brw->intelScreen));
+ brw->intelScreen->devinfo = devinfo;
+ brw->gen = devinfo->gen = 6;
bool fail = false;
for (brw->gen = 6; brw->gen <= 7; brw->gen++) {
diff --git a/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp
index ed8744d2d2e..206a76e9242 100644
--- a/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp
@@ -31,6 +31,7 @@ class cmod_propagation_test : public ::testing::Test {
public:
struct brw_context *brw;
+ struct brw_device_info *devinfo;
struct gl_context *ctx;
struct brw_wm_prog_data *prog_data;
struct gl_shader_program *shader_prog;
@@ -51,6 +52,9 @@ public:
void cmod_propagation_test::SetUp()
{
brw = (struct brw_context *)calloc(1, sizeof(*brw));
+ devinfo = (struct brw_device_info *)calloc(1, sizeof(*brw));
+ brw->intelScreen = (struct intel_screen *)calloc(1, sizeof(*brw->intelScreen));
+ brw->intelScreen->devinfo = devinfo;
ctx = &brw->ctx;
fp = ralloc(NULL, struct brw_fragment_program);
@@ -61,7 +65,7 @@ void cmod_propagation_test::SetUp()
_mesa_init_fragment_program(ctx, &fp->program, GL_FRAGMENT_SHADER, 0);
- brw->gen = 4;
+ brw->gen = devinfo->gen = 4;
}
static fs_inst *
diff --git a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
index 6f762bcc6e0..4c91af3ea8d 100644
--- a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
@@ -31,6 +31,7 @@ class saturate_propagation_test : public ::testing::Test {
public:
struct brw_context *brw;
+ struct brw_device_info *devinfo;
struct gl_context *ctx;
struct brw_wm_prog_data *prog_data;
struct gl_shader_program *shader_prog;
@@ -51,6 +52,9 @@ public:
void saturate_propagation_test::SetUp()
{
brw = (struct brw_context *)calloc(1, sizeof(*brw));
+ devinfo = (struct brw_device_info *)calloc(1, sizeof(*brw));
+ brw->intelScreen = (struct intel_screen *)calloc(1, sizeof(*brw->intelScreen));
+ brw->intelScreen->devinfo = devinfo;
ctx = &brw->ctx;
fp = ralloc(NULL, struct brw_fragment_program);
@@ -61,7 +65,7 @@ void saturate_propagation_test::SetUp()
_mesa_init_fragment_program(ctx, &fp->program, GL_FRAGMENT_SHADER, 0);
- brw->gen = 4;
+ brw->gen = devinfo->gen = 4;
}
static fs_inst *
diff --git a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
index f9e4ce1dc42..2ef52e9fd6b 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
@@ -34,6 +34,7 @@ class copy_propagation_test : public ::testing::Test {
public:
struct brw_context *brw;
+ struct brw_device_info *devinfo;
struct gl_context *ctx;
struct gl_shader_program *shader_prog;
struct brw_vertex_program *vp;
@@ -93,6 +94,9 @@ protected:
void copy_propagation_test::SetUp()
{
brw = (struct brw_context *)calloc(1, sizeof(*brw));
+ devinfo = (struct brw_device_info *)calloc(1, sizeof(*brw));
+ brw->intelScreen = (struct intel_screen *)calloc(1, sizeof(*brw->intelScreen));
+ brw->intelScreen->devinfo = devinfo;
ctx = &brw->ctx;
vp = ralloc(NULL, struct brw_vertex_program);
@@ -103,7 +107,7 @@ void copy_propagation_test::SetUp()
_mesa_init_vertex_program(ctx, &vp->program, GL_VERTEX_SHADER, 0);
- brw->gen = 4;
+ brw->gen = devinfo->gen = 4;
}
static void
diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
index 17bece5478f..c8c67574e95 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
@@ -36,6 +36,7 @@ class register_coalesce_test : public ::testing::Test {
public:
struct brw_context *brw;
+ struct brw_device_info *devinfo;
struct gl_context *ctx;
struct gl_shader_program *shader_prog;
struct brw_vertex_program *vp;
@@ -96,6 +97,9 @@ protected:
void register_coalesce_test::SetUp()
{
brw = (struct brw_context *)calloc(1, sizeof(*brw));
+ devinfo = (struct brw_device_info *)calloc(1, sizeof(*brw));
+ brw->intelScreen = (struct intel_screen *)calloc(1, sizeof(*brw->intelScreen));
+ brw->intelScreen->devinfo = devinfo;
ctx = &brw->ctx;
vp = ralloc(NULL, struct brw_vertex_program);
@@ -106,7 +110,7 @@ void register_coalesce_test::SetUp()
_mesa_init_vertex_program(ctx, &vp->program, GL_VERTEX_SHADER, 0);
- brw->gen = 4;
+ brw->gen = devinfo->gen = 4;
}
static void