HLSL Updates [Ryan Holtz, Bat Country Entertainment]

- Re-worked render target handling to align pixels better, reducing unintentional blurring
- Made major fixes to CVBS simulation, significantly increasing color saturation
This commit is contained in:
Ryan Holtz 2011-05-20 07:37:34 +00:00
parent 3126517ab3
commit fd7a110eba
6 changed files with 122 additions and 63 deletions

View File

@ -80,9 +80,11 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.y -= 0.5f; Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f); Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color; Output.Color = Input.Color;
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight); //float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight);
float2 TexCoord = (Input.Position.xy * InvTexSize) / float2(WidthRatio, HeightRatio); //float2 TexCoord = (Input.Position.xy * InvTexSize) / float2(WidthRatio, HeightRatio);
Output.TexCoord = TexCoord;//(Input.TexCoord - float2(0.5f, 0.5f)) / 8.0f + float2(0.25f, 0.25f); float2 Ratios = float2(WidthRatio, HeightRatio);
float2 Offset = float2(0.5f / RawWidth, 0.5f / RawHeight);
Output.TexCoord = Input.TexCoord;//(Input.TexCoord - float2(0.5f, 0.5f)) / 8.0f + float2(0.25f, 0.25f);
Output.ExtraInfo = Input.ExtraInfo; Output.ExtraInfo = Input.ExtraInfo;
return Output; return Output;
@ -148,7 +150,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
float3 PincushionCurveX = PinUnitCoord.x * PincushionAmount * PincushionR2; float3 PincushionCurveX = PinUnitCoord.x * PincushionAmount * PincushionR2;
float3 PincushionCurveY = PinUnitCoord.y * PincushionAmount * PincushionR2; float3 PincushionCurveY = PinUnitCoord.y * PincushionAmount * PincushionR2;
float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord * Ratios); float4 BaseTexel = tex2D(DiffuseSampler, Input.TexCoord);
// -- Alpha Clipping (1px border in drawd3d does not work for some reason) -- // -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
clip((ScreenClipCoord.x < 1.0f / TargetWidth) ? -1 : 1); clip((ScreenClipCoord.x < 1.0f / TargetWidth) ? -1 : 1);

View File

