- Fix for pixel gaps between multi-screen games in HLSL mode. [MooglyGuy]

This commit is contained in:
Ryan Holtz 2014-01-04 03:17:31 +00:00
parent 1c5f0dfe04
commit 3312b67f93
4 changed files with 249 additions and 243 deletions

View File

@ -17,9 +17,9 @@ texture DiffuseK;
sampler DiffuseSampler0 = sampler_state sampler DiffuseSampler0 = sampler_state
{ {
Texture = <DiffuseA>; Texture = <DiffuseA>;
MipFilter = LINEAR; MipFilter = NONE;
MinFilter = LINEAR; MinFilter = NONE;
MagFilter = LINEAR; MagFilter = NONE;
AddressU = CLAMP; AddressU = CLAMP;
AddressV = CLAMP; AddressV = CLAMP;
AddressW = CLAMP; AddressW = CLAMP;
@ -164,19 +164,20 @@ struct PS_INPUT
// Bloom Vertex Shader // Bloom Vertex Shader
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
uniform float2 TargetSize; uniform float2 ScreenSize;
uniform float2 TextureSize;
VS_OUTPUT vs_main(VS_INPUT Input) VS_OUTPUT vs_main(VS_INPUT Input)
{ {
VS_OUTPUT Output = (VS_OUTPUT)0; VS_OUTPUT Output = (VS_OUTPUT)0;
Output.Position = float4(Input.Position.xyz, 1.0f); Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= TargetSize; Output.Position.xy /= ScreenSize;
Output.Position.y = 1.0f - Output.Position.y; Output.Position.y = 1.0f - Output.Position.y;
Output.Position.xy -= float2(0.5f, 0.5f); Output.Position.xy -= float2(0.5f, 0.5f);
Output.Position.xy *= float2(2.0f, 2.0f); Output.Position.xy *= float2(2.0f, 2.0f);
Output.Color = Input.Color; Output.Color = Input.Color;
Output.TexCoord = (Input.Position.xy + 0.5f) / TargetSize; Output.TexCoord = (Input.Position.xy + 0.5f) / ScreenSize;
return Output; return Output;
} }

View File

@ -1051,6 +1051,8 @@ int shaders::create_resources(bool reset)
post_effect->add_uniform("Power", uniform::UT_VEC3, uniform::CU_POST_POWER); post_effect->add_uniform("Power", uniform::UT_VEC3, uniform::CU_POST_POWER);
post_effect->add_uniform("Floor", uniform::UT_VEC3, uniform::CU_POST_FLOOR); post_effect->add_uniform("Floor", uniform::UT_VEC3, uniform::CU_POST_FLOOR);
bloom_effect->add_uniform("SourceRect", uniform::UT_VEC2, uniform::CU_SOURCE_RECT);
initialized = true; initialized = true;
return 0; return 0;
@ -1629,7 +1631,7 @@ void shaders::screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta,
HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, rt->target[2]); HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, rt->target[2]);
result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(1,0,0,0), 0, 0); result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
curr_effect->begin(&num_passes, 0); curr_effect->begin(&num_passes, 0);
@ -1697,14 +1699,17 @@ void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta,
} }
curr_effect = bloom_effect; curr_effect = bloom_effect;
curr_effect->update_uniforms();
float weight0123[4] = { options->bloom_level0_weight, options->bloom_level1_weight, options->bloom_level2_weight, options->bloom_level3_weight }; float weight0123[4] = { options->bloom_level0_weight, options->bloom_level1_weight, options->bloom_level2_weight, options->bloom_level3_weight };
float weight4567[4] = { options->bloom_level4_weight, options->bloom_level5_weight, options->bloom_level6_weight, options->bloom_level7_weight }; float weight4567[4] = { options->bloom_level4_weight, options->bloom_level5_weight, options->bloom_level6_weight, options->bloom_level7_weight };
float weight89A[3] = { options->bloom_level8_weight, options->bloom_level9_weight, options->bloom_level10_weight }; float weight89A[3] = { options->bloom_level8_weight, options->bloom_level9_weight, options->bloom_level10_weight };
float temp0[2] = { 1024.0f, 512.0f };
curr_effect->set_vector("Level0123Weight", 4, weight0123); curr_effect->set_vector("Level0123Weight", 4, weight0123);
curr_effect->set_vector("Level4567Weight", 4, weight4567); curr_effect->set_vector("Level4567Weight", 4, weight4567);
curr_effect->set_vector("Level89AWeight", 3, weight89A); curr_effect->set_vector("Level89AWeight", 3, weight89A);
curr_effect->set_vector("TargetSize", 2, &screendims.c.x); curr_effect->set_vector("ScreenSize", 2, &screendims.c.x);
curr_effect->set_vector("TextureSize", 2, temp0);
curr_effect->set_texture("DiffuseA", rt->render_texture[2]); curr_effect->set_texture("DiffuseA", rt->render_texture[2]);

View File

@ -1690,14 +1690,14 @@ void renderer::draw_quad(const render_primitive *prim)
return; return;
// fill in the vertexes clockwise // fill in the vertexes clockwise
vertex[0].x = prim->bounds.x0 - 0.5f; vertex[0].x = roundf(prim->bounds.x0) - 0.5f;
vertex[0].y = prim->bounds.y0 - 0.5f; vertex[0].y = roundf(prim->bounds.y0) - 0.5f;
vertex[1].x = prim->bounds.x1 - 0.5f; vertex[1].x = roundf(prim->bounds.x1) - 0.5f;
vertex[1].y = prim->bounds.y0 - 0.5f; vertex[1].y = roundf(prim->bounds.y0) - 0.5f;
vertex[2].x = prim->bounds.x0 - 0.5f; vertex[2].x = roundf(prim->bounds.x0) - 0.5f;
vertex[2].y = prim->bounds.y1 - 0.5f; vertex[2].y = roundf(prim->bounds.y1) - 0.5f;
vertex[3].x = prim->bounds.x1 - 0.5f; vertex[3].x = roundf(prim->bounds.x1) - 0.5f;
vertex[3].y = prim->bounds.y1 - 0.5f; vertex[3].y = roundf(prim->bounds.y1) - 0.5f;
float width = prim->bounds.x1 - prim->bounds.x0; float width = prim->bounds.x1 - prim->bounds.x0;
float height = prim->bounds.y1 - prim->bounds.y0; float height = prim->bounds.y1 - prim->bounds.y0;