wined3d: Store all the resource desc information in struct wined3d_resource.

This commit is contained in:
Henri Verbeet 2011-03-08 19:41:07 +01:00 committed by Alexandre Julliard
parent 63b72d789d
commit ac9c592ca9
15 changed files with 236 additions and 229 deletions

View File

@ -640,7 +640,7 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha
{ {
IWineD3DBaseShaderImpl *pshader = (IWineD3DBaseShaderImpl *)stateBlock->state.pixel_shader; IWineD3DBaseShaderImpl *pshader = (IWineD3DBaseShaderImpl *)stateBlock->state.pixel_shader;
const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; 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 */ /* Load DirectX 9 float constants for pixel shader */
device->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB, 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 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); shader_arb_ps_local_constants(compiled, context, state, rt_height);
} }

View File

@ -34,8 +34,9 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_
{ {
HRESULT hr; HRESULT hr;
hr = resource_init(&texture->resource, resource_type, device, hr = resource_init(&texture->resource, device, resource_type, format,
0, usage, format, pool, parent, parent_ops, resource_ops); WINED3DMULTISAMPLE_NONE, 0, usage, pool, 0, 0, 0, 0,
parent, parent_ops, resource_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize resource, returning %#x\n", hr); WARN("Failed to initialize resource, returning %#x\n", hr);

View File

@ -1431,8 +1431,9 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
hr = resource_init(&buffer->resource, WINED3DRTYPE_BUFFER, device, size, hr = resource_init(&buffer->resource, device, WINED3DRTYPE_BUFFER, format,
usage, format, pool, parent, parent_ops, &buffer_resource_ops); WINED3DMULTISAMPLE_NONE, 0, usage, pool, size, 1, 1, size,
parent, parent_ops, &buffer_resource_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize resource, hr %#x\n", hr); WARN("Failed to initialize resource, hr %#x\n", hr);

View File

@ -1663,8 +1663,8 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte
int i; int i;
const struct StateEntry *StateTable = This->StateTable; const struct StateEntry *StateTable = This->StateTable;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
UINT width = context->current_rt->currentDesc.Width; UINT width = context->current_rt->resource.width;
UINT height = context->current_rt->currentDesc.Height; UINT height = context->current_rt->resource.height;
DWORD sampler; DWORD sampler;
TRACE("Setting up context %p for blitting\n", context); TRACE("Setting up context %p for blitting\n", context);

View File

@ -591,14 +591,14 @@ static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, co
{ {
/* partial draw rect */ /* partial draw rect */
if (draw_rect->left || draw_rect->top if (draw_rect->left || draw_rect->top
|| draw_rect->right < target->currentDesc.Width || draw_rect->right < target->resource.width
|| draw_rect->bottom < target->currentDesc.Height) || draw_rect->bottom < target->resource.height)
return FALSE; return FALSE;
/* partial clear rect */ /* partial clear rect */
if (clear_rect && (clear_rect->left > 0 || clear_rect->top > 0 if (clear_rect && (clear_rect->left > 0 || clear_rect->top > 0
|| clear_rect->right < target->currentDesc.Width || clear_rect->right < target->resource.width
|| clear_rect->bottom < target->currentDesc.Height)) || clear_rect->bottom < target->resource.height))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -5506,8 +5506,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
surface_internal_preload(dst_impl, SRGB_RGB); surface_internal_preload(dst_impl, SRGB_RGB);
surface_bind(dst_impl, gl_info, FALSE); surface_bind(dst_impl, gl_info, FALSE);
src_w = src_impl->currentDesc.Width; src_w = src_impl->resource.width;
src_h = src_impl->currentDesc.Height; src_h = src_impl->resource.height;
update_w = src_rect ? src_rect->right - src_rect->left : src_w; update_w = src_rect ? src_rect->right - src_rect->left : src_w;
update_h = src_rect ? src_rect->bottom - src_rect->top : src_h; 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 /* Set the viewport and scissor rectangles, if requested. Tests show
* that stateblock recording is ignored, the change goes directly * that stateblock recording is ignored, the change goes directly
* into the primary stateblock. */ * into the primary stateblock. */
device->stateBlock->state.viewport.Height = device->render_targets[0]->currentDesc.Height; device->stateBlock->state.viewport.Height = device->render_targets[0]->resource.height;
device->stateBlock->state.viewport.Width = device->render_targets[0]->currentDesc.Width; device->stateBlock->state.viewport.Width = device->render_targets[0]->resource.width;
device->stateBlock->state.viewport.X = 0; device->stateBlock->state.viewport.X = 0;
device->stateBlock->state.viewport.Y = 0; device->stateBlock->state.viewport.Y = 0;
device->stateBlock->state.viewport.MaxZ = 1.0f; device->stateBlock->state.viewport.MaxZ = 1.0f;
@ -5870,8 +5870,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
|| This->depth_stencil->flags & SFLAG_DISCARD) || This->depth_stencil->flags & SFLAG_DISCARD)
{ {
surface_modify_ds_location(This->depth_stencil, SFLAG_DS_DISCARDED, surface_modify_ds_location(This->depth_stencil, SFLAG_DS_DISCARDED,
This->depth_stencil->currentDesc.Width, This->depth_stencil->resource.width,
This->depth_stencil->currentDesc.Height); This->depth_stencil->resource.height);
if (This->depth_stencil == This->onscreen_depth_stencil) if (This->depth_stencil == This->onscreen_depth_stencil)
{ {
IWineD3DSurface_Release((IWineD3DSurface *)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; This->cursorTexture = 0;
} }
if ((s->currentDesc.Width == 32) && (s->currentDesc.Height == 32)) if (s->resource.width == 32 && s->resource.height == 32)
This->haveHardwareCursor = TRUE; This->haveHardwareCursor = TRUE;
else else
This->haveHardwareCursor = FALSE; This->haveHardwareCursor = FALSE;
@ -5934,11 +5934,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
} }
/* MSDN: Cursor must be smaller than the display mode */ /* MSDN: Cursor must be smaller than the display mode */
if (s->currentDesc.Width > This->ddraw_width if (s->resource.width > This->ddraw_width
|| s->currentDesc.Height > This->ddraw_height) || s->resource.height > This->ddraw_height)
{ {
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n", 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; return WINED3DERR_INVALIDCALL;
} }
@ -5951,8 +5951,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
* creating circular refcount dependencies. Copy out the gl texture * creating circular refcount dependencies. Copy out the gl texture
* instead. * instead.
*/ */
This->cursorWidth = s->currentDesc.Width; This->cursorWidth = s->resource.width;
This->cursorHeight = s->currentDesc.Height; This->cursorHeight = s->resource.height;
if (SUCCEEDED(IWineD3DSurface_Map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY))) if (SUCCEEDED(IWineD3DSurface_Map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
{ {
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; 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 * 32-bit cursors. 32x32 bits split into 32-bit chunks == 32
* chunks. */ * chunks. */
DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 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, IWineD3DSurface_Map(cursor_image, &lockedRect, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY); 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.fIcon = FALSE;
cursorInfo.xHotspot = XHotSpot; cursorInfo.xHotspot = XHotSpot;
cursorInfo.yHotspot = YHotSpot; cursorInfo.yHotspot = YHotSpot;
cursorInfo.hbmMask = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 1, maskBits); cursorInfo.hbmMask = CreateBitmap(s->resource.width, s->resource.height, 1, 1, maskBits);
cursorInfo.hbmColor = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 32, lockedRect.pBits); cursorInfo.hbmColor = CreateBitmap(s->resource.width, s->resource.height, 1, 32, lockedRect.pBits);
IWineD3DSurface_Unmap(cursor_image); IWineD3DSurface_Unmap(cursor_image);
/* Create our cursor and clean up. */ /* Create our cursor and clean up. */
cursor = CreateIconIndirect(&cursorInfo); cursor = CreateIconIndirect(&cursorInfo);
@ -6140,8 +6140,8 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES
surface->resource.allocatedMemory = NULL; surface->resource.allocatedMemory = NULL;
surface->flags &= ~SFLAG_DIBSECTION; surface->flags &= ~SFLAG_DIBSECTION;
} }
surface->currentDesc.Width = pPresentationParameters->BackBufferWidth; surface->resource.width = pPresentationParameters->BackBufferWidth;
surface->currentDesc.Height = pPresentationParameters->BackBufferHeight; surface->resource.height = pPresentationParameters->BackBufferHeight;
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE] if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE]
|| gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{ {

View File

@ -821,7 +821,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
correction_params[1] = 1.0f; correction_params[1] = 1.0f;
} else { } else {
/* position is window relative, not viewport relative */ /* 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; correction_params[1] = -1.0f;
} }
GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params)); 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"); 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", 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); context->render_offscreen ? 1.0f : -1.0f);
} }
shader_addline(buffer, "vec4 vpos;\n"); shader_addline(buffer, "vec4 vpos;\n");

View File

@ -43,17 +43,24 @@ struct private_data
DWORD size; DWORD size;
}; };
HRESULT resource_init(struct wined3d_resource *resource, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(struct wined3d_resource *resource, IWineD3DDeviceImpl *device,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, WINED3DRESOURCETYPE resource_type, const struct wined3d_format *format,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops, 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) const struct wined3d_resource_ops *resource_ops)
{ {
resource->ref = 1;
resource->device = device; resource->device = device;
resource->resourceType = resource_type; resource->resourceType = resource_type;
resource->ref = 1;
resource->pool = pool;
resource->format = format; resource->format = format;
resource->multisample_type = multisample_type;
resource->multisample_quality = multisample_quality;
resource->usage = usage; resource->usage = usage;
resource->pool = pool;
resource->width = width;
resource->height = height;
resource->depth = depth;
resource->size = size; resource->size = size;
resource->priority = 0; resource->priority = 0;
resource->parent = parent; resource->parent = parent;

View File

@ -4758,8 +4758,10 @@ static void viewport_miscpart(DWORD state, struct wined3d_stateblock *stateblock
UINT width, height; UINT width, height;
WINED3DVIEWPORT vp = stateblock->state.viewport; WINED3DVIEWPORT vp = stateblock->state.viewport;
if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width; if (vp.Width > target->resource.width)
if(vp.Height > target->currentDesc.Height) vp.Height = target->currentDesc.Height; vp.Width = target->resource.width;
if (vp.Height > target->resource.height)
vp.Height = target->resource.height;
glDepthRange(vp.MinZ, vp.MaxZ); glDepthRange(vp.MinZ, vp.MaxZ);
checkGLcall("glDepthRange"); checkGLcall("glDepthRange");

View File

@ -272,8 +272,8 @@ static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_
{ {
rect_out->left = 0; rect_out->left = 0;
rect_out->top = 0; rect_out->top = 0;
rect_out->right = This->currentDesc.Width; rect_out->right = This->resource.width;
rect_out->bottom = This->currentDesc.Height; rect_out->bottom = This->resource.height;
} }
} }
@ -597,8 +597,9 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
hr = resource_init(&surface->resource, WINED3DRTYPE_SURFACE, device, resource_size, hr = resource_init(&surface->resource, device, WINED3DRTYPE_SURFACE, format,
usage, format, pool, parent, parent_ops, &surface_resource_ops); multisample_type, multisample_quality, usage, pool, width, height, 1,
resource_size, parent, parent_ops, &surface_resource_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize resource, returning %#x.\n", hr); WARN("Failed to initialize resource, returning %#x.\n", hr);
@ -608,10 +609,6 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
/* "Standalone" surface. */ /* "Standalone" surface. */
surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); 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; surface->texture_level = level;
list_init(&surface->overlays); 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. * 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 * 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 * 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, * 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; src_data = mem;
dst_data = This->resource.allocatedMemory; dst_data = This->resource.allocatedMemory;
TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", This, src_pitch, dst_pitch); 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 */ /* skip the first row */
src_data += src_pitch; src_data += src_pitch;
dst_data += dst_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, static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
const struct wined3d_format *format, BOOL srgb, const GLvoid *data) const struct wined3d_format *format, BOOL srgb, const GLvoid *data)
{ {
GLsizei width = This->currentDesc.Width; GLsizei width = This->resource.width;
GLsizei height = This->currentDesc.Height; GLsizei height = This->resource.height;
GLenum internal; GLenum internal;
if (srgb) if (srgb)
@ -1210,8 +1208,8 @@ void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect
{ {
surface->dirtyRect.left = 0; surface->dirtyRect.left = 0;
surface->dirtyRect.top = 0; surface->dirtyRect.top = 0;
surface->dirtyRect.right = surface->currentDesc.Width; surface->dirtyRect.right = surface->resource.width;
surface->dirtyRect.bottom = surface->currentDesc.Height; surface->dirtyRect.bottom = surface->resource.height;
} }
/* if the container is a basetexture then mark it dirty. */ /* 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) { if(!rect) {
local_rect.left = 0; local_rect.left = 0;
local_rect.top = 0; local_rect.top = 0;
local_rect.right = This->currentDesc.Width; local_rect.right = This->resource.width;
local_rect.bottom = This->currentDesc.Height; local_rect.bottom = This->resource.height;
} else { }
else
{
local_rect = *rect; local_rect = *rect;
} }
/* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */ /* 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"); checkGLcall("glGetIntegerv");
/* Setup pixel store pack state -- to glReadPixels into the correct place */ /* 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"); checkGLcall("glPixelStorei");
glPixelStorei(GL_PACK_SKIP_PIXELS, local_rect.left); glPixelStorei(GL_PACK_SKIP_PIXELS, local_rect.left);
checkGLcall("glPixelStorei"); checkGLcall("glPixelStorei");
glPixelStorei(GL_PACK_SKIP_ROWS, local_rect.top); glPixelStorei(GL_PACK_SKIP_ROWS, local_rect.top);
checkGLcall("glPixelStorei"); 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.right - local_rect.left,
local_rect.bottom - local_rect.top, local_rect.bottom - local_rect.top,
fmt, type, mem); fmt, type, mem);
@ -1719,7 +1719,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
checkGLcall("glReadBuffer"); checkGLcall("glReadBuffer");
glCopyTexSubImage2D(This->texture_target, This->texture_level, 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"); checkGLcall("glCopyTexSubImage2D");
LEAVE_GL(); LEAVE_GL();
@ -1882,8 +1882,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Map(IWineD3DSurface *iface,
/* surface_load_location() does not check if the rectangle specifies /* surface_load_location() does not check if the rectangle specifies
* the full surface. Most callers don't need that, so do it here. */ * the full surface. Most callers don't need that, so do it here. */
if (pRect && !pRect->top && !pRect->left if (pRect && !pRect->top && !pRect->left
&& pRect->right == This->currentDesc.Width && pRect->right == This->resource.width
&& pRect->bottom == This->currentDesc.Height) && pRect->bottom == This->resource.height)
{ {
pass_rect = NULL; pass_rect = NULL;
} }
@ -1974,7 +1974,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *surface,
checkGLcall("glRasterPos3i"); checkGLcall("glRasterPos3i");
/* If not fullscreen, we need to skip a number of bytes to find the next row of data */ /* 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) if (surface->flags & SFLAG_PBO)
{ {
@ -2055,8 +2055,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Unmap(IWineD3DSurface *iface)
} }
if (!This->dirtyRect.left && !This->dirtyRect.top if (!This->dirtyRect.left && !This->dirtyRect.top
&& This->dirtyRect.right == This->currentDesc.Width && This->dirtyRect.right == This->resource.width
&& This->dirtyRect.bottom == This->currentDesc.Height) && This->dirtyRect.bottom == This->resource.height)
{ {
fullsurface = TRUE; fullsurface = TRUE;
} else { } else {
@ -2080,8 +2080,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Unmap(IWineD3DSurface *iface)
surface_evict_sysmem(This); surface_evict_sysmem(This);
} }
This->dirtyRect.left = This->currentDesc.Width; This->dirtyRect.left = This->resource.width;
This->dirtyRect.top = This->currentDesc.Height; This->dirtyRect.top = This->resource.height;
This->dirtyRect.right = 0; This->dirtyRect.right = 0;
This->dirtyRect.bottom = 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, glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level,
dst_rect.left /*xoffset */, dst_rect.top /* y offset */, 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); 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, /* I have to process this row by row to swap the image,
* otherwise it would be upside down, so stretching in y direction * otherwise it would be upside down, so stretching in y direction
* doesn't cost extra time * doesn't cost extra time
@ -2958,8 +2960,8 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
GLuint src, backup = 0; GLuint src, backup = 0;
IWineD3DSwapChainImpl *src_swapchain = NULL; IWineD3DSwapChainImpl *src_swapchain = NULL;
float left, right, top, bottom; /* Texture coordinates */ float left, right, top, bottom; /* Texture coordinates */
UINT fbwidth = src_surface->currentDesc.Width; UINT fbwidth = src_surface->resource.width;
UINT fbheight = src_surface->currentDesc.Height; UINT fbheight = src_surface->resource.height;
struct wined3d_context *context; struct wined3d_context *context;
GLenum drawBuffer = GL_BACK; GLenum drawBuffer = GL_BACK;
GLenum texture_target; GLenum texture_target;
@ -3104,13 +3106,13 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
if (!upsidedown) if (!upsidedown)
{ {
top = src_surface->currentDesc.Height - src_rect->top; top = src_surface->resource.height - src_rect->top;
bottom = src_surface->currentDesc.Height - src_rect->bottom; bottom = src_surface->resource.height - src_rect->bottom;
} }
else else
{ {
top = src_surface->currentDesc.Height - src_rect->bottom; top = src_surface->resource.height - src_rect->bottom;
bottom = src_surface->currentDesc.Height - src_rect->top; bottom = src_surface->resource.height - src_rect->top;
} }
if (src_surface->flags & SFLAG_NORMCOORD) if (src_surface->flags & SFLAG_NORMCOORD)
@ -3259,7 +3261,7 @@ void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window
} }
else else
{ {
drawable_height = surface->currentDesc.Height; drawable_height = surface->resource.height;
} }
rect->top = drawable_height - rect->top; 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) 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; 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 FALSE;
return TRUE; return TRUE;
} }
@ -3562,8 +3564,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
TRACE("Looking if a Present can be done...\n"); TRACE("Looking if a Present can be done...\n");
/* Source Rectangle must be full surface */ /* Source Rectangle must be full surface */
if (src_rect.left || src_rect.top if (src_rect.left || src_rect.top
|| src_rect.right != src_surface->currentDesc.Width || src_rect.right != src_surface->resource.width
|| src_rect.bottom != src_surface->currentDesc.Height) || src_rect.bottom != src_surface->resource.height)
{ {
TRACE("No, Source rectangle doesn't match\n"); TRACE("No, Source rectangle doesn't match\n");
break; break;
@ -3598,8 +3600,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
} }
} }
else if (dst_rect.left || dst_rect.top else if (dst_rect.left || dst_rect.top
|| dst_rect.right != dst_surface->currentDesc.Width || dst_rect.right != dst_surface->resource.width
|| dst_rect.bottom != dst_surface->currentDesc.Height) || dst_rect.bottom != dst_surface->resource.height)
{ {
TRACE("No, dest rectangle doesn't match(surface size)\n"); TRACE("No, dest rectangle doesn't match(surface size)\n");
break; break;
@ -3712,8 +3714,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
dst_surface, SFLAG_INDRAWABLE, &dst_rect); dst_surface, SFLAG_INDRAWABLE, &dst_rect);
surface_modify_location(dst_surface, SFLAG_INDRAWABLE, TRUE); surface_modify_location(dst_surface, SFLAG_INDRAWABLE, TRUE);
} }
else if (!stretchx || dst_rect.right - dst_rect.left > src_surface->currentDesc.Width else if (!stretchx || dst_rect.right - dst_rect.left > src_surface->resource.width
|| dst_rect.bottom - dst_rect.top > src_surface->currentDesc.Height) || dst_rect.bottom - dst_rect.top > src_surface->resource.height)
{ {
TRACE("No stretching in x direction, using direct framebuffer -> texture copy\n"); 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); 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 */ /* Non-power2 support */
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{ {
pow2Width = This->currentDesc.Width; pow2Width = This->resource.width;
pow2Height = This->currentDesc.Height; pow2Height = This->resource.height;
} }
else else
{ {
/* Find the nearest pow2 match */ /* Find the nearest pow2 match */
pow2Width = pow2Height = 1; pow2Width = pow2Height = 1;
while (pow2Width < This->currentDesc.Width) pow2Width <<= 1; while (pow2Width < This->resource.width) pow2Width <<= 1;
while (pow2Height < This->currentDesc.Height) pow2Height <<= 1; while (pow2Height < This->resource.height) pow2Height <<= 1;
} }
This->pow2Width = pow2Width; This->pow2Width = pow2Width;
This->pow2Height = pow2Height; 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. */ /* TODO: Add support for non power two compressed textures. */
if (This->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED) if (This->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED)
{ {
FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n", 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; return WINED3DERR_NOTAVAILABLE;
} }
} }
if (pow2Width != This->currentDesc.Width if (pow2Width != This->resource.width
|| pow2Height != This->currentDesc.Height) || pow2Height != This->resource.height)
{ {
This->flags |= SFLAG_NONPOW2; This->flags |= SFLAG_NONPOW2;
} }
@ -4050,8 +4052,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
&& wined3d_settings.rendertargetlock_mode == RTL_READTEX)) && wined3d_settings.rendertargetlock_mode == RTL_READTEX))
{ {
This->texture_target = GL_TEXTURE_RECTANGLE_ARB; This->texture_target = GL_TEXTURE_RECTANGLE_ARB;
This->pow2Width = This->currentDesc.Width; This->pow2Width = This->resource.width;
This->pow2Height = This->currentDesc.Height; This->pow2Height = This->resource.height;
This->flags &= ~(SFLAG_NONPOW2 | SFLAG_NORMCOORD); 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; surface->ds_current_size.cy = 0;
} }
if (surface->ds_current_size.cx == surface->currentDesc.Width if (surface->ds_current_size.cx == surface->resource.width
&& surface->ds_current_size.cy == surface->currentDesc.Height) && surface->ds_current_size.cy == surface->resource.height)
{ {
TRACE("Location (%#x) is already up to date.\n", location); TRACE("Location (%#x) is already up to date.\n", location);
return; 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 * buffer, so the onscreen depth/stencil buffer is potentially smaller
* than the offscreen surface. Don't overwrite the offscreen surface * than the offscreen surface. Don't overwrite the offscreen surface
* with undefined data. */ * with undefined data. */
w = min(surface->currentDesc.Width, context->swapchain->presentParms.BackBufferWidth); w = min(surface->resource.width, context->swapchain->presentParms.BackBufferWidth);
h = min(surface->currentDesc.Height, context->swapchain->presentParms.BackBufferHeight); h = min(surface->resource.height, context->swapchain->presentParms.BackBufferHeight);
TRACE("Copying onscreen depth buffer to depth texture.\n"); 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); context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
surface_depth_blt(surface, gl_info, surface->texture_name, 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"); checkGLcall("depth_blt");
if (context->current_fbo) context_bind_fbo(context, GL_FRAMEBUFFER, &context->current_fbo->id); 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->flags |= location;
surface->ds_current_size.cx = surface->currentDesc.Width; surface->ds_current_size.cx = surface->resource.width;
surface->ds_current_size.cy = surface->currentDesc.Height; surface->ds_current_size.cy = surface->resource.height;
} }
void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent) 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); FALSE /* We won't use textures */, &format, &convert);
/* The width is in 'length' not in bytes */ /* The width is in 'length' not in bytes */
width = surface->currentDesc.Width; width = surface->resource.width;
pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface); pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED /* 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) if ((convert != NO_CONVERSION) && surface->resource.allocatedMemory)
{ {
int height = surface->currentDesc.Height; int height = surface->resource.height;
byte_count = format.conv_byte_count; byte_count = format.conv_byte_count;
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */ /* 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)) NULL, surface->resource.usage, surface->resource.pool, surface->resource.format))
{ {
DWORD src_location = flag == SFLAG_INSRGBTEX ? SFLAG_INTEXTURE : SFLAG_INSRGBTEX; 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_blt_fbo(surface->resource.device, WINED3DTEXF_POINT,
surface, src_location, &rect, surface, flag, &rect); 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; else surface->flags &= ~SFLAG_GLCKEY;
/* The width is in 'length' not in bytes */ /* The width is in 'length' not in bytes */
width = surface->currentDesc.Width; width = surface->resource.width;
pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface); pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED /* 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) if (format.convert)
{ {
/* This code is entered for texture formats which need a fixup. */ /* 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 */ /* Stick to the alignment for the converted surface too, makes it easier to load the surface */
outpitch = width * format.conv_byte_count; 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) else if (convert != NO_CONVERSION && surface->resource.allocatedMemory)
{ {
/* This code is only entered for color keying fixups */ /* 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 */ /* Stick to the alignment for the converted surface too, makes it easier to load the surface */
outpitch = width * format.conv_byte_count; 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, static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
const RECT *dst_rect, const WINED3DCOLORVALUE *color) 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 */, 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 */); dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f /* depth */, 0 /* stencil */);

