- do not search for attached surfaces if the texture doesn't have the

MIPMAP flag set
- add GL crit. section support for matrix setting
- support the various BLEND texture operations
This commit is contained in:
Lionel Ulmer 2003-06-04 21:53:43 +00:00 committed by Alexandre Julliard
parent a856019687
commit c312ff950b
2 changed files with 53 additions and 12 deletions

View File

@ -1810,6 +1810,27 @@ GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface,
glTexEnvi(GL_TEXTURE_ENV, parm, GL_ADD_SIGNED_EXT); glTexEnvi(GL_TEXTURE_ENV, parm, GL_ADD_SIGNED_EXT);
break; break;
/* For the four blending modes, use the Arg2 parameter */
case D3DTOP_BLENDDIFFUSEALPHA:
case D3DTOP_BLENDTEXTUREALPHA:
case D3DTOP_BLENDFACTORALPHA:
case D3DTOP_BLENDCURRENTALPHA: {
GLenum src = GL_PRIMARY_COLOR_EXT; /* Just to prevent a compiler warning.. */
switch (dwState) {
case D3DTOP_BLENDDIFFUSEALPHA: src = GL_PRIMARY_COLOR_EXT;
case D3DTOP_BLENDTEXTUREALPHA: src = GL_TEXTURE;
case D3DTOP_BLENDFACTORALPHA: src = GL_CONSTANT_EXT;
case D3DTOP_BLENDCURRENTALPHA: src = GL_PREVIOUS_EXT;
}
glTexEnvi(GL_TEXTURE_ENV, parm, GL_INTERPOLATE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, src);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_EXT, src);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_EXT, GL_SRC_ALPHA);
} break;
default: default:
handled = FALSE; handled = FALSE;
break; break;
@ -1969,7 +1990,9 @@ GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface,
} }
if ((dwState & 0xFF) != D3DTTFF_DISABLE) { if ((dwState & 0xFF) != D3DTTFF_DISABLE) {
LEAVE_GL();
This->matrices_updated(This, TEXMAT0_CHANGED << dwStage); This->matrices_updated(This, TEXMAT0_CHANGED << dwStage);
ENTER_GL();
} }
if (handled == TRUE) { if (handled == TRUE) {
@ -2707,6 +2730,10 @@ d3ddevice_matrices_updated(IDirect3DDeviceImpl *This, DWORD matrices)
glThis->transform_state = GL_TRANSFORM_NONE; glThis->transform_state = GL_TRANSFORM_NONE;
} }
} }
if (matrices & (TEXMAT0_CHANGED|TEXMAT1_CHANGED|TEXMAT2_CHANGED|TEXMAT3_CHANGED|
TEXMAT4_CHANGED|TEXMAT5_CHANGED|TEXMAT6_CHANGED|TEXMAT7_CHANGED))
{
ENTER_GL();
for (tex_mat = TEXMAT0_CHANGED, tex_stage = 0; tex_mat <= TEXMAT7_CHANGED; tex_mat <<= 1, tex_stage++) { for (tex_mat = TEXMAT0_CHANGED, tex_stage = 0; tex_mat <= TEXMAT7_CHANGED; tex_mat <<= 1, tex_stage++) {
if (matrices & tex_mat) { if (matrices & tex_mat) {
if (This->state_block.texture_stage_state[tex_stage][D3DTSS_TEXTURETRANSFORMFLAGS - 1] != D3DTTFF_DISABLE) { if (This->state_block.texture_stage_state[tex_stage][D3DTSS_TEXTURETRANSFORMFLAGS - 1] != D3DTTFF_DISABLE) {
@ -2721,6 +2748,8 @@ d3ddevice_matrices_updated(IDirect3DDeviceImpl *This, DWORD matrices)
} }
} }
} }
LEAVE_GL();
}
} }
/* TODO for both these functions : /* TODO for both these functions :

View File

@ -585,7 +585,11 @@ gltex_upload_texture(IDirectDrawSurfaceImpl *This) {
} }
} }
if (surf_ptr->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) {
surf_ptr = get_sub_mimaplevel(surf_ptr); surf_ptr = get_sub_mimaplevel(surf_ptr);
} else {
surf_ptr = NULL;
}
} }
return DD_OK; return DD_OK;
@ -817,8 +821,16 @@ GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
} }
} }
if (src_ptr->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) {
src_ptr = get_sub_mimaplevel(src_ptr); src_ptr = get_sub_mimaplevel(src_ptr);
} else {
src_ptr = NULL;
}
if (dst_ptr->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) {
dst_ptr = get_sub_mimaplevel(dst_ptr); dst_ptr = get_sub_mimaplevel(dst_ptr);
} else {
dst_ptr = NULL;
}
if ((src_ptr == NULL) || (dst_ptr == NULL)) { if ((src_ptr == NULL) || (dst_ptr == NULL)) {
if (src_ptr != dst_ptr) { if (src_ptr != dst_ptr) {