d3dcompiler: Move some bytecode output functions to bytecodewriter.c.

This commit is contained in:
Henri Verbeet 2010-10-18 13:05:49 +02:00 committed by Alexandre Julliard
parent 3db5163fd0
commit 72d5b9ddab
3 changed files with 230 additions and 230 deletions

View File

@ -28,226 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(asmshader);
/* bwriter -> d3d9 conversion functions */
DWORD d3d9_swizzle(DWORD bwriter_swizzle) {
/* Currently a NOP, but this allows changing the internal definitions
* without side effects
*/
DWORD ret = 0;
if((bwriter_swizzle & BWRITERVS_X_X) == BWRITERVS_X_X) ret |= D3DVS_X_X;
if((bwriter_swizzle & BWRITERVS_X_Y) == BWRITERVS_X_Y) ret |= D3DVS_X_Y;
if((bwriter_swizzle & BWRITERVS_X_Z) == BWRITERVS_X_Z) ret |= D3DVS_X_Z;
if((bwriter_swizzle & BWRITERVS_X_W) == BWRITERVS_X_W) ret |= D3DVS_X_W;
if((bwriter_swizzle & BWRITERVS_Y_X) == BWRITERVS_Y_X) ret |= D3DVS_Y_X;
if((bwriter_swizzle & BWRITERVS_Y_Y) == BWRITERVS_Y_Y) ret |= D3DVS_Y_Y;
if((bwriter_swizzle & BWRITERVS_Y_Z) == BWRITERVS_Y_Z) ret |= D3DVS_Y_Z;
if((bwriter_swizzle & BWRITERVS_Y_W) == BWRITERVS_Y_W) ret |= D3DVS_Y_W;
if((bwriter_swizzle & BWRITERVS_Z_X) == BWRITERVS_Z_X) ret |= D3DVS_Z_X;
if((bwriter_swizzle & BWRITERVS_Z_Y) == BWRITERVS_Z_Y) ret |= D3DVS_Z_Y;
if((bwriter_swizzle & BWRITERVS_Z_Z) == BWRITERVS_Z_Z) ret |= D3DVS_Z_Z;
if((bwriter_swizzle & BWRITERVS_Z_W) == BWRITERVS_Z_W) ret |= D3DVS_Z_W;
if((bwriter_swizzle & BWRITERVS_W_X) == BWRITERVS_W_X) ret |= D3DVS_W_X;
if((bwriter_swizzle & BWRITERVS_W_Y) == BWRITERVS_W_Y) ret |= D3DVS_W_Y;
if((bwriter_swizzle & BWRITERVS_W_Z) == BWRITERVS_W_Z) ret |= D3DVS_W_Z;
if((bwriter_swizzle & BWRITERVS_W_W) == BWRITERVS_W_W) ret |= D3DVS_W_W;
return ret;
}
DWORD d3d9_writemask(DWORD bwriter_writemask) {
DWORD ret = 0;
if(bwriter_writemask & BWRITERSP_WRITEMASK_0) ret |= D3DSP_WRITEMASK_0;
if(bwriter_writemask & BWRITERSP_WRITEMASK_1) ret |= D3DSP_WRITEMASK_1;
if(bwriter_writemask & BWRITERSP_WRITEMASK_2) ret |= D3DSP_WRITEMASK_2;
if(bwriter_writemask & BWRITERSP_WRITEMASK_3) ret |= D3DSP_WRITEMASK_3;
return ret;
}
DWORD d3d9_srcmod(DWORD bwriter_srcmod) {
switch(bwriter_srcmod) {
case BWRITERSPSM_NONE: return D3DSPSM_NONE;
case BWRITERSPSM_NEG: return D3DSPSM_NEG;
case BWRITERSPSM_BIAS: return D3DSPSM_BIAS;
case BWRITERSPSM_BIASNEG: return D3DSPSM_BIASNEG;
case BWRITERSPSM_SIGN: return D3DSPSM_SIGN;
case BWRITERSPSM_SIGNNEG: return D3DSPSM_SIGNNEG;
case BWRITERSPSM_COMP: return D3DSPSM_COMP;
case BWRITERSPSM_X2: return D3DSPSM_X2;
case BWRITERSPSM_X2NEG: return D3DSPSM_X2NEG;
case BWRITERSPSM_DZ: return D3DSPSM_DZ;
case BWRITERSPSM_DW: return D3DSPSM_DW;
case BWRITERSPSM_ABS: return D3DSPSM_ABS;
case BWRITERSPSM_ABSNEG: return D3DSPSM_ABSNEG;
case BWRITERSPSM_NOT: return D3DSPSM_NOT;
default:
FIXME("Unhandled BWRITERSPSM token %u\n", bwriter_srcmod);
return 0;
}
}
DWORD d3d9_dstmod(DWORD bwriter_mod) {
DWORD ret = 0;
if(bwriter_mod & BWRITERSPDM_SATURATE) ret |= D3DSPDM_SATURATE;
if(bwriter_mod & BWRITERSPDM_PARTIALPRECISION) ret |= D3DSPDM_PARTIALPRECISION;
if(bwriter_mod & BWRITERSPDM_MSAMPCENTROID) ret |= D3DSPDM_MSAMPCENTROID;
return ret;
}
DWORD d3d9_comparetype(DWORD asmshader_comparetype) {
switch(asmshader_comparetype) {
case BWRITER_COMPARISON_GT: return D3DSPC_GT;
case BWRITER_COMPARISON_EQ: return D3DSPC_EQ;
case BWRITER_COMPARISON_GE: return D3DSPC_GE;
case BWRITER_COMPARISON_LT: return D3DSPC_LT;
case BWRITER_COMPARISON_NE: return D3DSPC_NE;
case BWRITER_COMPARISON_LE: return D3DSPC_LE;
default:
FIXME("Unexpected BWRITER_COMPARISON type %u\n", asmshader_comparetype);
return 0;
}
}
DWORD d3d9_sampler(DWORD bwriter_sampler) {
if(bwriter_sampler == BWRITERSTT_UNKNOWN) return D3DSTT_UNKNOWN;
if(bwriter_sampler == BWRITERSTT_1D) return D3DSTT_1D;
if(bwriter_sampler == BWRITERSTT_2D) return D3DSTT_2D;
if(bwriter_sampler == BWRITERSTT_CUBE) return D3DSTT_CUBE;
if(bwriter_sampler == BWRITERSTT_VOLUME) return D3DSTT_VOLUME;
FIXME("Unexpected BWRITERSAMPLER_TEXTURE_TYPE type %u\n", bwriter_sampler);
return 0;
}
DWORD d3d9_register(DWORD bwriter_register) {
if(bwriter_register == BWRITERSPR_TEMP) return D3DSPR_TEMP;
if(bwriter_register == BWRITERSPR_INPUT) return D3DSPR_INPUT;
if(bwriter_register == BWRITERSPR_CONST) return D3DSPR_CONST;
if(bwriter_register == BWRITERSPR_ADDR) return D3DSPR_ADDR;
if(bwriter_register == BWRITERSPR_TEXTURE) return D3DSPR_TEXTURE;
if(bwriter_register == BWRITERSPR_RASTOUT) return D3DSPR_RASTOUT;
if(bwriter_register == BWRITERSPR_ATTROUT) return D3DSPR_ATTROUT;
if(bwriter_register == BWRITERSPR_TEXCRDOUT) return D3DSPR_TEXCRDOUT;
if(bwriter_register == BWRITERSPR_OUTPUT) return D3DSPR_OUTPUT;
if(bwriter_register == BWRITERSPR_CONSTINT) return D3DSPR_CONSTINT;
if(bwriter_register == BWRITERSPR_COLOROUT) return D3DSPR_COLOROUT;
if(bwriter_register == BWRITERSPR_DEPTHOUT) return D3DSPR_DEPTHOUT;
if(bwriter_register == BWRITERSPR_SAMPLER) return D3DSPR_SAMPLER;
if(bwriter_register == BWRITERSPR_CONSTBOOL) return D3DSPR_CONSTBOOL;
if(bwriter_register == BWRITERSPR_LOOP) return D3DSPR_LOOP;
if(bwriter_register == BWRITERSPR_MISCTYPE) return D3DSPR_MISCTYPE;
if(bwriter_register == BWRITERSPR_LABEL) return D3DSPR_LABEL;
if(bwriter_register == BWRITERSPR_PREDICATE) return D3DSPR_PREDICATE;
FIXME("Unexpected BWRITERSPR %u\n", bwriter_register);
return -1;
}
DWORD d3d9_opcode(DWORD bwriter_opcode) {
switch(bwriter_opcode) {
case BWRITERSIO_NOP: return D3DSIO_NOP;
case BWRITERSIO_MOV: return D3DSIO_MOV;
case BWRITERSIO_ADD: return D3DSIO_ADD;
case BWRITERSIO_SUB: return D3DSIO_SUB;
case BWRITERSIO_MAD: return D3DSIO_MAD;
case BWRITERSIO_MUL: return D3DSIO_MUL;
case BWRITERSIO_RCP: return D3DSIO_RCP;
case BWRITERSIO_RSQ: return D3DSIO_RSQ;
case BWRITERSIO_DP3: return D3DSIO_DP3;
case BWRITERSIO_DP4: return D3DSIO_DP4;
case BWRITERSIO_MIN: return D3DSIO_MIN;
case BWRITERSIO_MAX: return D3DSIO_MAX;
case BWRITERSIO_SLT: return D3DSIO_SLT;
case BWRITERSIO_SGE: return D3DSIO_SGE;
case BWRITERSIO_EXP: return D3DSIO_EXP;
case BWRITERSIO_LOG: return D3DSIO_LOG;
case BWRITERSIO_LIT: return D3DSIO_LIT;
case BWRITERSIO_DST: return D3DSIO_DST;
case BWRITERSIO_LRP: return D3DSIO_LRP;
case BWRITERSIO_FRC: return D3DSIO_FRC;
case BWRITERSIO_M4x4: return D3DSIO_M4x4;
case BWRITERSIO_M4x3: return D3DSIO_M4x3;
case BWRITERSIO_M3x4: return D3DSIO_M3x4;
case BWRITERSIO_M3x3: return D3DSIO_M3x3;
case BWRITERSIO_M3x2: return D3DSIO_M3x2;
case BWRITERSIO_CALL: return D3DSIO_CALL;
case BWRITERSIO_CALLNZ: return D3DSIO_CALLNZ;
case BWRITERSIO_LOOP: return D3DSIO_LOOP;
case BWRITERSIO_RET: return D3DSIO_RET;
case BWRITERSIO_ENDLOOP: return D3DSIO_ENDLOOP;
case BWRITERSIO_LABEL: return D3DSIO_LABEL;
case BWRITERSIO_DCL: return D3DSIO_DCL;
case BWRITERSIO_POW: return D3DSIO_POW;
case BWRITERSIO_CRS: return D3DSIO_CRS;
case BWRITERSIO_SGN: return D3DSIO_SGN;
case BWRITERSIO_ABS: return D3DSIO_ABS;
case BWRITERSIO_NRM: return D3DSIO_NRM;
case BWRITERSIO_SINCOS: return D3DSIO_SINCOS;
case BWRITERSIO_REP: return D3DSIO_REP;
case BWRITERSIO_ENDREP: return D3DSIO_ENDREP;
case BWRITERSIO_IF: return D3DSIO_IF;
case BWRITERSIO_IFC: return D3DSIO_IFC;
case BWRITERSIO_ELSE: return D3DSIO_ELSE;
case BWRITERSIO_ENDIF: return D3DSIO_ENDIF;
case BWRITERSIO_BREAK: return D3DSIO_BREAK;
case BWRITERSIO_BREAKC: return D3DSIO_BREAKC;
case BWRITERSIO_MOVA: return D3DSIO_MOVA;
case BWRITERSIO_DEFB: return D3DSIO_DEFB;
case BWRITERSIO_DEFI: return D3DSIO_DEFI;
case BWRITERSIO_TEXCOORD: return D3DSIO_TEXCOORD;
case BWRITERSIO_TEXKILL: return D3DSIO_TEXKILL;
case BWRITERSIO_TEX: return D3DSIO_TEX;
case BWRITERSIO_TEXBEM: return D3DSIO_TEXBEM;
case BWRITERSIO_TEXBEML: return D3DSIO_TEXBEML;
case BWRITERSIO_TEXREG2AR: return D3DSIO_TEXREG2AR;
case BWRITERSIO_TEXREG2GB: return D3DSIO_TEXREG2GB;
case BWRITERSIO_TEXM3x2PAD: return D3DSIO_TEXM3x2PAD;
case BWRITERSIO_TEXM3x2TEX: return D3DSIO_TEXM3x2TEX;
case BWRITERSIO_TEXM3x3PAD: return D3DSIO_TEXM3x3PAD;
case BWRITERSIO_TEXM3x3TEX: return D3DSIO_TEXM3x3TEX;
case BWRITERSIO_TEXM3x3SPEC: return D3DSIO_TEXM3x3SPEC;
case BWRITERSIO_TEXM3x3VSPEC:return D3DSIO_TEXM3x3VSPEC;
case BWRITERSIO_EXPP: return D3DSIO_EXPP;
case BWRITERSIO_LOGP: return D3DSIO_LOGP;
case BWRITERSIO_CND: return D3DSIO_CND;
case BWRITERSIO_DEF: return D3DSIO_DEF;
case BWRITERSIO_TEXREG2RGB: return D3DSIO_TEXREG2RGB;
case BWRITERSIO_TEXDP3TEX: return D3DSIO_TEXDP3TEX;
case BWRITERSIO_TEXM3x2DEPTH:return D3DSIO_TEXM3x2DEPTH;
case BWRITERSIO_TEXDP3: return D3DSIO_TEXDP3;
case BWRITERSIO_TEXM3x3: return D3DSIO_TEXM3x3;
case BWRITERSIO_TEXDEPTH: return D3DSIO_TEXDEPTH;
case BWRITERSIO_CMP: return D3DSIO_CMP;
case BWRITERSIO_BEM: return D3DSIO_BEM;
case BWRITERSIO_DP2ADD: return D3DSIO_DP2ADD;
case BWRITERSIO_DSX: return D3DSIO_DSX;
case BWRITERSIO_DSY: return D3DSIO_DSY;
case BWRITERSIO_TEXLDD: return D3DSIO_TEXLDD;
case BWRITERSIO_SETP: return D3DSIO_SETP;
case BWRITERSIO_TEXLDL: return D3DSIO_TEXLDL;
case BWRITERSIO_BREAKP: return D3DSIO_BREAKP;
case BWRITERSIO_PHASE: return D3DSIO_PHASE;
case BWRITERSIO_COMMENT: return D3DSIO_COMMENT;
case BWRITERSIO_END: return D3DSIO_END;
case BWRITERSIO_TEXLDP: return D3DSIO_TEX | D3DSI_TEXLD_PROJECT;
case BWRITERSIO_TEXLDB: return D3DSIO_TEX | D3DSI_TEXLD_BIAS;
default:
FIXME("Unhandled BWRITERSIO token %u\n", bwriter_opcode);
return -1;
}
}
/* Debug print functions */
const char *debug_print_srcmod(DWORD mod) {
switch(mod) {

View File

@ -341,6 +341,236 @@ static void put_dword(struct bytecode_buffer *buffer, DWORD value) {
buffer->data[buffer->size++] = value;
}
/* bwriter -> d3d9 conversion functions. */
static DWORD d3d9_swizzle(DWORD bwriter_swizzle)
{
/* Currently a NOP, but this allows changing the internal definitions
* without side effects. */
DWORD ret = 0;
if ((bwriter_swizzle & BWRITERVS_X_X) == BWRITERVS_X_X) ret |= D3DVS_X_X;
if ((bwriter_swizzle & BWRITERVS_X_Y) == BWRITERVS_X_Y) ret |= D3DVS_X_Y;
if ((bwriter_swizzle & BWRITERVS_X_Z) == BWRITERVS_X_Z) ret |= D3DVS_X_Z;
if ((bwriter_swizzle & BWRITERVS_X_W) == BWRITERVS_X_W) ret |= D3DVS_X_W;
if ((bwriter_swizzle & BWRITERVS_Y_X) == BWRITERVS_Y_X) ret |= D3DVS_Y_X;
if ((bwriter_swizzle & BWRITERVS_Y_Y) == BWRITERVS_Y_Y) ret |= D3DVS_Y_Y;
if ((bwriter_swizzle & BWRITERVS_Y_Z) == BWRITERVS_Y_Z) ret |= D3DVS_Y_Z;
if ((bwriter_swizzle & BWRITERVS_Y_W) == BWRITERVS_Y_W) ret |= D3DVS_Y_W;
if ((bwriter_swizzle & BWRITERVS_Z_X) == BWRITERVS_Z_X) ret |= D3DVS_Z_X;
if ((bwriter_swizzle & BWRITERVS_Z_Y) == BWRITERVS_Z_Y) ret |= D3DVS_Z_Y;
if ((bwriter_swizzle & BWRITERVS_Z_Z) == BWRITERVS_Z_Z) ret |= D3DVS_Z_Z;
if ((bwriter_swizzle & BWRITERVS_Z_W) == BWRITERVS_Z_W) ret |= D3DVS_Z_W;
if ((bwriter_swizzle & BWRITERVS_W_X) == BWRITERVS_W_X) ret |= D3DVS_W_X;
if ((bwriter_swizzle & BWRITERVS_W_Y) == BWRITERVS_W_Y) ret |= D3DVS_W_Y;
if ((bwriter_swizzle & BWRITERVS_W_Z) == BWRITERVS_W_Z) ret |= D3DVS_W_Z;
if ((bwriter_swizzle & BWRITERVS_W_W) == BWRITERVS_W_W) ret |= D3DVS_W_W;
return ret;
}
static DWORD d3d9_writemask(DWORD bwriter_writemask)
{
DWORD ret = 0;
if (bwriter_writemask & BWRITERSP_WRITEMASK_0) ret |= D3DSP_WRITEMASK_0;
if (bwriter_writemask & BWRITERSP_WRITEMASK_1) ret |= D3DSP_WRITEMASK_1;
if (bwriter_writemask & BWRITERSP_WRITEMASK_2) ret |= D3DSP_WRITEMASK_2;
if (bwriter_writemask & BWRITERSP_WRITEMASK_3) ret |= D3DSP_WRITEMASK_3;
return ret;
}
static DWORD d3d9_srcmod(DWORD bwriter_srcmod)
{
switch (bwriter_srcmod)
{
case BWRITERSPSM_NONE: return D3DSPSM_NONE;
case BWRITERSPSM_NEG: return D3DSPSM_NEG;
case BWRITERSPSM_BIAS: return D3DSPSM_BIAS;
case BWRITERSPSM_BIASNEG: return D3DSPSM_BIASNEG;
case BWRITERSPSM_SIGN: return D3DSPSM_SIGN;
case BWRITERSPSM_SIGNNEG: return D3DSPSM_SIGNNEG;
case BWRITERSPSM_COMP: return D3DSPSM_COMP;
case BWRITERSPSM_X2: return D3DSPSM_X2;
case BWRITERSPSM_X2NEG: return D3DSPSM_X2NEG;
case BWRITERSPSM_DZ: return D3DSPSM_DZ;
case BWRITERSPSM_DW: return D3DSPSM_DW;
case BWRITERSPSM_ABS: return D3DSPSM_ABS;
case BWRITERSPSM_ABSNEG: return D3DSPSM_ABSNEG;
case BWRITERSPSM_NOT: return D3DSPSM_NOT;
default:
FIXME("Unhandled BWRITERSPSM token %#x.\n", bwriter_srcmod);
return 0;
}
}
static DWORD d3d9_dstmod(DWORD bwriter_mod)
{
DWORD ret = 0;
if (bwriter_mod & BWRITERSPDM_SATURATE) ret |= D3DSPDM_SATURATE;
if (bwriter_mod & BWRITERSPDM_PARTIALPRECISION) ret |= D3DSPDM_PARTIALPRECISION;
if (bwriter_mod & BWRITERSPDM_MSAMPCENTROID) ret |= D3DSPDM_MSAMPCENTROID;
return ret;
}
static DWORD d3d9_comparetype(DWORD asmshader_comparetype)
{
switch (asmshader_comparetype)
{
case BWRITER_COMPARISON_GT: return D3DSPC_GT;
case BWRITER_COMPARISON_EQ: return D3DSPC_EQ;
case BWRITER_COMPARISON_GE: return D3DSPC_GE;
case BWRITER_COMPARISON_LT: return D3DSPC_LT;
case BWRITER_COMPARISON_NE: return D3DSPC_NE;
case BWRITER_COMPARISON_LE: return D3DSPC_LE;
default:
FIXME("Unexpected BWRITER_COMPARISON type %#x.\n", asmshader_comparetype);
return 0;
}
}
static DWORD d3d9_sampler(DWORD bwriter_sampler)
{
if (bwriter_sampler == BWRITERSTT_UNKNOWN) return D3DSTT_UNKNOWN;
if (bwriter_sampler == BWRITERSTT_1D) return D3DSTT_1D;
if (bwriter_sampler == BWRITERSTT_2D) return D3DSTT_2D;
if (bwriter_sampler == BWRITERSTT_CUBE) return D3DSTT_CUBE;
if (bwriter_sampler == BWRITERSTT_VOLUME) return D3DSTT_VOLUME;
FIXME("Unexpected BWRITERSAMPLER_TEXTURE_TYPE type %#x.\n", bwriter_sampler);
return 0;
}
static DWORD d3d9_register(DWORD bwriter_register)
{
if (bwriter_register == BWRITERSPR_TEMP) return D3DSPR_TEMP;
if (bwriter_register == BWRITERSPR_INPUT) return D3DSPR_INPUT;
if (bwriter_register == BWRITERSPR_CONST) return D3DSPR_CONST;
if (bwriter_register == BWRITERSPR_ADDR) return D3DSPR_ADDR;
if (bwriter_register == BWRITERSPR_TEXTURE) return D3DSPR_TEXTURE;
if (bwriter_register == BWRITERSPR_RASTOUT) return D3DSPR_RASTOUT;
if (bwriter_register == BWRITERSPR_ATTROUT) return D3DSPR_ATTROUT;
if (bwriter_register == BWRITERSPR_TEXCRDOUT) return D3DSPR_TEXCRDOUT;
if (bwriter_register == BWRITERSPR_OUTPUT) return D3DSPR_OUTPUT;
if (bwriter_register == BWRITERSPR_CONSTINT) return D3DSPR_CONSTINT;
if (bwriter_register == BWRITERSPR_COLOROUT) return D3DSPR_COLOROUT;
if (bwriter_register == BWRITERSPR_DEPTHOUT) return D3DSPR_DEPTHOUT;
if (bwriter_register == BWRITERSPR_SAMPLER) return D3DSPR_SAMPLER;
if (bwriter_register == BWRITERSPR_CONSTBOOL) return D3DSPR_CONSTBOOL;
if (bwriter_register == BWRITERSPR_LOOP) return D3DSPR_LOOP;
if (bwriter_register == BWRITERSPR_MISCTYPE) return D3DSPR_MISCTYPE;
if (bwriter_register == BWRITERSPR_LABEL) return D3DSPR_LABEL;
if (bwriter_register == BWRITERSPR_PREDICATE) return D3DSPR_PREDICATE;
FIXME("Unexpected BWRITERSPR %#x.\n", bwriter_register);
return ~0U;
}
static DWORD d3d9_opcode(DWORD bwriter_opcode)
{
switch (bwriter_opcode)
{
case BWRITERSIO_NOP: return D3DSIO_NOP;
case BWRITERSIO_MOV: return D3DSIO_MOV;
case BWRITERSIO_ADD: return D3DSIO_ADD;
case BWRITERSIO_SUB: return D3DSIO_SUB;
case BWRITERSIO_MAD: return D3DSIO_MAD;
case BWRITERSIO_MUL: return D3DSIO_MUL;
case BWRITERSIO_RCP: return D3DSIO_RCP;
case BWRITERSIO_RSQ: return D3DSIO_RSQ;
case BWRITERSIO_DP3: return D3DSIO_DP3;
case BWRITERSIO_DP4: return D3DSIO_DP4;
case BWRITERSIO_MIN: return D3DSIO_MIN;
case BWRITERSIO_MAX: return D3DSIO_MAX;
case BWRITERSIO_SLT: return D3DSIO_SLT;
case BWRITERSIO_SGE: return D3DSIO_SGE;
case BWRITERSIO_EXP: return D3DSIO_EXP;
case BWRITERSIO_LOG: return D3DSIO_LOG;
case BWRITERSIO_LIT: return D3DSIO_LIT;
case BWRITERSIO_DST: return D3DSIO_DST;
case BWRITERSIO_LRP: return D3DSIO_LRP;
case BWRITERSIO_FRC: return D3DSIO_FRC;
case BWRITERSIO_M4x4: return D3DSIO_M4x4;
case BWRITERSIO_M4x3: return D3DSIO_M4x3;
case BWRITERSIO_M3x4: return D3DSIO_M3x4;
case BWRITERSIO_M3x3: return D3DSIO_M3x3;
case BWRITERSIO_M3x2: return D3DSIO_M3x2;
case BWRITERSIO_CALL: return D3DSIO_CALL;
case BWRITERSIO_CALLNZ: return D3DSIO_CALLNZ;
case BWRITERSIO_LOOP: return D3DSIO_LOOP;
case BWRITERSIO_RET: return D3DSIO_RET;
case BWRITERSIO_ENDLOOP: return D3DSIO_ENDLOOP;
case BWRITERSIO_LABEL: return D3DSIO_LABEL;
case BWRITERSIO_DCL: return D3DSIO_DCL;
case BWRITERSIO_POW: return D3DSIO_POW;
case BWRITERSIO_CRS: return D3DSIO_CRS;
case BWRITERSIO_SGN: return D3DSIO_SGN;
case BWRITERSIO_ABS: return D3DSIO_ABS;
case BWRITERSIO_NRM: return D3DSIO_NRM;
case BWRITERSIO_SINCOS: return D3DSIO_SINCOS;
case BWRITERSIO_REP: return D3DSIO_REP;
case BWRITERSIO_ENDREP: return D3DSIO_ENDREP;
case BWRITERSIO_IF: return D3DSIO_IF;
case BWRITERSIO_IFC: return D3DSIO_IFC;
case BWRITERSIO_ELSE: return D3DSIO_ELSE;
case BWRITERSIO_ENDIF: return D3DSIO_ENDIF;
case BWRITERSIO_BREAK: return D3DSIO_BREAK;
case BWRITERSIO_BREAKC: return D3DSIO_BREAKC;
case BWRITERSIO_MOVA: return D3DSIO_MOVA;
case BWRITERSIO_DEFB: return D3DSIO_DEFB;
case BWRITERSIO_DEFI: return D3DSIO_DEFI;
case BWRITERSIO_TEXCOORD: return D3DSIO_TEXCOORD;
case BWRITERSIO_TEXKILL: return D3DSIO_TEXKILL;
case BWRITERSIO_TEX: return D3DSIO_TEX;
case BWRITERSIO_TEXBEM: return D3DSIO_TEXBEM;
case BWRITERSIO_TEXBEML: return D3DSIO_TEXBEML;
case BWRITERSIO_TEXREG2AR: return D3DSIO_TEXREG2AR;
case BWRITERSIO_TEXREG2GB: return D3DSIO_TEXREG2GB;
case BWRITERSIO_TEXM3x2PAD: return D3DSIO_TEXM3x2PAD;
case BWRITERSIO_TEXM3x2TEX: return D3DSIO_TEXM3x2TEX;
case BWRITERSIO_TEXM3x3PAD: return D3DSIO_TEXM3x3PAD;
case BWRITERSIO_TEXM3x3TEX: return D3DSIO_TEXM3x3TEX;
case BWRITERSIO_TEXM3x3SPEC: return D3DSIO_TEXM3x3SPEC;
case BWRITERSIO_TEXM3x3VSPEC:return D3DSIO_TEXM3x3VSPEC;
case BWRITERSIO_EXPP: return D3DSIO_EXPP;
case BWRITERSIO_LOGP: return D3DSIO_LOGP;
case BWRITERSIO_CND: return D3DSIO_CND;
case BWRITERSIO_DEF: return D3DSIO_DEF;
case BWRITERSIO_TEXREG2RGB: return D3DSIO_TEXREG2RGB;
case BWRITERSIO_TEXDP3TEX: return D3DSIO_TEXDP3TEX;
case BWRITERSIO_TEXM3x2DEPTH:return D3DSIO_TEXM3x2DEPTH;
case BWRITERSIO_TEXDP3: return D3DSIO_TEXDP3;
case BWRITERSIO_TEXM3x3: return D3DSIO_TEXM3x3;
case BWRITERSIO_TEXDEPTH: return D3DSIO_TEXDEPTH;
case BWRITERSIO_CMP: return D3DSIO_CMP;
case BWRITERSIO_BEM: return D3DSIO_BEM;
case BWRITERSIO_DP2ADD: return D3DSIO_DP2ADD;
case BWRITERSIO_DSX: return D3DSIO_DSX;
case BWRITERSIO_DSY: return D3DSIO_DSY;
case BWRITERSIO_TEXLDD: return D3DSIO_TEXLDD;
case BWRITERSIO_SETP: return D3DSIO_SETP;
case BWRITERSIO_TEXLDL: return D3DSIO_TEXLDL;
case BWRITERSIO_BREAKP: return D3DSIO_BREAKP;
case BWRITERSIO_PHASE: return D3DSIO_PHASE;
case BWRITERSIO_COMMENT: return D3DSIO_COMMENT;
case BWRITERSIO_END: return D3DSIO_END;
case BWRITERSIO_TEXLDP: return D3DSIO_TEX | D3DSI_TEXLD_PROJECT;
case BWRITERSIO_TEXLDB: return D3DSIO_TEX | D3DSI_TEXLD_BIAS;
default:
FIXME("Unhandled BWRITERSIO token %#x.\n", bwriter_opcode);
return ~0U;
}
}
/******************************************************
* Implementation of the writer functions starts here *
******************************************************/

View File

@ -338,16 +338,6 @@ const char *debug_print_srcreg(const struct shader_reg *reg);
const char *debug_print_comp(DWORD comp);
const char *debug_print_opcode(DWORD opcode);
/* Utilities for internal->d3d constant mapping */
DWORD d3d9_swizzle(DWORD bwriter_swizzle);
DWORD d3d9_writemask(DWORD bwriter_writemask);
DWORD d3d9_srcmod(DWORD bwriter_srcmod);
DWORD d3d9_dstmod(DWORD bwriter_mod);
DWORD d3d9_comparetype(DWORD bwriter_comparetype);
DWORD d3d9_sampler(DWORD bwriter_sampler);
DWORD d3d9_register(DWORD bwriter_register);
DWORD d3d9_opcode(DWORD bwriter_opcode);
/* Used to signal an incorrect swizzle/writemask */
#define SWIZZLE_ERR ~0U