Commit feba1363 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

midgard: Load gl_Position in vertex epilogue

parent 4f3c30f8
......@@ -1268,16 +1268,36 @@ midgard_compile_shader_nir(nir_shader *nir, struct util_dynarray *compiled)
static void
emit_vertex_epilogue(nir_builder *b)
{
/* First, load the final gl_Position as written to the imaginary varying */
nir_intrinsic_instr *load;
load = nir_intrinsic_instr_create(b->shader, nir_intrinsic_load_input);
load->num_components = 4;
nir_intrinsic_set_base(load, 0 /* TODO */);
load->src[0] = nir_src_for_ssa(nir_imm_int(b, 0));
nir_ssa_dest_init(&load->instr, &load->dest, 4, 32, NULL);
nir_builder_instr_insert(b, &load->instr);
nir_ssa_def *input_point = &load->dest.ssa;
nir_ssa_def *transformed_point = input_point;
/* Finally, write out the transformed values to VERTEX_EPILOGUE_BASE
* (which ends up being r27) */
nir_intrinsic_instr *store;
store = nir_intrinsic_instr_create(b->shader, nir_intrinsic_store_output);
store->num_components = 4;
nir_intrinsic_set_base(store, /* out->data.driver_location */ VERTEX_EPILOGUE_BASE);
nir_intrinsic_set_base(store, VERTEX_EPILOGUE_BASE);
nir_intrinsic_set_write_mask(store, 0xf);
#if 0
store->src[0].ssa = nir_vec4(b,
nir_imm_float(b, 0.3f),
nir_imm_float(b, 0.2f),
nir_imm_float(b, 0.4f),
nir_imm_float(b, 0.5f));
#endif
store->src[0].ssa = transformed_point;
store->src[0].is_ssa = true;
store->src[1] = nir_src_for_ssa(nir_imm_int(b, 0));
nir_builder_instr_insert(b, &store->instr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment