Commit 6f5af404 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the glname field in struct SHADER_OPCODE.

It's only used for shader_hw_map2gl() and vshader_hw_rsq_rcp(), and we can handle those the same way we handle the GLSL equivalents.
parent ff409280
...@@ -902,9 +902,39 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg) ...@@ -902,9 +902,39 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg)
SHADER_BUFFER* buffer = arg->buffer; SHADER_BUFFER* buffer = arg->buffer;
DWORD dst = arg->dst; DWORD dst = arg->dst;
const DWORD *src = arg->src; const DWORD *src = arg->src;
const char *instruction;
char arguments[256]; char arguments[256];
unsigned int i; unsigned int i;
switch (curOpcode->opcode)
{
case WINED3DSIO_ABS: instruction = "ABS"; break;
case WINED3DSIO_ADD: instruction = "ADD"; break;
case WINED3DSIO_CRS: instruction = "XPD"; break;
case WINED3DSIO_DP3: instruction = "DP3"; break;
case WINED3DSIO_DP4: instruction = "DP4"; break;
case WINED3DSIO_DST: instruction = "DST"; break;
case WINED3DSIO_EXP: instruction = "EX2"; break;
case WINED3DSIO_EXPP: instruction = "EXP"; break;
case WINED3DSIO_FRC: instruction = "FRC"; break;
case WINED3DSIO_LIT: instruction = "LIT"; break;
case WINED3DSIO_LOG: instruction = "LG2"; break;
case WINED3DSIO_LOGP: instruction = "LOG"; break;
case WINED3DSIO_LRP: instruction = "LRP"; break;
case WINED3DSIO_MAD: instruction = "MAD"; break;
case WINED3DSIO_MAX: instruction = "MAX"; break;
case WINED3DSIO_MIN: instruction = "MIN"; break;
case WINED3DSIO_MUL: instruction = "MUL"; break;
case WINED3DSIO_NOP: instruction = "NOP"; break;
case WINED3DSIO_POW: instruction = "POW"; break;
case WINED3DSIO_SGE: instruction = "SGE"; break;
case WINED3DSIO_SLT: instruction = "SLT"; break;
case WINED3DSIO_SUB: instruction = "SUB"; break;
default: instruction = "";
FIXME("Unhandled opcode %s\n", curOpcode->name);
break;
}
if (shader_is_pshader_version(arg->reg_maps->shader_version)) if (shader_is_pshader_version(arg->reg_maps->shader_version))
{ {
/* Output token related */ /* Output token related */
...@@ -958,7 +988,7 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg) ...@@ -958,7 +988,7 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg)
strcat(arguments, ", "); strcat(arguments, ", ");
strcat(arguments, operands[i]); strcat(arguments, operands[i]);
} }
shader_addline(buffer, "%s%s %s;\n", curOpcode->glname, modifier, arguments); shader_addline(buffer, "%s%s %s;\n", instruction, modifier, arguments);
/* A shift requires another line. */ /* A shift requires another line. */
if (shift) pshader_gen_output_modifier_line(buffer, saturate, output_wmask, shift, output_rname); if (shift) pshader_gen_output_modifier_line(buffer, saturate, output_wmask, shift, output_rname);
...@@ -975,7 +1005,7 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg) ...@@ -975,7 +1005,7 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg)
vshader_program_add_param(arg, src[i-1], TRUE, arguments); vshader_program_add_param(arg, src[i-1], TRUE, arguments);
} }
} }
shader_addline(buffer, "%s%s;\n", curOpcode->glname, arguments); shader_addline(buffer, "%s%s;\n", instruction, arguments);
} }
} }
...@@ -1560,10 +1590,20 @@ static void vshader_hw_rsq_rcp(const SHADER_OPCODE_ARG *arg) ...@@ -1560,10 +1590,20 @@ static void vshader_hw_rsq_rcp(const SHADER_OPCODE_ARG *arg)
DWORD dst = arg->dst; DWORD dst = arg->dst;
DWORD src = arg->src[0]; DWORD src = arg->src[0];
DWORD swizzle = (src & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT; DWORD swizzle = (src & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT;
const char *instruction;
char tmpLine[256]; char tmpLine[256];
strcpy(tmpLine, curOpcode->glname); /* Opcode */ switch(curOpcode->opcode)
{
case WINED3DSIO_RSQ: instruction = "RSQ"; break;
case WINED3DSIO_RCP: instruction = "RCP"; break;
default: instruction = "";
FIXME("Unhandled opcode %s\n", curOpcode->name);
break;
}
strcpy(tmpLine, instruction);
vshader_program_add_param(arg, dst, FALSE, tmpLine); /* Destination */ vshader_program_add_param(arg, dst, FALSE, tmpLine); /* Destination */
strcat(tmpLine, ","); strcat(tmpLine, ",");
vshader_program_add_param(arg, src, TRUE, tmpLine); vshader_program_add_param(arg, src, TRUE, tmpLine);
......
...@@ -2132,7 +2132,6 @@ typedef enum COMPARISON_TYPE { ...@@ -2132,7 +2132,6 @@ typedef enum COMPARISON_TYPE {
typedef struct SHADER_OPCODE { typedef struct SHADER_OPCODE {
unsigned int opcode; unsigned int opcode;
const char* name; const char* name;
const char* glname;
char dst_token; char dst_token;
CONST UINT num_params; CONST UINT num_params;
enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx;
......
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