diff --git a/gfx/d3d/d3d_wrapper.cpp b/gfx/d3d/d3d_wrapper.cpp index de09498e3a..8a63ffda66 100644 --- a/gfx/d3d/d3d_wrapper.cpp +++ b/gfx/d3d/d3d_wrapper.cpp @@ -328,7 +328,8 @@ void d3d_texture_blit(void *data, unsigned pixel_size, return; #ifdef _XBOX - d3d_set_texture(d3d->dev, 0, NULL); // Set the texture to null so D3D don't complain about it being in use... + /* Set the texture to NULL so D3D doesn't complain about it being in use... */ + d3d_set_texture(d3d->dev, 0, NULL); D3DTexture_LockRect(tex, 0, lr, NULL, D3DLOCK_NOSYSLOCK); #if defined(_XBOX360) D3DSURFACE_DESC desc; diff --git a/gfx/d3d/render_chain.cpp b/gfx/d3d/render_chain.cpp index 68121f3ccc..1ed4542113 100644 --- a/gfx/d3d/render_chain.cpp +++ b/gfx/d3d/render_chain.cpp @@ -615,21 +615,21 @@ void renderchain_bind_luts(void *data, void *pass_data) { CGparameter vparam; CGparameter fparam = cgGetNamedParameter(pass->fPrg, chain->luts[i].id); - int bound_index = -1; + int bound_index = -1; if (fparam) { - index = cgGetParameterResourceIndex(fparam); - bound_index = index; + index = cgGetParameterResourceIndex(fparam); + bound_index = index; renderchain_add_lut(chain, index, i); } - vparam = cgGetNamedParameter(pass->vPrg, chain->luts[i].id); + vparam = cgGetNamedParameter(pass->vPrg, chain->luts[i].id); if (vparam) { - index = cgGetParameterResourceIndex(vparam); + index = cgGetParameterResourceIndex(vparam); if (index != (unsigned)bound_index) renderchain_add_lut(chain, index, i); } @@ -750,7 +750,7 @@ bool renderchain_init(void *data, const video_info_t *video_info, #endif chain->video_info = video_info; chain->tracker = NULL; - chain->final_viewport = (D3DVIEWPORT*)final_viewport_; + chain->final_viewport = (D3DVIEWPORT*)final_viewport_; chain->frame_count = 0; chain->pixel_size = (fmt == RGB565) ? 2 : 4; @@ -812,7 +812,7 @@ void renderchain_set_final_viewport(void *data, const void *viewport_data) bool renderchain_set_pass_size(void *data, unsigned pass_index, unsigned width, unsigned height) { - renderchain_t *chain = (renderchain_t*)data; + renderchain_t *chain = (renderchain_t*)data; LPDIRECT3DDEVICE d3dr = chain->dev; Pass *pass = (Pass*)&chain->passes[pass_index]; @@ -891,7 +891,7 @@ bool renderchain_add_lut(void *data, const char *id, bool smooth) { lut_info info; - renderchain_t *chain = (renderchain_t*)data; + renderchain_t *chain = (renderchain_t*)data; LPDIRECT3DDEVICE d3dr = chain->dev; LPDIRECT3DTEXTURE lut = (LPDIRECT3DTEXTURE) d3d_texture_new(d3dr, @@ -1006,6 +1006,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; + d3d_set_viewport(d3dr, &viewport); d3d_clear(d3dr, 0, 0, D3DCLEAR_TARGET, 0, 1, 0); diff --git a/gfx/d3d/render_chain_xdk.h b/gfx/d3d/render_chain_xdk.h index ab7e28fb26..a137460b69 100644 --- a/gfx/d3d/render_chain_xdk.h +++ b/gfx/d3d/render_chain_xdk.h @@ -1,7 +1,7 @@ static void renderchain_set_mvp(void *data, unsigned vp_width, unsigned vp_height, unsigned rotation) { - d3d_video_t *d3d = (d3d_video_t*)data; + d3d_video_t *d3d = (d3d_video_t*)data; LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev; #if defined(_XBOX360) && defined(HAVE_HLSL) @@ -23,6 +23,7 @@ static void renderchain_set_mvp(void *data, unsigned vp_width, static void renderchain_clear(void *data) { d3d_video_t *d3d = (d3d_video_t*)data; + d3d_texture_free(d3d->tex); d3d_vertex_buffer_free(d3d->vertex_buf); @@ -112,7 +113,7 @@ static bool renderchain_init(void *data, const video_info_t *info) LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev; global_t *global = global_get_ptr(); - chain->pixel_size = info->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t); + chain->pixel_size = info->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t); if (!renderchain_create_first_pass(chain, info)) return false; @@ -126,73 +127,74 @@ static bool renderchain_init(void *data, const video_info_t *info) return true; } -static void renderchain_set_vertices(void *data, unsigned pass, unsigned width, unsigned height) +static void renderchain_set_vertices(void *data, unsigned pass, + unsigned width, unsigned height) { - d3d_video_t *d3d = (d3d_video_t*)data; - runloop_t *runloop = rarch_main_get_ptr(); + d3d_video_t *d3d = (d3d_video_t*)data; + runloop_t *runloop = rarch_main_get_ptr(); if (d3d->last_width != width || d3d->last_height != height) { unsigned i; - void *verts = NULL; + Vertex vert[4]; + void *verts = NULL; - d3d->last_width = width; + d3d->last_width = width; d3d->last_height = height; - Vertex vert[4]; - float tex_w = width; - float tex_h = height; + float tex_w = width; + float tex_h = height; #ifdef _XBOX360 - tex_w /= ((float)d3d->tex_w); - tex_h /= ((float)d3d->tex_h); + tex_w /= ((float)d3d->tex_w); + tex_h /= ((float)d3d->tex_h); #endif - vert[0].x = -1.0f; - vert[1].x = 1.0f; - vert[2].x = -1.0f; - vert[3].x = 1.0f; + vert[0].x = -1.0f; + vert[1].x = 1.0f; + vert[2].x = -1.0f; + vert[3].x = 1.0f; - vert[0].y = -1.0f; - vert[1].y = -1.0f; - vert[2].y = 1.0f; - vert[3].y = 1.0f; + vert[0].y = -1.0f; + vert[1].y = -1.0f; + vert[2].y = 1.0f; + vert[3].y = 1.0f; #if defined(_XBOX1) - vert[0].z = 1.0f; - vert[1].z = 1.0f; - vert[2].z = 1.0f; - vert[3].z = 1.0f; + vert[0].z = 1.0f; + vert[1].z = 1.0f; + vert[2].z = 1.0f; + vert[3].z = 1.0f; - vert[0].rhw = 0.0f; - vert[1].rhw = tex_w; - vert[2].rhw = 0.0f; - vert[3].rhw = tex_w; + vert[0].rhw = 0.0f; + vert[1].rhw = tex_w; + vert[2].rhw = 0.0f; + vert[3].rhw = tex_w; - vert[0].u = tex_h; - vert[1].u = tex_h; - vert[2].u = 0.0f; - vert[3].u = 0.0f; + vert[0].u = tex_h; + vert[1].u = tex_h; + vert[2].u = 0.0f; + vert[3].u = 0.0f; - vert[0].v = 0.0f; - vert[1].v = 0.0f; - vert[2].v = 0.0f; - vert[3].v = 0.0f; + vert[0].v = 0.0f; + vert[1].v = 0.0f; + vert[2].v = 0.0f; + vert[3].v = 0.0f; #elif defined(_XBOX360) - vert[0].u = 0.0f; - vert[1].u = tex_w; - vert[2].u = 0.0f; - vert[3].u = tex_w; + vert[0].u = 0.0f; + vert[1].u = tex_w; + vert[2].u = 0.0f; + vert[3].u = tex_w; - vert[0].v = tex_h; - vert[1].v = tex_h; - vert[2].v = 0.0f; - vert[3].v = 0.0f; + vert[0].v = tex_h; + vert[1].v = tex_h; + vert[2].v = 0.0f; + vert[3].v = 0.0f; #endif /* Align texels and vertices. */ for (i = 0; i < 4; i++) { - vert[i].x -= 0.5f / ((float)d3d->tex_w); - vert[i].y += 0.5f / ((float)d3d->tex_h); + vert[i].x -= 0.5f / ((float)d3d->tex_w); + vert[i].y += 0.5f / ((float)d3d->tex_h); } verts = d3d_vertex_buffer_lock(d3d->vertex_buf);