View File

@ -168,11 +168,11 @@ void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, struct wined
desc->usage = surface->resource.usage; desc->usage = surface->resource.usage;
desc->pool = surface->resource.pool; desc->pool = surface->resource.pool;
desc->size = surface->resource.size; /* dx8 only */ desc->size = surface->resource.size; /* dx8 only */
desc->multisample_type = surface->currentDesc.MultiSampleType; desc->multisample_type = surface->resource.multisample_type;
desc->multisample_quality = surface->currentDesc.MultiSampleQuality; desc->multisample_quality = surface->resource.multisample_quality;
desc->width = surface->currentDesc.Width; desc->width = surface->resource.width;
desc->height = surface->currentDesc.Height; desc->height = surface->resource.height;
desc->depth = 1; desc->depth = surface->resource.depth;
} }
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD flags) 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 /* 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. */ * 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; ret = row_block_count * format->block_byte_count;
} }
else else
{ {
unsigned char alignment = This->resource.device->surface_alignment; 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); ret = (ret + alignment - 1) & ~(alignment - 1);
} }
TRACE("(%p) Returning %d\n", This, ret); TRACE("(%p) Returning %d\n", This, ret);
@ -439,8 +439,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, con
} else { } else {
This->overlay_srcrect.left = 0; This->overlay_srcrect.left = 0;
This->overlay_srcrect.top = 0; This->overlay_srcrect.top = 0;
This->overlay_srcrect.right = This->currentDesc.Width; This->overlay_srcrect.right = This->resource.width;
This->overlay_srcrect.bottom = This->currentDesc.Height; This->overlay_srcrect.bottom = This->resource.height;
} }
if(DstRect) { if(DstRect) {
@ -448,8 +448,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, con
} else { } else {
This->overlay_destrect.left = 0; This->overlay_destrect.left = 0;
This->overlay_destrect.top = 0; This->overlay_destrect.top = 0;
This->overlay_destrect.right = Dst ? Dst->currentDesc.Width : 0; This->overlay_destrect.right = Dst ? Dst->resource.width : 0;
This->overlay_destrect.bottom = Dst ? Dst->currentDesc.Height : 0; This->overlay_destrect.bottom = Dst ? Dst->resource.height : 0;
} }
if (This->overlay_dest && (This->overlay_dest != Dst || flags & WINEDDOVER_HIDE)) 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); b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
/* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */ /* 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.biWidth = IWineD3DSurface_GetPitch(iface) / format->byte_count;
b_info->bmiHeader.biHeight = -This->currentDesc.Height -extraline; b_info->bmiHeader.biHeight = -This->resource.height - extraline;
b_info->bmiHeader.biSizeImage = ( This->currentDesc.Height + extraline) * IWineD3DSurface_GetPitch(iface); b_info->bmiHeader.biSizeImage = (This->resource.height + extraline) * IWineD3DSurface_GetPitch(iface);
b_info->bmiHeader.biPlanes = 1; b_info->bmiHeader.biPlanes = 1;
b_info->bmiHeader.biBitCount = format->byte_count * 8; 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); TRACE("DIBSection at : %p\n", This->dib.bitmap_data);
/* copy the existing surface to the dib section */ /* copy the existing surface to the dib section */
if(This->resource.allocatedMemory) { if (This->resource.allocatedMemory)
memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, This->currentDesc.Height * IWineD3DSurface_GetPitch(iface)); {
} else { 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 is to make LockRect read the gl Texture although memory is allocated */
This->flags &= ~SFLAG_INSYSMEM; This->flags &= ~SFLAG_INSYSMEM;
} }
@ -847,8 +851,8 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
return NULL; return NULL;
} }
IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width, IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->resource.width,
source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */, source->resource.height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */,
0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */, 0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */,
0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source), 0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
NULL /* parent */, &wined3d_null_parent_ops, &ret); 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, 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(ret);
IWineD3DSurface_Unmap((IWineD3DSurface *)source); IWineD3DSurface_Unmap((IWineD3DSurface *)source);
@ -992,18 +996,18 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
if (src) if (src)
{ {
if (SrcRect->right < SrcRect->left || SrcRect->bottom < SrcRect->top if (SrcRect->right < SrcRect->left || SrcRect->bottom < SrcRect->top
|| SrcRect->left > src->currentDesc.Width || SrcRect->left < 0 || SrcRect->left > src->resource.width || SrcRect->left < 0
|| SrcRect->top > src->currentDesc.Height || SrcRect->top < 0 || SrcRect->top > src->resource.height || SrcRect->top < 0
|| SrcRect->right > src->currentDesc.Width || SrcRect->right < 0 || SrcRect->right > src->resource.width || SrcRect->right < 0
|| SrcRect->bottom > src->currentDesc.Height || SrcRect->bottom < 0) || SrcRect->bottom > src->resource.height || SrcRect->bottom < 0)
{ {
WARN("Application gave us bad source rectangle for Blt.\n"); WARN("Application gave us bad source rectangle for Blt.\n");
return WINEDDERR_INVALIDRECT; return WINEDDERR_INVALIDRECT;
} }
if (!SrcRect->right || !SrcRect->bottom if (!SrcRect->right || !SrcRect->bottom
|| SrcRect->left == (int)src->currentDesc.Width || SrcRect->left == (int)src->resource.width
|| SrcRect->top == (int)src->currentDesc.Height) || SrcRect->top == (int)src->resource.height)
{ {
TRACE("Nothing to be done.\n"); TRACE("Nothing to be done.\n");
return WINED3D_OK; return WINED3D_OK;
@ -1016,8 +1020,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
{ {
xsrc.left = 0; xsrc.left = 0;
xsrc.top = 0; xsrc.top = 0;
xsrc.right = src->currentDesc.Width; xsrc.right = src->resource.width;
xsrc.bottom = src->currentDesc.Height; xsrc.bottom = src->resource.height;
} }
else 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 /* For the Destination rect, it can be out of bounds on the condition
* that a clipper is set for the given surface. */ * that a clipper is set for the given surface. */
if (!This->clipper && (DestRect->right < DestRect->left || DestRect->bottom < DestRect->top if (!This->clipper && (DestRect->right < DestRect->left || DestRect->bottom < DestRect->top
|| DestRect->left > This->currentDesc.Width || DestRect->left < 0 || DestRect->left > This->resource.width || DestRect->left < 0
|| DestRect->top > This->currentDesc.Height || DestRect->top < 0 || DestRect->top > This->resource.height || DestRect->top < 0
|| DestRect->right > This->currentDesc.Width || DestRect->right < 0 || DestRect->right > This->resource.width || DestRect->right < 0
|| DestRect->bottom > This->currentDesc.Height || DestRect->bottom < 0)) || DestRect->bottom > This->resource.height || DestRect->bottom < 0))
{ {
WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n"); WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
return WINEDDERR_INVALIDRECT; return WINEDDERR_INVALIDRECT;
} }
if (DestRect->right <= 0 || DestRect->bottom <= 0 if (DestRect->right <= 0 || DestRect->bottom <= 0
|| DestRect->left >= (int)This->currentDesc.Width || DestRect->left >= (int)This->resource.width
|| DestRect->top >= (int)This->currentDesc.Height) || DestRect->top >= (int)This->resource.height)
{ {
TRACE("Nothing to be done.\n"); TRACE("Nothing to be done.\n");
return WINED3D_OK; return WINED3D_OK;
@ -1052,8 +1056,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
full_rect.left = 0; full_rect.left = 0;
full_rect.top = 0; full_rect.top = 0;
full_rect.right = This->currentDesc.Width; full_rect.right = This->resource.width;
full_rect.bottom = This->currentDesc.Height; full_rect.bottom = This->resource.height;
IntersectRect(&xdst, &full_rect, DestRect); IntersectRect(&xdst, &full_rect, DestRect);
} }
else else
@ -1061,8 +1065,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
BOOL clip_horiz, clip_vert; BOOL clip_horiz, clip_vert;
xdst = *DestRect; xdst = *DestRect;
clip_horiz = xdst.left < 0 || xdst.right > (int)This->currentDesc.Width; clip_horiz = xdst.left < 0 || xdst.right > (int)This->resource.width;
clip_vert = xdst.top < 0 || xdst.bottom > (int)This->currentDesc.Height; clip_vert = xdst.top < 0 || xdst.bottom > (int)This->resource.height;
if (clip_vert || clip_horiz) if (clip_vert || clip_horiz)
{ {
@ -1082,10 +1086,10 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
xsrc.left -= xdst.left; xsrc.left -= xdst.left;
xdst.left = 0; xdst.left = 0;
} }
if (xdst.right > This->currentDesc.Width) if (xdst.right > This->resource.width)
{ {
xsrc.right -= (xdst.right - (int)This->currentDesc.Width); xsrc.right -= (xdst.right - (int)This->resource.width);
xdst.right = (int)This->currentDesc.Width; xdst.right = (int)This->resource.width;
} }
} }
@ -1096,20 +1100,20 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
xsrc.top -= xdst.top; xsrc.top -= xdst.top;
xdst.top = 0; xdst.top = 0;
} }
if (xdst.bottom > This->currentDesc.Height) if (xdst.bottom > This->resource.height)
{ {
xsrc.bottom -= (xdst.bottom - (int)This->currentDesc.Height); xsrc.bottom -= (xdst.bottom - (int)This->resource.height);
xdst.bottom = (int)This->currentDesc.Height; xdst.bottom = (int)This->resource.height;
} }
} }
/* And check if after clipping something is still to be done... */ /* And check if after clipping something is still to be done... */
if ((xdst.right <= 0) || (xdst.bottom <= 0) if ((xdst.right <= 0) || (xdst.bottom <= 0)
|| (xdst.left >= (int)This->currentDesc.Width) || (xdst.left >= (int)This->resource.width)
|| (xdst.top >= (int)This->currentDesc.Height) || (xdst.top >= (int)This->resource.height)
|| (xsrc.right <= 0) || (xsrc.bottom <= 0) || (xsrc.right <= 0) || (xsrc.bottom <= 0)
|| (xsrc.left >= (int)src->currentDesc.Width) || (xsrc.left >= (int)src->resource.width)
|| (xsrc.top >= (int)src->currentDesc.Height)) || (xsrc.top >= (int)src->resource.height))
{ {
TRACE("Nothing to be done after clipping.\n"); TRACE("Nothing to be done after clipping.\n");
return WINED3D_OK; return WINED3D_OK;
@ -1121,8 +1125,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
{ {
xdst.left = 0; xdst.left = 0;
xdst.top = 0; xdst.top = 0;
xdst.right = This->currentDesc.Width; xdst.right = This->resource.width;
xdst.bottom = This->currentDesc.Height; xdst.bottom = This->resource.height;
} }
if (src == This) if (src == This)
@ -1619,16 +1623,16 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
WARN("rsrc is NULL!\n"); WARN("rsrc is NULL!\n");
rsrc2.left = 0; rsrc2.left = 0;
rsrc2.top = 0; rsrc2.top = 0;
rsrc2.right = src->currentDesc.Width; rsrc2.right = src->resource.width;
rsrc2.bottom = src->currentDesc.Height; rsrc2.bottom = src->resource.height;
rsrc = &rsrc2; rsrc = &rsrc2;
} }
/* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/ /* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/
if ((rsrc->bottom > src->currentDesc.Height) || (rsrc->bottom < 0) if ((rsrc->bottom > src->resource.height) || (rsrc->bottom < 0)
|| (rsrc->top > src->currentDesc.Height) || (rsrc->top < 0) || (rsrc->top > src->resource.height) || (rsrc->top < 0)
|| (rsrc->left > src->currentDesc.Width) || (rsrc->left < 0) || (rsrc->left > src->resource.width) || (rsrc->left < 0)
|| (rsrc->right > src->currentDesc.Width) || (rsrc->right < 0) || (rsrc->right > src->resource.width) || (rsrc->right < 0)
|| (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top)) || (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top))
{ {
WARN("Application gave us bad source rectangle for BltFast.\n"); 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; h = rsrc->bottom - rsrc->top;
if (h > This->currentDesc.Height-dsty) h = This->currentDesc.Height-dsty; if (h > This->resource.height-dsty)
if (h > src->currentDesc.Height-rsrc->top) h = src->currentDesc.Height-rsrc->top; h = This->resource.height-dsty;
if (h <= 0) return WINEDDERR_INVALIDRECT; if (h > src->resource.height-rsrc->top)
h = src->resource.height-rsrc->top;
if (h <= 0)
return WINEDDERR_INVALIDRECT;
w = rsrc->right - rsrc->left; w = rsrc->right - rsrc->left;
if (w > This->currentDesc.Width-dstx) w = This->currentDesc.Width-dstx; if (w > This->resource.width-dstx)
if (w > src->currentDesc.Width-rsrc->left) w = src->currentDesc.Width-rsrc->left; w = This->resource.width-dstx;
if (w <= 0) return WINEDDERR_INVALIDRECT; if (w > src->resource.width-rsrc->left)
w = src->resource.width-rsrc->left;
if (w <= 0)
return WINEDDERR_INVALIDRECT;
/* Now compute the locking rectangle... */ /* Now compute the locking rectangle... */
lock_src.left = rsrc->left; lock_src.left = rsrc->left;
@ -1863,8 +1873,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Map(IWineD3DSurface *iface,
pLockedRect->pBits = This->resource.allocatedMemory; pLockedRect->pBits = This->resource.allocatedMemory;
This->lockedRect.left = 0; This->lockedRect.left = 0;
This->lockedRect.top = 0; This->lockedRect.top = 0;
This->lockedRect.right = This->currentDesc.Width; This->lockedRect.right = This->resource.width;
This->lockedRect.bottom = This->currentDesc.Height; This->lockedRect.bottom = This->resource.height;
TRACE("Locked Rect (%p) = l %d, t %d, r %d, b %d\n", TRACE("Locked Rect (%p) = l %d, t %d, r %d, b %d\n",
&This->lockedRect, This->lockedRect.left, This->lockedRect.top, &This->lockedRect, This->lockedRect.left, This->lockedRect.top,

View File

@ -369,8 +369,8 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
} }
/* We don't mind the nonpow2 stuff in GDI */ /* We don't mind the nonpow2 stuff in GDI */
This->pow2Width = This->currentDesc.Width; This->pow2Width = This->resource.width;
This->pow2Height = This->currentDesc.Height; This->pow2Height = This->resource.height;
return WINED3D_OK; return WINED3D_OK;
} }

View File

@ -268,11 +268,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface,
cursor.texture_name = This->device->cursorTexture; cursor.texture_name = This->device->cursorTexture;
cursor.texture_target = GL_TEXTURE_2D; cursor.texture_target = GL_TEXTURE_2D;
cursor.texture_level = 0; cursor.texture_level = 0;
cursor.currentDesc.Width = This->device->cursorWidth; cursor.resource.width = This->device->cursorWidth;
cursor.currentDesc.Height = This->device->cursorHeight; cursor.resource.height = This->device->cursorHeight;
/* The cursor must have pow2 sizes */ /* The cursor must have pow2 sizes */
cursor.pow2Width = cursor.currentDesc.Width; cursor.pow2Width = cursor.resource.width;
cursor.pow2Height = cursor.currentDesc.Height; cursor.pow2Height = cursor.resource.height;
/* The surface is in the texture */ /* The surface is in the texture */
cursor.flags |= SFLAG_INTEXTURE; cursor.flags |= SFLAG_INTEXTURE;
/* DDBLT_KEYSRC will cause BltOverride to enable the alpha test with GL_NOTEQUAL, 0.0, /* 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) || This->device->depth_stencil->flags & SFLAG_DISCARD)
{ {
surface_modify_ds_location(This->device->depth_stencil, SFLAG_DS_DISCARDED, surface_modify_ds_location(This->device->depth_stencil, SFLAG_DS_DISCARDED,
This->device->depth_stencil->currentDesc.Width, This->device->depth_stencil->resource.width,
This->device->depth_stencil->currentDesc.Height); This->device->depth_stencil->resource.height);
if (This->device->depth_stencil == This->device->onscreen_depth_stencil) if (This->device->depth_stencil == This->device->onscreen_depth_stencil)
{ {
IWineD3DSurface_Release((IWineD3DSurface *)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. /* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window size) */ * (Actually: The window size, but the surface is created in window size) */
*width = context->current_rt->currentDesc.Width; *width = context->current_rt->resource.width;
*height = context->current_rt->currentDesc.Height; *height = context->current_rt->resource.height;
} }

