mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 09:00:10 +01:00
gallium: translate ARB fp/vp immediates consistently to tgsi immediates
This commit is contained in:
parent
ebf78c0dcc
commit
21c67b70d4
1 changed files with 20 additions and 4 deletions
|
|
@ -47,7 +47,9 @@
|
||||||
*/
|
*/
|
||||||
static GLuint
|
static GLuint
|
||||||
map_register_file(
|
map_register_file(
|
||||||
enum register_file file )
|
enum register_file file,
|
||||||
|
GLuint index,
|
||||||
|
const GLuint immediateMapping[] )
|
||||||
{
|
{
|
||||||
switch( file ) {
|
switch( file ) {
|
||||||
case PROGRAM_UNDEFINED:
|
case PROGRAM_UNDEFINED:
|
||||||
|
|
@ -56,9 +58,19 @@ map_register_file(
|
||||||
return TGSI_FILE_TEMPORARY;
|
return TGSI_FILE_TEMPORARY;
|
||||||
//case PROGRAM_LOCAL_PARAM:
|
//case PROGRAM_LOCAL_PARAM:
|
||||||
//case PROGRAM_ENV_PARAM:
|
//case PROGRAM_ENV_PARAM:
|
||||||
|
|
||||||
|
/* Because of the longstanding problem with mesa arb shaders
|
||||||
|
* where constants, immediates and state variables are all
|
||||||
|
* bundled together as PROGRAM_STATE_VAR, we can't tell from the
|
||||||
|
* mesa register file whether this is a CONSTANT or an
|
||||||
|
* IMMEDIATE, hence we need all the other information.
|
||||||
|
*/
|
||||||
case PROGRAM_STATE_VAR:
|
case PROGRAM_STATE_VAR:
|
||||||
case PROGRAM_NAMED_PARAM:
|
case PROGRAM_NAMED_PARAM:
|
||||||
case PROGRAM_UNIFORM:
|
case PROGRAM_UNIFORM:
|
||||||
|
if (immediateMapping[index] != ~0)
|
||||||
|
return TGSI_FILE_IMMEDIATE;
|
||||||
|
else
|
||||||
return TGSI_FILE_CONSTANT;
|
return TGSI_FILE_CONSTANT;
|
||||||
case PROGRAM_CONSTANT:
|
case PROGRAM_CONSTANT:
|
||||||
return TGSI_FILE_IMMEDIATE;
|
return TGSI_FILE_IMMEDIATE;
|
||||||
|
|
@ -194,7 +206,7 @@ compile_instruction(
|
||||||
fullinst->Instruction.NumSrcRegs = _mesa_num_inst_src_regs( inst->Opcode );
|
fullinst->Instruction.NumSrcRegs = _mesa_num_inst_src_regs( inst->Opcode );
|
||||||
|
|
||||||
fulldst = &fullinst->FullDstRegisters[0];
|
fulldst = &fullinst->FullDstRegisters[0];
|
||||||
fulldst->DstRegister.File = map_register_file( inst->DstReg.File );
|
fulldst->DstRegister.File = map_register_file( inst->DstReg.File, 0, NULL );
|
||||||
fulldst->DstRegister.Index = map_register_file_index(
|
fulldst->DstRegister.Index = map_register_file_index(
|
||||||
fulldst->DstRegister.File,
|
fulldst->DstRegister.File,
|
||||||
inst->DstReg.Index,
|
inst->DstReg.Index,
|
||||||
|
|
@ -208,7 +220,9 @@ compile_instruction(
|
||||||
GLuint j;
|
GLuint j;
|
||||||
|
|
||||||
fullsrc = &fullinst->FullSrcRegisters[i];
|
fullsrc = &fullinst->FullSrcRegisters[i];
|
||||||
fullsrc->SrcRegister.File = map_register_file( inst->SrcReg[i].File );
|
fullsrc->SrcRegister.File = map_register_file( inst->SrcReg[i].File,
|
||||||
|
inst->SrcReg[i].Index,
|
||||||
|
immediateMapping );
|
||||||
fullsrc->SrcRegister.Index = map_register_file_index(
|
fullsrc->SrcRegister.Index = map_register_file_index(
|
||||||
fullsrc->SrcRegister.File,
|
fullsrc->SrcRegister.File,
|
||||||
inst->SrcReg[i].Index,
|
inst->SrcReg[i].Index,
|
||||||
|
|
@ -813,6 +827,8 @@ tgsi_translate_mesa_program(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* immediates/literals */
|
/* immediates/literals */
|
||||||
|
memset(immediates, ~0, sizeof(immediates));
|
||||||
|
|
||||||
for (i = 0; program->Parameters && i < program->Parameters->NumParameters;
|
for (i = 0; program->Parameters && i < program->Parameters->NumParameters;
|
||||||
i++) {
|
i++) {
|
||||||
if (program->Parameters->Parameters[i].Type == PROGRAM_CONSTANT) {
|
if (program->Parameters->Parameters[i].Type == PROGRAM_CONSTANT) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue