mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
compute InputsRead/OutputsWritten with slang_update_inputs_outputs()
This commit is contained in:
parent
c9db223f90
commit
64f78dd6a8
2 changed files with 31 additions and 20 deletions
|
|
@ -625,24 +625,6 @@ static GLint
|
||||||
slang_alloc_varying(struct gl_program *prog, const char *name)
|
slang_alloc_varying(struct gl_program *prog, const char *name)
|
||||||
{
|
{
|
||||||
GLint i = _mesa_add_varying(prog->Varying, name, 4); /* XXX fix size */
|
GLint i = _mesa_add_varying(prog->Varying, name, 4); /* XXX fix size */
|
||||||
#if 0
|
|
||||||
if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
|
|
||||||
#ifdef OLD_LINK
|
|
||||||
i += VERT_RESULT_VAR0;
|
|
||||||
prog->OutputsWritten |= (1 << i);
|
|
||||||
#else
|
|
||||||
prog->OutputsWritten |= (1 << (i + VERT_RESULT_VAR0));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#ifdef OLD_LINK
|
|
||||||
i += FRAG_ATTRIB_VAR0;
|
|
||||||
prog->InputsRead |= (1 << i);
|
|
||||||
#else
|
|
||||||
prog->InputsRead |= (1 << (i + FRAG_ATTRIB_VAR0));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -746,7 +728,6 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n,
|
||||||
n->Store->File = PROGRAM_INPUT;
|
n->Store->File = PROGRAM_INPUT;
|
||||||
n->Store->Index = i;
|
n->Store->Index = i;
|
||||||
assert(n->Store->Size > 0);
|
assert(n->Store->Size > 0);
|
||||||
prog->InputsRead |= (1 << i);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -754,7 +735,6 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n,
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
n->Store->File = PROGRAM_OUTPUT;
|
n->Store->File = PROGRAM_OUTPUT;
|
||||||
n->Store->Index = i;
|
n->Store->Index = i;
|
||||||
prog->OutputsWritten |= (1 << i);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,6 +293,34 @@ slang_resolve_branches(struct gl_program *prog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan program instructions to update the program's InputsRead and
|
||||||
|
* OutputsWritten fields.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
slang_update_inputs_outputs(struct gl_program *prog)
|
||||||
|
{
|
||||||
|
GLuint i, j;
|
||||||
|
|
||||||
|
prog->InputsRead = 0x0;
|
||||||
|
prog->OutputsWritten = 0x0;
|
||||||
|
|
||||||
|
for (i = 0; i < prog->NumInstructions; i++) {
|
||||||
|
const struct prog_instruction *inst = prog->Instructions + i;
|
||||||
|
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
|
||||||
|
for (j = 0; j < numSrc; j++) {
|
||||||
|
if (inst->SrcReg[j].File == PROGRAM_INPUT) {
|
||||||
|
prog->InputsRead |= 1 << inst->SrcReg[j].Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inst->DstReg.File == PROGRAM_OUTPUT) {
|
||||||
|
prog->OutputsWritten |= 1 << inst->DstReg.Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** cast wrapper */
|
/** cast wrapper */
|
||||||
static struct gl_vertex_program *
|
static struct gl_vertex_program *
|
||||||
vertex_program(struct gl_program *prog)
|
vertex_program(struct gl_program *prog)
|
||||||
|
|
@ -390,6 +418,9 @@ _slang_link2(GLcontext *ctx,
|
||||||
slang_resolve_branches(&shProg->VertexProgram->Base);
|
slang_resolve_branches(&shProg->VertexProgram->Base);
|
||||||
slang_resolve_branches(&shProg->FragmentProgram->Base);
|
slang_resolve_branches(&shProg->FragmentProgram->Base);
|
||||||
|
|
||||||
|
slang_update_inputs_outputs(&shProg->VertexProgram->Base);
|
||||||
|
slang_update_inputs_outputs(&shProg->FragmentProgram->Base);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
printf("************** original fragment program\n");
|
printf("************** original fragment program\n");
|
||||||
_mesa_print_program(&fragProg->Base);
|
_mesa_print_program(&fragProg->Base);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue