wined3d: Add RESZ support.

This commit is contained in:
Matteo Bruni 2013-02-18 13:56:23 +01:00 committed by Alexandre Julliard
parent 25d0d0876d
commit 5e28b0c974
3 changed files with 36 additions and 0 deletions

View File

@ -2212,6 +2212,22 @@ void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, stru
*viewport = device->stateBlock->state.viewport;
}
static void resolve_depth_buffer(struct wined3d_state *state)
{
struct wined3d_texture *texture = state->textures[0];
struct wined3d_surface *depth_stencil, *surface;
if (!texture || texture->resource.type != WINED3D_RTYPE_TEXTURE
|| !(texture->resource.format->flags & WINED3DFMT_FLAG_DEPTH))
return;
surface = surface_from_resource(texture->sub_resources[0]);
depth_stencil = state->fb->depth_stencil;
if (!depth_stencil)
return;
wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT);
}
void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
enum wined3d_render_state state, DWORD value)
{
@ -2234,6 +2250,12 @@ void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
TRACE("Application is setting the old value over, nothing to do.\n");
else
device_invalidate_state(device, STATE_RENDER(state));
if (state == WINED3D_RS_POINTSIZE && value == WINED3D_RESZ_CODE)
{
TRACE("RESZ multisampled depth buffer resolve triggered.\n");
resolve_depth_buffer(&device->stateBlock->state);
}
}
DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state)

View File

@ -126,6 +126,7 @@ static const struct wined3d_format_channels formats[] =
{WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{WINED3DFMT_INTZ, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
{WINED3DFMT_RESZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{WINED3DFMT_NVHU, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
{WINED3DFMT_NVHS, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
{WINED3DFMT_NULL, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0},
@ -1712,6 +1713,15 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
gl_info->formats[idx].flags |= WINED3DFMT_FLAG_TEXTURE;
}
/* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ
* support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with
* RENDERTARGET usage. */
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
{
idx = getFmtIdx(WINED3DFMT_RESZ);
gl_info->formats[idx].flags |= WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET;
}
for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i)
{
struct wined3d_format *format = &gl_info->formats[idx];
@ -1975,6 +1985,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id)
FMT_TO_STR(WINED3DFMT_B8G8R8A8_UNORM);
FMT_TO_STR(WINED3DFMT_B8G8R8X8_UNORM);
FMT_TO_STR(WINED3DFMT_INTZ);
FMT_TO_STR(WINED3DFMT_RESZ);
FMT_TO_STR(WINED3DFMT_NULL);
FMT_TO_STR(WINED3DFMT_R16);
FMT_TO_STR(WINED3DFMT_AL16);

View File

@ -245,6 +245,7 @@ enum wined3d_format_id
WINED3DFMT_NVHU = WINEMAKEFOURCC('N','V','H','U'),
WINED3DFMT_NVHS = WINEMAKEFOURCC('N','V','H','S'),
WINED3DFMT_INTZ = WINEMAKEFOURCC('I','N','T','Z'),
WINED3DFMT_RESZ = WINEMAKEFOURCC('R','E','S','Z'),
WINED3DFMT_NULL = WINEMAKEFOURCC('N','U','L','L'),
WINED3DFMT_R16 = WINEMAKEFOURCC(' ','R','1','6'),
WINED3DFMT_AL16 = WINEMAKEFOURCC('A','L','1','6'),
@ -1216,6 +1217,8 @@ enum wined3d_display_rotation
#define WINED3D_LEGACY_DEPTH_BIAS 0x00000001
#define WINED3D_NO3D 0x00000002
#define WINED3D_RESZ_CODE 0x7fa05000
/* dwDDFX */
/* arithmetic stretching along y axis */
#define WINEDDBLTFX_ARITHSTRETCHY 0x00000001