wined3d: Allow read back of P8 surfaces. This fixes some of the redrawing issues in Red Alert.
This commit is contained in:
parent
f84589ea1f
commit
424e9c3e08
|
@ -55,7 +55,8 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->Flags & SFLAG_CONVERTED) {
|
/* Only support read back of converted P8 surfaces */
|
||||||
|
if(This->Flags & SFLAG_CONVERTED && (This->resource.format != WINED3DFMT_P8)) {
|
||||||
FIXME("Read back converted textures unsupported, format=%s\n", debug_d3dformat(This->resource.format));
|
FIXME("Read back converted textures unsupported, format=%s\n", debug_d3dformat(This->resource.format));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -86,9 +87,17 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
} else {
|
} else {
|
||||||
void *mem;
|
void *mem;
|
||||||
|
GLenum format = This->glDescription.glFormat;
|
||||||
|
GLenum type = This->glDescription.glType;
|
||||||
int src_pitch = 0;
|
int src_pitch = 0;
|
||||||
int dst_pitch = 0;
|
int dst_pitch = 0;
|
||||||
|
|
||||||
|
/* In case of P8 the index is stored in the alpha component if the primary render target uses P8 */
|
||||||
|
if(This->resource.format == WINED3DFMT_P8) {
|
||||||
|
format = GL_ALPHA;
|
||||||
|
type = GL_UNSIGNED_BYTE;
|
||||||
|
}
|
||||||
|
|
||||||
if (This->Flags & SFLAG_NONPOW2) {
|
if (This->Flags & SFLAG_NONPOW2) {
|
||||||
unsigned char alignment = This->resource.wineD3DDevice->surface_alignment;
|
unsigned char alignment = This->resource.wineD3DDevice->surface_alignment;
|
||||||
src_pitch = This->bytesPerPixel * This->pow2Width;
|
src_pitch = This->bytesPerPixel * This->pow2Width;
|
||||||
|
@ -100,21 +109,21 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("(%p) : Calling glGetTexImage level %d, format %#x, type %#x, data %p\n", This, This->glDescription.level,
|
TRACE("(%p) : Calling glGetTexImage level %d, format %#x, type %#x, data %p\n", This, This->glDescription.level,
|
||||||
This->glDescription.glFormat, This->glDescription.glType, mem);
|
format, type, mem);
|
||||||
|
|
||||||
if(This->Flags & SFLAG_PBO) {
|
if(This->Flags & SFLAG_PBO) {
|
||||||
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
|
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
|
||||||
checkGLcall("glBindBufferARB");
|
checkGLcall("glBindBufferARB");
|
||||||
|
|
||||||
glGetTexImage(This->glDescription.target, This->glDescription.level, This->glDescription.glFormat,
|
glGetTexImage(This->glDescription.target, This->glDescription.level, format,
|
||||||
This->glDescription.glType, NULL);
|
type, NULL);
|
||||||
checkGLcall("glGetTexImage()");
|
checkGLcall("glGetTexImage()");
|
||||||
|
|
||||||
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
|
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
|
||||||
checkGLcall("glBindBufferARB");
|
checkGLcall("glBindBufferARB");
|
||||||
} else {
|
} else {
|
||||||
glGetTexImage(This->glDescription.target, This->glDescription.level, This->glDescription.glFormat,
|
glGetTexImage(This->glDescription.target, This->glDescription.level, format,
|
||||||
This->glDescription.glType, mem);
|
type, mem);
|
||||||
checkGLcall("glGetTexImage()");
|
checkGLcall("glGetTexImage()");
|
||||||
}
|
}
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
Loading…
Reference in New Issue