@ -7,9 +7,9 @@ texture Diffuse;
sampler DiffuseSampler = sampler_state sampler DiffuseSampler = sampler_state
{ {
Texture = <Diffuse>; Texture = <Diffuse>;
MipFilter = LINEAR; MipFilter = POINT;
MinFilter = LINEAR; MinFilter = POINT;
MagFilter = LINEAR; MagFilter = POINT;
AddressU = CLAMP; AddressU = CLAMP;
AddressV = CLAMP; AddressV = CLAMP;
AddressW = CLAMP; AddressW = CLAMP;
@ -70,20 +70,19 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position = float4(Input.Position.xyz, 1.0f); Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.x /= TargetWidth; Output.Position.x /= TargetWidth;
Output.Position.y /= TargetHeight; Output.Position.y /= TargetHeight;
//Output.Position.x /= WidthRatio;
//Output.Position.y /= HeightRatio;
Output.Position.y = 1.0f - Output.Position.y; Output.Position.y = 1.0f - Output.Position.y;
Output.Position.x -= 0.5f; Output.Position.x -= 0.5f;
Output.Position.y -= 0.5f; Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f); Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color; Output.Color = Input.Color;
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight); Output.Coord0 = Input.TexCoord + float2(0.00f / RawWidth, 0.0f);
float2 Ratios = float2(WidthRatio, HeightRatio); Output.Coord1 = Input.TexCoord + float2(0.25f / RawWidth, 0.0f);
float2 TexCoord = (Input.Position.xy * InvTexSize) / Ratios; Output.Coord2 = Input.TexCoord + float2(0.50f / RawWidth, 0.0f);
Output.Coord0 = TexCoord + float2(0.0f / RawWidth, 0.0f); Output.Coord3 = Input.TexCoord + float2(0.75f / RawWidth, 0.0f);
Output.Coord1 = TexCoord + float2(0.25f / RawWidth, 0.0f); Output.Coord4 = Input.TexCoord + float2(1.00f / RawWidth, 0.0f);
Output.Coord2 = TexCoord + float2(0.5f / RawWidth, 0.0f); Output.Coord5 = Input.TexCoord + float2(1.25f / RawWidth, 0.0f);
Output.Coord3 = TexCoord + float2(0.75f / RawWidth, 0.0f);
Output.Coord4 = TexCoord + float2(1.0f / RawWidth, 0.0f);
Output.Coord5 = TexCoord + float2(1.25f / RawWidth, 0.0f);
return Output; return Output;
} }
@ -102,6 +101,7 @@ uniform float BValue;
float4 ps_main(PS_INPUT Input) : COLOR float4 ps_main(PS_INPUT Input) : COLOR
{ {
float2 RawDims = float2(RawWidth, RawHeight);
float4 OrigC = tex2D(DiffuseSampler, Input.Coord0.xy); float4 OrigC = tex2D(DiffuseSampler, Input.Coord0.xy);
float4 OrigC2 = tex2D(DiffuseSampler, Input.Coord4.xy); float4 OrigC2 = tex2D(DiffuseSampler, Input.Coord4.xy);
float4 C = OrigC; float4 C = OrigC;
@ -116,8 +116,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
float PI = 3.14159265f; float PI = 3.14159265f;
float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio); float2 Scaler = RawDims;
float2 Scaler = float2(RawWidth, RawHeight) * InvRatios;
float2 Coord0 = Input.Coord0.xy * Scaler; float2 Coord0 = Input.Coord0.xy * Scaler;
float2 Coord1 = Input.Coord1.xy * Scaler; float2 Coord1 = Input.Coord1.xy * Scaler;
float2 Coord2 = Input.Coord2.xy * Scaler; float2 Coord2 = Input.Coord2.xy * Scaler;
@ -125,8 +124,8 @@ float4 ps_main(PS_INPUT Input) : COLOR
float2 Coord4 = Input.Coord4.xy * Scaler; float2 Coord4 = Input.Coord4.xy * Scaler;
float2 Coord5 = Input.Coord5.xy * Scaler; float2 Coord5 = Input.Coord5.xy * Scaler;
float W = WValue * 2.0f; float W = WValue;
float YRatio = 0.5333f; float YRatio = 1.0f;
float T0 = Coord0.x + AValue * YRatio * Coord0.y + BValue; float T0 = Coord0.x + AValue * YRatio * Coord0.y + BValue;
float T1 = Coord1.x + AValue * YRatio * Coord1.y + BValue; float T1 = Coord1.x + AValue * YRatio * Coord1.y + BValue;
float T2 = Coord2.x + AValue * YRatio * Coord2.y + BValue; float T2 = Coord2.x + AValue * YRatio * Coord2.y + BValue;
@ -152,8 +151,6 @@ float4 ps_main(PS_INPUT Input) : COLOR
float3 OutRGB = float3(dot(YIQ, float3(1.0f, 0.9563f, 0.6210f)), dot(YIQ, float3(1.0f, -0.2721f, -0.6474f)), dot(YIQ, float3(1.0f, -1.1070f, 1.7046f))); float3 OutRGB = float3(dot(YIQ, float3(1.0f, 0.9563f, 0.6210f)), dot(YIQ, float3(1.0f, -0.2721f, -0.6474f)), dot(YIQ, float3(1.0f, -1.1070f, 1.7046f)));
// Debugging: return sin(W * Tc) * 0.5f + 0.5f;
// Debugging: return float4(0.5f + 0.5f * sin(W * float3(T0, T2, T4)), 1.0f);
return float4(OutRGB, 1.0f); return float4(OutRGB, 1.0f);
} }

View File

