[PATCH 3/4] wined3d: Store all the resource desc information in struct wined3d_resource.
Henri Verbeet
hverbeet at codeweavers.com
Tue Mar 8 12:41:07 CST 2011
---
dlls/wined3d/arb_program_shader.c | 4 +-
dlls/wined3d/basetexture.c | 5 +-
dlls/wined3d/buffer.c | 5 +-
dlls/wined3d/context.c | 4 +-
dlls/wined3d/device.c | 44 ++++++------
dlls/wined3d/glsl_shader.c | 4 +-
dlls/wined3d/resource.c | 17 +++--
dlls/wined3d/state.c | 6 +-
dlls/wined3d/surface.c | 140 +++++++++++++++++++------------------
dlls/wined3d/surface_base.c | 136 +++++++++++++++++++-----------------
dlls/wined3d/surface_gdi.c | 4 +-
dlls/wined3d/swapchain.c | 16 ++--
dlls/wined3d/swapchain_gdi.c | 4 +-
dlls/wined3d/volume.c | 34 ++++-----
dlls/wined3d/wined3d_private.h | 40 ++++-------
15 files changed, 235 insertions(+), 228 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 8770e05..2f3cefb 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -640,7 +640,7 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha
{
IWineD3DBaseShaderImpl *pshader = (IWineD3DBaseShaderImpl *)stateBlock->state.pixel_shader;
const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog;
- float rt_height = device->render_targets[0]->currentDesc.Height;
+ float rt_height = device->render_targets[0]->resource.height;
/* Load DirectX 9 float constants for pixel shader */
device->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
@@ -4592,7 +4592,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS,
}
else
{
- float rt_height = This->render_targets[0]->currentDesc.Height;
+ float rt_height = This->render_targets[0]->resource.height;
shader_arb_ps_local_constants(compiled, context, state, rt_height);
}
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index e14185b..26e9a70 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -34,8 +34,9 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_
{
HRESULT hr;
- hr = resource_init(&texture->resource, resource_type, device,
- 0, usage, format, pool, parent, parent_ops, resource_ops);
+ hr = resource_init(&texture->resource, device, resource_type, format,
+ WINED3DMULTISAMPLE_NONE, 0, usage, pool, 0, 0, 0, 0,
+ parent, parent_ops, resource_ops);
if (FAILED(hr))
{
WARN("Failed to initialize resource, returning %#x\n", hr);
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 0ce2e72..e665311 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1431,8 +1431,9 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
return WINED3DERR_INVALIDCALL;
}
- hr = resource_init(&buffer->resource, WINED3DRTYPE_BUFFER, device, size,
- usage, format, pool, parent, parent_ops, &buffer_resource_ops);
+ hr = resource_init(&buffer->resource, device, WINED3DRTYPE_BUFFER, format,
+ WINED3DMULTISAMPLE_NONE, 0, usage, pool, size, 1, 1, size,
+ parent, parent_ops, &buffer_resource_ops);
if (FAILED(hr))
{
WARN("Failed to initialize resource, hr %#x\n", hr);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 8852733..624f507 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1663,8 +1663,8 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte
int i;
const struct StateEntry *StateTable = This->StateTable;
const struct wined3d_gl_info *gl_info = context->gl_info;
- UINT width = context->current_rt->currentDesc.Width;
- UINT height = context->current_rt->currentDesc.Height;
+ UINT width = context->current_rt->resource.width;
+ UINT height = context->current_rt->resource.height;
DWORD sampler;
TRACE("Setting up context %p for blitting\n", context);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d5d1900..4343f83 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -591,14 +591,14 @@ static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, co
{
/* partial draw rect */
if (draw_rect->left || draw_rect->top
- || draw_rect->right < target->currentDesc.Width
- || draw_rect->bottom < target->currentDesc.Height)
+ || draw_rect->right < target->resource.width
+ || draw_rect->bottom < target->resource.height)
return FALSE;
/* partial clear rect */
if (clear_rect && (clear_rect->left > 0 || clear_rect->top > 0
- || clear_rect->right < target->currentDesc.Width
- || clear_rect->bottom < target->currentDesc.Height))
+ || clear_rect->right < target->resource.width
+ || clear_rect->bottom < target->resource.height))
return FALSE;
return TRUE;
@@ -5506,8 +5506,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
surface_internal_preload(dst_impl, SRGB_RGB);
surface_bind(dst_impl, gl_info, FALSE);
- src_w = src_impl->currentDesc.Width;
- src_h = src_impl->currentDesc.Height;
+ src_w = src_impl->resource.width;
+ src_h = src_impl->resource.height;
update_w = src_rect ? src_rect->right - src_rect->left : src_w;
update_h = src_rect ? src_rect->bottom - src_rect->top : src_h;
@@ -5833,8 +5833,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
/* Set the viewport and scissor rectangles, if requested. Tests show
* that stateblock recording is ignored, the change goes directly
* into the primary stateblock. */
- device->stateBlock->state.viewport.Height = device->render_targets[0]->currentDesc.Height;
- device->stateBlock->state.viewport.Width = device->render_targets[0]->currentDesc.Width;
+ device->stateBlock->state.viewport.Height = device->render_targets[0]->resource.height;
+ device->stateBlock->state.viewport.Width = device->render_targets[0]->resource.width;
device->stateBlock->state.viewport.X = 0;
device->stateBlock->state.viewport.Y = 0;
device->stateBlock->state.viewport.MaxZ = 1.0f;
@@ -5870,8 +5870,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
|| This->depth_stencil->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(This->depth_stencil, SFLAG_DS_DISCARDED,
- This->depth_stencil->currentDesc.Width,
- This->depth_stencil->currentDesc.Height);
+ This->depth_stencil->resource.width,
+ This->depth_stencil->resource.height);
if (This->depth_stencil == This->onscreen_depth_stencil)
{
IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil);
@@ -5917,7 +5917,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
This->cursorTexture = 0;
}
- if ((s->currentDesc.Width == 32) && (s->currentDesc.Height == 32))
+ if (s->resource.width == 32 && s->resource.height == 32)
This->haveHardwareCursor = TRUE;
else
This->haveHardwareCursor = FALSE;
@@ -5934,11 +5934,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
}
/* MSDN: Cursor must be smaller than the display mode */
- if (s->currentDesc.Width > This->ddraw_width
- || s->currentDesc.Height > This->ddraw_height)
+ if (s->resource.width > This->ddraw_width
+ || s->resource.height > This->ddraw_height)
{
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n",
- s, s->currentDesc.Width, s->currentDesc.Height, This->ddraw_width, This->ddraw_height);
+ s, s->resource.width, s->resource.height, This->ddraw_width, This->ddraw_height);
return WINED3DERR_INVALIDCALL;
}
@@ -5951,8 +5951,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
* creating circular refcount dependencies. Copy out the gl texture
* instead.
*/
- This->cursorWidth = s->currentDesc.Width;
- This->cursorHeight = s->currentDesc.Height;
+ This->cursorWidth = s->resource.width;
+ This->cursorHeight = s->resource.height;
if (SUCCEEDED(IWineD3DSurface_Map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
{
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
@@ -6028,16 +6028,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
* 32-bit cursors. 32x32 bits split into 32-bit chunks == 32
* chunks. */
DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- (s->currentDesc.Width * s->currentDesc.Height / 8));
+ (s->resource.width * s->resource.height / 8));
IWineD3DSurface_Map(cursor_image, &lockedRect, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY);
- TRACE("width: %u height: %u.\n", s->currentDesc.Width, s->currentDesc.Height);
+ TRACE("width: %u height: %u.\n", s->resource.width, s->resource.height);
cursorInfo.fIcon = FALSE;
cursorInfo.xHotspot = XHotSpot;
cursorInfo.yHotspot = YHotSpot;
- cursorInfo.hbmMask = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 1, maskBits);
- cursorInfo.hbmColor = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 32, lockedRect.pBits);
+ cursorInfo.hbmMask = CreateBitmap(s->resource.width, s->resource.height, 1, 1, maskBits);
+ cursorInfo.hbmColor = CreateBitmap(s->resource.width, s->resource.height, 1, 32, lockedRect.pBits);
IWineD3DSurface_Unmap(cursor_image);
/* Create our cursor and clean up. */
cursor = CreateIconIndirect(&cursorInfo);
@@ -6140,8 +6140,8 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES
surface->resource.allocatedMemory = NULL;
surface->flags &= ~SFLAG_DIBSECTION;
}
- surface->currentDesc.Width = pPresentationParameters->BackBufferWidth;
- surface->currentDesc.Height = pPresentationParameters->BackBufferHeight;
+ surface->resource.width = pPresentationParameters->BackBufferWidth;
+ surface->resource.height = pPresentationParameters->BackBufferHeight;
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE]
|| gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 6d54871..9e4fa2a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -821,7 +821,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
correction_params[1] = 1.0f;
} else {
/* position is window relative, not viewport relative */
- correction_params[0] = context->current_rt->currentDesc.Height;
+ correction_params[0] = context->current_rt->resource.height;
correction_params[1] = -1.0f;
}
GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params));
@@ -1039,7 +1039,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
*/
FIXME("Cannot find a free uniform for vpos correction params\n");
shader_addline(buffer, "const vec4 ycorrection = vec4(%f, %f, 0.0, 0.0);\n",
- context->render_offscreen ? 0.0f : device->render_targets[0]->currentDesc.Height,
+ context->render_offscreen ? 0.0f : device->render_targets[0]->resource.height,
context->render_offscreen ? 1.0f : -1.0f);
}
shader_addline(buffer, "vec4 vpos;\n");
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 5a9d5d6..66c2e62 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -43,17 +43,24 @@ struct private_data
DWORD size;
};
-HRESULT resource_init(struct wined3d_resource *resource, WINED3DRESOURCETYPE resource_type,
- IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
- WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops,
+HRESULT resource_init(struct wined3d_resource *resource, IWineD3DDeviceImpl *device,
+ WINED3DRESOURCETYPE resource_type, const struct wined3d_format *format,
+ WINED3DMULTISAMPLE_TYPE multisample_type, UINT multisample_quality,
+ DWORD usage, WINED3DPOOL pool, UINT width, UINT height, UINT depth, UINT size,
+ void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_resource_ops *resource_ops)
{
+ resource->ref = 1;
resource->device = device;
resource->resourceType = resource_type;
- resource->ref = 1;
- resource->pool = pool;
resource->format = format;
+ resource->multisample_type = multisample_type;
+ resource->multisample_quality = multisample_quality;
resource->usage = usage;
+ resource->pool = pool;
+ resource->width = width;
+ resource->height = height;
+ resource->depth = depth;
resource->size = size;
resource->priority = 0;
resource->parent = parent;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index daecba2..81ac09d 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4758,8 +4758,10 @@ static void viewport_miscpart(DWORD state, struct wined3d_stateblock *stateblock
UINT width, height;
WINED3DVIEWPORT vp = stateblock->state.viewport;
- if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width;
- if(vp.Height > target->currentDesc.Height) vp.Height = target->currentDesc.Height;
+ if (vp.Width > target->resource.width)
+ vp.Width = target->resource.width;
+ if (vp.Height > target->resource.height)
+ vp.Height = target->resource.height;
glDepthRange(vp.MinZ, vp.MaxZ);
checkGLcall("glDepthRange");
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2c9aa48..6589f05 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -272,8 +272,8 @@ static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_
{
rect_out->left = 0;
rect_out->top = 0;
- rect_out->right = This->currentDesc.Width;
- rect_out->bottom = This->currentDesc.Height;
+ rect_out->right = This->resource.width;
+ rect_out->bottom = This->resource.height;
}
}
@@ -597,8 +597,9 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
return WINED3DERR_INVALIDCALL;
}
- hr = resource_init(&surface->resource, WINED3DRTYPE_SURFACE, device, resource_size,
- usage, format, pool, parent, parent_ops, &surface_resource_ops);
+ hr = resource_init(&surface->resource, device, WINED3DRTYPE_SURFACE, format,
+ multisample_type, multisample_quality, usage, pool, width, height, 1,
+ resource_size, parent, parent_ops, &surface_resource_ops);
if (FAILED(hr))
{
WARN("Failed to initialize resource, returning %#x.\n", hr);
@@ -608,10 +609,6 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
/* "Standalone" surface. */
surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL);
- surface->currentDesc.Width = width;
- surface->currentDesc.Height = height;
- surface->currentDesc.MultiSampleType = multisample_type;
- surface->currentDesc.MultiSampleQuality = multisample_quality;
surface->texture_level = level;
list_init(&surface->overlays);
@@ -920,7 +917,7 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
* standard texture with a non-power2 width instead of texture boxed up to be a power2 texture.
*
* internally the texture is still stored in a boxed format so any references to textureName will
- * get a boxed texture with width pow2width and not a texture of width currentDesc.Width.
+ * get a boxed texture with width pow2width and not a texture of width resource.width.
*
* Performance should not be an issue, because applications normally do not lock the surfaces when
* rendering. If an app does, the SFLAG_DYNLOCK flag will kick in and the memory copy won't be released,
@@ -929,7 +926,8 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
src_data = mem;
dst_data = This->resource.allocatedMemory;
TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", This, src_pitch, dst_pitch);
- for (y = 1 ; y < This->currentDesc.Height; y++) {
+ for (y = 1; y < This->resource.height; ++y)
+ {
/* skip the first row */
src_data += src_pitch;
dst_data += dst_pitch;
@@ -950,8 +948,8 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
const struct wined3d_format *format, BOOL srgb, const GLvoid *data)
{
- GLsizei width = This->currentDesc.Width;
- GLsizei height = This->currentDesc.Height;
+ GLsizei width = This->resource.width;
+ GLsizei height = This->resource.height;
GLenum internal;
if (srgb)
@@ -1210,8 +1208,8 @@ void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect
{
surface->dirtyRect.left = 0;
surface->dirtyRect.top = 0;
- surface->dirtyRect.right = surface->currentDesc.Width;
- surface->dirtyRect.bottom = surface->currentDesc.Height;
+ surface->dirtyRect.right = surface->resource.width;
+ surface->dirtyRect.bottom = surface->resource.height;
}
/* if the container is a basetexture then mark it dirty. */
@@ -1498,9 +1496,11 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
if(!rect) {
local_rect.left = 0;
local_rect.top = 0;
- local_rect.right = This->currentDesc.Width;
- local_rect.bottom = This->currentDesc.Height;
- } else {
+ local_rect.right = This->resource.width;
+ local_rect.bottom = This->resource.height;
+ }
+ else
+ {
local_rect = *rect;
}
/* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */
@@ -1567,14 +1567,14 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
checkGLcall("glGetIntegerv");
/* Setup pixel store pack state -- to glReadPixels into the correct place */
- glPixelStorei(GL_PACK_ROW_LENGTH, This->currentDesc.Width);
+ glPixelStorei(GL_PACK_ROW_LENGTH, This->resource.width);
checkGLcall("glPixelStorei");
glPixelStorei(GL_PACK_SKIP_PIXELS, local_rect.left);
checkGLcall("glPixelStorei");
glPixelStorei(GL_PACK_SKIP_ROWS, local_rect.top);
checkGLcall("glPixelStorei");
- glReadPixels(local_rect.left, (!srcIsUpsideDown) ? (This->currentDesc.Height - local_rect.bottom) : local_rect.top ,
+ glReadPixels(local_rect.left, !srcIsUpsideDown ? (This->resource.height - local_rect.bottom) : local_rect.top,
local_rect.right - local_rect.left,
local_rect.bottom - local_rect.top,
fmt, type, mem);
@@ -1719,7 +1719,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
checkGLcall("glReadBuffer");
glCopyTexSubImage2D(This->texture_target, This->texture_level,
- 0, 0, 0, 0, This->currentDesc.Width, This->currentDesc.Height);
+ 0, 0, 0, 0, This->resource.width, This->resource.height);
checkGLcall("glCopyTexSubImage2D");
LEAVE_GL();
@@ -1882,8 +1882,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Map(IWineD3DSurface *iface,
/* surface_load_location() does not check if the rectangle specifies
* the full surface. Most callers don't need that, so do it here. */
if (pRect && !pRect->top && !pRect->left
- && pRect->right == This->currentDesc.Width
- && pRect->bottom == This->currentDesc.Height)
+ && pRect->right == This->resource.width
+ && pRect->bottom == This->resource.height)
{
pass_rect = NULL;
}
@@ -1974,7 +1974,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *surface,
checkGLcall("glRasterPos3i");
/* If not fullscreen, we need to skip a number of bytes to find the next row of data */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, surface->currentDesc.Width);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, surface->resource.width);
if (surface->flags & SFLAG_PBO)
{
@@ -2055,8 +2055,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Unmap(IWineD3DSurface *iface)
}
if (!This->dirtyRect.left && !This->dirtyRect.top
- && This->dirtyRect.right == This->currentDesc.Width
- && This->dirtyRect.bottom == This->currentDesc.Height)
+ && This->dirtyRect.right == This->resource.width
+ && This->dirtyRect.bottom == This->resource.height)
{
fullsurface = TRUE;
} else {
@@ -2080,8 +2080,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Unmap(IWineD3DSurface *iface)
surface_evict_sysmem(This);
}
- This->dirtyRect.left = This->currentDesc.Width;
- This->dirtyRect.top = This->currentDesc.Height;
+ This->dirtyRect.left = This->resource.width;
+ This->dirtyRect.top = This->resource.height;
This->dirtyRect.right = 0;
This->dirtyRect.bottom = 0;
}
@@ -2906,10 +2906,12 @@ static void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *dst_surface, IWineD3D
glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level,
dst_rect.left /*xoffset */, dst_rect.top /* y offset */,
- src_rect->left, src_surface->currentDesc.Height - src_rect->bottom,
+ src_rect->left, src_surface->resource.height - src_rect->bottom,
dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top);
- } else {
- UINT yoffset = src_surface->currentDesc.Height - src_rect->top + dst_rect.top - 1;
+ }
+ else
+ {
+ UINT yoffset = src_surface->resource.height - src_rect->top + dst_rect.top - 1;
/* I have to process this row by row to swap the image,
* otherwise it would be upside down, so stretching in y direction
* doesn't cost extra time
@@ -2958,8 +2960,8 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
GLuint src, backup = 0;
IWineD3DSwapChainImpl *src_swapchain = NULL;
float left, right, top, bottom; /* Texture coordinates */
- UINT fbwidth = src_surface->currentDesc.Width;
- UINT fbheight = src_surface->currentDesc.Height;
+ UINT fbwidth = src_surface->resource.width;
+ UINT fbheight = src_surface->resource.height;
struct wined3d_context *context;
GLenum drawBuffer = GL_BACK;
GLenum texture_target;
@@ -3104,13 +3106,13 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
if (!upsidedown)
{
- top = src_surface->currentDesc.Height - src_rect->top;
- bottom = src_surface->currentDesc.Height - src_rect->bottom;
+ top = src_surface->resource.height - src_rect->top;
+ bottom = src_surface->resource.height - src_rect->bottom;
}
else
{
- top = src_surface->currentDesc.Height - src_rect->bottom;
- bottom = src_surface->currentDesc.Height - src_rect->top;
+ top = src_surface->resource.height - src_rect->bottom;
+ bottom = src_surface->resource.height - src_rect->top;
}
if (src_surface->flags & SFLAG_NORMCOORD)
@@ -3259,7 +3261,7 @@ void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window
}
else
{
- drawable_height = surface->currentDesc.Height;
+ drawable_height = surface->resource.height;
}
rect->top = drawable_height - rect->top;
@@ -3268,9 +3270,9 @@ void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window
static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r)
{
- if ((r->left && r->right) || abs(r->right - r->left) != surface->currentDesc.Width)
+ if ((r->left && r->right) || abs(r->right - r->left) != surface->resource.width)
return FALSE;
- if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->currentDesc.Height)
+ if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->resource.height)
return FALSE;
return TRUE;
}
@@ -3562,8 +3564,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
TRACE("Looking if a Present can be done...\n");
/* Source Rectangle must be full surface */
if (src_rect.left || src_rect.top
- || src_rect.right != src_surface->currentDesc.Width
- || src_rect.bottom != src_surface->currentDesc.Height)
+ || src_rect.right != src_surface->resource.width
+ || src_rect.bottom != src_surface->resource.height)
{
TRACE("No, Source rectangle doesn't match\n");
break;
@@ -3598,8 +3600,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
}
}
else if (dst_rect.left || dst_rect.top
- || dst_rect.right != dst_surface->currentDesc.Width
- || dst_rect.bottom != dst_surface->currentDesc.Height)
+ || dst_rect.right != dst_surface->resource.width
+ || dst_rect.bottom != dst_surface->resource.height)
{
TRACE("No, dest rectangle doesn't match(surface size)\n");
break;
@@ -3712,8 +3714,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
dst_surface, SFLAG_INDRAWABLE, &dst_rect);
surface_modify_location(dst_surface, SFLAG_INDRAWABLE, TRUE);
}
- else if (!stretchx || dst_rect.right - dst_rect.left > src_surface->currentDesc.Width
- || dst_rect.bottom - dst_rect.top > src_surface->currentDesc.Height)
+ else if (!stretchx || dst_rect.right - dst_rect.left > src_surface->resource.width
+ || dst_rect.bottom - dst_rect.top > src_surface->resource.height)
{
TRACE("No stretching in x direction, using direct framebuffer -> texture copy\n");
fb_copy_to_texture_direct(dst_surface, src_surface, &src_rect, &dst_rect, Filter);
@@ -3989,32 +3991,32 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
/* Non-power2 support */
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{
- pow2Width = This->currentDesc.Width;
- pow2Height = This->currentDesc.Height;
+ pow2Width = This->resource.width;
+ pow2Height = This->resource.height;
}
else
{
/* Find the nearest pow2 match */
pow2Width = pow2Height = 1;
- while (pow2Width < This->currentDesc.Width) pow2Width <<= 1;
- while (pow2Height < This->currentDesc.Height) pow2Height <<= 1;
+ while (pow2Width < This->resource.width) pow2Width <<= 1;
+ while (pow2Height < This->resource.height) pow2Height <<= 1;
}
This->pow2Width = pow2Width;
This->pow2Height = pow2Height;
- if (pow2Width > This->currentDesc.Width || pow2Height > This->currentDesc.Height)
+ if (pow2Width > This->resource.width || pow2Height > This->resource.height)
{
/* TODO: Add support for non power two compressed textures. */
if (This->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED)
{
FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n",
- This, This->currentDesc.Width, This->currentDesc.Height);
+ This, This->resource.width, This->resource.height);
return WINED3DERR_NOTAVAILABLE;
}
}
- if (pow2Width != This->currentDesc.Width
- || pow2Height != This->currentDesc.Height)
+ if (pow2Width != This->resource.width
+ || pow2Height != This->resource.height)
{
This->flags |= SFLAG_NONPOW2;
}
@@ -4050,8 +4052,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
&& wined3d_settings.rendertargetlock_mode == RTL_READTEX))
{
This->texture_target = GL_TEXTURE_RECTANGLE_ARB;
- This->pow2Width = This->currentDesc.Width;
- This->pow2Height = This->currentDesc.Height;
+ This->pow2Width = This->resource.width;
+ This->pow2Height = This->resource.height;
This->flags &= ~(SFLAG_NONPOW2 | SFLAG_NORMCOORD);
}
}
@@ -4163,8 +4165,8 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte
surface->ds_current_size.cy = 0;
}
- if (surface->ds_current_size.cx == surface->currentDesc.Width
- && surface->ds_current_size.cy == surface->currentDesc.Height)
+ if (surface->ds_current_size.cx == surface->resource.width
+ && surface->ds_current_size.cy == surface->resource.height)
{
TRACE("Location (%#x) is already up to date.\n", location);
return;
@@ -4193,8 +4195,8 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte
* buffer, so the onscreen depth/stencil buffer is potentially smaller
* than the offscreen surface. Don't overwrite the offscreen surface
* with undefined data. */
- w = min(surface->currentDesc.Width, context->swapchain->presentParms.BackBufferWidth);
- h = min(surface->currentDesc.Height, context->swapchain->presentParms.BackBufferHeight);
+ w = min(surface->resource.width, context->swapchain->presentParms.BackBufferWidth);
+ h = min(surface->resource.height, context->swapchain->presentParms.BackBufferHeight);
TRACE("Copying onscreen depth buffer to depth texture.\n");
@@ -4269,7 +4271,7 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
surface_depth_blt(surface, gl_info, surface->texture_name,
- surface->currentDesc.Width, surface->currentDesc.Height, surface->texture_target);
+ surface->resource.width, surface->resource.height, surface->texture_target);
checkGLcall("depth_blt");
if (context->current_fbo) context_bind_fbo(context, GL_FRAMEBUFFER, &context->current_fbo->id);
@@ -4284,8 +4286,8 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte
}
surface->flags |= location;
- surface->ds_current_size.cx = surface->currentDesc.Width;
- surface->ds_current_size.cy = surface->currentDesc.Height;
+ surface->ds_current_size.cx = surface->resource.width;
+ surface->ds_current_size.cy = surface->resource.height;
}
void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent)
@@ -4471,7 +4473,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
FALSE /* We won't use textures */, &format, &convert);
/* The width is in 'length' not in bytes */
- width = surface->currentDesc.Width;
+ width = surface->resource.width;
pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED
@@ -4489,7 +4491,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
if ((convert != NO_CONVERSION) && surface->resource.allocatedMemory)
{
- int height = surface->currentDesc.Height;
+ int height = surface->resource.height;
byte_count = format.conv_byte_count;
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
@@ -4535,7 +4537,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format))
{
DWORD src_location = flag == SFLAG_INSRGBTEX ? SFLAG_INTEXTURE : SFLAG_INSRGBTEX;
- RECT rect = {0, 0, surface->currentDesc.Width, surface->currentDesc.Height};
+ RECT rect = {0, 0, surface->resource.width, surface->resource.height};
surface_blt_fbo(surface->resource.device, WINED3DTEXF_POINT,
surface, src_location, &rect, surface, flag, &rect);
@@ -4587,7 +4589,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
else surface->flags &= ~SFLAG_GLCKEY;
/* The width is in 'length' not in bytes */
- width = surface->currentDesc.Width;
+ width = surface->resource.width;
pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED
@@ -4601,7 +4603,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
if (format.convert)
{
/* This code is entered for texture formats which need a fixup. */
- int height = surface->currentDesc.Height;
+ UINT height = surface->resource.height;
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
outpitch = width * format.conv_byte_count;
@@ -4618,7 +4620,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
else if (convert != NO_CONVERSION && surface->resource.allocatedMemory)
{
/* This code is only entered for color keying fixups */
- int height = surface->currentDesc.Height;
+ UINT height = surface->resource.height;
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
outpitch = width * format.conv_byte_count;
@@ -4860,7 +4862,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
const RECT *dst_rect, const WINED3DCOLORVALUE *color)
{
- const RECT draw_rect = {0, 0, dst_surface->currentDesc.Width, dst_surface->currentDesc.Height};
+ const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
return device_clear_render_targets(device, 1 /* rt_count */, &dst_surface, 1 /* rect_count */,
dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f /* depth */, 0 /* stencil */);
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 7aa77aa..fc093b3 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -168,11 +168,11 @@ void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, struct wined
desc->usage = surface->resource.usage;
desc->pool = surface->resource.pool;
desc->size = surface->resource.size; /* dx8 only */
- desc->multisample_type = surface->currentDesc.MultiSampleType;
- desc->multisample_quality = surface->currentDesc.MultiSampleQuality;
- desc->width = surface->currentDesc.Width;
- desc->height = surface->currentDesc.Height;
- desc->depth = 1;
+ desc->multisample_type = surface->resource.multisample_type;
+ desc->multisample_quality = surface->resource.multisample_quality;
+ desc->width = surface->resource.width;
+ desc->height = surface->resource.height;
+ desc->depth = surface->resource.depth;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD flags)
@@ -338,13 +338,13 @@ DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface)
{
/* 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. */
- UINT row_block_count = (This->currentDesc.Width + format->block_width - 1) / format->block_width;
+ UINT row_block_count = (This->resource.width + format->block_width - 1) / format->block_width;
ret = row_block_count * format->block_byte_count;
}
else
{
unsigned char alignment = This->resource.device->surface_alignment;
- ret = This->resource.format->byte_count * This->currentDesc.Width; /* Bytes / row */
+ ret = This->resource.format->byte_count * This->resource.width; /* Bytes / row */
ret = (ret + alignment - 1) & ~(alignment - 1);
}
TRACE("(%p) Returning %d\n", This, ret);
@@ -439,8 +439,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, con
} else {
This->overlay_srcrect.left = 0;
This->overlay_srcrect.top = 0;
- This->overlay_srcrect.right = This->currentDesc.Width;
- This->overlay_srcrect.bottom = This->currentDesc.Height;
+ This->overlay_srcrect.right = This->resource.width;
+ This->overlay_srcrect.bottom = This->resource.height;
}
if(DstRect) {
@@ -448,8 +448,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, con
} else {
This->overlay_destrect.left = 0;
This->overlay_destrect.top = 0;
- This->overlay_destrect.right = Dst ? Dst->currentDesc.Width : 0;
- This->overlay_destrect.bottom = Dst ? Dst->currentDesc.Height : 0;
+ This->overlay_destrect.right = Dst ? Dst->resource.width : 0;
+ This->overlay_destrect.bottom = Dst ? Dst->resource.height : 0;
}
if (This->overlay_dest && (This->overlay_dest != Dst || flags & WINEDDOVER_HIDE))
@@ -582,8 +582,8 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface)
b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
/* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */
b_info->bmiHeader.biWidth = IWineD3DSurface_GetPitch(iface) / format->byte_count;
- b_info->bmiHeader.biHeight = -This->currentDesc.Height -extraline;
- b_info->bmiHeader.biSizeImage = ( This->currentDesc.Height + extraline) * IWineD3DSurface_GetPitch(iface);
+ b_info->bmiHeader.biHeight = -This->resource.height - extraline;
+ b_info->bmiHeader.biSizeImage = (This->resource.height + extraline) * IWineD3DSurface_GetPitch(iface);
b_info->bmiHeader.biPlanes = 1;
b_info->bmiHeader.biBitCount = format->byte_count * 8;
@@ -645,9 +645,13 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface)
TRACE("DIBSection at : %p\n", This->dib.bitmap_data);
/* copy the existing surface to the dib section */
- if(This->resource.allocatedMemory) {
- memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, This->currentDesc.Height * IWineD3DSurface_GetPitch(iface));
- } else {
+ if (This->resource.allocatedMemory)
+ {
+ memcpy(This->dib.bitmap_data, This->resource.allocatedMemory,
+ This->resource.height * IWineD3DSurface_GetPitch(iface));
+ }
+ else
+ {
/* This is to make LockRect read the gl Texture although memory is allocated */
This->flags &= ~SFLAG_INSYSMEM;
}
@@ -847,8 +851,8 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
return NULL;
}
- IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width,
- source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */,
+ IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->resource.width,
+ source->resource.height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */,
0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */,
0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
NULL /* parent */, &wined3d_null_parent_ops, &ret);
@@ -877,7 +881,7 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
}
conv->convert(lock_src.pBits, lock_dst.pBits, lock_src.Pitch, lock_dst.Pitch,
- source->currentDesc.Width, source->currentDesc.Height);
+ source->resource.width, source->resource.height);
IWineD3DSurface_Unmap(ret);
IWineD3DSurface_Unmap((IWineD3DSurface *)source);
@@ -992,18 +996,18 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
if (src)
{
if (SrcRect->right < SrcRect->left || SrcRect->bottom < SrcRect->top
- || SrcRect->left > src->currentDesc.Width || SrcRect->left < 0
- || SrcRect->top > src->currentDesc.Height || SrcRect->top < 0
- || SrcRect->right > src->currentDesc.Width || SrcRect->right < 0
- || SrcRect->bottom > src->currentDesc.Height || SrcRect->bottom < 0)
+ || SrcRect->left > src->resource.width || SrcRect->left < 0
+ || SrcRect->top > src->resource.height || SrcRect->top < 0
+ || SrcRect->right > src->resource.width || SrcRect->right < 0
+ || SrcRect->bottom > src->resource.height || SrcRect->bottom < 0)
{
WARN("Application gave us bad source rectangle for Blt.\n");
return WINEDDERR_INVALIDRECT;
}
if (!SrcRect->right || !SrcRect->bottom
- || SrcRect->left == (int)src->currentDesc.Width
- || SrcRect->top == (int)src->currentDesc.Height)
+ || SrcRect->left == (int)src->resource.width
+ || SrcRect->top == (int)src->resource.height)
{
TRACE("Nothing to be done.\n");
return WINED3D_OK;
@@ -1016,8 +1020,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
{
xsrc.left = 0;
xsrc.top = 0;
- xsrc.right = src->currentDesc.Width;
- xsrc.bottom = src->currentDesc.Height;
+ xsrc.right = src->resource.width;
+ xsrc.bottom = src->resource.height;
}
else
{
@@ -1029,18 +1033,18 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
/* For the Destination rect, it can be out of bounds on the condition
* that a clipper is set for the given surface. */
if (!This->clipper && (DestRect->right < DestRect->left || DestRect->bottom < DestRect->top
- || DestRect->left > This->currentDesc.Width || DestRect->left < 0
- || DestRect->top > This->currentDesc.Height || DestRect->top < 0
- || DestRect->right > This->currentDesc.Width || DestRect->right < 0
- || DestRect->bottom > This->currentDesc.Height || DestRect->bottom < 0))
+ || DestRect->left > This->resource.width || DestRect->left < 0
+ || DestRect->top > This->resource.height || DestRect->top < 0
+ || DestRect->right > This->resource.width || DestRect->right < 0
+ || DestRect->bottom > This->resource.height || DestRect->bottom < 0))
{
WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
return WINEDDERR_INVALIDRECT;
}
if (DestRect->right <= 0 || DestRect->bottom <= 0
- || DestRect->left >= (int)This->currentDesc.Width
- || DestRect->top >= (int)This->currentDesc.Height)
+ || DestRect->left >= (int)This->resource.width
+ || DestRect->top >= (int)This->resource.height)
{
TRACE("Nothing to be done.\n");
return WINED3D_OK;
@@ -1052,8 +1056,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
full_rect.left = 0;
full_rect.top = 0;
- full_rect.right = This->currentDesc.Width;
- full_rect.bottom = This->currentDesc.Height;
+ full_rect.right = This->resource.width;
+ full_rect.bottom = This->resource.height;
IntersectRect(&xdst, &full_rect, DestRect);
}
else
@@ -1061,8 +1065,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
BOOL clip_horiz, clip_vert;
xdst = *DestRect;
- clip_horiz = xdst.left < 0 || xdst.right > (int)This->currentDesc.Width;
- clip_vert = xdst.top < 0 || xdst.bottom > (int)This->currentDesc.Height;
+ clip_horiz = xdst.left < 0 || xdst.right > (int)This->resource.width;
+ clip_vert = xdst.top < 0 || xdst.bottom > (int)This->resource.height;
if (clip_vert || clip_horiz)
{
@@ -1082,10 +1086,10 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
xsrc.left -= xdst.left;
xdst.left = 0;
}
- if (xdst.right > This->currentDesc.Width)
+ if (xdst.right > This->resource.width)
{
- xsrc.right -= (xdst.right - (int)This->currentDesc.Width);
- xdst.right = (int)This->currentDesc.Width;
+ xsrc.right -= (xdst.right - (int)This->resource.width);
+ xdst.right = (int)This->resource.width;
}
}
@@ -1096,20 +1100,20 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
xsrc.top -= xdst.top;
xdst.top = 0;
}
- if (xdst.bottom > This->currentDesc.Height)
+ if (xdst.bottom > This->resource.height)
{
- xsrc.bottom -= (xdst.bottom - (int)This->currentDesc.Height);
- xdst.bottom = (int)This->currentDesc.Height;
+ xsrc.bottom -= (xdst.bottom - (int)This->resource.height);
+ xdst.bottom = (int)This->resource.height;
}
}
/* And check if after clipping something is still to be done... */
if ((xdst.right <= 0) || (xdst.bottom <= 0)
- || (xdst.left >= (int)This->currentDesc.Width)
- || (xdst.top >= (int)This->currentDesc.Height)
+ || (xdst.left >= (int)This->resource.width)
+ || (xdst.top >= (int)This->resource.height)
|| (xsrc.right <= 0) || (xsrc.bottom <= 0)
- || (xsrc.left >= (int)src->currentDesc.Width)
- || (xsrc.top >= (int)src->currentDesc.Height))
+ || (xsrc.left >= (int)src->resource.width)
+ || (xsrc.top >= (int)src->resource.height))
{
TRACE("Nothing to be done after clipping.\n");
return WINED3D_OK;
@@ -1121,8 +1125,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
{
xdst.left = 0;
xdst.top = 0;
- xdst.right = This->currentDesc.Width;
- xdst.bottom = This->currentDesc.Height;
+ xdst.right = This->resource.width;
+ xdst.bottom = This->resource.height;
}
if (src == This)
@@ -1619,16 +1623,16 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
WARN("rsrc is NULL!\n");
rsrc2.left = 0;
rsrc2.top = 0;
- rsrc2.right = src->currentDesc.Width;
- rsrc2.bottom = src->currentDesc.Height;
+ rsrc2.right = src->resource.width;
+ rsrc2.bottom = src->resource.height;
rsrc = &rsrc2;
}
/* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/
- if ((rsrc->bottom > src->currentDesc.Height) || (rsrc->bottom < 0)
- || (rsrc->top > src->currentDesc.Height) || (rsrc->top < 0)
- || (rsrc->left > src->currentDesc.Width) || (rsrc->left < 0)
- || (rsrc->right > src->currentDesc.Width) || (rsrc->right < 0)
+ if ((rsrc->bottom > src->resource.height) || (rsrc->bottom < 0)
+ || (rsrc->top > src->resource.height) || (rsrc->top < 0)
+ || (rsrc->left > src->resource.width) || (rsrc->left < 0)
+ || (rsrc->right > src->resource.width) || (rsrc->right < 0)
|| (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top))
{
WARN("Application gave us bad source rectangle for BltFast.\n");
@@ -1636,14 +1640,20 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
}
h = rsrc->bottom - rsrc->top;
- if (h > This->currentDesc.Height-dsty) h = This->currentDesc.Height-dsty;
- if (h > src->currentDesc.Height-rsrc->top) h = src->currentDesc.Height-rsrc->top;
- if (h <= 0) return WINEDDERR_INVALIDRECT;
+ if (h > This->resource.height-dsty)
+ h = This->resource.height-dsty;
+ if (h > src->resource.height-rsrc->top)
+ h = src->resource.height-rsrc->top;
+ if (h <= 0)
+ return WINEDDERR_INVALIDRECT;
w = rsrc->right - rsrc->left;
- if (w > This->currentDesc.Width-dstx) w = This->currentDesc.Width-dstx;
- if (w > src->currentDesc.Width-rsrc->left) w = src->currentDesc.Width-rsrc->left;
- if (w <= 0) return WINEDDERR_INVALIDRECT;
+ if (w > This->resource.width-dstx)
+ w = This->resource.width-dstx;
+ if (w > src->resource.width-rsrc->left)
+ w = src->resource.width-rsrc->left;
+ if (w <= 0)
+ return WINEDDERR_INVALIDRECT;
/* Now compute the locking rectangle... */
lock_src.left = rsrc->left;
@@ -1863,8 +1873,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Map(IWineD3DSurface *iface,
pLockedRect->pBits = This->resource.allocatedMemory;
This->lockedRect.left = 0;
This->lockedRect.top = 0;
- This->lockedRect.right = This->currentDesc.Width;
- This->lockedRect.bottom = This->currentDesc.Height;
+ This->lockedRect.right = This->resource.width;
+ This->lockedRect.bottom = This->resource.height;
TRACE("Locked Rect (%p) = l %d, t %d, r %d, b %d\n",
&This->lockedRect, This->lockedRect.left, This->lockedRect.top,
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index d91bb00..f0ec491 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -369,8 +369,8 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
}
/* We don't mind the nonpow2 stuff in GDI */
- This->pow2Width = This->currentDesc.Width;
- This->pow2Height = This->currentDesc.Height;
+ This->pow2Width = This->resource.width;
+ This->pow2Height = This->resource.height;
return WINED3D_OK;
}
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 2c186a2..c3b73bf 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -268,11 +268,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface,
cursor.texture_name = This->device->cursorTexture;
cursor.texture_target = GL_TEXTURE_2D;
cursor.texture_level = 0;
- cursor.currentDesc.Width = This->device->cursorWidth;
- cursor.currentDesc.Height = This->device->cursorHeight;
+ cursor.resource.width = This->device->cursorWidth;
+ cursor.resource.height = This->device->cursorHeight;
/* The cursor must have pow2 sizes */
- cursor.pow2Width = cursor.currentDesc.Width;
- cursor.pow2Height = cursor.currentDesc.Height;
+ cursor.pow2Width = cursor.resource.width;
+ cursor.pow2Height = cursor.resource.height;
/* The surface is in the texture */
cursor.flags |= SFLAG_INTEXTURE;
/* DDBLT_KEYSRC will cause BltOverride to enable the alpha test with GL_NOTEQUAL, 0.0,
@@ -441,8 +441,8 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface,
|| This->device->depth_stencil->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(This->device->depth_stencil, SFLAG_DS_DISCARDED,
- This->device->depth_stencil->currentDesc.Width,
- This->device->depth_stencil->currentDesc.Height);
+ This->device->depth_stencil->resource.width,
+ This->device->depth_stencil->resource.height);
if (This->device->depth_stencil == This->device->onscreen_depth_stencil)
{
IWineD3DSurface_Release((IWineD3DSurface *)This->device->onscreen_depth_stencil);
@@ -832,6 +832,6 @@ void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, U
{
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window size) */
- *width = context->current_rt->currentDesc.Width;
- *height = context->current_rt->currentDesc.Height;
+ *width = context->current_rt->resource.width;
+ *height = context->current_rt->resource.height;
}
diff --git a/dlls/wined3d/swapchain_gdi.c b/dlls/wined3d/swapchain_gdi.c
index 699bb4b..0184ccd 100644
--- a/dlls/wined3d/swapchain_gdi.c
+++ b/dlls/wined3d/swapchain_gdi.c
@@ -126,9 +126,9 @@ void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc)
}
#endif
drawrect.left = 0;
- drawrect.right = front->currentDesc.Width;
+ drawrect.right = front->resource.width;
drawrect.top = 0;
- drawrect.bottom = front->currentDesc.Height;
+ drawrect.bottom = front->resource.height;
#if 0
/* TODO: Support clippers */
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 6459dac..0210669 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -79,9 +79,9 @@ void volume_add_dirty_box(struct IWineD3DVolumeImpl *volume, const WINED3DBOX *d
volume->lockedBox.Left = 0;
volume->lockedBox.Top = 0;
volume->lockedBox.Front = 0;
- volume->lockedBox.Right = volume->currentDesc.Width;
- volume->lockedBox.Bottom = volume->currentDesc.Height;
- volume->lockedBox.Back = volume->currentDesc.Depth;
+ volume->lockedBox.Right = volume->resource.width;
+ volume->lockedBox.Bottom = volume->resource.height;
+ volume->lockedBox.Back = volume->resource.depth;
}
}
@@ -105,7 +105,7 @@ void volume_load(IWineD3DVolumeImpl *volume, UINT level, BOOL srgb_mode)
ENTER_GL();
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal,
- volume->currentDesc.Width, volume->currentDesc.Height, volume->currentDesc.Depth,
+ volume->resource.width, volume->resource.height, volume->resource.depth,
0, format->glFormat, format->glType, volume->resource.allocatedMemory));
checkGLcall("glTexImage3D");
LEAVE_GL();
@@ -233,9 +233,9 @@ static void WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, struct wine
desc->size = volume->resource.size; /* dx8 only */
desc->multisample_type = WINED3DMULTISAMPLE_NONE;
desc->multisample_quality = 0;
- desc->width = volume->currentDesc.Width;
- desc->height = volume->currentDesc.Height;
- desc->depth = volume->currentDesc.Depth;
+ desc->width = volume->resource.width;
+ desc->height = volume->resource.height;
+ desc->depth = volume->resource.depth;
}
static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface,
@@ -251,18 +251,18 @@ static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface,
/* fixme: should we really lock as such? */
TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory);
- pLockedVolume->RowPitch = This->resource.format->byte_count * This->currentDesc.Width; /* Bytes / row */
+ pLockedVolume->RowPitch = This->resource.format->byte_count * This->resource.width; /* Bytes / row */
pLockedVolume->SlicePitch = This->resource.format->byte_count
- * This->currentDesc.Width * This->currentDesc.Height; /* Bytes / slice */
+ * This->resource.width * This->resource.height; /* Bytes / slice */
if (!pBox) {
TRACE("No box supplied - all is ok\n");
pLockedVolume->pBits = This->resource.allocatedMemory;
This->lockedBox.Left = 0;
This->lockedBox.Top = 0;
This->lockedBox.Front = 0;
- This->lockedBox.Right = This->currentDesc.Width;
- This->lockedBox.Bottom = This->currentDesc.Height;
- This->lockedBox.Back = This->currentDesc.Depth;
+ This->lockedBox.Right = This->resource.width;
+ This->lockedBox.Bottom = This->resource.height;
+ This->lockedBox.Back = This->resource.depth;
} else {
TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back);
pLockedVolume->pBits = This->resource.allocatedMemory
@@ -344,18 +344,16 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
volume->lpVtbl = &IWineD3DVolume_Vtbl;
- hr = resource_init(&volume->resource, WINED3DRTYPE_VOLUME, device,
- width * height * depth * format->byte_count, usage, format, pool,
- parent, parent_ops, &volume_resource_ops);
+ hr = resource_init(&volume->resource, device, WINED3DRTYPE_VOLUME, format,
+ WINED3DMULTISAMPLE_NONE, 0, usage, pool, width, height, depth,
+ width * height * depth * format->byte_count, parent, parent_ops,
+ &volume_resource_ops);
if (FAILED(hr))
{
WARN("Failed to initialize resource, returning %#x.\n", hr);
return hr;
}
- volume->currentDesc.Width = width;
- volume->currentDesc.Height = height;
- volume->currentDesc.Depth = depth;
volume->lockable = TRUE;
volume->locked = FALSE;
memset(&volume->lockedBox, 0, sizeof(volume->lockedBox));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8d5bbbf..201e19b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1800,12 +1800,17 @@ struct wined3d_resource_ops
struct wined3d_resource
{
LONG ref;
- WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *device;
+ WINED3DRESOURCETYPE resourceType;
+ const struct wined3d_format *format;
+ WINED3DMULTISAMPLE_TYPE multisample_type;
+ UINT multisample_quality;
+ DWORD usage;
WINED3DPOOL pool;
+ UINT width;
+ UINT height;
+ UINT depth;
UINT size;
- DWORD usage;
- const struct wined3d_format *format;
DWORD priority;
BYTE *allocatedMemory; /* Pointer to the real data location */
BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */
@@ -1822,9 +1827,11 @@ HRESULT resource_free_private_data(struct wined3d_resource *resource, REFGUID gu
DWORD resource_get_priority(const struct wined3d_resource *resource) DECLSPEC_HIDDEN;
HRESULT resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid,
void *data, DWORD *data_size) DECLSPEC_HIDDEN;
-HRESULT resource_init(struct wined3d_resource *resource, WINED3DRESOURCETYPE resource_type,
- IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
- WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops,
+HRESULT resource_init(struct wined3d_resource *resource, IWineD3DDeviceImpl *device,
+ WINED3DRESOURCETYPE resource_type, const struct wined3d_format *format,
+ WINED3DMULTISAMPLE_TYPE multisample_type, UINT multisample_quality,
+ DWORD usage, WINED3DPOOL pool, UINT width, UINT height, UINT depth, UINT size,
+ void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN;
WINED3DRESOURCETYPE resource_get_type(const struct wined3d_resource *resource) DECLSPEC_HIDDEN;
DWORD resource_set_priority(struct wined3d_resource *resource, DWORD priority) DECLSPEC_HIDDEN;
@@ -1973,24 +1980,12 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
-typedef struct _WINED3DVOLUMET_DESC
-{
- UINT Width;
- UINT Height;
- UINT Depth;
-} WINED3DVOLUMET_DESC;
-
-/*****************************************************************************
- * IWineD3DVolume implementation structure (extends IUnknown)
- */
typedef struct IWineD3DVolumeImpl
{
/* IUnknown & WineD3DResource fields */
const IWineD3DVolumeVtbl *lpVtbl;
struct wined3d_resource resource;
- /* WineD3DVolume Information */
- WINED3DVOLUMET_DESC currentDesc;
struct IWineD3DVolumeTextureImpl *container;
BOOL lockable;
BOOL locked;
@@ -2026,14 +2021,6 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
-typedef struct _WINED3DSURFACET_DESC
-{
- WINED3DMULTISAMPLE_TYPE MultiSampleType;
- DWORD MultiSampleQuality;
- UINT Width;
- UINT Height;
-} WINED3DSURFACET_DESC;
-
/*****************************************************************************
* Structure for DIB Surfaces (GetDC and GDI surfaces)
*/
@@ -2105,7 +2092,6 @@ struct IWineD3DSurfaceImpl
/* IWineD3DSurface fields */
const struct wined3d_surface_ops *surface_ops;
struct wined3d_subresource_container container;
- WINED3DSURFACET_DESC currentDesc;
struct wined3d_palette *palette; /* D3D7 style palette handling */
PALETTEENTRY *palette9; /* D3D8/9 style palette handling */
--
1.7.3.4
More information about the wine-patches
mailing list