mirror of
https://github.com/reactos/wine.git
synced 2024-12-11 05:14:25 +00:00
wined3d: Improve volume size calculation.
This commit is contained in:
parent
089cc78182
commit
9d75a517c2
@ -2293,7 +2293,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
|
||||
|
||||
if (format->flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
UINT row_length = wined3d_format_calculate_size(format, 1, update_w, 1);
|
||||
UINT row_length = wined3d_format_calculate_size(format, 1, update_w, 1, 1);
|
||||
UINT row_count = (update_h + format->block_height - 1) / format->block_height;
|
||||
const BYTE *addr = data->addr;
|
||||
GLenum internal;
|
||||
@ -3437,7 +3437,7 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
|
||||
struct wined3d_device *device = surface->resource.device;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
UINT resource_size = wined3d_format_calculate_size(format, device->surface_alignment, width, height);
|
||||
UINT resource_size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, 1);
|
||||
|
||||
TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u.\n",
|
||||
surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type);
|
||||
@ -7161,7 +7161,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, UINT alignment, UIN
|
||||
|
||||
/* FIXME: Check that the format is supported by the device. */
|
||||
|
||||
resource_size = wined3d_format_calculate_size(format, alignment, width, height);
|
||||
resource_size = wined3d_format_calculate_size(format, alignment, width, height, 1);
|
||||
if (!resource_size)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
|
@ -1942,7 +1942,8 @@ const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl
|
||||
return &gl_info->formats[idx];
|
||||
}
|
||||
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT alignment, UINT width, UINT height)
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT alignment,
|
||||
UINT width, UINT height, UINT depth)
|
||||
{
|
||||
UINT size;
|
||||
|
||||
@ -1968,6 +1969,8 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
|
||||
size /= format->height_scale.denominator;
|
||||
}
|
||||
|
||||
size *= depth;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,7 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
HRESULT hr;
|
||||
UINT size;
|
||||
|
||||
if (!gl_info->supported[EXT_TEXTURE3D])
|
||||
{
|
||||
@ -272,10 +273,11 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, depth);
|
||||
|
||||
hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, format,
|
||||
WINED3D_MULTISAMPLE_NONE, 0, usage, pool, width, height, depth,
|
||||
width * height * depth * format->byte_count, parent, parent_ops,
|
||||
&volume_resource_ops);
|
||||
size, parent, parent_ops, &volume_resource_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x.\n", hr);
|
||||
|
@ -2962,7 +2962,7 @@ struct wined3d_format
|
||||
const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl_info,
|
||||
enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format *format,
|
||||
UINT alignment, UINT width, UINT height) DECLSPEC_HIDDEN;
|
||||
UINT alignment, UINT width, UINT height, UINT depth) DECLSPEC_HIDDEN;
|
||||
DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface,
|
||||
const struct wined3d_color *color) DECLSPEC_HIDDEN;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user