Commit b052c6e8 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove some redundant s3tc extension checks.

If the extension isn't available to surface shouldn't have been created. We don't do extension checks for all the other formats either.
parent ea09e4af
...@@ -5987,22 +5987,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, ...@@ -5987,22 +5987,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
WINED3DFMT_DXT3 == destFormat || WINED3DFMT_DXT3 == destFormat ||
WINED3DFMT_DXT4 == destFormat || WINED3DFMT_DXT4 == destFormat ||
WINED3DFMT_DXT5 == destFormat) { WINED3DFMT_DXT5 == destFormat) {
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
if (destSurfaceHeight != srcHeight || destSurfaceWidth != srcWidth) {
/* FIXME: The easy way to do this is to lock the destination, and copy the bits across */
FIXME("Updating part of a compressed texture is not supported at the moment\n");
} if (destFormat != srcFormat) {
FIXME("Updating mixed format compressed texture is not curretly support\n");
} else {
GL_EXTCALL(glCompressedTexImage2DARB(glDescription->target, glDescription->level,
dst_format_desc->glInternal, srcWidth, srcHeight, 0, destSize, data));
}
} else {
FIXME("Attempting to update a DXT compressed texture without hardware support\n");
}
} else { if (destSurfaceHeight != srcHeight || destSurfaceWidth != srcWidth)
{
/* FIXME: The easy way to do this is to lock the destination, and copy the bits across. */
FIXME("Updating part of a compressed texture is not supported.\n");
}
if (destFormat != srcFormat)
{
FIXME("Updating mixed format compressed textures is not supported.\n");
}
else
{
GL_EXTCALL(glCompressedTexImage2DARB(glDescription->target, glDescription->level,
dst_format_desc->glInternal, srcWidth, srcHeight, 0, destSize, data));
}
}
else
{
glTexSubImage2D(glDescription->target, glDescription->level, destLeft, destTop, glTexSubImage2D(glDescription->target, glDescription->level, destLeft, destTop,
srcWidth, srcHeight, dst_format_desc->glFormat, dst_format_desc->glType, data); srcWidth, srcHeight, dst_format_desc->glFormat, dst_format_desc->glType, data);
} }
......
...@@ -150,25 +150,26 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) { ...@@ -150,25 +150,26 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
|| format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4 || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4
|| format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N) || format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N)
{ {
if (!GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) { /* We can assume this as the texture would not have been created otherwise */ TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n",
FIXME("(%p) : Attempting to lock a compressed texture when texture compression isn't supported by opengl\n", This); This, This->glDescription.level, format_desc->glFormat, format_desc->glType,
} else { This->resource.allocatedMemory);
TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p\n",
This, This->glDescription.level, format_desc->glFormat, format_desc->glType, if (This->Flags & SFLAG_PBO)
This->resource.allocatedMemory); {
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
if(This->Flags & SFLAG_PBO) { checkGLcall("glBindBufferARB");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo)); GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, NULL));
checkGLcall("glBindBufferARB"); checkGLcall("glGetCompressedTexImageARB()");
GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, NULL)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
checkGLcall("glGetCompressedTexImageARB()"); checkGLcall("glBindBufferARB");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
checkGLcall("glBindBufferARB");
} else {
GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, This->resource.allocatedMemory));
checkGLcall("glGetCompressedTexImageARB()");
}
} }
else
{
GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target,
This->glDescription.level, This->resource.allocatedMemory));
checkGLcall("glGetCompressedTexImageARB()");
}
LEAVE_GL(); LEAVE_GL();
} else { } else {
void *mem; void *mem;
...@@ -297,35 +298,41 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi ...@@ -297,35 +298,41 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi
|| format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4 || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4
|| format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N) || format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N)
{ {
if (!GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) { /* glCompressedTexSubImage2D() for uploading and glTexImage2D() for
FIXME("Using DXT1/3/5 without advertized support\n"); * allocating does not work well on some drivers (r200 dri, MacOS ATI
} else { * driver). glCompressedTexImage2D() does not accept NULL pointers. So
/* glCompressedTexSubImage2D for uploading and glTexImage2D for allocating does not work well on some drivers(r200 dri, MacOS ATI driver) * for compressed textures surface_allocate_surface() does nothing,
* glCompressedTexImage2D does not accept NULL pointers. So for compressed textures surface_allocate_surface does nothing, and this * and this function uses glCompressedTexImage2D() instead of
* function uses glCompressedTexImage2D instead of the SubImage call * glCompressedTexSubImage2D(). */
*/ TRACE("(%p) : Calling glCompressedTexImage2DARB w %u, h %u, data %p.\n", This, width, height, data);
TRACE("(%p) : Calling glCompressedTexSubImage2D w %d, h %d, data %p\n", This, width, height, data);
ENTER_GL(); ENTER_GL();
if(This->Flags & SFLAG_PBO) { if (This->Flags & SFLAG_PBO)
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); {
checkGLcall("glBindBufferARB"); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
TRACE("(%p) pbo: %#x, data: %p\n", This, This->pbo, data); checkGLcall("glBindBufferARB");
GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level, internal, TRACE("(%p) pbo: %#x, data: %p.\n", This, This->pbo, data);
width, height, 0 /* border */, This->resource.size, NULL));
checkGLcall("glCompressedTexSubImage2D");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level,
checkGLcall("glBindBufferARB"); internal, width, height, 0 /* border */, This->resource.size, NULL));
} else { checkGLcall("glCompressedTexImage2DARB");
GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level, internal,
width, height, 0 /* border */, This->resource.size, data)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
checkGLcall("glCompressedTexSubImage2D"); checkGLcall("glBindBufferARB");
}
LEAVE_GL();
} }
} else { else
{
GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level,
internal, width, height, 0 /* border */, This->resource.size, data));
checkGLcall("glCompressedTexSubImage2D");
}
LEAVE_GL();
}
else
{
TRACE("(%p) : Calling glTexSubImage2D w %d, h %d, data, %p\n", This, width, height, data); TRACE("(%p) : Calling glTexSubImage2D w %d, h %d, data, %p\n", This, width, height, data);
ENTER_GL(); ENTER_GL();
......
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