diff options
Diffstat (limited to 'src/osd/modules/render/d3d')
-rw-r--r-- | src/osd/modules/render/d3d/d3dcomm.h | 14 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.cpp | 28 |
2 files changed, 22 insertions, 20 deletions
diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index 38b93adb7ac..98a720988c0 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -220,7 +220,7 @@ class d3d_render_target { public: // construction/destruction - d3d_render_target(): target_width(0), target_height(0), width(0), height(0), screen_index(0), bloom_count(0) + d3d_render_target(): target_width(0), target_height(0), width(0), height(0), screen_index(0), bloom_count(0), cache_index(0) { for (int index = 0; index < MAX_BLOOM_COUNT; index++) { @@ -234,16 +234,16 @@ public: source_surface[index] = nullptr; target_texture[index] = nullptr; target_surface[index] = nullptr; + cache_texture[index] = nullptr; + cache_surface[index] = nullptr; } - - cache_texture = nullptr; - cache_surface = nullptr; } ~d3d_render_target(); bool init(renderer_d3d9 *d3d, int source_width, int source_height, int target_width, int target_height, int screen_index); int next_index(int index) { return ++index > 1 ? 0 : index; } + int next_cache_index() { cache_index = ++cache_index > 1 ? 0 : cache_index; return cache_index; } // real target dimension int target_width; @@ -260,8 +260,8 @@ public: IDirect3DSurface9 *source_surface[2]; IDirect3DTexture9 *source_texture[2]; - IDirect3DSurface9 *cache_surface; - IDirect3DTexture9 *cache_texture; + IDirect3DSurface9 *cache_surface[2]; + IDirect3DTexture9 *cache_texture[2]; IDirect3DSurface9 *bloom_surface[MAX_BLOOM_COUNT]; IDirect3DTexture9 *bloom_texture[MAX_BLOOM_COUNT]; @@ -269,6 +269,8 @@ public: float bloom_dims[MAX_BLOOM_COUNT][2]; int bloom_count; + + int cache_index; }; #endif diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index c41ab4f083f..17861ef3ce1 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -1097,20 +1097,20 @@ int shaders::phosphor_pass(d3d_render_target *rt, int source_index, poly_info *p curr_effect = phosphor_effect; curr_effect->update_uniforms(); curr_effect->set_texture("Diffuse", rt->target_texture[next_index]); - curr_effect->set_texture("LastPass", rt->cache_texture); + curr_effect->set_texture("LastPass", rt->cache_texture[rt->cache_index]); curr_effect->set_bool("Passthrough", false); curr_effect->set_float("DeltaTime", delta_time()); - next_index = rt->next_index(next_index); - blit(rt->target_surface[next_index], false, D3DPT_TRIANGLELIST, 0, 2); + rt->next_cache_index(); + blit(rt->cache_surface[rt->cache_index], false, D3DPT_TRIANGLELIST, 0, 2); - // Pass along our phosphor'd screen + // copy cached texture to target texture curr_effect->update_uniforms(); - curr_effect->set_texture("Diffuse", rt->target_texture[next_index]); - curr_effect->set_texture("LastPass", rt->target_texture[next_index]); + curr_effect->set_texture("Diffuse", rt->cache_texture[rt->cache_index]); + curr_effect->set_texture("LastPass", rt->cache_texture[rt->cache_index]); curr_effect->set_bool("Passthrough", true); - blit(rt->cache_surface, false, D3DPT_TRIANGLELIST, 0, 2); + blit(rt->target_surface[next_index], false, D3DPT_TRIANGLELIST, 0, 2); return next_index; } @@ -1129,20 +1129,20 @@ int shaders::ghosting_pass(d3d_render_target *rt, int source_index, poly_info *p curr_effect = ghosting_effect; curr_effect->update_uniforms(); curr_effect->set_texture("Diffuse", rt->target_texture[next_index]); - curr_effect->set_texture("LastPass", rt->cache_texture); + curr_effect->set_texture("LastPass", rt->cache_texture[rt->cache_index]); curr_effect->set_bool("Passthrough", false); curr_effect->set_float("DeltaTime", delta_time()); - next_index = rt->next_index(next_index); - blit(rt->target_surface[next_index], false, D3DPT_TRIANGLELIST, 0, 2); + rt->next_cache_index(); + blit(rt->cache_surface[rt->cache_index], false, D3DPT_TRIANGLELIST, 0, 2); - // Pass along our ghost'd screen + // copy cached texture to target texture curr_effect->update_uniforms(); - curr_effect->set_texture("Diffuse", rt->target_texture[next_index]); - curr_effect->set_texture("LastPass", rt->target_texture[next_index]); + curr_effect->set_texture("Diffuse", rt->cache_texture[rt->cache_index]); + curr_effect->set_texture("LastPass", rt->cache_texture[rt->cache_index]); curr_effect->set_bool("Passthrough", true); - blit(rt->cache_surface, false, D3DPT_TRIANGLELIST, 0, 2); + blit(rt->target_surface[next_index], false, D3DPT_TRIANGLELIST, 0, 2); return next_index; } |