summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render')
-rw-r--r--src/osd/modules/render/d3d/d3dcomm.h14
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp28
-rw-r--r--src/osd/modules/render/drawd3d.cpp27
3 files changed, 39 insertions, 30 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;
}
diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp
index d0a1ce6c9d1..4cc547b5181 100644
--- a/src/osd/modules/render/drawd3d.cpp
+++ b/src/osd/modules/render/drawd3d.cpp
@@ -1120,6 +1120,13 @@ bool renderer_d3d9::device_verify_caps()
success = false;
}
+ result = d3dintf->d3dobj->CheckDeviceFormat(m_adapter, D3DDEVTYPE_HAL, m_pixformat, 0, D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F);
+ if (FAILED(result))
+ {
+ osd_printf_error("Direct3D Error: Your graphics card does not support the A16B16G16R16F texture format.\n");
+ success = false;
+ }
+
if (!success)
{
osd_printf_error("This feature or features are required to use the Direct3D renderer. Please\n");
@@ -2662,13 +2669,13 @@ d3d_render_target::~d3d_render_target()
if (target_surface[index] != nullptr)
target_surface[index]->Release();
- }
- if (cache_texture != nullptr)
- cache_texture->Release();
+ if (cache_texture[index] != nullptr)
+ cache_texture[index]->Release();
- if (cache_surface != nullptr)
- cache_surface->Release();
+ if (cache_surface[index] != nullptr)
+ cache_surface[index]->Release();
+ }
}
@@ -2701,13 +2708,13 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, int source_width, int source_he
return false;
target_texture[index]->GetSurfaceLevel(0, &target_surface[index]);
- }
- result = d3d->get_device()->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &cache_texture, nullptr);
- if (FAILED(result))
- return false;
+ result = d3d->get_device()->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A16B16G16R16F, D3DPOOL_DEFAULT, &cache_texture[index], nullptr);
+ if (FAILED(result))
+ return false;
- cache_texture->GetSurfaceLevel(0, &cache_surface);
+ cache_texture[index]->GetSurfaceLevel(0, &cache_surface[index]);
+ }
auto win = d3d->assert_window();