diff options
author | 2013-05-22 01:58:38 +0000 | |
---|---|---|
committer | 2013-05-22 01:58:38 +0000 | |
commit | 35ef098e64a825890a98cec461a955d08f4cdb91 (patch) | |
tree | 6aa3d1038c806f51e5b2eba9b5ecdac810119be7 | |
parent | 2d474c6a3bcb7719d438a5f6b5951655351e4518 (diff) |
MAME Testers bugs fixed: 5201, 5202
- HLSL changes: [MooglyGuy]
* Upped vertex buffer size to 64k verts, fixes assert in
starwars and alphaone, please include the printed error
message in any subsequent encounterings of the assert.
* Improved vector rendering (beam width 1.5 suggested)
* Ducked raster bloom default to 0.225 to reduce washout
-rw-r--r-- | hlsl/bloom.fx | 1 | ||||
-rw-r--r-- | hlsl/color.fx | 1 | ||||
-rw-r--r-- | hlsl/deconverge.fx | 1 | ||||
-rw-r--r-- | hlsl/downsample.fx | 21 | ||||
-rw-r--r-- | hlsl/focus.fx | 1 | ||||
-rw-r--r-- | hlsl/phosphor.fx | 1 | ||||
-rw-r--r-- | hlsl/pincushion.fx | 1 | ||||
-rw-r--r-- | hlsl/post.fx | 1 | ||||
-rw-r--r-- | hlsl/prescale.fx | 1 | ||||
-rw-r--r-- | hlsl/primary.fx | 1 | ||||
-rw-r--r-- | hlsl/vector.fx | 16 | ||||
-rw-r--r-- | hlsl/yiq_decode.fx | 1 | ||||
-rw-r--r-- | hlsl/yiq_encode.fx | 1 | ||||
-rw-r--r-- | src/osd/windows/d3dcomm.h | 1 | ||||
-rw-r--r-- | src/osd/windows/d3dhlsl.c | 13 | ||||
-rw-r--r-- | src/osd/windows/drawd3d.c | 18 | ||||
-rw-r--r-- | src/osd/windows/drawd3d.h | 4 | ||||
-rw-r--r-- | src/osd/windows/winmain.c | 32 |
18 files changed, 83 insertions, 33 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx index a39657c2d9f..83f87a2961d 100644 --- a/hlsl/bloom.fx +++ b/hlsl/bloom.fx @@ -156,6 +156,7 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/color.fx b/hlsl/color.fx index e22bd17634b..95881d71c2c 100644 --- a/hlsl/color.fx +++ b/hlsl/color.fx @@ -31,6 +31,7 @@ struct VS_INPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/deconverge.fx b/hlsl/deconverge.fx index 3943b2666cd..1478dd23418 100644 --- a/hlsl/deconverge.fx +++ b/hlsl/deconverge.fx @@ -36,6 +36,7 @@ struct VS_INPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx index 9790af2b4a5..e4e3b400ee7 100644 --- a/hlsl/downsample.fx +++ b/hlsl/downsample.fx @@ -32,6 +32,7 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT @@ -62,10 +63,11 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Position.xy *= float2(2.0f, 2.0f); Output.Color = Input.Color; float2 inversePixel = 1.0f / ScreenSize; - Output.TexCoord01.xy = Input.Position.xy / ScreenSize + float2(0.5f, 0.5f) / TargetSize; - Output.TexCoord01.zw = Input.Position.xy / ScreenSize + float2(1.5f, 0.5f) / TargetSize; - Output.TexCoord23.xy = Input.Position.xy / ScreenSize + float2(0.5f, 1.5f) / TargetSize; - Output.TexCoord23.zw = Input.Position.xy / ScreenSize + float2(1.5f, 1.5f) / TargetSize; + Output.TexCoord01.xy = Input.Position.xy / ScreenSize + float2(1.0f, 1.0f) / TargetSize; + //Output.TexCoord01.xy = Input.Position.xy / ScreenSize + float2(0.5f, 0.5f) / TargetSize; + //Output.TexCoord01.zw = Input.Position.xy / ScreenSize + float2(1.5f, 0.5f) / TargetSize; + //Output.TexCoord23.xy = Input.Position.xy / ScreenSize + float2(0.5f, 1.5f) / TargetSize; + //Output.TexCoord23.zw = Input.Position.xy / ScreenSize + float2(1.5f, 1.5f) / TargetSize; return Output; } @@ -77,11 +79,12 @@ VS_OUTPUT vs_main(VS_INPUT Input) float4 ps_main(PS_INPUT Input) : COLOR { float4 texel0 = tex2D(DiffuseSampler, Input.TexCoord01.xy); - float4 texel1 = tex2D(DiffuseSampler, Input.TexCoord01.zw); - float4 texel2 = tex2D(DiffuseSampler, Input.TexCoord23.xy); - float4 texel3 = tex2D(DiffuseSampler, Input.TexCoord23.zw); - float4 outTexel = (texel0 + texel1 + texel2 + texel3) * BloomRescale; - return float4(outTexel.rgb, 1.0f); + //float4 texel1 = tex2D(DiffuseSampler, Input.TexCoord01.zw); + //float4 texel2 = tex2D(DiffuseSampler, Input.TexCoord23.xy); + //float4 texel3 = tex2D(DiffuseSampler, Input.TexCoord23.zw); + //float4 outTexel = (texel0 + texel1 + texel2 + texel3) * BloomRescale; + //return float4(outTexel.rgb, 1.0f); + return float4(texel0.rgb, 1.0f); } //----------------------------------------------------------------------------- diff --git a/hlsl/focus.fx b/hlsl/focus.fx index 0df9c876b2b..f51957d630c 100644 --- a/hlsl/focus.fx +++ b/hlsl/focus.fx @@ -38,6 +38,7 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx index b1a7f983435..b1842fdf02a 100644 --- a/hlsl/phosphor.fx +++ b/hlsl/phosphor.fx @@ -45,6 +45,7 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/pincushion.fx b/hlsl/pincushion.fx index 03f4dbc278d..7e856c6ca26 100644 --- a/hlsl/pincushion.fx +++ b/hlsl/pincushion.fx @@ -34,6 +34,7 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/post.fx b/hlsl/post.fx index 5b4640db496..7bbda640dcf 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -44,6 +44,7 @@ struct VS_INPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/prescale.fx b/hlsl/prescale.fx index 965d89691f8..3c207875ca2 100644 --- a/hlsl/prescale.fx +++ b/hlsl/prescale.fx @@ -30,6 +30,7 @@ struct VS_INPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/primary.fx b/hlsl/primary.fx index 53653cfba16..472c2dc4692 100644 --- a/hlsl/primary.fx +++ b/hlsl/primary.fx @@ -31,6 +31,7 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/vector.fx b/hlsl/vector.fx index e93d8dee4cf..89072253e88 100644 --- a/hlsl/vector.fx +++ b/hlsl/vector.fx @@ -11,6 +11,7 @@ struct VS_OUTPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 LineInfo : TEXCOORD1; }; struct VS_INPUT @@ -18,12 +19,14 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 LineInfo : TEXCOORD1; }; struct PS_INPUT { float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 LineInfo : TEXCOORD1; }; //----------------------------------------------------------------------------- @@ -48,7 +51,7 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f); Output.Color = Input.Color; Output.TexCoord = Input.Position.xy / float2(TargetWidth, TargetHeight); - + Output.LineInfo = Input.LineInfo; return Output; } @@ -58,17 +61,18 @@ VS_OUTPUT vs_main(VS_INPUT Input) // TimeParams.x: Frame time of the vector // TimeParams.y: How much frame time affects the vector's fade -// LengthParams.x: Length of the vector // LengthParams.y: How much length affects the vector's fade // LengthParams.z: Size at which fade is maximum float4 ps_main(PS_INPUT Input) : COLOR { - float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y) * 2.0; + float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y) * 1.0; - float lengthModulate = clamp(1.0f - LengthParams.x / LengthParams.z, 0.0f, 1.0f); - lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 2.0; + float lengthModulate = 1.0f - clamp(Input.LineInfo.x / LengthParams.z, 0.0f, 1.0f); + float minLength = 2.0f - clamp(Input.LineInfo.x - 1.0f, 0.0f, 2.0f); + lengthModulate = lerp(lengthModulate, 4.0f, minLength * 0.5f); + lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 1.0; - float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 8.0; + float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 2.0; return outColor; } diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx index af3c01c34ab..afbdb98e528 100644 --- a/hlsl/yiq_decode.fx +++ b/hlsl/yiq_decode.fx @@ -43,6 +43,7 @@ struct VS_INPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/hlsl/yiq_encode.fx b/hlsl/yiq_encode.fx index 2a2a1e40851..8793bfbb633 100644 --- a/hlsl/yiq_encode.fx +++ b/hlsl/yiq_encode.fx @@ -34,6 +34,7 @@ struct VS_INPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 Unused : TEXCOORD1; }; struct PS_INPUT diff --git a/src/osd/windows/d3dcomm.h b/src/osd/windows/d3dcomm.h index ec3ee2e97c9..c1db074e24e 100644 --- a/src/osd/windows/d3dcomm.h +++ b/src/osd/windows/d3dcomm.h @@ -261,6 +261,7 @@ struct vertex float rhw; // RHW when no HLSL, padding when HLSL D3DCOLOR color; // diffuse color float u0, v0; // texture stage 0 coordinates + float u1, v1; // additional info for vector data }; diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c index f81b8870c26..ff53845498c 100644 --- a/src/osd/windows/d3dhlsl.c +++ b/src/osd/windows/d3dhlsl.c @@ -1075,6 +1075,19 @@ void shaders::init_fsfx_quad(void *vertbuf) fsfx_vertices[5].u0 = 1.0f; fsfx_vertices[5].v0 = 1.0f; + fsfx_vertices[0].u1 = 0.0f; + fsfx_vertices[0].v1 = 0.0f; + fsfx_vertices[1].u1 = 0.0f; + fsfx_vertices[1].v1 = 0.0f; + fsfx_vertices[2].u1 = 0.0f; + fsfx_vertices[2].v1 = 0.0f; + fsfx_vertices[3].u1 = 0.0f; + fsfx_vertices[3].v1 = 0.0f; + fsfx_vertices[4].u1 = 0.0f; + fsfx_vertices[4].v1 = 0.0f; + fsfx_vertices[5].u1 = 0.0f; + fsfx_vertices[5].v1 = 0.0f; + // set the color, Z parameters to standard values for (int i = 0; i < 6; i++) { diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 686df150f5e..fc0d418e18e 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -1621,6 +1621,10 @@ void renderer::batch_vector(const render_primitive *prim, float line_time) m_vectorbatch[m_batchindex + 5].x = b1.x1 + step->xoffs; m_vectorbatch[m_batchindex + 5].y = b1.y1 + step->yoffs; + float dx = b1.x1 - b0.x1; + float dy = b1.y1 - b0.y1; + float line_length = sqrtf(dx * dx + dy * dy); + // determine the color of the line INT32 r = (INT32)(prim->color.r * step->weight * 255.0f); INT32 g = (INT32)(prim->color.g * step->weight * 255.0f); @@ -1649,6 +1653,13 @@ void renderer::batch_vector(const render_primitive *prim, float line_time) m_vectorbatch[m_batchindex + 5].u0 = stop.c.x; m_vectorbatch[m_batchindex + 5].v0 = stop.c.y; + m_vectorbatch[m_batchindex + 0].u1 = line_length; + m_vectorbatch[m_batchindex + 1].u1 = line_length; + m_vectorbatch[m_batchindex + 2].u1 = line_length; + m_vectorbatch[m_batchindex + 3].u1 = line_length; + m_vectorbatch[m_batchindex + 4].u1 = line_length; + m_vectorbatch[m_batchindex + 5].u1 = line_length; + // set the color, Z parameters to standard values for (int i = 0; i < 6; i++) { @@ -1868,6 +1879,7 @@ vertex *renderer::mesh_alloc(int numverts) // if we're going to overflow, flush if (m_lockedbuf != NULL && m_numverts + numverts >= VERTEX_BUFFER_SIZE) { + printf("request for %d verts\n", numverts); primitive_flush_pending(); if(m_shaders->enabled()) @@ -1952,6 +1964,12 @@ void renderer::primitive_flush_pending() // set the blendmode if different set_blendmode(PRIMFLAG_GET_BLENDMODE(flags)); + if (vertnum + m_poly[polynum].get_vertcount() > m_numverts) + { + printf("Error: vertnum (%d) plus poly vertex count (%d) > %d\n", vertnum, m_poly[polynum].get_vertcount(), m_numverts); + fflush(stdout); + } + assert(vertnum + m_poly[polynum].get_vertcount() <= m_numverts); if(m_shaders->enabled() && d3dintf->post_fx_available) diff --git a/src/osd/windows/drawd3d.h b/src/osd/windows/drawd3d.h index 95d34ebb6a0..4a6d9b76582 100644 --- a/src/osd/windows/drawd3d.h +++ b/src/osd/windows/drawd3d.h @@ -50,8 +50,8 @@ // CONSTANTS //============================================================ -#define VERTEX_BASE_FORMAT (D3DFVF_DIFFUSE | D3DFVF_TEX1) -#define VERTEX_BUFFER_SIZE (10240*4+4) +#define VERTEX_BASE_FORMAT (D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEX2) +#define VERTEX_BUFFER_SIZE (16384*4+4) //============================================================ // TYPE DEFINITIONS diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index b57fd4782f6..365f4de3bb2 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -393,24 +393,24 @@ const options_entry windows_options::s_option_entries[] = /* Vector simulation below this line */ { NULL, NULL, OPTION_HEADER, "VECTOR POST-PROCESSING OPTIONS" }, { WINOPTION_VECTOR_TIME_SCALE";vectime", "0.0", OPTION_FLOAT, "How much the fade rate affects vector fade" }, - { WINOPTION_VECTOR_TIME_PERIOD";vecperiod", "0.1", OPTION_FLOAT, "Vector fade rate versus screen refresh rate" }, - { WINOPTION_VECTOR_LENGTH_SCALE";veclength", "0.9", OPTION_FLOAT, "How much length affects vector fade" }, - { WINOPTION_VECTOR_LENGTH_RATIO";vecsize", "4.0", OPTION_FLOAT, "Vector fade length (4.0 - vectors fade the most at and above 4 pixels, etc.)" }, + { WINOPTION_VECTOR_TIME_PERIOD";vecperiod", "0.0", OPTION_FLOAT, "Vector fade rate versus screen refresh rate" }, + { WINOPTION_VECTOR_LENGTH_SCALE";veclength", "0.8", OPTION_FLOAT, "How much length affects vector fade" }, + { WINOPTION_VECTOR_LENGTH_RATIO";vecsize", "500.0", OPTION_FLOAT, "Vector fade length (4.0 - vectors fade the most at and above 4 pixels, etc.)" }, /* Bloom below this line */ { NULL, NULL, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" }, - { WINOPTION_VECTOR_BLOOM_SCALE, "0.3", OPTION_FLOAT, "Intensity factor for vector bloom" }, - { WINOPTION_RASTER_BLOOM_SCALE, "0.25", OPTION_FLOAT, "Intensity factor for raster bloom" }, - { WINOPTION_BLOOM_LEVEL0_WEIGHT, "1.0", OPTION_FLOAT, "Bloom level 0 (full-size target) weight" }, - { WINOPTION_BLOOM_LEVEL1_WEIGHT, "0.21", OPTION_FLOAT, "Bloom level 1 (half-size target) weight" }, - { WINOPTION_BLOOM_LEVEL2_WEIGHT, "0.19", OPTION_FLOAT, "Bloom level 2 (quarter-size target) weight" }, - { WINOPTION_BLOOM_LEVEL3_WEIGHT, "0.17", OPTION_FLOAT, "Bloom level 3 (.) weight" }, - { WINOPTION_BLOOM_LEVEL4_WEIGHT, "0.15", OPTION_FLOAT, "Bloom level 4 (.) weight" }, - { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.14", OPTION_FLOAT, "Bloom level 5 (.) weight" }, - { WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.13", OPTION_FLOAT, "Bloom level 6 (.) weight" }, - { WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.12", OPTION_FLOAT, "Bloom level 7 (.) weight" }, - { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.11", OPTION_FLOAT, "Bloom level 8 (.) weight" }, - { WINOPTION_BLOOM_LEVEL9_WEIGHT, "0.10", OPTION_FLOAT, "Bloom level 9 (.) weight" }, - { WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.09", OPTION_FLOAT, "Bloom level 10 (1x1 target) weight" }, + { WINOPTION_VECTOR_BLOOM_SCALE, "0.3", OPTION_FLOAT, "Intensity factor for vector bloom" }, + { WINOPTION_RASTER_BLOOM_SCALE, "0.225", OPTION_FLOAT, "Intensity factor for raster bloom" }, + { WINOPTION_BLOOM_LEVEL0_WEIGHT, "1.0", OPTION_FLOAT, "Bloom level 0 (full-size target) weight" }, + { WINOPTION_BLOOM_LEVEL1_WEIGHT, "0.21", OPTION_FLOAT, "Bloom level 1 (half-size target) weight" }, + { WINOPTION_BLOOM_LEVEL2_WEIGHT, "0.19", OPTION_FLOAT, "Bloom level 2 (quarter-size target) weight" }, + { WINOPTION_BLOOM_LEVEL3_WEIGHT, "0.17", OPTION_FLOAT, "Bloom level 3 (.) weight" }, + { WINOPTION_BLOOM_LEVEL4_WEIGHT, "0.15", OPTION_FLOAT, "Bloom level 4 (.) weight" }, + { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.14", OPTION_FLOAT, "Bloom level 5 (.) weight" }, + { WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.13", OPTION_FLOAT, "Bloom level 6 (.) weight" }, + { WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.12", OPTION_FLOAT, "Bloom level 7 (.) weight" }, + { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.11", OPTION_FLOAT, "Bloom level 8 (.) weight" }, + { WINOPTION_BLOOM_LEVEL9_WEIGHT, "0.10", OPTION_FLOAT, "Bloom level 9 (.) weight" }, + { WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.09", OPTION_FLOAT, "Bloom level 10 (1x1 target) weight" }, // per-window options { NULL, NULL, OPTION_HEADER, "PER-WINDOW VIDEO OPTIONS" }, |