X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Ftest_vec4_copy_propagation.cpp;h=901f12a773d26fe60dd815f96d729abadc6e240d;hb=f20f616324a79b8be91b84b6d965a0bc0096789c;hp=fbd9fa8f19b6c9619aa8abe5eec1e44b23497428;hpb=01c5617c8edc2f392363e9f8861d62a9fc9aa973;p=mesa.git 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 fbd9fa8f19b..901f12a773d 100644 --- a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp @@ -24,6 +24,7 @@ #include #include "brw_vec4.h" #include "brw_vs.h" +#include "program/program.h" using namespace brw; @@ -37,7 +38,7 @@ public: struct brw_device_info *devinfo; struct gl_context *ctx; struct gl_shader_program *shader_prog; - struct brw_vertex_program *vp; + struct brw_vue_prog_data *prog_data; vec4_visitor *v; }; @@ -45,16 +46,16 @@ class copy_propagation_vec4_visitor : public vec4_visitor { public: copy_propagation_vec4_visitor(struct brw_compiler *compiler, - struct gl_shader_program *shader_prog) - : vec4_visitor(compiler, NULL, NULL, NULL, NULL, shader_prog, - MESA_SHADER_VERTEX, NULL, + nir_shader *shader, + struct brw_vue_prog_data *prog_data) + : vec4_visitor(compiler, NULL, NULL, prog_data, shader, NULL, false /* no_spills */, -1) { + prog_data->dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT; } protected: - virtual dst_reg *make_reg_for_system_value(int location, - const glsl_type *type) + virtual dst_reg *make_reg_for_system_value(int location) { unreachable("Not reached"); } @@ -69,11 +70,6 @@ protected: unreachable("Not reached"); } - virtual void emit_program_code() - { - unreachable("Not reached"); - } - virtual void emit_thread_end() { unreachable("Not reached"); @@ -96,15 +92,12 @@ void copy_propagation_test::SetUp() ctx = (struct gl_context *)calloc(1, sizeof(*ctx)); compiler = (struct brw_compiler *)calloc(1, sizeof(*compiler)); devinfo = (struct brw_device_info *)calloc(1, sizeof(*devinfo)); + prog_data = (struct brw_vue_prog_data *)calloc(1, sizeof(*prog_data)); compiler->devinfo = devinfo; - vp = ralloc(NULL, struct brw_vertex_program); - - shader_prog = ralloc(NULL, struct gl_shader_program); - - v = new copy_propagation_vec4_visitor(compiler, shader_prog); + nir_shader *shader = nir_shader_create(NULL, MESA_SHADER_VERTEX, NULL); - _mesa_init_vertex_program(ctx, &vp->program, GL_VERTEX_SHADER, 0); + v = new copy_propagation_vec4_visitor(compiler, shader, prog_data); devinfo->gen = 4; } @@ -150,7 +143,7 @@ TEST_F(copy_propagation_test, test_swizzle_swizzle) copy_propagation(v); - EXPECT_EQ(test_mov->src[0].reg, a.reg); + EXPECT_EQ(test_mov->src[0].nr, a.nr); EXPECT_EQ(test_mov->src[0].swizzle, BRW_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, @@ -168,7 +161,7 @@ TEST_F(copy_propagation_test, test_swizzle_writemask) SWIZZLE_X, SWIZZLE_Z)))); - v->emit(v->MOV(writemask(a, WRITEMASK_XYZ), src_reg(1.0f))); + v->emit(v->MOV(writemask(a, WRITEMASK_XYZ), brw_imm_f(1.0f))); vec4_instruction *test_mov = v->MOV(c, swizzle(src_reg(b), BRW_SWIZZLE4(SWIZZLE_W, @@ -180,7 +173,7 @@ TEST_F(copy_propagation_test, test_swizzle_writemask) copy_propagation(v); /* should not copy propagate */ - EXPECT_EQ(test_mov->src[0].reg, b.reg); + EXPECT_EQ(test_mov->src[0].nr, b.nr); EXPECT_EQ(test_mov->src[0].swizzle, BRW_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W,