(360) FBO changes

This commit is contained in:
TwinAphex51224 2012-04-18 23:57:01 +02:00
parent 7bab422a44
commit 77b4b76db4

View File

@ -515,20 +515,21 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
if (vid->last_width != width || vid->last_height != height)
{
D3DLOCKED_RECT d3dlr;
float tex_w, tex_h;
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
memset(d3dlr.pBits, 0, 512 * d3dlr.Pitch);
vid->lpTexture->UnlockRect(0);
ifdef(vid->fbo_inited)
if(vid->fbo_inited)
{
float tex_w = width / (512.0f * g_settings.video.fbo_scale_x);
float tex_h = height / (512.0f * g_settings.video.fbo_scale_y);
tex_w = width / (512.0f * g_settings.video.fbo_scale_x);
tex_h = height / (512.0f * g_settings.video.fbo_scale_y);
}
else
{
float tex_w = width / (512.0f);
float tex_h = height / (512.0f);
tex_w = width / (512.0f);
tex_h = height / (512.0f);
}
const DrawVerticeFormats verts[] = {
@ -562,6 +563,22 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
{
vid->d3d_render_device->Resolve( D3DRESOLVE_RENDERTARGET0, NULL, vid->lpTexture,
NULL, 0, 0, NULL, 0, 0, NULL );
hlsl_use(0);
hlsl_set_params(width, height, 512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y, vid->d3dpp.BackBufferWidth,
vid->d3dpp.BackBufferHeight, g_frame_count);
vid->d3d_render_device->SetTexture(0, NULL);
D3DLOCKED_RECT d3dlr;
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
for (unsigned y = 0; y < height; y++)
{
const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)d3dlr.pBits + y * d3dlr.Pitch;
memcpy(out, in, width * sizeof(uint16_t));
}
vid->lpTexture->UnlockRect(0);
// Set the render target back to the back buffer
vid->d3d_render_device->SetRenderTarget( 0, pRenderTarget0 );
@ -571,22 +588,6 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
0xff000000, 1.0f, 0);
hlsl_use(0);
hlsl_set_params(width, height, 512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y, vid->d3dpp.BackBufferWidth,
vid->d3dpp.BackBufferHeight, g_frame_count);
vid->d3d_render_device->SetTexture(0, NULL);
D3DLOCKED_RECT d3dlr;
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
for (unsigned y = 0; y < height; y++)
{
const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)d3dlr.pBits + y * d3dlr.Pitch;
memcpy(out, in, width * sizeof(uint16_t));
}
vid->lpTexture->UnlockRect(0);
vid->d3d_render_device->SetTexture(0, vid->lpTexture);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);