wined3d: Get rid of the get_drawable_size() callback in struct wined3d_surface.
This commit is contained in:
parent
9020ef9675
commit
d079066f5d
@ -326,7 +326,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
|
|||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
render_offscreen = context->render_offscreen;
|
render_offscreen = context->render_offscreen;
|
||||||
target->get_drawable_size(context, &drawable_width, &drawable_height);
|
surface_get_drawable_size(target, context, &drawable_width, &drawable_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4806,23 +4806,6 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_drawable_size_fbo(const struct wined3d_context *context, UINT *width, UINT *height)
|
|
||||||
{
|
|
||||||
/* The drawable size of a fbo target is the opengl texture size, which is the power of two size. */
|
|
||||||
*width = context->current_rt->pow2Width;
|
|
||||||
*height = context->current_rt->pow2Height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_drawable_size_backbuffer(const struct wined3d_context *context, UINT *width, UINT *height)
|
|
||||||
{
|
|
||||||
const struct wined3d_swapchain *swapchain = context->swapchain;
|
|
||||||
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
|
|
||||||
* current context's drawable, which is the size of the back buffer of the swapchain
|
|
||||||
* the active context belongs to. */
|
|
||||||
*width = swapchain->desc.backbuffer_width;
|
|
||||||
*height = swapchain->desc.backbuffer_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
|
LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
|
||||||
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc)
|
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc)
|
||||||
{
|
{
|
||||||
|
@ -4658,7 +4658,7 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
|
|||||||
{
|
{
|
||||||
UINT width, height;
|
UINT width, height;
|
||||||
|
|
||||||
target->get_drawable_size(context, &width, &height);
|
surface_get_drawable_size(target, context, &width, &height);
|
||||||
gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)),
|
gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)),
|
||||||
vp.width, vp.height);
|
vp.width, vp.height);
|
||||||
}
|
}
|
||||||
@ -4821,7 +4821,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st
|
|||||||
UINT height;
|
UINT height;
|
||||||
UINT width;
|
UINT width;
|
||||||
|
|
||||||
target->get_drawable_size(context, &width, &height);
|
surface_get_drawable_size(target, context, &width, &height);
|
||||||
gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top);
|
gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top);
|
||||||
}
|
}
|
||||||
checkGLcall("glScissor");
|
checkGLcall("glScissor");
|
||||||
|
@ -113,31 +113,39 @@ void surface_update_draw_binding(struct wined3d_surface *surface)
|
|||||||
surface->draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
|
surface->draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void surface_set_swapchain(struct wined3d_surface *surface, struct wined3d_swapchain *swapchain)
|
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
|
||||||
|
unsigned int *width, unsigned int *height)
|
||||||
{
|
{
|
||||||
TRACE("surface %p, swapchain %p.\n", surface, swapchain);
|
if (surface->swapchain)
|
||||||
|
{
|
||||||
|
/* The drawable size of an onscreen drawable is the surface size.
|
||||||
|
* (Actually: The window size, but the surface is created in window
|
||||||
|
* size.) */
|
||||||
|
*width = context->current_rt->resource.width;
|
||||||
|
*height = context->current_rt->resource.height;
|
||||||
|
}
|
||||||
|
else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
|
||||||
|
{
|
||||||
|
const struct wined3d_swapchain *swapchain = context->swapchain;
|
||||||
|
|
||||||
if (swapchain)
|
/* The drawable size of a backbuffer / aux buffer offscreen target is
|
||||||
{
|
* the size of the current context's drawable, which is the size of
|
||||||
surface->get_drawable_size = get_drawable_size_swapchain;
|
* the back buffer of the swapchain the active context belongs to. */
|
||||||
|
*width = swapchain->desc.backbuffer_width;
|
||||||
|
*height = swapchain->desc.backbuffer_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (wined3d_settings.offscreen_rendering_mode)
|
/* The drawable size of an FBO target is the OpenGL texture size,
|
||||||
|
* which is the power of two size. */
|
||||||
|
*width = context->current_rt->pow2Width;
|
||||||
|
*height = context->current_rt->pow2Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void surface_set_swapchain(struct wined3d_surface *surface, struct wined3d_swapchain *swapchain)
|
||||||
{
|
{
|
||||||
case ORM_FBO:
|
TRACE("surface %p, swapchain %p.\n", surface, swapchain);
|
||||||
surface->get_drawable_size = get_drawable_size_fbo;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ORM_BACKBUFFER:
|
|
||||||
surface->get_drawable_size = get_drawable_size_backbuffer;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
surface->swapchain = swapchain;
|
surface->swapchain = swapchain;
|
||||||
surface_update_draw_binding(surface);
|
surface_update_draw_binding(surface);
|
||||||
@ -147,24 +155,6 @@ void surface_set_container(struct wined3d_surface *surface, struct wined3d_textu
|
|||||||
{
|
{
|
||||||
TRACE("surface %p, container %p.\n", surface, container);
|
TRACE("surface %p, container %p.\n", surface, container);
|
||||||
|
|
||||||
if (!surface->swapchain)
|
|
||||||
{
|
|
||||||
switch (wined3d_settings.offscreen_rendering_mode)
|
|
||||||
{
|
|
||||||
case ORM_FBO:
|
|
||||||
surface->get_drawable_size = get_drawable_size_fbo;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ORM_BACKBUFFER:
|
|
||||||
surface->get_drawable_size = get_drawable_size_backbuffer;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
surface->container = container;
|
surface->container = container;
|
||||||
surface_update_draw_binding(surface);
|
surface_update_draw_binding(surface);
|
||||||
}
|
}
|
||||||
@ -729,21 +719,6 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
|
|||||||
surface->pow2Width, surface->pow2Height);
|
surface->pow2Width, surface->pow2Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (wined3d_settings.offscreen_rendering_mode)
|
|
||||||
{
|
|
||||||
case ORM_FBO:
|
|
||||||
surface->get_drawable_size = get_drawable_size_fbo;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ORM_BACKBUFFER:
|
|
||||||
surface->get_drawable_size = get_drawable_size_backbuffer;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode);
|
|
||||||
return WINED3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||||
surface->locations = WINED3D_LOCATION_DISCARDED;
|
surface->locations = WINED3D_LOCATION_DISCARDED;
|
||||||
|
|
||||||
|
@ -1115,14 +1115,6 @@ struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchai
|
|||||||
return swapchain_create_context(swapchain);
|
return swapchain_create_context(swapchain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_drawable_size_swapchain(const struct wined3d_context *context, UINT *width, UINT *height)
|
|
||||||
{
|
|
||||||
/* The drawable size of an onscreen drawable is the surface size.
|
|
||||||
* (Actually: The window size, but the surface is created in window size) */
|
|
||||||
*width = context->current_rt->resource.width;
|
|
||||||
*height = context->current_rt->resource.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain)
|
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain)
|
||||||
{
|
{
|
||||||
if (!swapchain->backup_dc)
|
if (!swapchain->backup_dc)
|
||||||
|
@ -2235,9 +2235,6 @@ struct wined3d_surface
|
|||||||
UINT pow2Width;
|
UINT pow2Width;
|
||||||
UINT pow2Height;
|
UINT pow2Height;
|
||||||
|
|
||||||
/* A method to retrieve the drawable size. Not in the Vtable to make it changeable */
|
|
||||||
void (*get_drawable_size)(const struct wined3d_context *context, UINT *width, UINT *height);
|
|
||||||
|
|
||||||
/* PBO */
|
/* PBO */
|
||||||
GLuint pbo;
|
GLuint pbo;
|
||||||
GLuint rb_multisample;
|
GLuint rb_multisample;
|
||||||
@ -2282,6 +2279,8 @@ void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
|||||||
HRESULT surface_color_fill(struct wined3d_surface *s,
|
HRESULT surface_color_fill(struct wined3d_surface *s,
|
||||||
const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
|
const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
|
||||||
GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
||||||
|
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
|
||||||
|
unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
|
||||||
void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
|
void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
|
||||||
BOOL surface_is_offscreen(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
BOOL surface_is_offscreen(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
||||||
void surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN;
|
void surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN;
|
||||||
@ -2308,10 +2307,6 @@ HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct w
|
|||||||
GLenum target, GLint level, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN;
|
GLenum target, GLint level, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN;
|
||||||
void surface_prepare_map_memory(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
void surface_prepare_map_memory(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void get_drawable_size_swapchain(const struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
|
|
||||||
void get_drawable_size_backbuffer(const struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
|
|
||||||
void get_drawable_size_fbo(const struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context,
|
void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context,
|
||||||
const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
|
const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
|
||||||
void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN;
|
void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user