Commit 85155cc6 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Disable depth test when there is no Z buffer attached.

Initialise texture states at creation instead of when tex name is generated.
parent 44b47779
......@@ -1325,6 +1325,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
IDirect3DDeviceGLImpl* glThis = (IDirect3DDeviceGLImpl*) This;
int num_active_stages = 0;
int num_tex_index = GET_TEXCOUNT_FROM_FVF(d3dvtVertexType);
BOOL reenable_depth_test = FALSE;
/* I put the trace before the various locks... So as to better understand where locks occur :-) */
if (TRACE_ON(ddraw)) {
......@@ -1349,9 +1350,12 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
hr = IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This->surface, IDirectDrawSurface7),
(DDSCAPS2 *) &zbuf_caps, &zbuf);
if (!FAILED(hr)) {
if (SUCCEEDED(hr)) {
This->current_zbuffer = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, zbuf);
IDirectDrawSurface7_Release(zbuf);
} else if (glThis->depth_test) {
glDisable(GL_DEPTH_TEST);
reenable_depth_test = TRUE;
}
}
if (This->current_zbuffer != NULL) {
......@@ -1615,6 +1619,9 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
/* Whatever the case, disable the color material stuff */
glDisable(GL_COLOR_MATERIAL);
if (reenable_depth_test)
glEnable(GL_DEPTH_TEST);
LEAVE_GL();
TRACE("End\n");
......
......@@ -903,12 +903,14 @@ HRESULT d3dtexture_create(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surf, BO
private->tex_name = 0;
if (surf->mipmap_level == 0) {
private->main = NULL;
private->__global_dirty_flag = SURFACE_MEMORY_DIRTY;
private->global_dirty_flag = &(private->__global_dirty_flag);
} else {
private->main = main;
private->global_dirty_flag = &(((IDirect3DTextureGLImpl *) (private->main->tex_private))->__global_dirty_flag);
}
private->initial_upload_done = FALSE;
private->dirty_flag = SURFACE_MEMORY_DIRTY;
}
return D3D_OK;
......@@ -925,15 +927,11 @@ GLuint gltex_get_tex_name(IDirectDrawSurfaceImpl *surf)
glGenTextures(1, &(private->tex_name));
if (private->tex_name == 0) ERR("Error at creation of OpenGL texture ID !\n");
TRACE(" GL texture id is : %d.\n", private->tex_name);
private->__global_dirty_flag = SURFACE_MEMORY_DIRTY;
} else {
private->tex_name = gltex_get_tex_name(private->main);
TRACE(" GL texture id reusing id %d from surface %p (private at %p)).\n", private->tex_name, private->main, private->main->tex_private);
}
LEAVE_GL();
/* And set the dirty flag accordingly */
private->dirty_flag = SURFACE_MEMORY_DIRTY;
}
return ((IDirect3DTextureGLImpl *) (surf->tex_private))->tex_name;
}
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