@ -66,14 +66,11 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position = float4(Input.Position.xyz, 1.0f); Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.x /= TargetWidth; Output.Position.x /= TargetWidth;
Output.Position.y /= TargetHeight; Output.Position.y /= TargetHeight;
Output.Position.y /= HeightRatio;
Output.Position.y = 1.0f - Output.Position.y; Output.Position.y = 1.0f - Output.Position.y;
Output.Position.x /= WidthRatio;
Output.Position.x -= 0.5f; Output.Position.x -= 0.5f;
Output.Position.y -= 0.5f; Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f); Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color; Output.Color = Input.Color;
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight);
Output.Coord0 = Input.TexCoord + float2(0.00f / RawWidth, 0.0f); Output.Coord0 = Input.TexCoord + float2(0.00f / RawWidth, 0.0f);
Output.Coord1 = Input.TexCoord + float2(0.25f / RawWidth, 0.0f); Output.Coord1 = Input.TexCoord + float2(0.25f / RawWidth, 0.0f);
Output.Coord2 = Input.TexCoord + float2(0.50f / RawWidth, 0.0f); Output.Coord2 = Input.TexCoord + float2(0.50f / RawWidth, 0.0f);
@ -96,27 +93,25 @@ uniform float BValue;
float4 ps_main(PS_INPUT Input) : COLOR float4 ps_main(PS_INPUT Input) : COLOR
{ {
float3 Texel0 = tex2D(DiffuseSampler, Input.Coord0).rgb; float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio);
float3 Texel1 = tex2D(DiffuseSampler, Input.Coord1).rgb; float2 Offset = float2(0.5f / RawWidth, 0.5f / RawHeight);
float3 Texel2 = tex2D(DiffuseSampler, Input.Coord2).rgb; float3 Texel0 = tex2D(DiffuseSampler, Input.Coord0 - Offset).rgb;
float3 Texel3 = tex2D(DiffuseSampler, Input.Coord3).rgb; float3 Texel1 = tex2D(DiffuseSampler, Input.Coord1 - Offset).rgb;
float3 Texel2 = tex2D(DiffuseSampler, Input.Coord2 - Offset).rgb;
float3 Texel3 = tex2D(DiffuseSampler, Input.Coord3 - Offset).rgb;
// Cos goes from 1 to 0 to 1 over the course of 2PI float2 Scaler = float2(RawWidth, RawHeight);
// Sin goes from 0 to 1 to 0 over the course of 2PI float2 Coord0 = Input.Coord0.xy * Scaler;
// WValue is 4PI / 3 float2 Coord1 = Input.Coord1.xy * Scaler;
// That is, 3 cycles through WValue will reuslt in 4PI being traversed, or cos() to go from 1 to 0 to 1 to 0 to 1 float2 Coord2 = Input.Coord2.xy * Scaler;
// WValue appears to be the chroma carrier rate float2 Coord3 = Input.Coord3.xy * Scaler;
// 1 Pixel -> 1 cycle
// WValue will cycle from 1 to 0 to 1 to 0 to 1 over 3 pixels
float PI = 3.14159265f;
float W = WValue; float W = WValue;
float YRatio = 1.0f;
float T0 = Input.Coord0.x * (RawWidth / WidthRatio) * 2.0f + AValue * 0.5333f * Input.Coord0.y * (RawHeight / HeightRatio) * 2.0f + BValue * 2.0f + 2.0f; float T0 = Coord0.x + AValue * YRatio * Coord0.y + BValue;
float T1 = Input.Coord1.x * (RawWidth / WidthRatio) * 2.0f + AValue * 0.5333f * Input.Coord1.y * (RawHeight / HeightRatio) * 2.0f + BValue * 2.0f + 2.0f; float T1 = Coord1.x + AValue * YRatio * Coord1.y + BValue;
float T2 = Input.Coord2.x * (RawWidth / WidthRatio) * 2.0f + AValue * 0.5333f * Input.Coord2.y * (RawHeight / HeightRatio) * 2.0f + BValue * 2.0f + 2.0f; float T2 = Coord2.x + AValue * YRatio * Coord2.y + BValue;
float T3 = Input.Coord3.x * (RawWidth / WidthRatio) * 2.0f + AValue * 0.5333f * Input.Coord3.y * (RawHeight / HeightRatio) * 2.0f + BValue * 2.0f + 2.0f; float T3 = Coord3.x + AValue * YRatio * Coord3.y + BValue;
float Y0 = dot(Texel0, float3(0.299f, 0.587f, 0.114f)); float Y0 = dot(Texel0, float3(0.299f, 0.587f, 0.114f));
float I0 = dot(Texel0, float3(0.595716f, -0.274453f, -0.321263f)); float I0 = dot(Texel0, float3(0.595716f, -0.274453f, -0.321263f));
@ -134,8 +129,6 @@ float4 ps_main(PS_INPUT Input) : COLOR
float I3 = dot(Texel3, float3(0.595716f, -0.274453f, -0.321263f)); float I3 = dot(Texel3, float3(0.595716f, -0.274453f, -0.321263f));
float Q3 = dot(Texel3, float3(0.211456f, -0.522591f, 0.311135f)); float Q3 = dot(Texel3, float3(0.211456f, -0.522591f, 0.311135f));
//float MaxC = 1.5957f;
//float MinC = -0.5957f;
float MaxC = 2.1183f; float MaxC = 2.1183f;
float MinC = -1.1183f; float MinC = -1.1183f;
float CRange = MaxC - MinC; float CRange = MaxC - MinC;
@ -149,7 +142,6 @@ float4 ps_main(PS_INPUT Input) : COLOR
C2 = (C2 - MinC) / CRange; C2 = (C2 - MinC) / CRange;
C3 = (C3 - MinC) / CRange; C3 = (C3 - MinC) / CRange;
float4 Tc = float4(T0, T1, T2, T3);
return float4(C0, C1, C2, C3); return float4(C0, C1, C2, C3);
} }