View File

@ -126,9 +126,9 @@ void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc)
} }
#endif #endif
drawrect.left = 0; drawrect.left = 0;
drawrect.right = front->currentDesc.Width; drawrect.right = front->resource.width;
drawrect.top = 0; drawrect.top = 0;
drawrect.bottom = front->currentDesc.Height; drawrect.bottom = front->resource.height;
#if 0 #if 0
/* TODO: Support clippers */ /* TODO: Support clippers */

View File

@ -79,9 +79,9 @@ void volume_add_dirty_box(struct IWineD3DVolumeImpl *volume, const WINED3DBOX *d
volume->lockedBox.Left = 0; volume->lockedBox.Left = 0;
volume->lockedBox.Top = 0; volume->lockedBox.Top = 0;
volume->lockedBox.Front = 0; volume->lockedBox.Front = 0;
volume->lockedBox.Right = volume->currentDesc.Width; volume->lockedBox.Right = volume->resource.width;
volume->lockedBox.Bottom = volume->currentDesc.Height; volume->lockedBox.Bottom = volume->resource.height;
volume->lockedBox.Back = volume->currentDesc.Depth; volume->lockedBox.Back = volume->resource.depth;
} }
} }
@ -105,7 +105,7 @@ void volume_load(IWineD3DVolumeImpl *volume, UINT level, BOOL srgb_mode)
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal, 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)); 0, format->glFormat, format->glType, volume->resource.allocatedMemory));
checkGLcall("glTexImage3D"); checkGLcall("glTexImage3D");
LEAVE_GL(); LEAVE_GL();
@ -233,9 +233,9 @@ static void WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, struct wine
desc->size = volume->resource.size; /* dx8 only */ desc->size = volume->resource.size; /* dx8 only */
desc->multisample_type = WINED3DMULTISAMPLE_NONE; desc->multisample_type = WINED3DMULTISAMPLE_NONE;
desc->multisample_quality = 0; desc->multisample_quality = 0;
desc->width = volume->currentDesc.Width; desc->width = volume->resource.width;
desc->height = volume->currentDesc.Height; desc->height = volume->resource.height;
desc->depth = volume->currentDesc.Depth; desc->depth = volume->resource.depth;
} }
static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface, 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? */ /* fixme: should we really lock as such? */
TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory); 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 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) { if (!pBox) {
TRACE("No box supplied - all is ok\n"); TRACE("No box supplied - all is ok\n");
pLockedVolume->pBits = This->resource.allocatedMemory; pLockedVolume->pBits = This->resource.allocatedMemory;
This->lockedBox.Left = 0; This->lockedBox.Left = 0;
This->lockedBox.Top = 0; This->lockedBox.Top = 0;
This->lockedBox.Front = 0; This->lockedBox.Front = 0;
This->lockedBox.Right = This->currentDesc.Width; This->lockedBox.Right = This->resource.width;
This->lockedBox.Bottom = This->currentDesc.Height; This->lockedBox.Bottom = This->resource.height;
This->lockedBox.Back = This->currentDesc.Depth; This->lockedBox.Back = This->resource.depth;
} else { } 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); 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 pLockedVolume->pBits = This->resource.allocatedMemory
@ -344,18 +344,16 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
volume->lpVtbl = &IWineD3DVolume_Vtbl; volume->lpVtbl = &IWineD3DVolume_Vtbl;
hr = resource_init(&volume->resource, WINED3DRTYPE_VOLUME, device, hr = resource_init(&volume->resource, device, WINED3DRTYPE_VOLUME, format,
width * height * depth * format->byte_count, usage, format, pool, WINED3DMULTISAMPLE_NONE, 0, usage, pool, width, height, depth,
parent, parent_ops, &volume_resource_ops); width * height * depth * format->byte_count, parent, parent_ops,
&volume_resource_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize resource, returning %#x.\n", hr); WARN("Failed to initialize resource, returning %#x.\n", hr);
return hr; return hr;
} }
volume->currentDesc.Width = width;
volume->currentDesc.Height = height;
volume->currentDesc.Depth = depth;
volume->lockable = TRUE; volume->lockable = TRUE;
volume->locked = FALSE; volume->locked = FALSE;
memset(&volume->lockedBox, 0, sizeof(volume->lockedBox)); memset(&volume->lockedBox, 0, sizeof(volume->lockedBox));

