From 4451bf477a56cd35b582bf0ed39f27d3818bff80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jun 2015 17:53:51 +0200 Subject: [PATCH] wined3d: Read format flags from the volume container. --- dlls/wined3d/resource.c | 5 +++-- dlls/wined3d/volume.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 2bc1cc1076b..d5a0041edaa 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -87,7 +87,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * resource->type = type; resource->gl_type = gl_type; resource->format = format; - resource->format_flags = format->flags[gl_type]; + if (gl_type < WINED3D_GL_RES_TYPE_COUNT) + resource->format_flags = format->flags[gl_type]; resource->multisample_type = multisample_type; resource->multisample_quality = multisample_quality; resource->usage = usage; @@ -105,7 +106,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * resource->resource_ops = resource_ops; resource->map_binding = WINED3D_LOCATION_SYSMEM; - if (pool != WINED3D_POOL_SCRATCH && type != WINED3D_RTYPE_BUFFER) + if (pool != WINED3D_POOL_SCRATCH && type != WINED3D_RTYPE_BUFFER && gl_type < WINED3D_GL_RES_TYPE_COUNT) { if ((usage & WINED3DUSAGE_RENDERTARGET) && !(resource->format_flags & WINED3DFMT_FLAG_RENDERTARGET)) { diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 5241286f798..0f02f340894 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -44,7 +44,7 @@ void wined3d_volume_get_pitch(const struct wined3d_volume *volume, UINT *row_pit { const struct wined3d_format *format = volume->resource.format; - if (volume->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) + if (volume->container->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) { /* Since compressed formats are block based, pitch means the amount of * bytes to the next row of block rather than the next row of pixels. */ @@ -89,7 +89,7 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine if (data->buffer_object) ERR("Loading a converted volume from a PBO.\n"); - if (volume->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) + if (volume->container->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) ERR("Converting a block-based format.\n"); dst_row_pitch = width * format->conv_byte_count; @@ -551,7 +551,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, const struct wined3d_gl_info *gl_info; BYTE *base_memory; const struct wined3d_format *format = volume->resource.format; - const unsigned int fmt_flags = volume->resource.format_flags; + const unsigned int fmt_flags = volume->container->resource.format_flags; TRACE("volume %p, map_desc %p, box %p, flags %#x.\n", volume, map_desc, box, flags); @@ -759,7 +759,7 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture size = wined3d_format_calculate_size(format, device->surface_alignment, desc->width, desc->height, desc->depth); - if (FAILED(hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, container->resource.gl_type, + if (FAILED(hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, WINED3D_GL_RES_TYPE_COUNT, format, WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->pool, desc->width, desc->height, desc->depth, size, NULL, &wined3d_null_parent_ops, &volume_resource_ops))) {