View File

@ -87,7 +87,7 @@ extern void mtlog_add(const char *event);
#define ENABLE_BORDER_PIX (1) #define ENABLE_BORDER_PIX (1)
#define VERTEX_BASE_FORMAT (D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEX2) #define VERTEX_BASE_FORMAT (D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEX2)
#define VERTEX_BUFFER_SIZE (2048*4) #define VERTEX_BUFFER_SIZE (2048*6+6)
enum enum
{ {
@ -200,6 +200,7 @@ struct _d3d_info
d3d_effect * color_effect; // pointer to the current color-effect object d3d_effect * color_effect; // pointer to the current color-effect object
d3d_effect * yiq_encode_effect; // pointer to the current YIQ encoder effect object d3d_effect * yiq_encode_effect; // pointer to the current YIQ encoder effect object
d3d_effect * yiq_decode_effect; // pointer to the current YIQ decoder effect object d3d_effect * yiq_decode_effect; // pointer to the current YIQ decoder effect object
d3d_vertex * fsfx_vertices; // pointer to our full-screen-quad object
poly_info poly[VERTEX_BUFFER_SIZE / 3];// array to hold polygons as they are created poly_info poly[VERTEX_BUFFER_SIZE / 3];// array to hold polygons as they are created
int numpolys; // number of accumulated polygons int numpolys; // number of accumulated polygons
@ -524,6 +525,7 @@ static int update_window_size(win_window_info *window);
// drawing // drawing
static void draw_line(d3d_info *d3d, const render_primitive *prim); static void draw_line(d3d_info *d3d, const render_primitive *prim);
static void draw_quad(d3d_info *d3d, const render_primitive *prim); static void draw_quad(d3d_info *d3d, const render_primitive *prim);
static void init_fsfx_quad(d3d_info *d3d);
// primitives // primitives
static d3d_vertex *primitive_alloc(d3d_info *d3d, int numverts); static d3d_vertex *primitive_alloc(d3d_info *d3d, int numverts);
@ -744,6 +746,11 @@ mtlog_add("drawd3d_window_draw: begin_scene");
d3d->lockedbuf = NULL; d3d->lockedbuf = NULL;
// loop over primitives // loop over primitives
if(d3d->hlsl_enable && d3dintf->post_fx_available)
{
init_fsfx_quad(d3d);
}
mtlog_add("drawd3d_window_draw: primitive loop begin"); mtlog_add("drawd3d_window_draw: primitive loop begin");
for (prim = window->primlist->first(); prim != NULL; prim = prim->next()) for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
switch (prim->type) switch (prim->type)
@ -1973,6 +1980,59 @@ static void draw_quad(d3d_info *d3d, const render_primitive *prim)
//============================================================
// init_fsfx_quad
//============================================================
static void init_fsfx_quad(d3d_info *d3d)
{
// get a pointer to the vertex buffer
d3d->fsfx_vertices = primitive_alloc(d3d, 6);
if (d3d->fsfx_vertices == NULL)
return;
// fill in the vertexes clockwise
windows_options &options = downcast<windows_options &>(d3d->window->machine().options());
float scale_top = options.screen_scale_top();
float scale_bottom = options.screen_scale_bottom();
d3d->fsfx_vertices[0].x = (d3d->width * (scale_top * 0.5f - 0.5f));
d3d->fsfx_vertices[0].y = 0.0f;
d3d->fsfx_vertices[1].x = d3d->width - (d3d->width * (scale_top * 0.5f - 0.5f));
d3d->fsfx_vertices[1].y = 0.0f;
d3d->fsfx_vertices[2].x = (d3d->width * (scale_bottom * 0.5f - 0.5f));
d3d->fsfx_vertices[2].y = d3d->height;
d3d->fsfx_vertices[3].x = d3d->width - (d3d->width * (scale_top * 0.5f - 0.5f));
d3d->fsfx_vertices[3].y = 0.0f;
d3d->fsfx_vertices[4].x = (d3d->width * (scale_bottom * 0.5f - 0.5f));
d3d->fsfx_vertices[4].y = d3d->height;
d3d->fsfx_vertices[5].x = d3d->width - (d3d->width * (scale_bottom * 0.5f - 0.5f));
d3d->fsfx_vertices[5].y = d3d->height;
d3d->fsfx_vertices[0].u0 = 0.0f;
d3d->fsfx_vertices[0].v0 = 0.0f;
d3d->fsfx_vertices[1].u0 = 1.0f;
d3d->fsfx_vertices[1].v0 = 0.0f;
d3d->fsfx_vertices[2].u0 = 0.0f;
d3d->fsfx_vertices[2].v0 = 1.0f;
d3d->fsfx_vertices[3].u0 = 1.0f;
d3d->fsfx_vertices[3].v0 = 0.0f;
d3d->fsfx_vertices[4].u0 = 0.0f;
d3d->fsfx_vertices[4].v0 = 1.0f;
d3d->fsfx_vertices[5].u0 = 1.0f;
d3d->fsfx_vertices[5].v0 = 1.0f;
// set the color, Z parameters to standard values
for (int i = 0; i < 6; i++)
{
d3d->fsfx_vertices[i].z = 0.0f;
d3d->fsfx_vertices[i].rhw = 1.0f;
d3d->fsfx_vertices[i].color = D3DCOLOR_ARGB(255, 255, 255, 255);
}
}
//============================================================ //============================================================
// primitive_alloc // primitive_alloc
//============================================================ //============================================================
@ -2050,13 +2110,18 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
result = (*d3dintf->device.get_render_target)(d3d->device, 0, &backbuffer); result = (*d3dintf->device.get_render_target)(d3d->device, 0, &backbuffer);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result);
vertnum = 6;
}
else
{
vertnum = 0;
} }
windows_options &options = downcast<windows_options &>(d3d->window->machine().options()); windows_options &options = downcast<windows_options &>(d3d->window->machine().options());
int cur_render_screen = 0; int cur_render_screen = 0;
// now do the polys // now do the polys
for (polynum = vertnum = 0; polynum < d3d->numpolys; polynum++) for (polynum = 0; polynum < d3d->numpolys; polynum++)
{ {
poly_info *poly = &d3d->poly[polynum]; poly_info *poly = &d3d->poly[polynum];
int newfilter; int newfilter;
@ -2160,7 +2225,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2177,8 +2242,6 @@ static void primitive_flush_pending(d3d_info *d3d)
(*d3dintf->effect.set_float)(curr_effect, "HeightRatio", poly->texture != NULL ? (1.0f / (poly->texture->vstop - poly->texture->vstart)) : 0.0f); (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", poly->texture != NULL ? (1.0f / (poly->texture->vstop - poly->texture->vstart)) : 0.0f);
(*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
(*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
(*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
(*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
(*d3dintf->effect.set_float)(curr_effect, "WValue", options.screen_yiq_w()); (*d3dintf->effect.set_float)(curr_effect, "WValue", options.screen_yiq_w());
(*d3dintf->effect.set_float)(curr_effect, "AValue", options.screen_yiq_a()); (*d3dintf->effect.set_float)(curr_effect, "AValue", options.screen_yiq_a());
(*d3dintf->effect.set_float)(curr_effect, "BValue", (float)poly->texture->cur_frame * options.screen_yiq_b()); (*d3dintf->effect.set_float)(curr_effect, "BValue", (float)poly->texture->cur_frame * options.screen_yiq_b());
@ -2195,7 +2258,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2252,7 +2315,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2293,7 +2356,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2331,7 +2394,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2361,7 +2424,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2396,7 +2459,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2422,7 +2485,7 @@ static void primitive_flush_pending(d3d_info *d3d)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -2432,7 +2495,7 @@ static void primitive_flush_pending(d3d_info *d3d)
/* Scanlines and shadow mask */ /* Scanlines and shadow mask */
curr_effect = d3d->post_effect; curr_effect = d3d->post_effect;
(*d3dintf->effect.set_texture)(curr_effect, "Diffuse", poly->texture->d3dtexture0); (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", poly->texture->d3dtexture3);
result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer); result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 5\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 5\n", (int)result);
@ -2686,7 +2749,6 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour
goto error; goto error;
(*d3dintf->texture.get_surface_level)(texture->d3dtexture3, 0, &texture->d3dtarget3); (*d3dintf->texture.get_surface_level)(texture->d3dtexture3, 0, &texture->d3dtarget3);
printf("Boo\n");
result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture4); result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture4);
if (result != D3D_OK) if (result != D3D_OK)
goto error; goto error;

View File

@ -341,6 +341,8 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_OVERSAMPLE_X";fs_overx(0.1-9.0)", "1.0", OPTION_FLOAT, "oversample amount in screen-relative X direction, multiple" }, { WINOPTION_OVERSAMPLE_X";fs_overx(0.1-9.0)", "1.0", OPTION_FLOAT, "oversample amount in screen-relative X direction, multiple" },
{ WINOPTION_OVERSAMPLE_Y";fs_overy(0.1-9.0)", "1.0", OPTION_FLOAT, "oversample amount in screen-relative Y direction, multiple" }, { WINOPTION_OVERSAMPLE_Y";fs_overy(0.1-9.0)", "1.0", OPTION_FLOAT, "oversample amount in screen-relative Y direction, multiple" },
{ WINOPTION_CURVATURE";fs_curv(0.0-4.0)", "0.0", OPTION_FLOAT, "screen curvature amount" }, { WINOPTION_CURVATURE";fs_curv(0.0-4.0)", "0.0", OPTION_FLOAT, "screen curvature amount" },
{ WINOPTION_SCREEN_SCALE_TOP";fs_scalex(0.0-2.0)", "1.0", OPTION_FLOAT, "screen scale, top" },
{ WINOPTION_SCREEN_SCALE_BOTTOM";fs_scaley(0.0-2.0)", "1.0", OPTION_FLOAT, "screen scale, bottom" },
/* Beam-related values below this line*/ /* Beam-related values below this line*/
{ WINOPTION_PINCUSHION";fs_pin(0.0-4.0)", "0.0", OPTION_FLOAT, "pincushion amount" }, { WINOPTION_PINCUSHION";fs_pin(0.0-4.0)", "0.0", OPTION_FLOAT, "pincushion amount" },
{ WINOPTION_SCANLINE_AMOUNT";fs_scanam(0.0-4.0)", "0.0", OPTION_FLOAT, "overall alpha scaling value for scanlines" }, { WINOPTION_SCANLINE_AMOUNT";fs_scanam(0.0-4.0)", "0.0", OPTION_FLOAT, "overall alpha scaling value for scanlines" },

View File

@ -90,6 +90,8 @@
#define WINOPTION_SHADOW_MASK_USIZE "shadow_mask_usize" #define WINOPTION_SHADOW_MASK_USIZE "shadow_mask_usize"
#define WINOPTION_SHADOW_MASK_VSIZE "shadow_mask_vsize" #define WINOPTION_SHADOW_MASK_VSIZE "shadow_mask_vsize"
#define WINOPTION_PINCUSHION "pincushion" #define WINOPTION_PINCUSHION "pincushion"
#define WINOPTION_SCREEN_SCALE_TOP "screen_scale_top"
#define WINOPTION_SCREEN_SCALE_BOTTOM "screen_scale_bottom"
#define WINOPTION_CURVATURE "curvature" #define WINOPTION_CURVATURE "curvature"
#define WINOPTION_OVERSAMPLE_X "oversample_x" #define WINOPTION_OVERSAMPLE_X "oversample_x"
#define WINOPTION_OVERSAMPLE_Y "oversample_y" #define WINOPTION_OVERSAMPLE_Y "oversample_y"
@ -224,6 +226,8 @@ public:
float screen_scanline_bright_offset() const { return float_value(WINOPTION_SCANLINE_BRIGHT_OFFSET); } float screen_scanline_bright_offset() const { return float_value(WINOPTION_SCANLINE_BRIGHT_OFFSET); }
float screen_scanline_offset() const { return float_value(WINOPTION_SCANLINE_OFFSET); } float screen_scanline_offset() const { return float_value(WINOPTION_SCANLINE_OFFSET); }
float screen_pincushion() const { return float_value(WINOPTION_PINCUSHION); } float screen_pincushion() const { return float_value(WINOPTION_PINCUSHION); }
float screen_scale_top() const { return float_value(WINOPTION_SCREEN_SCALE_TOP); }
float screen_scale_bottom() const { return float_value(WINOPTION_SCREEN_SCALE_BOTTOM); }
float screen_curvature() const { return float_value(WINOPTION_CURVATURE); } float screen_curvature() const { return float_value(WINOPTION_CURVATURE); }
float screen_defocus_x() const { return float_value(WINOPTION_DEFOCUS_X); } float screen_defocus_x() const { return float_value(WINOPTION_DEFOCUS_X); }
float screen_defocus_y() const { return float_value(WINOPTION_DEFOCUS_Y); } float screen_defocus_y() const { return float_value(WINOPTION_DEFOCUS_Y); }