View File

@ -1800,12 +1800,17 @@ struct wined3d_resource_ops
struct wined3d_resource struct wined3d_resource
{ {
LONG ref; LONG ref;
WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *device; IWineD3DDeviceImpl *device;
WINED3DPOOL pool; WINED3DRESOURCETYPE resourceType;
UINT size;
DWORD usage;
const struct wined3d_format *format; 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 priority; DWORD priority;
BYTE *allocatedMemory; /* Pointer to the real data location */ BYTE *allocatedMemory; /* Pointer to the real data location */
BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */ 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; DWORD resource_get_priority(const struct wined3d_resource *resource) DECLSPEC_HIDDEN;
HRESULT resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid, HRESULT resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid,
void *data, DWORD *data_size) DECLSPEC_HIDDEN; void *data, DWORD *data_size) DECLSPEC_HIDDEN;
HRESULT resource_init(struct wined3d_resource *resource, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(struct wined3d_resource *resource, IWineD3DDeviceImpl *device,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, WINED3DRESOURCETYPE resource_type, const struct wined3d_format *format,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops, 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; const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN;
WINED3DRESOURCETYPE resource_get_type(const struct wined3d_resource *resource) 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; 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, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; 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 typedef struct IWineD3DVolumeImpl
{ {
/* IUnknown & WineD3DResource fields */ /* IUnknown & WineD3DResource fields */
const IWineD3DVolumeVtbl *lpVtbl; const IWineD3DVolumeVtbl *lpVtbl;
struct wined3d_resource resource; struct wined3d_resource resource;
/* WineD3DVolume Information */
WINED3DVOLUMET_DESC currentDesc;
struct IWineD3DVolumeTextureImpl *container; struct IWineD3DVolumeTextureImpl *container;
BOOL lockable; BOOL lockable;
BOOL locked; 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, 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; 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) * Structure for DIB Surfaces (GetDC and GDI surfaces)
*/ */
@ -2105,7 +2092,6 @@ struct IWineD3DSurfaceImpl
/* IWineD3DSurface fields */ /* IWineD3DSurface fields */
const struct wined3d_surface_ops *surface_ops; const struct wined3d_surface_ops *surface_ops;
struct wined3d_subresource_container container; struct wined3d_subresource_container container;
WINED3DSURFACET_DESC currentDesc;
struct wined3d_palette *palette; /* D3D7 style palette handling */ struct wined3d_palette *palette; /* D3D7 style palette handling */
PALETTEENTRY *palette9; /* D3D8/9 style palette handling */ PALETTEENTRY *palette9; /* D3D8/9 style palette handling */