wined3d: Rename surface_calculate_size() to wined3d_format_calculate_size().
This commit is contained in:
parent
6a9476b609
commit
d494dfb6c0
|
@ -92,31 +92,6 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
|
|||
resource_cleanup((IWineD3DResource *)This);
|
||||
}
|
||||
|
||||
UINT surface_calculate_size(const struct wined3d_format_desc *format_desc, UINT alignment, UINT width, UINT height)
|
||||
{
|
||||
UINT size;
|
||||
|
||||
if (format_desc->format == WINED3DFMT_UNKNOWN)
|
||||
{
|
||||
size = 0;
|
||||
}
|
||||
else if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
UINT row_block_count = (width + format_desc->block_width - 1) / format_desc->block_width;
|
||||
UINT row_count = (height + format_desc->block_height - 1) / format_desc->block_height;
|
||||
size = row_count * row_block_count * format_desc->block_byte_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The pitch is a multiple of 4 bytes. */
|
||||
size = height * (((width * format_desc->byte_count) + alignment - 1) & ~(alignment - 1));
|
||||
}
|
||||
|
||||
if (format_desc->heightscale != 0.0f) size *= format_desc->heightscale;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
struct blt_info
|
||||
{
|
||||
GLenum binding;
|
||||
|
@ -356,7 +331,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
|
|||
|
||||
/* FIXME: Check that the format is supported by the device. */
|
||||
|
||||
resource_size = surface_calculate_size(format_desc, alignment, width, height);
|
||||
resource_size = wined3d_format_calculate_size(format_desc, alignment, width, height);
|
||||
|
||||
/* Look at the implementation and set the correct Vtable. */
|
||||
switch (surface_type)
|
||||
|
|
|
@ -511,7 +511,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D
|
|||
|
||||
TRACE("(%p) : Setting texture format to (%d,%s)\n", This, format, debug_d3dformat(format));
|
||||
|
||||
This->resource.size = surface_calculate_size(format_desc, This->resource.device->surface_alignment,
|
||||
This->resource.size = wined3d_format_calculate_size(format_desc, This->resource.device->surface_alignment,
|
||||
This->pow2Width, This->pow2Height);
|
||||
|
||||
This->Flags |= (WINED3DFMT_D16_LOCKABLE == format) ? SFLAG_LOCKABLE : 0;
|
||||
|
|
|
@ -1550,6 +1550,30 @@ const struct wined3d_format_desc *getFormatDescEntry(WINED3DFORMAT fmt, const st
|
|||
return &gl_info->gl_formats[idx];
|
||||
}
|
||||
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format_desc *format, UINT alignment, UINT width, UINT height)
|
||||
{
|
||||
UINT size;
|
||||
|
||||
if (format->format == WINED3DFMT_UNKNOWN)
|
||||
{
|
||||
size = 0;
|
||||
}
|
||||
else if (format->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
UINT row_block_count = (width + format->block_width - 1) / format->block_width;
|
||||
UINT row_count = (height + format->block_height - 1) / format->block_height;
|
||||
size = row_count * (((row_block_count * format->block_byte_count) + alignment - 1) & ~(alignment - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
size = height * (((width * format->byte_count) + alignment - 1) & ~(alignment - 1));
|
||||
}
|
||||
|
||||
if (format->heightscale != 0.0f) size *= format->heightscale;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Trace formatting of useful values
|
||||
*/
|
||||
|
|
|
@ -2068,8 +2068,6 @@ extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl DECLSPEC_HIDDEN;
|
|||
extern const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl DECLSPEC_HIDDEN;
|
||||
|
||||
void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
|
||||
UINT surface_calculate_size(const struct wined3d_format_desc *format_desc,
|
||||
UINT alignment, UINT width, UINT height) DECLSPEC_HIDDEN;
|
||||
void surface_gdi_cleanup(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
|
||||
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
|
||||
HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment,
|
||||
|
@ -2980,6 +2978,8 @@ struct wined3d_format_desc
|
|||
|
||||
const struct wined3d_format_desc *getFormatDescEntry(WINED3DFORMAT fmt,
|
||||
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format_desc *format,
|
||||
UINT alignment, UINT width, UINT height) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline BOOL use_vs(IWineD3DStateBlockImpl *stateblock)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue