Commit ac9c592c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 63b72d78
...@@ -640,7 +640,7 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha ...@@ -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, ...@@ -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);
} }
......
...@@ -34,8 +34,9 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_ ...@@ -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);
......
...@@ -1431,8 +1431,9 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, ...@@ -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);
......
...@@ -1663,8 +1663,8 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte ...@@ -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);
......
...@@ -591,14 +591,14 @@ static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, co ...@@ -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, ...@@ -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, ...@@ -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 * ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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])
{ {
......
...@@ -821,7 +821,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, ...@@ -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 ...@@ -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");
......
...@@ -43,17 +43,24 @@ struct private_data ...@@ -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;
......
...@@ -4758,8 +4758,10 @@ static void viewport_miscpart(DWORD state, struct wined3d_stateblock *stateblock ...@@ -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");
......
...@@ -369,8 +369,8 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface) ...@@ -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;
} }
......
...@@ -268,11 +268,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, ...@@ -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, ...@@ -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 ...@@ -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;
} }
...@@ -126,9 +126,9 @@ void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc) ...@@ -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 */
......
...@@ -79,9 +79,9 @@ void volume_add_dirty_box(struct IWineD3DVolumeImpl *volume, const WINED3DBOX *d ...@@ -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) ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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));
......
...@@ -1800,12 +1800,17 @@ struct wined3d_resource_ops ...@@ -1800,12 +1800,17 @@ struct wined3d_resource_ops
struct wined3d_resource struct wined3d_resource
{ {
LONG ref; LONG ref;
WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *device; IWineD3DDeviceImpl *device;
WINED3DRESOURCETYPE resourceType;
const struct wined3d_format *format;
WINED3DMULTISAMPLE_TYPE multisample_type;
UINT multisample_quality;
DWORD usage;
WINED3DPOOL pool; WINED3DPOOL pool;
UINT width;
UINT height;
UINT depth;
UINT size; UINT size;
DWORD usage;
const struct wined3d_format *format;
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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment