wined3d: Move D3DSP_REG structures into the WINED3D namespace.

This commit is contained in:
Ivan Gyurdiev 2006-10-09 19:47:12 -04:00 committed by Alexandre Julliard
parent e8137632c7
commit 17c9d9588a
6 changed files with 72 additions and 63 deletions

View File

@ -310,7 +310,7 @@ static void vshader_program_add_input_param_swizzle(const DWORD param, int is_co
static void pshader_get_register_name(
const DWORD param, char* regstr) {
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD reg = param & WINED3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(param);
switch (regtype) {
@ -363,7 +363,7 @@ static void vshader_program_add_param(SHADER_OPCODE_ARG *arg, const DWORD param,
/* oPos, oFog and oPts in D3D */
static const char* hwrastout_reg_names[] = { "TMP_OUT", "TMP_FOG", "result.pointsize" };
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD reg = param & WINED3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(param);
char tmpReg[255];
BOOL is_color = FALSE;
@ -633,7 +633,7 @@ void pshader_hw_tex(SHADER_OPCODE_ARG* arg) {
DWORD sampler_type;
/* All versions have a destination register */
reg_dest_code = dst & D3DSP_REGNUM_MASK;
reg_dest_code = dst & WINED3DSP_REGNUM_MASK;
pshader_get_register_name(dst, reg_dest);
/* 1.0-1.3: Use destination register as coordinate source.
@ -648,7 +648,7 @@ void pshader_hw_tex(SHADER_OPCODE_ARG* arg) {
if (hex_version < D3DPS_VERSION(2,0))
reg_sampler_code = reg_dest_code;
else
reg_sampler_code = src[1] & D3DSP_REGNUM_MASK;
reg_sampler_code = src[1] & WINED3DSP_REGNUM_MASK;
sampler_type = arg->reg_maps->samplers[reg_sampler_code] & WINED3DSP_TEXTURETYPE_MASK;
switch(sampler_type) {
@ -693,11 +693,11 @@ void pshader_hw_texcoord(SHADER_OPCODE_ARG* arg) {
char tmp[20];
pshader_get_write_mask(dst, tmp);
if (hex_version != D3DPS_VERSION(1,4)) {
DWORD reg = dst & D3DSP_REGNUM_MASK;
DWORD reg = dst & WINED3DSP_REGNUM_MASK;
shader_addline(buffer, "MOV_SAT T%u%s, fragment.texcoord[%u];\n", reg, tmp, reg);
} else {
DWORD reg1 = dst & D3DSP_REGNUM_MASK;
DWORD reg2 = src[0] & D3DSP_REGNUM_MASK;
DWORD reg1 = dst & WINED3DSP_REGNUM_MASK;
DWORD reg2 = src[0] & WINED3DSP_REGNUM_MASK;
shader_addline(buffer, "MOV R%u%s, fragment.texcoord[%u];\n", reg1, tmp, reg2);
}
}
@ -706,8 +706,8 @@ void pshader_hw_texreg2ar(SHADER_OPCODE_ARG* arg) {
SHADER_BUFFER* buffer = arg->buffer;
DWORD reg1 = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & WINED3DSP_REGNUM_MASK;
shader_addline(buffer, "MOV TMP.r, T%u.a;\n", reg2);
shader_addline(buffer, "MOV TMP.g, T%u.r;\n", reg2);
shader_addline(buffer, "TEX T%u, TMP, texture[%u], 2D;\n", reg1, reg1);
@ -717,8 +717,8 @@ void pshader_hw_texreg2gb(SHADER_OPCODE_ARG* arg) {
SHADER_BUFFER* buffer = arg->buffer;
DWORD reg1 = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & WINED3DSP_REGNUM_MASK;
shader_addline(buffer, "MOV TMP.r, T%u.g;\n", reg2);
shader_addline(buffer, "MOV TMP.g, T%u.b;\n", reg2);
shader_addline(buffer, "TEX T%u, TMP, texture[%u], 2D;\n", reg1, reg1);
@ -727,8 +727,8 @@ void pshader_hw_texreg2gb(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) {
SHADER_BUFFER* buffer = arg->buffer;
DWORD reg1 = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & WINED3DSP_REGNUM_MASK;
/* FIXME: Should apply the BUMPMAPENV matrix */
shader_addline(buffer, "ADD TMP.rg, fragment.texcoord[%u], T%u;\n", reg1, reg2);
@ -737,7 +737,7 @@ void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texm3x2pad(SHADER_OPCODE_ARG* arg) {
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
char src0_name[50];
@ -747,7 +747,7 @@ void pshader_hw_texm3x2pad(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texm3x2tex(SHADER_OPCODE_ARG* arg) {
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
char src0_name[50];
@ -759,7 +759,7 @@ void pshader_hw_texm3x2tex(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texm3x3pad(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char src0_name[50];
@ -772,7 +772,7 @@ void pshader_hw_texm3x3pad(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texm3x3tex(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char src0_name[50];
@ -788,7 +788,7 @@ void pshader_hw_texm3x3tex(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texm3x3vspec(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char src0_name[50];
@ -814,8 +814,8 @@ void pshader_hw_texm3x3vspec(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texm3x3spec(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg3 = arg->src[1] & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD reg3 = arg->src[1] & WINED3DSP_REGNUM_MASK;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
SHADER_BUFFER* buffer = arg->buffer;
char src0_name[50];

View File

@ -158,7 +158,7 @@ int shader_skip_unrecognized(
unsigned int shader_get_float_offset(const DWORD reg) {
unsigned int regnum = reg & D3DSP_REGNUM_MASK;
unsigned int regnum = reg & WINED3DSP_REGNUM_MASK;
int regtype = shader_get_regtype(reg);
switch (regtype) {
@ -223,7 +223,7 @@ HRESULT shader_get_registers_used(
DWORD usage = *pToken++;
DWORD param = *pToken++;
DWORD regtype = shader_get_regtype(param);
unsigned int regnum = param & D3DSP_REGNUM_MASK;
unsigned int regnum = param & WINED3DSP_REGNUM_MASK;
/* Vshader: mark attributes used
Pshader: mark 3.0 input registers used, save token */
@ -251,7 +251,7 @@ HRESULT shader_get_registers_used(
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
if (!lconst) return E_OUTOFMEMORY;
lconst->idx = *pToken & D3DSP_REGNUM_MASK;
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
memcpy(&lconst->value, pToken + 1, 4 * sizeof(DWORD));
list_add_head(&This->baseShader.constantsF, &lconst->entry);
pToken += curOpcode->num_params;
@ -260,7 +260,7 @@ HRESULT shader_get_registers_used(
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
if (!lconst) return E_OUTOFMEMORY;
lconst->idx = *pToken & D3DSP_REGNUM_MASK;
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
memcpy(&lconst->value, pToken + 1, 4 * sizeof(DWORD));
list_add_head(&This->baseShader.constantsI, &lconst->entry);
pToken += curOpcode->num_params;
@ -269,7 +269,7 @@ HRESULT shader_get_registers_used(
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
if (!lconst) return E_OUTOFMEMORY;
lconst->idx = *pToken & D3DSP_REGNUM_MASK;
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
memcpy(&lconst->value, pToken + 1, 1 * sizeof(DWORD));
list_add_head(&This->baseShader.constantsB, &lconst->entry);
pToken += curOpcode->num_params;
@ -283,7 +283,7 @@ HRESULT shader_get_registers_used(
/* For subroutine prototypes */
} else if (WINED3DSIO_LABEL == curOpcode->opcode) {
DWORD snum = *pToken & D3DSP_REGNUM_MASK;
DWORD snum = *pToken & WINED3DSP_REGNUM_MASK;
reg_maps->labels[snum] = 1;
pToken += curOpcode->num_params;
@ -299,7 +299,7 @@ HRESULT shader_get_registers_used(
WINED3DSIO_TEXM3x3TEX == curOpcode->opcode)) {
/* Fake sampler usage, only set reserved bit and ttype */
DWORD sampler_code = *pToken & D3DSP_REGNUM_MASK;
DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK;
if(!stateBlock->textures[sampler_code]) {
ERR("No texture bound to sampler %d\n", sampler_code);
@ -337,13 +337,13 @@ HRESULT shader_get_registers_used(
* FIXME: This could be either Cube or Volume, but we wouldn't know unless
* we waited to generate the shader until the textures were all bound.
* For now, use Cube textures because they are more common. */
DWORD sampler_code = *pToken & D3DSP_REGNUM_MASK;
DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK;
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_CUBE;
} else if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
(WINED3DSIO_TEXDP3TEX == curOpcode->opcode)) {
/* 1D Sampler usage */
DWORD sampler_code = *pToken & D3DSP_REGNUM_MASK;
DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK;
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_1D;
}
@ -363,7 +363,7 @@ HRESULT shader_get_registers_used(
pToken += shader_get_param(iface, pToken, &param, &addr_token);
regtype = shader_get_regtype(param);
reg = param & D3DSP_REGNUM_MASK;
reg = param & WINED3DSP_REGNUM_MASK;
if (WINED3DSPR_TEXTURE == regtype) { /* vs: WINED3DSPR_ADDR */
@ -505,7 +505,7 @@ void shader_dump_param(
static const char* rastout_reg_names[] = { "oPos", "oFog", "oPts" };
char swizzle_reg_chars[4];
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD reg = param & WINED3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(param);
DWORD modifier = param & D3DSP_SRCMOD_MASK;
@ -877,7 +877,7 @@ void shader_trace_init(
len += 5;
} else if (curOpcode->opcode == WINED3DSIO_DEFI) {
TRACE("defi i%u = %d, %d, %d, %d", *pToken & D3DSP_REGNUM_MASK,
TRACE("defi i%u = %d, %d, %d, %d", *pToken & WINED3DSP_REGNUM_MASK,
*(pToken + 1),
*(pToken + 2),
*(pToken + 3),
@ -888,7 +888,7 @@ void shader_trace_init(
} else if (curOpcode->opcode == WINED3DSIO_DEFB) {
TRACE("defb b%u = %s", *pToken & D3DSP_REGNUM_MASK,
TRACE("defb b%u = %s", *pToken & WINED3DSP_REGNUM_MASK,
*(pToken + 1)? "true": "false");
pToken += 2;

View File

@ -508,7 +508,7 @@ static void shader_glsl_add_dst(DWORD param, const char* reg_name, char* reg_mas
char cast[6];
if ((shader_get_regtype(param) == WINED3DSPR_RASTOUT)
&& ((param & D3DSP_REGNUM_MASK) != 0)) {
&& ((param & WINED3DSP_REGNUM_MASK) != 0)) {
/* gl_FogFragCoord or glPointSize - both floats */
strcpy(cast, "float");
strcpy(reg_mask, "");
@ -598,7 +598,7 @@ static void shader_glsl_get_register_name(
/* oPos, oFog and oPts in D3D */
const char* hwrastout_reg_names[] = { "gl_Position", "gl_FogFragCoord", "gl_PointSize" };
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD reg = param & WINED3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(param);
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
@ -1331,13 +1331,13 @@ void shader_glsl_breakc(SHADER_OPCODE_ARG* arg) {
void shader_glsl_label(SHADER_OPCODE_ARG* arg) {
DWORD snum = (arg->src[0]) & D3DSP_REGNUM_MASK;
DWORD snum = (arg->src[0]) & WINED3DSP_REGNUM_MASK;
shader_addline(arg->buffer, "}\n");
shader_addline(arg->buffer, "void subroutine%lu () {\n", snum);
}
void shader_glsl_call(SHADER_OPCODE_ARG* arg) {
DWORD snum = (arg->src[0]) & D3DSP_REGNUM_MASK;
DWORD snum = (arg->src[0]) & WINED3DSP_REGNUM_MASK;
shader_addline(arg->buffer, "subroutine%lu();\n", snum);
}
@ -1347,7 +1347,7 @@ void shader_glsl_callnz(SHADER_OPCODE_ARG* arg) {
char src1_reg[50];
char src1_mask[6];
DWORD snum = (arg->src[0]) & D3DSP_REGNUM_MASK;
DWORD snum = (arg->src[0]) & WINED3DSP_REGNUM_MASK;
shader_glsl_add_param(arg, arg->src[1], arg->src_addr[1], TRUE, src1_reg, src1_mask, src1_str);
shader_addline(arg->buffer, "if (%s) subroutine%lu();\n", src1_str, snum);
}
@ -1368,7 +1368,7 @@ void pshader_glsl_tex(SHADER_OPCODE_ARG* arg) {
char dst_str[100], dst_reg[50], dst_mask[6];
char coord_str[100], coord_reg[50], coord_mask[6];
char sampler_str[100], sampler_reg[50], sampler_mask[6];
DWORD reg_dest_code = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg_dest_code = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD sampler_code, sampler_type;
/* All versions have a destination register */
@ -1389,7 +1389,7 @@ void pshader_glsl_tex(SHADER_OPCODE_ARG* arg) {
}
else {
shader_glsl_add_param(arg, arg->src[1], arg->src_addr[1], TRUE, sampler_reg, sampler_mask, sampler_str);
sampler_code = arg->src[1] & D3DSP_REGNUM_MASK;
sampler_code = arg->src[1] & WINED3DSP_REGNUM_MASK;
}
sampler_type = arg->reg_maps->samplers[sampler_code] & WINED3DSP_TEXTURETYPE_MASK;
@ -1446,10 +1446,10 @@ void pshader_glsl_texcoord(SHADER_OPCODE_ARG* arg) {
shader_glsl_add_param(arg, arg->dst, 0, FALSE, tmpReg, tmpMask, tmpStr);
if (hex_version != D3DPS_VERSION(1,4)) {
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
shader_addline(buffer, "%s = clamp(gl_TexCoord[%u], 0.0, 1.0);\n", tmpReg, reg);
} else {
DWORD reg2 = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & WINED3DSP_REGNUM_MASK;
shader_addline(buffer, "%s = gl_TexCoord[%u]%s;\n", tmpStr, reg2, tmpMask);
}
}
@ -1459,7 +1459,7 @@ void pshader_glsl_texcoord(SHADER_OPCODE_ARG* arg) {
* then perform a 1D texture lookup from stage dstregnum, place into dst. */
void pshader_glsl_texdp3tex(SHADER_OPCODE_ARG* arg) {
DWORD dstreg = arg->dst & D3DSP_REGNUM_MASK;
DWORD dstreg = arg->dst & WINED3DSP_REGNUM_MASK;
char src0_str[100], dst_str[100];
char src0_name[50], dst_name[50];
char src0_mask[6], dst_mask[6];
@ -1475,7 +1475,7 @@ void pshader_glsl_texdp3tex(SHADER_OPCODE_ARG* arg) {
* Take a 3-component dot product of the TexCoord[dstreg] and src. */
void pshader_glsl_texdp3(SHADER_OPCODE_ARG* arg) {
DWORD dstreg = arg->dst & D3DSP_REGNUM_MASK;
DWORD dstreg = arg->dst & WINED3DSP_REGNUM_MASK;
char src0_str[100], dst_str[100];
char src0_name[50], dst_name[50];
char src0_mask[6], dst_mask[6];
@ -1507,7 +1507,7 @@ void pshader_glsl_texdepth(SHADER_OPCODE_ARG* arg) {
*/
void pshader_glsl_texm3x2depth(SHADER_OPCODE_ARG* arg) {
DWORD dstreg = arg->dst & D3DSP_REGNUM_MASK;
DWORD dstreg = arg->dst & WINED3DSP_REGNUM_MASK;
char src0_str[100], dst_str[100];
char src0_name[50], dst_name[50];
char src0_mask[6], dst_mask[6];
@ -1523,7 +1523,7 @@ void pshader_glsl_texm3x2depth(SHADER_OPCODE_ARG* arg) {
* Calculate the 1st of a 2-row matrix multiplication. */
void pshader_glsl_texm3x2pad(SHADER_OPCODE_ARG* arg) {
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
char src0_str[100];
char src0_name[50];
@ -1538,7 +1538,7 @@ void pshader_glsl_texm3x2pad(SHADER_OPCODE_ARG* arg) {
void pshader_glsl_texm3x3pad(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* shader = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state;
char src0_str[100];
@ -1554,7 +1554,7 @@ void pshader_glsl_texm3x2tex(SHADER_OPCODE_ARG* arg) {
/* FIXME: Make this work for more than just 2D textures */
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
char src0_str[100];
char src0_name[50];
@ -1573,8 +1573,8 @@ void pshader_glsl_texm3x3tex(SHADER_OPCODE_ARG* arg) {
char src0_name[50];
char src0_mask[6];
char dimensions[5];
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD src0_regnum = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD src0_regnum = arg->src[0] & WINED3DSP_REGNUM_MASK;
DWORD stype = arg->reg_maps->samplers[src0_regnum] & WINED3DSP_TEXTURETYPE_MASK;
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
@ -1603,7 +1603,7 @@ void pshader_glsl_texm3x3(SHADER_OPCODE_ARG* arg) {
char src0_str[100];
char src0_name[50];
char src0_mask[6];
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
@ -1619,7 +1619,7 @@ void pshader_glsl_texm3x3(SHADER_OPCODE_ARG* arg) {
void pshader_glsl_texm3x3spec(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* shader = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
char dimensions[5];
char src0_str[100], src0_name[50], src0_mask[6];
char src1_str[100], src1_name[50], src1_mask[6];
@ -1657,7 +1657,7 @@ void pshader_glsl_texm3x3spec(SHADER_OPCODE_ARG* arg) {
void pshader_glsl_texm3x3vspec(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* shader = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state;
char src0_str[100], src0_name[50], src0_mask[6];
@ -1693,8 +1693,8 @@ void pshader_glsl_texm3x3vspec(SHADER_OPCODE_ARG* arg) {
* FIXME: Should apply the BUMPMAPENV matrix. For now, just sample the texture */
void pshader_glsl_texbem(SHADER_OPCODE_ARG* arg) {
DWORD reg1 = arg->dst & D3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD reg2 = arg->src[0] & WINED3DSP_REGNUM_MASK;
FIXME("Not applying the BUMPMAPENV matrix for pixel shader instruction texbem.\n");
shader_addline(arg->buffer, "T%u = texture2D(Psampler%u, gl_TexCoord[%u].xy + T%u.xy);\n",
@ -1709,7 +1709,7 @@ void pshader_glsl_texreg2ar(SHADER_OPCODE_ARG* arg) {
char dst_str[100], src0_str[100];
char dst_reg[50], src0_reg[50];
char dst_mask[6], src0_mask[6];
DWORD src0_regnum = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD src0_regnum = arg->src[0] & WINED3DSP_REGNUM_MASK;
shader_glsl_add_param(arg, arg->dst, 0, FALSE, dst_reg, dst_mask, dst_str);
shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, src0_reg, src0_mask, src0_str);
@ -1727,7 +1727,7 @@ void pshader_glsl_texreg2gb(SHADER_OPCODE_ARG* arg) {
char dst_str[100], src0_str[100];
char dst_reg[50], src0_reg[50];
char dst_mask[6], src0_mask[6];
DWORD src0_regnum = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD src0_regnum = arg->src[0] & WINED3DSP_REGNUM_MASK;
shader_glsl_add_param(arg, arg->dst, 0, FALSE, dst_reg, dst_mask, dst_str);
shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, src0_reg, src0_mask, src0_str);
@ -1746,7 +1746,7 @@ void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg) {
char dst_reg[50], src0_reg[50];
char dst_mask[6], src0_mask[6];
char dimensions[5];
DWORD src0_regnum = arg->src[0] & D3DSP_REGNUM_MASK;
DWORD src0_regnum = arg->src[0] & WINED3DSP_REGNUM_MASK;
DWORD stype = arg->reg_maps->samplers[src0_regnum] & WINED3DSP_TEXTURETYPE_MASK;
switch (stype) {
case WINED3DSTT_2D: strcpy(dimensions, "2D"); break;

View File

@ -627,7 +627,7 @@ static void vshader_set_input(
/* Fake register; set reserved bit, regnum, type: input, wmask: all */
DWORD reg_token = (0x1 << 31) |
D3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << D3DSP_REGTYPE_SHIFT) | regnum;
D3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << WINED3DSP_REGTYPE_SHIFT) | regnum;
This->semantics_in[regnum].usage = usage_token;
This->semantics_in[regnum].reg = reg_token;
@ -913,7 +913,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
if (curOpcode->num_params > 0) {
/* TRACE(">> execting opcode: pos=%d opcode_name=%s token=%08lX\n", pToken - vshader->function, curOpcode->name, *pToken); */
for (i = 0; i < curOpcode->num_params; ++i) {
DWORD reg = pToken[i] & D3DSP_REGNUM_MASK;
DWORD reg = pToken[i] & WINED3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(pToken[i]);
switch (regtype) {

View File

@ -1668,8 +1668,8 @@ extern void print_glsl_info_log(
GLhandleARB obj);
inline static int shader_get_regtype(const DWORD param) {
return (((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) |
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2));
return (((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) |
((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2));
}
extern unsigned int shader_get_float_offset(const DWORD reg);

View File

@ -43,7 +43,16 @@ typedef enum _WINED3DSAMPLER_TEXTURE_TYPE {
WINED3DSTT_FORCE_DWORD = 0x7FFFFFFF
} WINED3DSAMPLER_TEXTURE_TYPE;
/** register types for PS and VS */
/** Register number mask **/
#define WINED3DSP_REGNUM_MASK 0x000007FF
/** Register type masks **/
#define WINED3DSP_REGTYPE_SHIFT 28
#define WINED3DSP_REGTYPE_SHIFT2 8
#define WINED3DSP_REGTYPE_MASK (0x7 << WINED3DSP_REGTYPE_SHIFT)
#define WINED3DSP_REGTYPE_MASK2 0x00001800
/** Register types **/
typedef enum _WINED3DSHADER_PARAM_REGISTER_TYPE {
WINED3DSPR_TEMP = 0,
WINED3DSPR_INPUT = 1,