Commit 98466024 authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Add D3DTEXTURETRANSFORMTYPE to the WINED3D namespace.

parent 4745e602
......@@ -673,7 +673,7 @@ void pshader_hw_tex(SHADER_OPCODE_ARG* arg) {
tex_type = "2D";
}
if (deviceImpl->stateBlock->textureState[reg_sampler_code][WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) {
if (deviceImpl->stateBlock->textureState[reg_sampler_code][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED) {
shader_addline(buffer, "TXP %s, %s, texture[%u], %s;\n",
reg_dest, reg_coord, reg_sampler_code, tex_type);
} else {
......
......@@ -232,7 +232,9 @@ static void WINAPI IWineD3DCubeTextureImpl_ApplyStateChanges(IWineD3DCubeTexture
/* Apply non-power2 mappings and texture offsets so long as the texture coords aren't projected or generated */
if(This->pow2scalingFactor != 1.0f) {
if((textureStates[WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) == D3DTSS_TCI_PASSTHRU && (~textureStates[WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED)) {
if((textureStates[WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) == D3DTSS_TCI_PASSTHRU &&
(~textureStates[WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED)) {
glMatrixMode(GL_TEXTURE);
memset(matrix, 0 , sizeof(matrix));
......
......@@ -738,7 +738,7 @@ static void draw_vertex(IWineD3DDevice *iface, /* interf
}
switch (numcoords[coordIdx]) { /* Supply the provided texture coords */
case D3DTTFF_COUNT1:
case WINED3DTTFF_COUNT1:
VTRACE(("tex:%d, s=%f\n", textureNo, s));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GLMULTITEXCOORD1F(textureNo, s);
......@@ -746,7 +746,7 @@ static void draw_vertex(IWineD3DDevice *iface, /* interf
glTexCoord1f(s);
}
break;
case D3DTTFF_COUNT2:
case WINED3DTTFF_COUNT2:
VTRACE(("tex:%d, s=%f, t=%f\n", textureNo, s, t));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GLMULTITEXCOORD2F(textureNo, s, t);
......@@ -754,7 +754,7 @@ static void draw_vertex(IWineD3DDevice *iface, /* interf
glTexCoord2f(s, t);
}
break;
case D3DTTFF_COUNT3:
case WINED3DTTFF_COUNT3:
VTRACE(("tex:%d, s=%f, t=%f, r=%f\n", textureNo, s, t, r));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GLMULTITEXCOORD3F(textureNo, s, t, r);
......@@ -762,7 +762,7 @@ static void draw_vertex(IWineD3DDevice *iface, /* interf
glTexCoord3f(s, t, r);
}
break;
case D3DTTFF_COUNT4:
case WINED3DTTFF_COUNT4:
VTRACE(("tex:%d, s=%f, t=%f, r=%f, q=%f\n", textureNo, s, t, r, q));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GLMULTITEXCOORD4F(textureNo, s, t, r, q);
......@@ -1420,14 +1420,14 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
/* Projected is more 'fun' - Move the last coord to the 'q'
parameter (see comments under WINED3DTSS_TEXTURETRANSFORMFLAGS */
if ((This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] != D3DTTFF_DISABLE) &&
(This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED)) {
if ((This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] != WINED3DTTFF_DISABLE) &&
(This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED)) {
if (This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) {
if (This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED) {
switch (coordsToUse) {
case 0: /* Drop Through */
case 1:
FIXME("D3DTTFF_PROJECTED but only zero or one coordinate?\n");
FIXME("WINED3DTTFF_PROJECTED but only zero or one coordinate?\n");
break;
case 2:
q = t;
......@@ -1443,13 +1443,13 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
break;
default:
FIXME("Unexpected WINED3DTSS_TEXTURETRANSFORMFLAGS value of %d\n",
This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED);
This->stateBlock->textureState[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED);
}
}
}
switch (coordsToUse) { /* Supply the provided texture coords */
case D3DTTFF_COUNT1:
case WINED3DTTFF_COUNT1:
VTRACE(("tex:%d, s=%f\n", textureNo, s));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GL_EXTCALL(glMultiTexCoord1fARB(texture_idx, s));
......@@ -1457,7 +1457,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
glTexCoord1f(s);
}
break;
case D3DTTFF_COUNT2:
case WINED3DTTFF_COUNT2:
VTRACE(("tex:%d, s=%f, t=%f\n", textureNo, s, t));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GL_EXTCALL(glMultiTexCoord2fARB(texture_idx, s, t));
......@@ -1465,7 +1465,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
glTexCoord2f(s, t);
}
break;
case D3DTTFF_COUNT3:
case WINED3DTTFF_COUNT3:
VTRACE(("tex:%d, s=%f, t=%f, r=%f\n", textureNo, s, t, r));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GL_EXTCALL(glMultiTexCoord3fARB(texture_idx, s, t, r));
......@@ -1473,7 +1473,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
glTexCoord3f(s, t, r);
}
break;
case D3DTTFF_COUNT4:
case WINED3DTTFF_COUNT4:
VTRACE(("tex:%d, s=%f, t=%f, r=%f, q=%f\n", textureNo, s, t, r, q));
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
GL_EXTCALL(glMultiTexCoord4fARB(texture_idx, s, t, r, q));
......@@ -1683,8 +1683,8 @@ void drawStridedSoftwareVS(IWineD3DDevice *iface, WineDirect3DVertexStridedData
texcoords[textureNo].y = vertexShader->output.oT[textureNo].y;
texcoords[textureNo].z = vertexShader->output.oT[textureNo].z;
texcoords[textureNo].w = vertexShader->output.oT[textureNo].w;
if (This->stateBlock->texture_state[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] != D3DTTFF_DISABLE) {
numcoords[textureNo] = This->stateBlock->texture_state[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & ~D3DTTFF_PROJECTED;
if (This->stateBlock->texture_state[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] != WINED3DTTFF_DISABLE) {
numcoords[textureNo] = This->stateBlock->texture_state[textureNo][WINED3DTSS_TEXTURETRANSFORMFLAGS] & ~WINED3DTTFF_PROJECTED;
} else {
switch (IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) This->stateBlock->textures[textureNo])) {
case WINED3DRTYPE_TEXTURE: numcoords[textureNo] = 2; break;
......
......@@ -1393,7 +1393,7 @@ void pshader_glsl_tex(SHADER_OPCODE_ARG* arg) {
}
sampler_type = arg->reg_maps->samplers[sampler_code] & WINED3DSP_TEXTURETYPE_MASK;
if(deviceImpl->stateBlock->textureState[sampler_code][WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) {
if(deviceImpl->stateBlock->textureState[sampler_code][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED) {
switch(sampler_type) {
case WINED3DSTT_2D:
......
......@@ -998,7 +998,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
This->textureState[i][WINED3DTSS_TEXCOORDINDEX ] = i;
This->textureState[i][WINED3DTSS_BUMPENVLSCALE ] = (DWORD) 0.0;
This->textureState[i][WINED3DTSS_BUMPENVLOFFSET ] = (DWORD) 0.0;
This->textureState[i][WINED3DTSS_TEXTURETRANSFORMFLAGS ] = D3DTTFF_DISABLE;
This->textureState[i][WINED3DTSS_TEXTURETRANSFORMFLAGS ] = WINED3DTTFF_DISABLE;
This->textureState[i][WINED3DTSS_ADDRESSW ] = D3DTADDRESS_WRAP;
This->textureState[i][WINED3DTSS_COLORARG0 ] = D3DTA_CURRENT;
This->textureState[i][WINED3DTSS_ALPHAARG0 ] = D3DTA_CURRENT;
......
......@@ -216,7 +216,7 @@ static void WINAPI IWineD3DTextureImpl_ApplyStateChanges(IWineD3DTexture *iface,
if(This->pow2scalingFactorX != 1.0f || This->pow2scalingFactorY != 1.0f) {
/* Apply non-power2 mappings and texture offsets so long as the texture coords aren't projected or generated */
if(((textureStates[WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) == D3DTSS_TCI_PASSTHRU) &&
(~textureStates[WINED3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED)) {
(~textureStates[WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED)) {
glMatrixMode(GL_TEXTURE);
memset(matrix, 0 , sizeof(matrix));
matrix[0] = This->pow2scalingFactorX;
......
......@@ -2229,32 +2229,32 @@ void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords)
glMatrixMode(GL_TEXTURE);
checkGLcall("glMatrixMode(GL_TEXTURE)");
if (flags == D3DTTFF_DISABLE) {
if (flags == WINED3DTTFF_DISABLE) {
glLoadIdentity();
checkGLcall("glLoadIdentity()");
return;
}
if (flags == (D3DTTFF_COUNT1|D3DTTFF_PROJECTED)) {
ERR("Invalid texture transform flags: D3DTTFF_COUNT1|D3DTTFF_PROJECTED\n");
if (flags == (WINED3DTTFF_COUNT1|WINED3DTTFF_PROJECTED)) {
ERR("Invalid texture transform flags: WINED3DTTFF_COUNT1|WINED3DTTFF_PROJECTED\n");
return;
}
memcpy(mat, smat, 16 * sizeof(float));
switch (flags & ~D3DTTFF_PROJECTED) {
case D3DTTFF_COUNT1: mat[1] = mat[5] = mat[13] = 0;
case D3DTTFF_COUNT2: mat[2] = mat[6] = mat[10] = mat[14] = 0;
switch (flags & ~WINED3DTTFF_PROJECTED) {
case WINED3DTTFF_COUNT1: mat[1] = mat[5] = mat[13] = 0;
case WINED3DTTFF_COUNT2: mat[2] = mat[6] = mat[10] = mat[14] = 0;
default: mat[3] = mat[7] = mat[11] = 0, mat[15] = 1;
}
if (flags & D3DTTFF_PROJECTED) {
switch (flags & ~D3DTTFF_PROJECTED) {
case D3DTTFF_COUNT2:
if (flags & WINED3DTTFF_PROJECTED) {
switch (flags & ~WINED3DTTFF_PROJECTED) {
case WINED3DTTFF_COUNT2:
mat[3] = mat[1], mat[7] = mat[5], mat[11] = mat[9], mat[15] = mat[13];
mat[1] = mat[5] = mat[9] = mat[13] = 0;
break;
case D3DTTFF_COUNT3:
case WINED3DTTFF_COUNT3:
mat[3] = mat[2], mat[7] = mat[6], mat[11] = mat[10], mat[15] = mat[14];
mat[2] = mat[6] = mat[10] = mat[14] = 0;
break;
......
......@@ -551,6 +551,17 @@ typedef enum _WINED3DTEXTURESTAGESTATETYPE {
#define WINED3D_HIGHEST_TEXTURE_STATE WINED3DTSS_CONSTANT
typedef enum _WINED3DTEXTURETRANSFORMFLAGS {
WINED3DTTFF_DISABLE = 0,
WINED3DTTFF_COUNT1 = 1,
WINED3DTTFF_COUNT2 = 2,
WINED3DTTFF_COUNT3 = 3,
WINED3DTTFF_COUNT4 = 4,
WINED3DTTFF_PROJECTED = 256,
WINED3DTTFF_FORCE_DWORD = 0x7fffffff
} WINED3DTEXTURETRANSFORMFLAGS;
typedef enum _WINED3DTEXTUREOP {
WINED3DTOP_DISABLE = 1,
WINED3DTOP_SELECTARG1 = 2,
......
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