Commit 7259b9d8 authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Move D3DSPR structure into the WINED3D namespace.

parent 062541c0
......@@ -314,23 +314,23 @@ static void pshader_get_register_name(
DWORD regtype = shader_get_regtype(param);
switch (regtype) {
case D3DSPR_TEMP:
case WINED3DSPR_TEMP:
sprintf(regstr, "R%u", reg);
break;
case D3DSPR_INPUT:
case WINED3DSPR_INPUT:
if (reg==0) {
strcpy(regstr, "fragment.color.primary");
} else {
strcpy(regstr, "fragment.color.secondary");
}
break;
case D3DSPR_CONST:
case WINED3DSPR_CONST:
sprintf(regstr, "C[%u]", reg);
break;
case D3DSPR_TEXTURE: /* case D3DSPR_ADDR: */
case WINED3DSPR_TEXTURE: /* case WINED3DSPR_ADDR: */
sprintf(regstr,"T%u", reg);
break;
case D3DSPR_COLOROUT:
case WINED3DSPR_COLOROUT:
if (reg == 0)
sprintf(regstr, "result.color");
else {
......@@ -339,13 +339,13 @@ static void pshader_get_register_name(
sprintf(regstr, "unsupported_register");
}
break;
case D3DSPR_DEPTHOUT:
case WINED3DSPR_DEPTHOUT:
sprintf(regstr, "result.depth");
break;
case D3DSPR_ATTROUT:
case WINED3DSPR_ATTROUT:
sprintf(regstr, "oD[%u]", reg);
break;
case D3DSPR_TEXCRDOUT:
case WINED3DSPR_TEXCRDOUT:
sprintf(regstr, "oT[%u]", reg);
break;
default:
......@@ -375,11 +375,11 @@ static void vshader_program_add_param(SHADER_OPCODE_ARG *arg, const DWORD param,
}
switch (regtype) {
case D3DSPR_TEMP:
case WINED3DSPR_TEMP:
sprintf(tmpReg, "R%u", reg);
strcat(hwLine, tmpReg);
break;
case D3DSPR_INPUT:
case WINED3DSPR_INPUT:
if (vshader_input_is_color((IWineD3DVertexShader*) This, reg))
is_color = TRUE;
......@@ -387,26 +387,26 @@ static void vshader_program_add_param(SHADER_OPCODE_ARG *arg, const DWORD param,
sprintf(tmpReg, "vertex.attrib[%u]", reg);
strcat(hwLine, tmpReg);
break;
case D3DSPR_CONST:
case WINED3DSPR_CONST:
sprintf(tmpReg, "C[%s%u]", (param & D3DVS_ADDRMODE_RELATIVE) ? "A0.x + " : "", reg);
strcat(hwLine, tmpReg);
break;
case D3DSPR_ADDR: /*case D3DSPR_TEXTURE:*/
case WINED3DSPR_ADDR: /*case D3DSPR_TEXTURE:*/
sprintf(tmpReg, "A%u", reg);
strcat(hwLine, tmpReg);
break;
case D3DSPR_RASTOUT:
case WINED3DSPR_RASTOUT:
sprintf(tmpReg, "%s", hwrastout_reg_names[reg]);
strcat(hwLine, tmpReg);
break;
case D3DSPR_ATTROUT:
case WINED3DSPR_ATTROUT:
if (reg==0) {
strcat(hwLine, "result.color.primary");
} else {
strcat(hwLine, "result.color.secondary");
}
break;
case D3DSPR_TEXCRDOUT:
case WINED3DSPR_TEXCRDOUT:
sprintf(tmpReg, "result.texcoord[%u]", reg);
strcat(hwLine, tmpReg);
break;
......@@ -896,7 +896,7 @@ void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg) {
char tmpLine[256];
unsigned int i;
if (curOpcode->opcode == WINED3DSIO_MOV && dst_regtype == D3DSPR_ADDR)
if (curOpcode->opcode == WINED3DSIO_MOV && dst_regtype == WINED3DSPR_ADDR)
strcpy(tmpLine, "ARL");
else
strcpy(tmpLine, curOpcode->glname);
......
......@@ -162,10 +162,10 @@ unsigned int shader_get_float_offset(const DWORD reg) {
int regtype = shader_get_regtype(reg);
switch (regtype) {
case D3DSPR_CONST: return regnum;
case D3DSPR_CONST2: return 2048 + regnum;
case D3DSPR_CONST3: return 4096 + regnum;
case D3DSPR_CONST4: return 6144 + regnum;
case WINED3DSPR_CONST: return regnum;
case WINED3DSPR_CONST2: return 2048 + regnum;
case WINED3DSPR_CONST3: return 4096 + regnum;
case WINED3DSPR_CONST4: return 6144 + regnum;
default:
FIXME("Unsupported register type: %d\n", regtype);
return regnum;
......@@ -227,7 +227,7 @@ HRESULT shader_get_registers_used(
/* Vshader: mark attributes used
Pshader: mark 3.0 input registers used, save token */
if (D3DSPR_INPUT == regtype) {
if (WINED3DSPR_INPUT == regtype) {
if (!pshader)
reg_maps->attributes[regnum] = 1;
......@@ -238,13 +238,13 @@ HRESULT shader_get_registers_used(
semantics_in[regnum].reg = param;
/* Vshader: mark 3.0 output registers used, save token */
} else if (D3DSPR_OUTPUT == regtype) {
} else if (WINED3DSPR_OUTPUT == regtype) {
reg_maps->packed_output[regnum] = 1;
semantics_out[regnum].usage = usage;
semantics_out[regnum].reg = param;
/* Save sampler usage token */
} else if (D3DSPR_SAMPLER == regtype)
} else if (WINED3DSPR_SAMPLER == regtype)
reg_maps->samplers[regnum] = usage;
} else if (WINED3DSIO_DEF == curOpcode->opcode) {
......@@ -365,7 +365,7 @@ HRESULT shader_get_registers_used(
regtype = shader_get_regtype(param);
reg = param & D3DSP_REGNUM_MASK;
if (D3DSPR_TEXTURE == regtype) { /* vs: D3DSPR_ADDR */
if (WINED3DSPR_TEXTURE == regtype) { /* vs: WINED3DSPR_ADDR */
if (pshader)
reg_maps->texcoord[reg] = 1;
......@@ -373,13 +373,13 @@ HRESULT shader_get_registers_used(
reg_maps->address[reg] = 1;
}
else if (D3DSPR_TEMP == regtype)
else if (WINED3DSPR_TEMP == regtype)
reg_maps->temporary[reg] = 1;
else if (D3DSPR_INPUT == regtype && !pshader)
else if (WINED3DSPR_INPUT == regtype && !pshader)
reg_maps->attributes[reg] = 1;
else if (D3DSPR_RASTOUT == regtype && reg == 1)
else if (WINED3DSPR_RASTOUT == regtype && reg == 1)
reg_maps->fog = 1;
}
}
......@@ -397,7 +397,7 @@ static void shader_dump_decl_usage(
TRACE("dcl");
if (regtype == D3DSPR_SAMPLER) {
if (regtype == WINED3DSPR_SAMPLER) {
DWORD ttype = decl & WINED3DSP_TEXTURETYPE_MASK;
switch (ttype) {
......@@ -537,39 +537,39 @@ void shader_dump_param(
}
switch (regtype) {
case D3DSPR_TEMP:
case WINED3DSPR_TEMP:
TRACE("r%u", reg);
break;
case D3DSPR_INPUT:
case WINED3DSPR_INPUT:
TRACE("v");
shader_dump_arr_entry(iface, param, addr_token, reg, input);
break;
case D3DSPR_CONST:
case D3DSPR_CONST2:
case D3DSPR_CONST3:
case D3DSPR_CONST4:
case WINED3DSPR_CONST:
case WINED3DSPR_CONST2:
case WINED3DSPR_CONST3:
case WINED3DSPR_CONST4:
TRACE("c");
shader_dump_arr_entry(iface, param, addr_token, shader_get_float_offset(param), input);
break;
case D3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
case WINED3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
TRACE("%c%u", (pshader? 't':'a'), reg);
break;
case D3DSPR_RASTOUT:
case WINED3DSPR_RASTOUT:
TRACE("%s", rastout_reg_names[reg]);
break;
case D3DSPR_COLOROUT:
case WINED3DSPR_COLOROUT:
TRACE("oC%u", reg);
break;
case D3DSPR_DEPTHOUT:
case WINED3DSPR_DEPTHOUT:
TRACE("oDepth");
break;
case D3DSPR_ATTROUT:
case WINED3DSPR_ATTROUT:
TRACE("oD%u", reg);
break;
case D3DSPR_TEXCRDOUT:
case WINED3DSPR_TEXCRDOUT:
/* Vertex shaders >= 3.0 use general purpose output registers
* (D3DSPR_OUTPUT), which can include an address token */
* (WINED3DSPR_OUTPUT), which can include an address token */
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
TRACE("o");
......@@ -578,24 +578,24 @@ void shader_dump_param(
else
TRACE("oT%u", reg);
break;
case D3DSPR_CONSTINT:
case WINED3DSPR_CONSTINT:
TRACE("i");
shader_dump_arr_entry(iface, param, addr_token, reg, input);
break;
case D3DSPR_CONSTBOOL:
case WINED3DSPR_CONSTBOOL:
TRACE("b");
shader_dump_arr_entry(iface, param, addr_token, reg, input);
break;
case D3DSPR_LABEL:
case WINED3DSPR_LABEL:
TRACE("l%u", reg);
break;
case D3DSPR_LOOP:
case WINED3DSPR_LOOP:
TRACE("aL");
break;
case D3DSPR_SAMPLER:
case WINED3DSPR_SAMPLER:
TRACE("s%u", reg);
break;
case D3DSPR_PREDICATE:
case WINED3DSPR_PREDICATE:
TRACE("p%u", reg);
break;
default:
......
......@@ -507,7 +507,7 @@ static void shader_glsl_add_dst(DWORD param, const char* reg_name, char* reg_mas
int shift = (param & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
char cast[6];
if ((shader_get_regtype(param) == D3DSPR_RASTOUT)
if ((shader_get_regtype(param) == WINED3DSPR_RASTOUT)
&& ((param & D3DSP_REGNUM_MASK) != 0)) {
/* gl_FogFragCoord or glPointSize - both floats */
strcpy(cast, "float");
......@@ -610,10 +610,10 @@ static void shader_glsl_get_register_name(
*is_color = FALSE;
switch (regtype) {
case D3DSPR_TEMP:
case WINED3DSPR_TEMP:
sprintf(tmpStr, "R%u", reg);
break;
case D3DSPR_INPUT:
case WINED3DSPR_INPUT:
if (pshader) {
/* Pixel shaders >= 3.0 */
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3)
......@@ -630,7 +630,7 @@ static void shader_glsl_get_register_name(
sprintf(tmpStr, "attrib%u", reg);
}
break;
case D3DSPR_CONST:
case WINED3DSPR_CONST:
{
const char* prefix = pshader? "PC":"VC";
......@@ -651,35 +651,35 @@ static void shader_glsl_get_register_name(
break;
}
case D3DSPR_CONSTINT:
case WINED3DSPR_CONSTINT:
if (pshader)
sprintf(tmpStr, "PI[%u]", reg);
else
sprintf(tmpStr, "VI[%u]", reg);
break;
case D3DSPR_CONSTBOOL:
case WINED3DSPR_CONSTBOOL:
if (pshader)
sprintf(tmpStr, "PB[%u]", reg);
else
sprintf(tmpStr, "VB[%u]", reg);
break;
case D3DSPR_TEXTURE: /* case D3DSPR_ADDR: */
case WINED3DSPR_TEXTURE: /* case WINED3DSPR_ADDR: */
if (pshader) {
sprintf(tmpStr, "T%u", reg);
} else {
sprintf(tmpStr, "A%u", reg);
}
break;
case D3DSPR_LOOP:
case WINED3DSPR_LOOP:
sprintf(tmpStr, "aL");
break;
case D3DSPR_SAMPLER:
case WINED3DSPR_SAMPLER:
if (pshader)
sprintf(tmpStr, "Psampler%u", reg);
else
sprintf(tmpStr, "Vsampler%u", reg);
break;
case D3DSPR_COLOROUT:
case WINED3DSPR_COLOROUT:
if (GL_SUPPORT(ARB_DRAW_BUFFERS)) {
sprintf(tmpStr, "gl_FragData[%u]", reg);
if (reg > 0) {
......@@ -693,21 +693,21 @@ static void shader_glsl_get_register_name(
sprintf(tmpStr, "gl_FragColor");
}
break;
case D3DSPR_RASTOUT:
case WINED3DSPR_RASTOUT:
sprintf(tmpStr, "%s", hwrastout_reg_names[reg]);
break;
case D3DSPR_DEPTHOUT:
case WINED3DSPR_DEPTHOUT:
sprintf(tmpStr, "gl_FragDepth");
break;
case D3DSPR_ATTROUT:
case WINED3DSPR_ATTROUT:
if (reg == 0) {
sprintf(tmpStr, "gl_FrontColor");
} else {
sprintf(tmpStr, "gl_FrontSecondaryColor");
}
break;
case D3DSPR_TEXCRDOUT:
/* Vertex shaders >= 3.0: D3DSPR_OUTPUT */
case WINED3DSPR_TEXCRDOUT:
/* Vertex shaders >= 3.0: WINED3DSPR_OUTPUT */
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3)
sprintf(tmpStr, "OUT%u", reg);
else
......
......@@ -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 | (D3DSPR_INPUT << D3DSP_REGTYPE_SHIFT) | regnum;
D3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << D3DSP_REGTYPE_SHIFT) | regnum;
This->semantics_in[regnum].usage = usage_token;
This->semantics_in[regnum].reg = reg_token;
......@@ -917,22 +917,22 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
DWORD regtype = shader_get_regtype(pToken[i]);
switch (regtype) {
case D3DSPR_TEMP:
case WINED3DSPR_TEMP:
/* TRACE("p[%d]=R[%d]\n", i, reg); */
p[i] = &R[reg];
break;
case D3DSPR_INPUT:
case WINED3DSPR_INPUT:
/* TRACE("p[%d]=V[%s]\n", i, VertexShaderDeclRegister[reg]); */
p[i] = &input->V[reg];
break;
case D3DSPR_CONST:
case WINED3DSPR_CONST:
if (pToken[i] & D3DVS_ADDRMODE_RELATIVE) {
p[i] = &This->data->C[(DWORD) A[0].x + reg];
} else {
p[i] = &This->data->C[reg];
}
break;
case D3DSPR_ADDR: /* case D3DSPR_TEXTURE: */
case WINED3DSPR_ADDR: /* case WINED3DSPR_TEXTURE: */
if (0 != reg) {
ERR("cannot handle address registers != a0, forcing use of a0\n");
reg = 0;
......@@ -940,7 +940,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
/* TRACE("p[%d]=A[%d]\n", i, reg); */
p[i] = &A[reg];
break;
case D3DSPR_RASTOUT:
case WINED3DSPR_RASTOUT:
switch (reg) {
case D3DSRO_POSITION:
p[i] = &output->oPos;
......@@ -953,18 +953,18 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
break;
}
break;
case D3DSPR_ATTROUT:
case WINED3DSPR_ATTROUT:
/* TRACE("p[%d]=oD[%d]\n", i, reg); */
p[i] = &output->oD[reg];
break;
case D3DSPR_TEXCRDOUT:
case WINED3DSPR_TEXCRDOUT:
/* TRACE("p[%d]=oT[%d]\n", i, reg); */
p[i] = &output->oT[reg];
break;
/* TODO Decls and defs */
#if 0
case D3DSPR_DCL:
case D3DSPR_DEF:
case WINED3DSPR_DCL:
case WINED3DSPR_DEF:
#endif
default:
break;
......
......@@ -23,6 +23,34 @@
#ifndef __WINE_WINED3D_TYPES_INTERNAL_H
#define __WINE_WINED3D_TYPES_INTERNAL_H
/** register types for PS and VS */
typedef enum _WINED3DSHADER_PARAM_REGISTER_TYPE {
WINED3DSPR_TEMP = 0,
WINED3DSPR_INPUT = 1,
WINED3DSPR_CONST = 2,
WINED3DSPR_ADDR = 3,
WINED3DSPR_TEXTURE = 3,
WINED3DSPR_RASTOUT = 4,
WINED3DSPR_ATTROUT = 5,
WINED3DSPR_TEXCRDOUT = 6,
WINED3DSPR_OUTPUT = 6,
WINED3DSPR_CONSTINT = 7,
WINED3DSPR_COLOROUT = 8,
WINED3DSPR_DEPTHOUT = 9,
WINED3DSPR_SAMPLER = 10,
WINED3DSPR_CONST2 = 11,
WINED3DSPR_CONST3 = 12,
WINED3DSPR_CONST4 = 13,
WINED3DSPR_CONSTBOOL = 14,
WINED3DSPR_LOOP = 15,
WINED3DSPR_TEMPFLOAT16 = 16,
WINED3DSPR_MISCTYPE = 17,
WINED3DSPR_LABEL = 18,
WINED3DSPR_PREDICATE = 19,
WINED3DSPR_FORCE_DWORD = 0x7FFFFFFF
} WINED3DSHADER_PARAM_REGISTER_TYPE;
/** opcodes types for PS and VS */
typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE {
WINED3DSIO_NOP = 0,
......
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