diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index cd4952d8050..2bf4fb4f524 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -915,7 +915,7 @@ static HRESULT STDMETHODCALLTYPE buffer_GetDesc(IWineD3DBuffer *iface, WINED3DVE TRACE("(%p)\n", This); - desc->Format = This->resource.format; + desc->Format = This->resource.format_desc->format; desc->Type = This->resource.resourceType; desc->Usage = This->resource.usage; desc->Pool = This->resource.pool; @@ -1166,7 +1166,7 @@ static HRESULT STDMETHODCALLTYPE IWineD3DIndexBufferImpl_GetDesc(IWineD3DIndexBu TRACE("(%p)\n", This); - pDesc->Format = This->resource.format; + pDesc->Format = This->resource.format_desc->format; pDesc->Type = This->resource.resourceType; pDesc->Usage = This->resource.usage; pDesc->Pool = This->resource.pool; diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index bb57130c5ac..4ae7c3dc63b 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -200,14 +200,16 @@ static void context_check_fbo_status(IWineD3DDevice *iface) attachment = (IWineD3DSurfaceImpl *)This->activeContext->current_fbo->render_targets[i]; if (attachment) { - FIXME("\tColor attachment %d: (%p) %s %ux%u\n", i, attachment, debug_d3dformat(attachment->resource.format), + FIXME("\tColor attachment %d: (%p) %s %ux%u\n", + i, attachment, debug_d3dformat(attachment->resource.format_desc->format), attachment->pow2Width, attachment->pow2Height); } } attachment = (IWineD3DSurfaceImpl *)This->activeContext->current_fbo->depth_stencil; if (attachment) { - FIXME("\tDepth attachment: (%p) %s %ux%u\n", attachment, debug_d3dformat(attachment->resource.format), + FIXME("\tDepth attachment: (%p) %s %ux%u\n", + attachment, debug_d3dformat(attachment->resource.format_desc->format), attachment->pow2Width, attachment->pow2Height); } } @@ -644,16 +646,21 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar int iPixelFormat = 0; IWineD3DSurface *StencilSurface = This->stencilBufferTarget; - WINED3DFORMAT StencilBufferFormat = (NULL != StencilSurface) ? ((IWineD3DSurfaceImpl *) StencilSurface)->resource.format : 0; + WINED3DFORMAT StencilBufferFormat = StencilSurface ? + ((IWineD3DSurfaceImpl *)StencilSurface)->resource.format_desc->format : 0; /* Try to find a pixel format with pbuffer support. */ - iPixelFormat = WineD3D_ChoosePixelFormat(This, hdc_parent, target->resource.format, StencilBufferFormat, FALSE /* auxBuffers */, 0 /* numSamples */, TRUE /* PBUFFER */, FALSE /* findCompatible */); + iPixelFormat = WineD3D_ChoosePixelFormat(This, hdc_parent, target->resource.format_desc->format, + StencilBufferFormat, FALSE /* auxBuffers */, 0 /* numSamples */, TRUE /* PBUFFER */, + FALSE /* findCompatible */); if(!iPixelFormat) { TRACE("Trying to locate a compatible pixel format because an exact match failed.\n"); /* For some reason we weren't able to find a format, try to find something instead of crashing. * A reason for failure could have been wglChoosePixelFormatARB strictness. */ - iPixelFormat = WineD3D_ChoosePixelFormat(This, hdc_parent, target->resource.format, StencilBufferFormat, FALSE /* auxBuffer */, 0 /* numSamples */, TRUE /* PBUFFER */, TRUE /* findCompatible */); + iPixelFormat = WineD3D_ChoosePixelFormat(This, hdc_parent, target->resource.format_desc->format, + StencilBufferFormat, FALSE /* auxBuffer */, 0 /* numSamples */, TRUE /* PBUFFER */, + TRUE /* findCompatible */); } /* This shouldn't happen as ChoosePixelFormat always returns something */ @@ -684,7 +691,7 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar PIXELFORMATDESCRIPTOR pfd; int iPixelFormat; int res; - WINED3DFORMAT ColorFormat = target->resource.format; + WINED3DFORMAT ColorFormat = target->resource.format_desc->format; WINED3DFORMAT DepthStencilFormat = 0; BOOL auxBuffers = FALSE; int numSamples = 0; @@ -699,9 +706,9 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar if(wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) { auxBuffers = TRUE; - if(target->resource.format == WINED3DFMT_X4R4G4B4) + if (target->resource.format_desc->format == WINED3DFMT_X4R4G4B4) ColorFormat = WINED3DFMT_A4R4G4B4; - else if(target->resource.format == WINED3DFMT_X8R8G8B8) + else if(target->resource.format_desc->format == WINED3DFMT_X8R8G8B8) ColorFormat = WINED3DFMT_A8R8G8B8; } diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index fe874a79990..ce5f6b618bc 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -120,7 +120,8 @@ void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB s ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); } - if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8 || This->resource.format_desc->format == WINED3DFMT_A8P8) + { for (i = 0; i < This->baseTexture.levels; i++) { for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) { if(palette9_changed((IWineD3DSurfaceImpl *)This->surfaces[j][i])) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index ab2474e665b..7f1840f4ddd 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -251,7 +251,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object); TRACE("size %#x, usage=%#x, format %s, memory @ %p, iface @ %p\n", object->resource.size, object->resource.usage, - debug_d3dformat(object->resource.format), object->resource.allocatedMemory, object); + debug_d3dformat(object->resource.format_desc->format), object->resource.allocatedMemory, object); *buffer = (IWineD3DBuffer *)object; @@ -262,8 +262,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac DWORD FVF, WINED3DPOOL Pool, IWineD3DBuffer **ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + /* Dummy format for now */ + const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(WINED3DFMT_VERTEXDATA, &This->adapter->gl_info); struct wined3d_buffer *object; - WINED3DFORMAT Format = WINED3DFMT_VERTEXDATA; /* Dummy format for now */ int dxVersion = ( (IWineD3DImpl *) This->wineD3D)->dxVersion; HRESULT hr; BOOL conv; @@ -290,7 +291,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac } object->vtbl = &wined3d_buffer_vtbl; - hr = resource_init(&object->resource, WINED3DRTYPE_VERTEXBUFFER, This, Size, Usage, Format, Pool, parent); + hr = resource_init(&object->resource, WINED3DRTYPE_VERTEXBUFFER, This, Size, Usage, format_desc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -392,6 +393,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface WINED3DFORMAT Format, WINED3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer, HANDLE *sharedHandle, IUnknown *parent) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info); IWineD3DIndexBufferImpl *object; HRESULT hr; @@ -407,7 +409,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface } object->lpVtbl = &IWineD3DIndexBuffer_Vtbl; - hr = resource_init(&object->resource, WINED3DRTYPE_INDEXBUFFER, This, Length, Usage, Format, Pool, parent); + hr = resource_init(&object->resource, WINED3DRTYPE_INDEXBUFFER, This, Length, Usage, format_desc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -778,7 +780,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U return WINED3DERR_INVALIDCALL; } - hr = resource_init(&object->resource, WINED3DRTYPE_SURFACE, This, Size, Usage, Format, Pool, parent); + hr = resource_init(&object->resource, WINED3DRTYPE_SURFACE, This, Size, Usage, glDesc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -902,6 +904,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, IWineD3DTexture **ppTexture, HANDLE *pSharedHandle, IUnknown *parent) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info); IWineD3DTextureImpl *object; unsigned int i; UINT tmpW; @@ -977,7 +980,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, } object->lpVtbl = &IWineD3DTexture_Vtbl; - hr = resource_init(&object->resource, WINED3DRTYPE_TEXTURE, This, 0, Usage, Format, Pool, parent); + hr = resource_init(&object->resource, WINED3DRTYPE_TEXTURE, This, 0, Usage, format_desc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -1074,6 +1077,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa IWineD3DVolumeTexture **ppVolumeTexture, HANDLE *pSharedHandle, IUnknown *parent) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info); IWineD3DVolumeTextureImpl *object; unsigned int i; UINT tmpW; @@ -1124,7 +1128,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa } object->lpVtbl = &IWineD3DVolumeTexture_Vtbl; - hr = resource_init(&object->resource, WINED3DRTYPE_VOLUMETEXTURE, This, 0, Usage, Format, Pool, parent); + hr = resource_init(&object->resource, WINED3DRTYPE_VOLUMETEXTURE, This, 0, Usage, format_desc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -1217,7 +1221,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, object->lpVtbl = &IWineD3DVolume_Vtbl; hr = resource_init(&object->resource, WINED3DRTYPE_VOLUME, This, - Width * Height * Depth * format_desc->byte_count, Usage, Format, Pool, parent); + Width * Height * Depth * format_desc->byte_count, Usage, format_desc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -1256,6 +1260,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface IWineD3DCubeTexture **ppCubeTexture, HANDLE *pSharedHandle, IUnknown *parent) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info); IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/ unsigned int i, j; UINT tmpW; @@ -1306,7 +1311,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface } object->lpVtbl = &IWineD3DCubeTexture_Vtbl; - hr = resource_init(&object->resource, WINED3DRTYPE_CUBETEXTURE, This, 0, Usage, Format, Pool, parent); + hr = resource_init(&object->resource, WINED3DRTYPE_CUBETEXTURE, This, 0, Usage, format_desc, Pool, parent); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x\n", hr); @@ -5840,7 +5845,9 @@ static void dirtify_p8_texture_samplers(IWineD3DDeviceImpl *device) for (i = 0; i < MAX_COMBINED_SAMPLERS; i++) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl*)device->stateBlock->textures[i]; - if (texture && (texture->resource.format == WINED3DFMT_P8 || texture->resource.format == WINED3DFMT_A8P8)) { + if (texture && (texture->resource.format_desc->format == WINED3DFMT_P8 + || texture->resource.format_desc->format == WINED3DFMT_A8P8)) + { IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(i)); } } @@ -6507,7 +6514,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD /* Just forward this to the DirectDraw blitting engine */ memset(&BltFx, 0, sizeof(BltFx)); BltFx.dwSize = sizeof(BltFx); - BltFx.u5.dwFillColor = argb_to_fmt(color, surface->resource.format); + BltFx.u5.dwFillColor = argb_to_fmt(color, surface->resource.format_desc->format); return IWineD3DSurface_Blt(pSurface, (const RECT *)pRect, NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_NONE); } @@ -6555,7 +6562,7 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac /* Just forward this to the DirectDraw blitting engine */ memset(&BltFx, 0, sizeof(BltFx)); BltFx.dwSize = sizeof(BltFx); - BltFx.u5.dwFillColor = argb_to_fmt(c, ((IWineD3DSurfaceImpl *)surface)->resource.format); + BltFx.u5.dwFillColor = argb_to_fmt(c, ((IWineD3DSurfaceImpl *)surface)->resource.format_desc->format); hr = IWineD3DSurface_Blt(surface, NULL, NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_NONE); if (FAILED(hr)) { @@ -6955,7 +6962,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i WINED3DLOCKED_RECT rect; /* MSDN: Cursor must be A8R8G8B8 */ - if (WINED3DFMT_A8R8G8B8 != pSur->resource.format) { + if (WINED3DFMT_A8R8G8B8 != pSur->resource.format_desc->format) + { ERR("(%p) : surface(%p) has an invalid format\n", This, pCursorBitmap); return WINED3DERR_INVALIDCALL; } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 898b732dd43..807240bb333 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -27,15 +27,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); HRESULT resource_init(struct IWineD3DResourceClass *resource, WINED3DRESOURCETYPE resource_type, - IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, IUnknown *parent) + IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc, + WINED3DPOOL pool, IUnknown *parent) { resource->wineD3DDevice = device; resource->parent = parent; resource->resourceType = resource_type; resource->ref = 1; resource->pool = pool; - resource->format = format; - resource->format_desc = getFormatDescEntry(format, &device->adapter->gl_info); + resource->format_desc = format_desc; resource->usage = usage; resource->size = size; resource->priority = 0; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 8f79da0794c..08cf64f6f4b 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -129,7 +129,8 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device) { if (device->render_targets && device->render_targets[0]) { IWineD3DSurfaceImpl* render_target = (IWineD3DSurfaceImpl*)device->render_targets[0]; - if((render_target->resource.usage & WINED3DUSAGE_RENDERTARGET) && (render_target->resource.format == WINED3DFMT_P8)) + if ((render_target->resource.usage & WINED3DUSAGE_RENDERTARGET) + && (render_target->resource.format_desc->format == WINED3DFMT_P8)) return TRUE; } return FALSE; @@ -138,22 +139,21 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device) /* This call just downloads data, the caller is responsible for activating the * right context and binding the correct texture. */ static void surface_download_data(IWineD3DSurfaceImpl *This) { - const struct GlPixelFormatDesc *format_desc; + const struct GlPixelFormatDesc *format_desc = This->resource.format_desc; /* 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)); + if (This->Flags & SFLAG_CONVERTED && format_desc->format != WINED3DFMT_P8) + { + FIXME("Read back converted textures unsupported, format=%s\n", debug_d3dformat(format_desc->format)); return; } - format_desc = This->resource.format_desc; - ENTER_GL(); - if (This->resource.format == WINED3DFMT_DXT1 || - This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 || - This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5 || - This->resource.format == WINED3DFMT_ATI2N) { + if (format_desc->format == WINED3DFMT_DXT1 || format_desc->format == WINED3DFMT_DXT2 + || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4 + || 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 */ FIXME("(%p) : Attempting to lock a compressed texture when texture compression isn't supported by opengl\n", This); } else { @@ -182,7 +182,8 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) { 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 && primary_render_target_is_p8(This->resource.wineD3DDevice)) { + if (format_desc->format == WINED3DFMT_P8 && primary_render_target_is_p8(This->resource.wineD3DDevice)) + { format = GL_ALPHA; type = GL_UNSIGNED_BYTE; } @@ -296,10 +297,10 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi if (format_desc->heightscale != 1.0 && format_desc->heightscale != 0.0) height *= format_desc->heightscale; - if (This->resource.format == WINED3DFMT_DXT1 || - This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 || - This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5 || - This->resource.format == WINED3DFMT_ATI2N) { + if (format_desc->format == WINED3DFMT_DXT1 || format_desc->format == WINED3DFMT_DXT2 + || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4 + || format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N) + { if (!GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) { FIXME("Using DXT1/3/5 without advertized support\n"); } else { @@ -361,13 +362,14 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal, if (format_desc->heightscale != 1.0 && format_desc->heightscale != 0.0) height *= format_desc->heightscale; - TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n", This, - This->glDescription.target, This->glDescription.level, debug_d3dformat(This->resource.format), internal, width, height, format, type); + TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n", + This, This->glDescription.target, This->glDescription.level, debug_d3dformat(format_desc->format), + internal, width, height, format, type); - if (This->resource.format == WINED3DFMT_DXT1 || - This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 || - This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5 || - This->resource.format == WINED3DFMT_ATI2N) { + if (format_desc->format == WINED3DFMT_DXT1 || format_desc->format == WINED3DFMT_DXT2 + || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4 + || format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N) + { /* glCompressedTexImage2D does not accept NULL pointers, so we cannot allocate a compressed texture without uploading data */ TRACE("Not allocating compressed surfaces, surface_upload_data will specify them\n"); @@ -609,7 +611,9 @@ void surface_internal_preload(IWineD3DSurface *iface, enum WINED3DSRGB srgb) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); } - if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8 + || This->resource.format_desc->format == WINED3DFMT_A8P8) + { if(palette9_changed(This)) { TRACE("Reloading surface because the d3d8/9 palette was changed\n"); /* TODO: This is not necessarily needed with hw palettized texture support */ @@ -798,7 +802,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v } /* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */ - switch(This->resource.format) + switch(This->resource.format_desc->format) { case WINED3DFMT_P8: { @@ -906,7 +910,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v row = HeapAlloc(GetProcessHeap(), 0, len); if(!row) { ERR("Out of memory\n"); - if(This->resource.format == WINED3DFMT_P8) HeapFree(GetProcessHeap(), 0, mem); + if (This->resource.format_desc->format == WINED3DFMT_P8) HeapFree(GetProcessHeap(), 0, mem); LEAVE_GL(); return; } @@ -936,7 +940,8 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v * the same color but we have no choice. * In case of P8 render targets, the index is stored in the alpha component so no conversion is needed. */ - if((This->resource.format == WINED3DFMT_P8) && !primary_render_target_is_p8(myDevice)) { + if ((This->resource.format_desc->format == WINED3DFMT_P8) && !primary_render_target_is_p8(myDevice)) + { const PALETTEENTRY *pal = NULL; DWORD width = pitch / 3; int x, y, c; @@ -1503,10 +1508,11 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD /* According to Direct3D9 docs, only these formats are supported */ if (((IWineD3DImpl *)This->resource.wineD3DDevice->wineD3D)->dxVersion > 7) { - if (This->resource.format != WINED3DFMT_R5G6B5 && - This->resource.format != WINED3DFMT_X1R5G5B5 && - This->resource.format != WINED3DFMT_R8G8B8 && - This->resource.format != WINED3DFMT_X8R8G8B8) return WINED3DERR_INVALIDCALL; + if (This->resource.format_desc->format != WINED3DFMT_R5G6B5 + && This->resource.format_desc->format != WINED3DFMT_X1R5G5B5 + && This->resource.format_desc->format != WINED3DFMT_R8G8B8 + && This->resource.format_desc->format != WINED3DFMT_X8R8G8B8) + return WINED3DERR_INVALIDCALL; } memset(&lock, 0, sizeof(lock)); /* To be sure */ @@ -1540,8 +1546,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD return hr; } - if(This->resource.format == WINED3DFMT_P8 || - This->resource.format == WINED3DFMT_A8P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8 + || This->resource.format_desc->format == WINED3DFMT_A8P8) + { /* GetDC on palettized formats is unsupported in D3D9, and the method is missing in D3D8, so this should only be used for DX <=7 surfaces (with non-device palettes) */ unsigned int n; @@ -1627,7 +1634,8 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_ } /* Ok, now look if we have to do any conversion */ - switch(This->resource.format) { + switch(This->resource.format_desc->format) + { case WINED3DFMT_P8: /* **************** Paletted Texture @@ -2271,7 +2279,9 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve BOOL palette9_changed(IWineD3DSurfaceImpl *This) { IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; - if(This->palette || (This->resource.format != WINED3DFMT_P8 && This->resource.format != WINED3DFMT_A8P8)) { + if (This->palette || (This->resource.format_desc->format != WINED3DFMT_P8 + && This->resource.format_desc->format != WINED3DFMT_A8P8)) + { /* If a ddraw-style palette is attached assume no d3d9 palette change. * Also the palette isn't interesting if the surface format isn't P8 or A8P8 */ @@ -2508,7 +2518,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, c return WINED3DERR_INVALIDCALL; } /* Save the data out to a TGA file because 1: it's an easy raw format, 2: it supports an alpha channel */ - TRACE("(%p) opened %s with format %s\n", This, filename, debug_d3dformat(This->resource.format)); + TRACE("(%p) opened %s with format %s\n", This, filename, debug_d3dformat(This->resource.format_desc->format)); /* TGA header */ fputc(0,f); fputc(0,f); @@ -3315,7 +3325,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const /* When blitting from a render target a texture, the texture isn't required to have a palette. * In this case grab the palette from the render target. */ - if((This->resource.format == WINED3DFMT_P8) && (This->palette == NULL)) { + if ((This->resource.format_desc->format == WINED3DFMT_P8) && (This->palette == NULL)) + { paletteOverride = TRUE; TRACE("Source surface (%p) lacks palette, overriding palette with palette %p of destination surface (%p)\n", Src, This->palette, This); This->palette = Src->palette; @@ -3391,7 +3402,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const * surface is not required to have a palette. Our rendering / conversion * code further down the road retrieves the palette from the surface, so * it must have a palette set. */ - if((Src->resource.format == WINED3DFMT_P8) && (Src->palette == NULL)) { + if ((Src->resource.format_desc->format == WINED3DFMT_P8) && (Src->palette == NULL)) + { paletteOverride = TRUE; TRACE("Source surface (%p) lacks palette, overriding palette with palette %p of destination surface (%p)\n", Src, This->palette, This); Src->palette = This->palette; @@ -3462,7 +3474,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const rect.y1 += This->currentDesc.Height - h; rect.y2 += This->currentDesc.Height - h; } - myDevice->blitter->set_shader((IWineD3DDevice *) myDevice, Src->resource.format, + myDevice->blitter->set_shader((IWineD3DDevice *) myDevice, Src->resource.format_desc->format, Src->glDescription.target, Src->pow2Width, Src->pow2Height); ENTER_GL(); @@ -3578,7 +3590,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const /* The color as given in the Blt function is in the format of the frame-buffer... * 'clear' expect it in ARGB format => we need to do some conversion :-) */ - if (This->resource.format == WINED3DFMT_P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8) + { DWORD alpha; if (primary_render_target_is_p8(myDevice)) alpha = DDBltFx->u5.dwFillColor << 24; @@ -3593,7 +3606,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const color = alpha; } } - else if (This->resource.format == WINED3DFMT_R5G6B5) { + else if (This->resource.format_desc->format == WINED3DFMT_R5G6B5) + { if (DDBltFx->u5.dwFillColor == 0xFFFF) { color = 0xFFFFFFFF; } else { @@ -3603,11 +3617,13 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const ((DDBltFx->u5.dwFillColor & 0x001F) << 3)); } } - else if ((This->resource.format == WINED3DFMT_R8G8B8) || - (This->resource.format == WINED3DFMT_X8R8G8B8) ) { + else if ((This->resource.format_desc->format == WINED3DFMT_R8G8B8) + || (This->resource.format_desc->format == WINED3DFMT_X8R8G8B8)) + { color = 0xFF000000 | DDBltFx->u5.dwFillColor; } - else if (This->resource.format == WINED3DFMT_A8R8G8B8) { + else if (This->resource.format_desc->format == WINED3DFMT_A8R8G8B8) + { color = DDBltFx->u5.dwFillColor; } else { @@ -3637,7 +3653,8 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D float depth; if (Flags & WINEDDBLT_DEPTHFILL) { - switch(This->resource.format) { + switch(This->resource.format_desc->format) + { case WINED3DFMT_D16_UNORM: depth = (float) DDBltFx->u5.dwFillDepth / (float) 0x0000ffff; break; @@ -3653,7 +3670,7 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D break; default: depth = 0.0; - ERR("Unexpected format for depth fill: %s\n", debug_d3dformat(This->resource.format)); + ERR("Unexpected format for depth fill: %s\n", debug_d3dformat(This->resource.format_desc->format)); } return IWineD3DDevice_Clear((IWineD3DDevice *) myDevice, @@ -3781,8 +3798,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface) if (!pal) return WINED3D_OK; - if(This->resource.format == WINED3DFMT_P8 || - This->resource.format == WINED3DFMT_A8P8) + if (This->resource.format_desc->format == WINED3DFMT_P8 + || This->resource.format_desc->format == WINED3DFMT_A8P8) { int bpp; GLenum format, internal, type; @@ -3854,11 +3871,12 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) { This->pow2Height = pow2Height; if (pow2Width > This->currentDesc.Width || pow2Height > This->currentDesc.Height) { - WINED3DFORMAT Format = This->resource.format; + WINED3DFORMAT Format = This->resource.format_desc->format; /** TODO: add support for non power two compressed textures **/ if (Format == WINED3DFMT_DXT1 || Format == WINED3DFMT_DXT2 || Format == WINED3DFMT_DXT3 || Format == WINED3DFMT_DXT4 || Format == WINED3DFMT_DXT5 - || This->resource.format == WINED3DFMT_ATI2N) { + || Format == WINED3DFMT_ATI2N) + { FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n", This, This->currentDesc.Width, This->currentDesc.Height); return WINED3DERR_NOTAVAILABLE; @@ -3893,8 +3911,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) { is used in combination with texture uploads (RTL_READTEX/RTL_TEXTEX). The reason is that EXT_PALETTED_TEXTURE doesn't work in combination with ARB_TEXTURE_RECTANGLE. */ - if(This->Flags & SFLAG_NONPOW2 && GL_SUPPORT(ARB_TEXTURE_RECTANGLE) && - !((This->resource.format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) && (wined3d_settings.rendertargetlock_mode == RTL_READTEX || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX))) + if(This->Flags & SFLAG_NONPOW2 && GL_SUPPORT(ARB_TEXTURE_RECTANGLE) + && !((This->resource.format_desc->format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) + && (wined3d_settings.rendertargetlock_mode == RTL_READTEX + || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX))) { This->glDescription.target = GL_TEXTURE_RECTANGLE_ARB; This->pow2Width = This->currentDesc.Width; @@ -4617,7 +4637,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D d3dfmt_convert_surface(This->resource.allocatedMemory, mem, pitch, width, height, outpitch, convert, This); This->Flags |= SFLAG_CONVERTED; - } else if( (This->resource.format == WINED3DFMT_P8) && (GL_SUPPORT(EXT_PALETTED_TEXTURE) || GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) ) { + } + else if ((This->resource.format_desc->format == WINED3DFMT_P8) + && (GL_SUPPORT(EXT_PALETTED_TEXTURE) || GL_SUPPORT(ARB_FRAGMENT_PROGRAM))) + { d3dfmt_p8_upload_palette(iface, convert); This->Flags &= ~SFLAG_CONVERTED; mem = This->resource.allocatedMemory; diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c index 8d04558b8f2..941d5379dc8 100644 --- a/dlls/wined3d/surface_base.c +++ b/dlls/wined3d/surface_base.c @@ -181,7 +181,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; TRACE("(%p) : copying into %p\n", This, pDesc); - if(pDesc->Format != NULL) *(pDesc->Format) = This->resource.format; + if(pDesc->Format != NULL) *(pDesc->Format) = This->resource.format_desc->format; if(pDesc->Type != NULL) *(pDesc->Type) = This->resource.resourceType; if(pDesc->Usage != NULL) *(pDesc->Usage) = This->resource.usage; if(pDesc->Pool != NULL) *(pDesc->Pool) = This->resource.pool; @@ -332,16 +332,17 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; + WINED3DFORMAT format = This->resource.format_desc->format; DWORD ret; TRACE("(%p)\n", This); /* DXTn formats don't have exact pitches as they are to the new row of blocks, where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt2/3/4/5) ie pitch = (width/4) * bytes per block */ - if (This->resource.format == WINED3DFMT_DXT1) /* DXT1 is 8 bytes per block */ + if (format == WINED3DFMT_DXT1) /* DXT1 is 8 bytes per block */ ret = ((This->currentDesc.Width + 3) >> 2) << 3; - else if (This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 || - This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5) /* DXT2/3/4/5 is 16 bytes per block */ + else if (format == WINED3DFMT_DXT2 || format == WINED3DFMT_DXT3 || + format == WINED3DFMT_DXT4 || format == WINED3DFMT_DXT5) /* DXT2/3/4/5 is 16 bytes per block */ ret = ((This->currentDesc.Width + 3) >> 2) << 4; else { unsigned char alignment = This->resource.wineD3DDevice->surface_alignment; @@ -511,7 +512,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(format, &This->resource.wineD3DDevice->adapter->gl_info); - if (This->resource.format != WINED3DFMT_UNKNOWN) { + if (This->resource.format_desc->format != WINED3DFMT_UNKNOWN) + { FIXME("(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN\n", This); return WINED3DERR_INVALIDCALL; } @@ -540,7 +542,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D This->Flags |= (WINED3DFMT_D16_LOCKABLE == format) ? SFLAG_LOCKABLE : 0; - This->resource.format = format; This->resource.format_desc = format_desc; TRACE("(%p) : Size %d, bytesPerPixel %d\n", This, This->resource.size, This->bytesPerPixel); @@ -607,7 +608,8 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) { /* Get the bit masks */ masks = (DWORD *)b_info->bmiColors; - switch (This->resource.format) { + switch (This->resource.format_desc->format) + { case WINED3DFMT_R8G8B8: usage = DIB_RGB_COLORS; b_info->bmiHeader.biCompression = BI_RGB; @@ -779,10 +781,10 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source, WINED3DLOCKED_RECT lock_src, lock_dst; HRESULT hr; - conv = find_convertor(source->resource.format, to_fmt); + conv = find_convertor(source->resource.format_desc->format, to_fmt); if(!conv) { FIXME("Cannot find a conversion function from format %s to %s\n", - debug_d3dformat(source->resource.format), debug_d3dformat(to_fmt)); + debug_d3dformat(source->resource.format_desc->format), debug_d3dformat(to_fmt)); return NULL; } @@ -916,7 +918,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D RECT xdst,xsrc; HRESULT ret = WINED3D_OK; WINED3DLOCKED_RECT dlock, slock; - WINED3DFORMAT dfmt = WINED3DFMT_UNKNOWN, sfmt = WINED3DFMT_UNKNOWN; int bpp, srcheight, srcwidth, dstheight, dstwidth, width; const struct GlPixelFormatDesc *sEntry, *dEntry; int x, y; @@ -1095,20 +1096,18 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D if (Src == This) { IWineD3DSurface_LockRect(iface, &dlock, NULL, 0); - dfmt = This->resource.format; slock = dlock; - sfmt = dfmt; sEntry = This->resource.format_desc; dEntry = sEntry; } else { - dfmt = This->resource.format; dEntry = This->resource.format_desc; if (Src) { - if(This->resource.format != Src->resource.format) { - Src = surface_convert_format(Src, dfmt); + if(This->resource.format_desc != Src->resource.format_desc) + { + Src = surface_convert_format(Src, dEntry->format); if(!Src) { /* The conv function writes a FIXME */ WARN("Cannot convert source surface format to dest format\n"); @@ -1116,7 +1115,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D } } IWineD3DSurface_LockRect((IWineD3DSurface *) Src, &slock, NULL, WINED3DLOCK_READONLY); - sfmt = Src->resource.format; sEntry = Src->resource.format_desc; } else @@ -1678,7 +1676,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst FIXME("trans arg not supported when a FOURCC surface is involved\n"); if (dstx || dsty) FIXME("offset for destination surface is not supported\n"); - if (Src->resource.format != This->resource.format) + if (Src->resource.format_desc != This->resource.format_desc) { FIXME("FOURCC->FOURCC copy only supported for the same type of surface\n"); ret = WINED3DERR_WRONGTEXTUREFORMAT; @@ -1841,12 +1839,14 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL * long. The x offset is calculated differently as well, since moving 4 * pixels to the right actually moves an entire 4x4 block to right, ie * 16 bytes (8 in case of DXT1). */ - if (This->resource.format == WINED3DFMT_DXT1) + if (This->resource.format_desc->format == WINED3DFMT_DXT1) { pLockedRect->pBits = This->resource.allocatedMemory + (pLockedRect->Pitch * pRect->top / 4) + (pRect->left * 2); } - else if (This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 || - This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5) + else if (This->resource.format_desc->format == WINED3DFMT_DXT2 + || This->resource.format_desc->format == WINED3DFMT_DXT3 + || This->resource.format_desc->format == WINED3DFMT_DXT4 + || This->resource.format_desc->format == WINED3DFMT_DXT5) { pLockedRect->pBits = This->resource.allocatedMemory + (pLockedRect->Pitch * pRect->top / 4) + (pRect->left * 4); } diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c index 670f4235817..64b73568c0e 100644 --- a/dlls/wined3d/surface_gdi.c +++ b/dlls/wined3d/surface_gdi.c @@ -304,7 +304,8 @@ const char* filename) } fprintf(f, "P6\n%d %d\n255\n", This->pow2Width, This->pow2Height); - if (This->resource.format == WINED3DFMT_P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8) + { unsigned char table[256][3]; int i; @@ -402,8 +403,9 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD return hr; } - if(This->resource.format == WINED3DFMT_P8 || - This->resource.format == WINED3DFMT_A8P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8 + || This->resource.format_desc->format == WINED3DFMT_A8P8) + { unsigned int n; const PALETTEENTRY *pal = NULL; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index d1a6520f633..12f812eb316 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -109,7 +109,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO cursor.resource.ref = 1; cursor.resource.wineD3DDevice = This->wineD3DDevice; cursor.resource.pool = WINED3DPOOL_SCRATCH; - cursor.resource.format = WINED3DFMT_A8R8G8B8; + cursor.resource.format_desc = getFormatDescEntry(WINED3DFMT_A8R8G8B8, &This->wineD3DDevice->adapter->gl_info); cursor.resource.resourceType = WINED3DRTYPE_SURFACE; cursor.glDescription.textureName = This->wineD3DDevice->cursorTexture; cursor.glDescription.target = GL_TEXTURE_2D; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 1aabc86193a..2f31ef1acb9 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -119,7 +119,9 @@ void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); } - if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) { + if (This->resource.format_desc->format == WINED3DFMT_P8 + || This->resource.format_desc->format == WINED3DFMT_A8P8) + { for (i = 0; i < This->baseTexture.levels; i++) { if(palette9_changed((IWineD3DSurfaceImpl *)This->surfaces[i])) { TRACE("Reloading surface because the d3d8/9 palette was changed\n"); diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index c4bdb746c61..8f6ae8d3f35 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -196,7 +196,7 @@ static HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DV IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; TRACE("(%p) : copying into %p\n", This, pDesc); - *(pDesc->Format) = This->resource.format; + *(pDesc->Format) = This->resource.format_desc->format; *(pDesc->Type) = This->resource.resourceType; *(pDesc->Usage) = This->resource.usage; *(pDesc->Pool) = This->resource.pool; @@ -302,9 +302,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWi static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) { IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; const struct GlPixelFormatDesc *glDesc = This->resource.format_desc; - WINED3DFORMAT format = This->resource.format; - TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format); + TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(glDesc->format), glDesc->format); volume_bind_and_dirtify(iface); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b545b782300..4f321a931a2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1236,7 +1236,6 @@ typedef struct IWineD3DResourceClass WINED3DPOOL pool; UINT size; DWORD usage; - WINED3DFORMAT format; const struct GlPixelFormatDesc *format_desc; DWORD priority; BYTE *allocatedMemory; /* Pointer to the real data location */ @@ -1261,7 +1260,8 @@ DWORD resource_get_priority(IWineD3DResource *iface); HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid, void *data, DWORD *data_size); HRESULT resource_init(struct IWineD3DResourceClass *resource, WINED3DRESOURCETYPE resource_type, - IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, IUnknown *parent); + IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc, + WINED3DPOOL pool, IUnknown *parent); WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface); DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority); HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid,