(D3D) Go through wrapper for SetViewport

This commit is contained in:
twinaphex 2014-09-12 18:01:32 +02:00
parent 147c40985c
commit b65e16254c
8 changed files with 25 additions and 11 deletions

View File

@ -29,6 +29,8 @@
#include "../../../message_queue.h"
#include "../../../general.h"
#include "../../gfx/d3d9/d3d.hpp"
#include "shared.h"
#define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1)
@ -306,7 +308,7 @@ static void rmenu_xui_frame(void)
vp_full.Height = d3d->screen_height;
vp_full.MinZ = 0.0f;
vp_full.MaxZ = 1.0f;
d3dr->SetViewport(&vp_full);
d3d_set_viewport(d3dr, &vp_full);
app.RunFrame();
XuiTimersRun();
@ -336,7 +338,7 @@ static void rmenu_xui_frame(void)
XuiRenderEnd( app.GetDC() );
d3dr->SetViewport(&d3d->final_viewport);
d3d_set_viewport(d3dr, &d3d->final_viewport);
}
static int rmenu_xui_input_postprocess(uint64_t old_state)

View File

@ -347,7 +347,7 @@ static bool texture_image_render(void *data,
vp.Y = 0;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
d3dr->SetViewport(&vp);
d3d_set_viewport(d3dr, &vp);
}
d3d_draw_primitive(d3dr, D3DPT_QUADLIST, 0, 1);
@ -564,7 +564,7 @@ static bool d3d_frame(void *data, const void *frame,
screen_vp.MaxZ = 1;
screen_vp.Width = d3d->screen_width;
screen_vp.Height = d3d->screen_height;
d3dr->SetViewport(&screen_vp);
d3d_set_viewport(d3dr, &screen_vp);
d3dr->Clear(0, 0, D3DCLEAR_TARGET, 0, 1, 0);
/* Insert black frame first, so we

View File

@ -100,7 +100,7 @@ static void d3d_overlay_render(void *data, overlay_t *overlay)
vp_full.Height = d3d->screen_height;
vp_full.MinZ = 0.0f;
vp_full.MaxZ = 1.0f;
d3d->dev->SetViewport(&vp_full);
d3d_set_viewport(d3d->dev, &vp_full);
}
/* Render overlay. */
@ -113,7 +113,7 @@ static void d3d_overlay_render(void *data, overlay_t *overlay)
/* Restore previous state. */
d3d->dev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
d3d->dev->SetViewport(&d3d->final_viewport);
d3d_set_viewport(d3d->dev, &final_viewport);
}
static void d3d_free_overlay(void *data, overlay_t *overlay)

View File

@ -154,6 +154,18 @@ void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
#endif
}
void d3d_set_viewport(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp)
{
(void)dev;
#if defined(_XBOX360)
D3DDevice_SetViewport(dev, vp);
#elif defined(_XBOX1)
D3DDevice_SetViewport(vp);
#else
dev->SetViewport(vp);
#endif
}
void d3d_textureblit(void *data, void *renderchain_data,
LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc,
D3DLOCKED_RECT lr, const void *frame,

View File

@ -55,4 +55,6 @@ void d3d_textureblit(void *data,
D3DLOCKED_RECT lr, const void *frame,
unsigned width, unsigned height, unsigned pitch);
void d3d_set_viewport(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp);
#endif

View File

@ -290,7 +290,7 @@ bool renderchain_render(void *chain_data, const void *data,
viewport.Height = to_pass.info.tex_h;
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
d3dr->SetViewport(&viewport);
d3d_set_viewport(d3dr, &viewport);
d3dr->Clear(0, 0, D3DCLEAR_TARGET, 0, 1, 0);
viewport.Width = out_width;
@ -465,7 +465,7 @@ void renderchain_set_viewport(void *data, D3DVIEWPORT *vp)
{
renderchain_t *chain = (renderchain_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
d3dr->SetViewport(vp);
d3d_set_viewport(d3dr, vp);
}
void renderchain_set_mvp(void *data, CGprogram &vPrg,

View File

@ -143,7 +143,7 @@ static void renderchain_render_pass(void *data, const void *frame, unsigned widt
renderchain_set_vertices(d3d, 1, width, height);
RD3DDevice_SetTexture(d3dr, 0, d3d->tex);
RD3DDevice_SetViewport(d3d->dev, &d3d->final_viewport);
d3d_set_viewport(d3d->dev, &d3d->final_viewport);
d3d_set_sampler_minfilter(d3dr, 0, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_sampler_magfilter(d3dr, 0, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);

View File

@ -32,7 +32,6 @@
#define RD3DVertexBuffer_Unlock(device)
#define RD3DDevice_SetTexture(device, Stage, pTexture) D3DDevice_SetTexture(Stage, pTexture)
#define RD3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil) D3DDevice_Clear(Count, pRects, Flags, Color, Z, Stencil)
#define RD3DDevice_SetViewport(device, viewport) D3DDevice_SetViewport(viewport)
#define D3DDevice_CreateVertexBuffers(device, Length, Usage, UnusedFVF, UnusedPool, ppVertexBuffer, pUnusedSharedHandle) IDirect3DDevice8_CreateVertexBuffer(device, Length, Usage, UnusedFVF, UnusedPool, ppVertexBuffer)
#elif defined(_XBOX360)
@ -47,7 +46,6 @@
#define D3DDevice_CreateVertexBuffers(device, Length, Usage, UnusedFVF, UnusedPool, ppVertexBuffer, pUnusedSharedHandle) IDirect3DDevice9_CreateVertexBuffer(device, Length, Usage, UnusedFVF, UnusedPool, ppVertexBuffer, NULL)
#define RD3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil) D3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil, false)
#define RD3DDevice_SetViewport(device, viewport) D3DDevice_SetViewport(device, viewport)
#endif
#define D3DTexture_LockRectClear(pass, tex, level, lockedrect, rect, flags) \