mirror of
https://github.com/holub/mame
synced 2025-06-08 13:53:52 +03:00
minor shader cleanup, nw
This commit is contained in:
parent
80fa5fade3
commit
a86d35158c
@ -44,8 +44,7 @@ struct PS_INPUT
|
|||||||
// Post-Processing Vertex Shader
|
// Post-Processing Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
|
|
||||||
uniform float2 RawDims;
|
uniform float2 RawDims;
|
||||||
|
|
||||||
@ -57,11 +56,9 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
|||||||
|
|
||||||
float2 invDims = 1.0f / RawDims;
|
float2 invDims = 1.0f / RawDims;
|
||||||
Output.Position = float4(Input.Position.xyz, 1.0f);
|
Output.Position = float4(Input.Position.xyz, 1.0f);
|
||||||
Output.Position.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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;
|
||||||
Output.TexCoord = Input.TexCoord + 0.5f * invDims;
|
Output.TexCoord = Input.TexCoord + 0.5f * invDims;
|
||||||
|
@ -57,8 +57,7 @@ struct PS_INPUT
|
|||||||
uniform float3 ConvergeX = float3(0.0f, 0.0f, 0.0f);
|
uniform float3 ConvergeX = float3(0.0f, 0.0f, 0.0f);
|
||||||
uniform float3 ConvergeY = float3(0.0f, 0.0f, 0.0f);
|
uniform float3 ConvergeY = float3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
|
|
||||||
uniform float2 RawDims;
|
uniform float2 RawDims;
|
||||||
|
|
||||||
@ -76,11 +75,9 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
|||||||
float2 invDims = 1.0f / RawDims;
|
float2 invDims = 1.0f / RawDims;
|
||||||
float2 Ratios = SizeRatio;
|
float2 Ratios = SizeRatio;
|
||||||
Output.Position = float4(Input.Position.xyz, 1.0f);
|
Output.Position = float4(Input.Position.xyz, 1.0f);
|
||||||
Output.Position.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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 TexCoord = Input.TexCoord;
|
float2 TexCoord = Input.TexCoord;
|
||||||
@ -95,9 +92,6 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
|||||||
|
|
||||||
Output.CoordX = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RadialConvergeX / RawDims.x) + 0.5f) * Ratios.x + ConvergeX * invDims.x;
|
Output.CoordX = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RadialConvergeX / RawDims.x) + 0.5f) * Ratios.x + ConvergeX * invDims.x;
|
||||||
Output.CoordY = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RadialConvergeY / RawDims.y) + 0.5f) * Ratios.y + ConvergeY * invDims.y;
|
Output.CoordY = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RadialConvergeY / RawDims.y) + 0.5f) * Ratios.y + ConvergeY * invDims.y;
|
||||||
//Output.RedCoord = (ScaledRatio * (1.0f + RadialRed / RawDims) + 0.5f) * SizeRatio + ConvergeRed * invDims;
|
|
||||||
//Output.GrnCoord = (ScaledRatio * (1.0f + RadialGrn / RawDims) + 0.5f) * SizeRatio + ConvergeGrn * invDims;
|
|
||||||
//Output.BluCoord = (ScaledRatio * (1.0f + RadialBlu / RawDims) + 0.5f) * SizeRatio + ConvergeBlu * invDims;
|
|
||||||
Output.TexCoord = TexCoord;
|
Output.TexCoord = TexCoord;
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
@ -110,14 +104,10 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
|||||||
float4 ps_main(PS_INPUT Input) : COLOR
|
float4 ps_main(PS_INPUT Input) : COLOR
|
||||||
{
|
{
|
||||||
float Alpha = tex2D(DiffuseSampler, Input.TexCoord).a;
|
float Alpha = tex2D(DiffuseSampler, Input.TexCoord).a;
|
||||||
//float RedTexel = tex2D(DiffuseSampler, Input.RedCoord).r;
|
|
||||||
//float GrnTexel = tex2D(DiffuseSampler, Input.GrnCoord).g;
|
|
||||||
//float BluTexel = tex2D(DiffuseSampler, Input.BluCoord).b;
|
|
||||||
float RedTexel = tex2D(DiffuseSampler, float2(Input.CoordX.x, Input.CoordY.x)).r;
|
float RedTexel = tex2D(DiffuseSampler, float2(Input.CoordX.x, Input.CoordY.x)).r;
|
||||||
float GrnTexel = tex2D(DiffuseSampler, float2(Input.CoordX.y, Input.CoordY.y)).g;
|
float GrnTexel = tex2D(DiffuseSampler, float2(Input.CoordX.y, Input.CoordY.y)).g;
|
||||||
float BluTexel = tex2D(DiffuseSampler, float2(Input.CoordX.z, Input.CoordY.z)).b;
|
float BluTexel = tex2D(DiffuseSampler, float2(Input.CoordX.z, Input.CoordY.z)).b;
|
||||||
|
|
||||||
//return float4(Input.TexCoord, 0.0f, 1.0f);
|
|
||||||
return float4(RedTexel, GrnTexel, BluTexel, Alpha);
|
return float4(RedTexel, GrnTexel, BluTexel, Alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +58,7 @@ struct PS_INPUT
|
|||||||
// Simple Vertex Shader
|
// Simple Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
|
|
||||||
uniform float2 Defocus = float2(0.0f, 0.0f);
|
uniform float2 Defocus = float2(0.0f, 0.0f);
|
||||||
|
|
||||||
float2 Coord0Offset = float2( 0.0f, 0.0f);
|
float2 Coord0Offset = float2( 0.0f, 0.0f);
|
||||||
@ -77,17 +75,14 @@ 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.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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 = 1.0f / ScreenDims;
|
||||||
float2 TexCoord = Input.TexCoord;
|
float2 TexCoord = Input.TexCoord;
|
||||||
TexCoord = TexCoord;// + float2(0.5f, -0.5f) * InvTexSize;
|
|
||||||
Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * Defocus;
|
Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * Defocus;
|
||||||
Output.TexCoord1 = TexCoord + Coord1Offset * InvTexSize * Defocus;
|
Output.TexCoord1 = TexCoord + Coord1Offset * InvTexSize * Defocus;
|
||||||
Output.TexCoord2 = TexCoord + Coord2Offset * InvTexSize * Defocus;
|
Output.TexCoord2 = TexCoord + Coord2Offset * InvTexSize * Defocus;
|
||||||
|
@ -59,8 +59,7 @@ struct PS_INPUT
|
|||||||
// Simple Vertex Shader
|
// Simple Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
|
|
||||||
uniform float TextureWidth;
|
uniform float TextureWidth;
|
||||||
uniform float TextureHeight;
|
uniform float TextureHeight;
|
||||||
@ -72,16 +71,14 @@ 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.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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 / TextureWidth, 1.0f / TextureHeight);
|
float2 HalfTexOffset = 0.5f / float2(TextureWidth, TextureHeight);
|
||||||
Output.TexCoord = Input.TexCoord + float2(0.5f, 0.5f) * InvTexSize;
|
Output.TexCoord = Input.TexCoord + HalfTexOffset;
|
||||||
Output.PrevCoord = Output.TexCoord;
|
Output.PrevCoord = Output.TexCoord;
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
|
13
hlsl/post.fx
13
hlsl/post.fx
@ -57,8 +57,7 @@ struct PS_INPUT
|
|||||||
// Scanline & Shadowmask Vertex Shader
|
// Scanline & Shadowmask Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
|
|
||||||
uniform float2 RawDims;
|
uniform float2 RawDims;
|
||||||
|
|
||||||
@ -69,14 +68,12 @@ 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.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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;
|
||||||
Output.TexCoord = Input.TexCoord + 0.5f / RawDims;//float2(TargetWidth, TargetHeight);
|
Output.TexCoord = Input.TexCoord + 0.5f / RawDims;
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
}
|
}
|
||||||
@ -120,7 +117,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
|||||||
float PincushionR2 = pow(length(PinUnitCoord), 2.0f) / pow(length(Ratios), 2.0f);
|
float PincushionR2 = pow(length(PinUnitCoord), 2.0f) / pow(length(Ratios), 2.0f);
|
||||||
float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
|
float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
|
||||||
float2 BaseCoord = Input.TexCoord;
|
float2 BaseCoord = Input.TexCoord;
|
||||||
float2 ScanCoord = BaseCoord - 0.5f / float2(TargetWidth, TargetHeight);
|
float2 ScanCoord = BaseCoord - 0.5f / ScreenDims;
|
||||||
|
|
||||||
BaseCoord -= 0.5f / Ratios;
|
BaseCoord -= 0.5f / Ratios;
|
||||||
BaseCoord *= 1.0f - PincushionAmount * Ratios * 0.2f; // Warning: Magic constant
|
BaseCoord *= 1.0f - PincushionAmount * Ratios * 0.2f; // Warning: Magic constant
|
||||||
|
@ -42,24 +42,20 @@ struct PS_INPUT
|
|||||||
// Passthrough Vertex Shader
|
// Passthrough Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
|
||||||
uniform float TargetHeight;
|
|
||||||
|
|
||||||
uniform float2 RawDims;
|
uniform float2 RawDims;
|
||||||
|
uniform float2 ScreenDims;
|
||||||
|
|
||||||
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.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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.TexCoord = Input.TexCoord + 0.5f / float2(TargetWidth, TargetHeight);
|
Output.TexCoord = Input.TexCoord + 0.5f / ScreenDims;
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
}
|
}
|
||||||
@ -70,12 +66,6 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
|||||||
|
|
||||||
float4 ps_main(PS_INPUT Input) : COLOR
|
float4 ps_main(PS_INPUT Input) : COLOR
|
||||||
{
|
{
|
||||||
//float2 TexCoord = Input.TexCoord * RawDims;
|
|
||||||
//TexCoord -= frac(TexCoord);
|
|
||||||
//TexCoord += 0.5f;
|
|
||||||
//TexCoord /= RawDims;
|
|
||||||
//
|
|
||||||
//return tex2D(DiffuseSampler, TexCoord);
|
|
||||||
return tex2D(DiffuseSampler, Input.TexCoord);
|
return tex2D(DiffuseSampler, Input.TexCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ struct PS_INPUT
|
|||||||
// Simple Vertex Shader
|
// Simple Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
uniform float PostPass;
|
uniform float PostPass;
|
||||||
uniform float FixedAlpha;
|
uniform float FixedAlpha;
|
||||||
uniform float Brighten;
|
uniform float Brighten;
|
||||||
@ -55,14 +54,12 @@ 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.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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;
|
||||||
Output.TexCoord = lerp(Input.TexCoord, Input.Position.xy / float2(TargetWidth, TargetHeight), PostPass);
|
Output.TexCoord = lerp(Input.TexCoord, Input.Position.xy / ScreenDims, PostPass);
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,7 @@ struct PS_INPUT
|
|||||||
// Simple Vertex Shader
|
// Simple Vertex Shader
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
uniform float TargetWidth;
|
uniform float2 ScreenDims;
|
||||||
uniform float TargetHeight;
|
|
||||||
uniform float2 TimeParams;
|
uniform float2 TimeParams;
|
||||||
uniform float3 LengthParams;
|
uniform float3 LengthParams;
|
||||||
|
|
||||||
@ -43,14 +42,12 @@ 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.x /= TargetWidth;
|
Output.Position.xy /= ScreenDims;
|
||||||
Output.Position.y /= TargetHeight;
|
|
||||||
Output.Position.y = 1.0f - Output.Position.y;
|
Output.Position.y = 1.0f - Output.Position.y;
|
||||||
Output.Position.x -= 0.5f;
|
Output.Position.xy -= 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;
|
||||||
Output.TexCoord = Input.Position.xy / float2(TargetWidth, TargetHeight);
|
Output.TexCoord = Input.Position.xy / ScreenDims;
|
||||||
Output.LineInfo = Input.LineInfo;
|
Output.LineInfo = Input.LineInfo;
|
||||||
return Output;
|
return Output;
|
||||||
}
|
}
|
||||||
|
@ -685,6 +685,124 @@ static const vertex_buffer_interface d3d9_vertex_buffer_interface =
|
|||||||
// Direct3DEffect interfaces
|
// Direct3DEffect interfaces
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
uniform::uniform(effect *shader, const char *name, uniform_type type)
|
||||||
|
{
|
||||||
|
m_shader = shader;
|
||||||
|
m_type = type;
|
||||||
|
m_next = NULL;
|
||||||
|
m_prev = NULL;
|
||||||
|
m_handle = m_shader->get_parameter(NULL, name);
|
||||||
|
m_ival = 0;
|
||||||
|
memset(m_vec, 0, sizeof(float) * 4);
|
||||||
|
m_mval = NULL;
|
||||||
|
m_texture = NULL;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case UT_INT:
|
||||||
|
case UT_FLOAT:
|
||||||
|
case UT_MATRIX:
|
||||||
|
case UT_SAMPLER:
|
||||||
|
m_count = 1;
|
||||||
|
break;
|
||||||
|
case UT_VEC2:
|
||||||
|
m_count = 2;
|
||||||
|
break;
|
||||||
|
case UT_VEC3:
|
||||||
|
m_count = 3;
|
||||||
|
break;
|
||||||
|
case UT_VEC4:
|
||||||
|
m_count = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_count = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set_next(uniform *next)
|
||||||
|
{
|
||||||
|
m_next->set_prev(next);
|
||||||
|
next->set_next(m_next);
|
||||||
|
|
||||||
|
next->set_prev(this);
|
||||||
|
m_next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set_prev(uniform *prev)
|
||||||
|
{
|
||||||
|
m_prev->set_next(prev);
|
||||||
|
prev->set_prev(m_prev);
|
||||||
|
|
||||||
|
prev->set_next(this);
|
||||||
|
m_prev = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(float x, float y, float z, float w)
|
||||||
|
{
|
||||||
|
m_vec[0] = x;
|
||||||
|
m_vec[1] = y;
|
||||||
|
m_vec[2] = z;
|
||||||
|
m_vec[3] = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(float x, float y, float z)
|
||||||
|
{
|
||||||
|
m_vec[0] = x;
|
||||||
|
m_vec[1] = y;
|
||||||
|
m_vec[2] = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(float x, float y)
|
||||||
|
{
|
||||||
|
m_vec[0] = x;
|
||||||
|
m_vec[1] = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(float x)
|
||||||
|
{
|
||||||
|
m_vec[0] = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(int x)
|
||||||
|
{
|
||||||
|
m_ival = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(matrix *mat)
|
||||||
|
{
|
||||||
|
m_mval = mat;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::set(texture *tex)
|
||||||
|
{
|
||||||
|
m_texture = tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform::upload()
|
||||||
|
{
|
||||||
|
switch(m_type)
|
||||||
|
{
|
||||||
|
case UT_INT:
|
||||||
|
m_shader->set_int(m_handle, m_ival);
|
||||||
|
break;
|
||||||
|
case UT_FLOAT:
|
||||||
|
m_shader->set_float(m_handle, m_vec[0]);
|
||||||
|
break;
|
||||||
|
case UT_VEC2:
|
||||||
|
case UT_VEC3:
|
||||||
|
case UT_VEC4:
|
||||||
|
m_shader->set_vector(m_handle, m_count, m_vec);
|
||||||
|
break;
|
||||||
|
case UT_MATRIX:
|
||||||
|
m_shader->set_matrix(m_handle, m_mval);
|
||||||
|
break;
|
||||||
|
case UT_SAMPLER:
|
||||||
|
m_shader->set_texture(m_handle, m_texture);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
effect::effect(device *dev, const char *name, const char *path)
|
effect::effect(device *dev, const char *name, const char *path)
|
||||||
{
|
{
|
||||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||||
@ -783,6 +901,11 @@ void effect::set_texture(D3DXHANDLE param, texture *tex)
|
|||||||
m_effect->SetTexture(param, (IDirect3DTexture9*)tex);
|
m_effect->SetTexture(param, (IDirect3DTexture9*)tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
D3DXHANDLE effect::get_parameter(D3DXHANDLE param, const char *name)
|
||||||
|
{
|
||||||
|
return m_effect->GetParameterByName(param, name);
|
||||||
|
}
|
||||||
|
|
||||||
ULONG effect::release()
|
ULONG effect::release()
|
||||||
{
|
{
|
||||||
return m_effect->Release();
|
return m_effect->Release();
|
||||||
|
@ -1055,8 +1055,8 @@ void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYP
|
|||||||
|
|
||||||
curr_effect->set_texture("Diffuse", src);
|
curr_effect->set_texture("Diffuse", src);
|
||||||
|
|
||||||
curr_effect->set_float("TargetWidth", (float)dstw);
|
float dst_dims[2] = { (float)dstw, (float)dsth };
|
||||||
curr_effect->set_float("TargetHeight", (float)dsth);
|
curr_effect->set_vector("ScreenDims", 2, dst_dims);
|
||||||
curr_effect->set_float("PostPass", 1.0f);
|
curr_effect->set_float("PostPass", 1.0f);
|
||||||
curr_effect->set_float("PincushionAmount", options->pincushion);
|
curr_effect->set_float("PincushionAmount", options->pincushion);
|
||||||
curr_effect->set_float("Brighten", 0.0f);
|
curr_effect->set_float("Brighten", 0.0f);
|
||||||
@ -1102,8 +1102,8 @@ void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYP
|
|||||||
|
|
||||||
curr_effect->set_texture("Diffuse", src);
|
curr_effect->set_texture("Diffuse", src);
|
||||||
|
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_float("ScreenWidth", (float)d3d->get_width());
|
curr_effect->set_float("ScreenWidth", (float)d3d->get_width());
|
||||||
curr_effect->set_float("ScreenHeight", (float)d3d->get_height());
|
curr_effect->set_float("ScreenHeight", (float)d3d->get_height());
|
||||||
curr_effect->set_float("PostPass", 1.0f);
|
curr_effect->set_float("PostPass", 1.0f);
|
||||||
@ -1211,8 +1211,8 @@ void shaders::init_effect_info(poly_info *poly)
|
|||||||
vec2f delta = texture->get_uvstop() - texture->get_uvstart();
|
vec2f delta = texture->get_uvstop() - texture->get_uvstart();
|
||||||
curr_effect->set_vector("RawDims", 2, &texture->get_rawdims().c.x);
|
curr_effect->set_vector("RawDims", 2, &texture->get_rawdims().c.x);
|
||||||
curr_effect->set_vector("SizeRatio", 2, &delta.c.x);
|
curr_effect->set_vector("SizeRatio", 2, &delta.c.x);
|
||||||
curr_effect->set_float("TargetWidth", d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("Floor", 3, options->floor);
|
curr_effect->set_vector("Floor", 3, options->floor);
|
||||||
curr_effect->set_float("SnapX", snap_width);
|
curr_effect->set_float("SnapX", snap_width);
|
||||||
curr_effect->set_float("SnapY", snap_height);
|
curr_effect->set_float("SnapY", snap_height);
|
||||||
@ -1316,6 +1316,7 @@ void shaders::ntsc_pass(render_target *rt, texture_info *texture, vec2f &texsize
|
|||||||
curr_effect->set_float("HeightRatio", 1.0f / delta.c.y);
|
curr_effect->set_float("HeightRatio", 1.0f / delta.c.y);
|
||||||
curr_effect->set_float("ScreenWidth", d3d->get_width());
|
curr_effect->set_float("ScreenWidth", d3d->get_width());
|
||||||
curr_effect->set_float("ScreenHeight", d3d->get_height());
|
curr_effect->set_float("ScreenHeight", d3d->get_height());
|
||||||
|
|
||||||
curr_effect->set_float("CCValue", options->yiq_cc);
|
curr_effect->set_float("CCValue", options->yiq_cc);
|
||||||
curr_effect->set_float("AValue", options->yiq_a);
|
curr_effect->set_float("AValue", options->yiq_a);
|
||||||
curr_effect->set_float("BValue", options->yiq_b);
|
curr_effect->set_float("BValue", options->yiq_b);
|
||||||
@ -1358,6 +1359,7 @@ void shaders::ntsc_pass(render_target *rt, texture_info *texture, vec2f &texsize
|
|||||||
curr_effect->set_float("HeightRatio", 1.0f / delta.c.y);
|
curr_effect->set_float("HeightRatio", 1.0f / delta.c.y);
|
||||||
curr_effect->set_float("ScreenWidth", d3d->get_width());
|
curr_effect->set_float("ScreenWidth", d3d->get_width());
|
||||||
curr_effect->set_float("ScreenHeight", d3d->get_height());
|
curr_effect->set_float("ScreenHeight", d3d->get_height());
|
||||||
|
|
||||||
curr_effect->set_float("CCValue", options->yiq_cc);
|
curr_effect->set_float("CCValue", options->yiq_cc);
|
||||||
curr_effect->set_float("AValue", options->yiq_a);
|
curr_effect->set_float("AValue", options->yiq_a);
|
||||||
curr_effect->set_float("BValue", options->yiq_b);
|
curr_effect->set_float("BValue", options->yiq_b);
|
||||||
@ -1406,8 +1408,9 @@ void shaders::color_convolution_pass(render_target *rt, texture_info *texture, v
|
|||||||
if(options->params_dirty)
|
if(options->params_dirty)
|
||||||
{
|
{
|
||||||
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
|
|
||||||
curr_effect->set_float("YIQEnable", options->yiq_enable ? 1.0f : 0.0f);
|
curr_effect->set_float("YIQEnable", options->yiq_enable ? 1.0f : 0.0f);
|
||||||
curr_effect->set_vector("RedRatios", 3, options->red_ratio);
|
curr_effect->set_vector("RedRatios", 3, options->red_ratio);
|
||||||
curr_effect->set_vector("GrnRatios", 3, options->grn_ratio);
|
curr_effect->set_vector("GrnRatios", 3, options->grn_ratio);
|
||||||
@ -1447,8 +1450,8 @@ void shaders::prescale_pass(render_target *rt, texture_info *texture, vec2f &tex
|
|||||||
|
|
||||||
if(options->params_dirty)
|
if(options->params_dirty)
|
||||||
{
|
{
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1481,8 +1484,8 @@ void shaders::deconverge_pass(render_target *rt, texture_info *texture, vec2f &t
|
|||||||
|
|
||||||
if(options->params_dirty)
|
if(options->params_dirty)
|
||||||
{
|
{
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
||||||
curr_effect->set_vector("SizeRatio", 2, &delta.c.x);
|
curr_effect->set_vector("SizeRatio", 2, &delta.c.x);
|
||||||
curr_effect->set_vector("ConvergeX", 3, options->converge_x);
|
curr_effect->set_vector("ConvergeX", 3, options->converge_x);
|
||||||
@ -1520,8 +1523,8 @@ void shaders::defocus_pass(render_target *rt, texture_info *texture, vec2f &texs
|
|||||||
|
|
||||||
curr_effect->set_texture("Diffuse", rt->render_texture[2]);
|
curr_effect->set_texture("Diffuse", rt->render_texture[2]);
|
||||||
|
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("Defocus", 2, &options->defocus[0]);
|
curr_effect->set_vector("Defocus", 2, &options->defocus[0]);
|
||||||
|
|
||||||
curr_effect->begin(&num_passes, 0);
|
curr_effect->begin(&num_passes, 0);
|
||||||
@ -1546,8 +1549,7 @@ void shaders::defocus_pass(render_target *rt, texture_info *texture, vec2f &texs
|
|||||||
|
|
||||||
curr_effect->set_texture("Diffuse", rt->render_texture[0]);
|
curr_effect->set_texture("Diffuse", rt->render_texture[0]);
|
||||||
|
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
|
||||||
curr_effect->set_vector("Defocus", 2, &options->defocus[1]);
|
curr_effect->set_vector("Defocus", 2, &options->defocus[1]);
|
||||||
|
|
||||||
curr_effect->begin(&num_passes, 0);
|
curr_effect->begin(&num_passes, 0);
|
||||||
@ -1576,8 +1578,8 @@ void shaders::phosphor_pass(render_target *rt, cache_target *ct, texture_info *t
|
|||||||
|
|
||||||
if(options->params_dirty)
|
if(options->params_dirty)
|
||||||
{
|
{
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("Phosphor", 3, options->phosphor);
|
curr_effect->set_vector("Phosphor", 3, options->phosphor);
|
||||||
}
|
}
|
||||||
curr_effect->set_float("TextureWidth", (float)rt->target_width);
|
curr_effect->set_float("TextureWidth", (float)rt->target_width);
|
||||||
@ -1637,8 +1639,9 @@ void shaders::avi_post_pass(render_target *rt, texture_info *texture, vec2f &tex
|
|||||||
UINT num_passes = 0;
|
UINT num_passes = 0;
|
||||||
|
|
||||||
curr_effect = post_effect;
|
curr_effect = post_effect;
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
vec2f screendims = d3d->get_dims();
|
||||||
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
|
|
||||||
// Scanlines and shadow mask, at high res for AVI logging
|
// Scanlines and shadow mask, at high res for AVI logging
|
||||||
if(avi_output_file != NULL)
|
if(avi_output_file != NULL)
|
||||||
@ -1696,19 +1699,15 @@ void shaders::screen_post_pass(render_target *rt, texture_info *texture, vec2f &
|
|||||||
curr_effect->set_texture("Diffuse", rt->render_texture[0]);
|
curr_effect->set_texture("Diffuse", rt->render_texture[0]);
|
||||||
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
curr_effect->set_vector("RawDims", 2, &rawdims.c.x);
|
||||||
curr_effect->set_vector("SizeRatio", 2, &delta.c.x);
|
curr_effect->set_vector("SizeRatio", 2, &delta.c.x);
|
||||||
|
vec2f screendims = d3d->get_dims();
|
||||||
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
|
|
||||||
d3d->set_wrap(D3DTADDRESS_MIRROR);
|
d3d->set_wrap(D3DTADDRESS_MIRROR);
|
||||||
|
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
|
||||||
|
|
||||||
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]);
|
||||||
|
|
||||||
d3d->set_wrap(D3DTADDRESS_MIRROR);
|
|
||||||
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(1,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->set_float("TargetWidth", (float)d3d->get_width());
|
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
|
||||||
|
|
||||||
curr_effect->begin(&num_passes, 0);
|
curr_effect->begin(&num_passes, 0);
|
||||||
|
|
||||||
@ -1743,8 +1742,8 @@ void shaders::raster_bloom_pass(render_target *rt, texture_info *texture, vec2f
|
|||||||
float prim_width = poly->get_prim_width();
|
float prim_width = poly->get_prim_width();
|
||||||
float prim_height = poly->get_prim_height();
|
float prim_height = poly->get_prim_height();
|
||||||
float prim_ratio[2] = { prim_width / bloom_width, prim_height / bloom_height };
|
float prim_ratio[2] = { prim_width / bloom_width, prim_height / bloom_height };
|
||||||
float screen_size[2] = { d3d->get_width(), d3d->get_height() };
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_vector("ScreenSize", 2, screen_size);
|
curr_effect->set_vector("ScreenSize", 2, &screendims.c.x);
|
||||||
for(; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
|
for(; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
|
||||||
{
|
{
|
||||||
float target_size[2] = { bloom_width, bloom_height };
|
float target_size[2] = { bloom_width, bloom_height };
|
||||||
@ -1779,8 +1778,7 @@ void shaders::raster_bloom_pass(render_target *rt, texture_info *texture, vec2f
|
|||||||
|
|
||||||
curr_effect = bloom_effect;
|
curr_effect = bloom_effect;
|
||||||
|
|
||||||
float target_size[2] = { d3d->get_width(), d3d->get_height() };
|
curr_effect->set_vector("TargetSize", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("TargetSize", 2, target_size);
|
|
||||||
float weight0123[4] = { options->bloom_level0_weight, options->bloom_level1_weight,
|
float weight0123[4] = { options->bloom_level0_weight, options->bloom_level1_weight,
|
||||||
options->bloom_level2_weight, options->bloom_level3_weight };
|
options->bloom_level2_weight, options->bloom_level3_weight };
|
||||||
float weight4567[4] = { options->bloom_level4_weight, options->bloom_level5_weight,
|
float weight4567[4] = { options->bloom_level4_weight, options->bloom_level5_weight,
|
||||||
@ -1790,7 +1788,7 @@ void shaders::raster_bloom_pass(render_target *rt, texture_info *texture, vec2f
|
|||||||
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, target_size);
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
|
|
||||||
curr_effect->set_texture("DiffuseA", rt->render_texture[2]);
|
curr_effect->set_texture("DiffuseA", rt->render_texture[2]);
|
||||||
curr_effect->set_float("DiffuseScaleA", 1.0f);
|
curr_effect->set_float("DiffuseScaleA", 1.0f);
|
||||||
@ -1891,8 +1889,8 @@ void shaders::render_quad(poly_info *poly, int vertnum)
|
|||||||
|
|
||||||
if(options->params_dirty)
|
if(options->params_dirty)
|
||||||
{
|
{
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
float time_params[2] = { 0.0f, 0.0f };
|
float time_params[2] = { 0.0f, 0.0f };
|
||||||
@ -2043,8 +2041,8 @@ void shaders::render_quad(poly_info *poly, int vertnum)
|
|||||||
|
|
||||||
if(options->params_dirty)
|
if(options->params_dirty)
|
||||||
{
|
{
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_vector("Phosphor", 3, options->phosphor);
|
curr_effect->set_vector("Phosphor", 3, options->phosphor);
|
||||||
}
|
}
|
||||||
curr_effect->set_float("TextureWidth", (float)d3d->get_width());
|
curr_effect->set_float("TextureWidth", (float)d3d->get_width());
|
||||||
@ -2088,8 +2086,8 @@ void shaders::render_quad(poly_info *poly, int vertnum)
|
|||||||
{
|
{
|
||||||
curr_effect = default_effect;
|
curr_effect = default_effect;
|
||||||
|
|
||||||
curr_effect->set_float("TargetWidth", (float)d3d->get_width());
|
vec2f screendims = d3d->get_dims();
|
||||||
curr_effect->set_float("TargetHeight", (float)d3d->get_height());
|
curr_effect->set_vector("ScreenDims", 2, &screendims.c.x);
|
||||||
curr_effect->set_float("PostPass", 0.0f);
|
curr_effect->set_float("PostPass", 0.0f);
|
||||||
|
|
||||||
curr_effect->begin(&num_passes, 0);
|
curr_effect->begin(&num_passes, 0);
|
||||||
|
@ -77,9 +77,54 @@ struct device;
|
|||||||
struct surface;
|
struct surface;
|
||||||
struct texture;
|
struct texture;
|
||||||
struct vertex_buffer;
|
struct vertex_buffer;
|
||||||
|
class effect;
|
||||||
typedef D3DXVECTOR4 vector;
|
typedef D3DXVECTOR4 vector;
|
||||||
typedef D3DMATRIX matrix;
|
typedef D3DMATRIX matrix;
|
||||||
|
|
||||||
|
class uniform
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UT_VEC4,
|
||||||
|
UT_VEC3,
|
||||||
|
UT_VEC2,
|
||||||
|
UT_FLOAT,
|
||||||
|
UT_INT,
|
||||||
|
UT_MATRIX,
|
||||||
|
UT_SAMPLER,
|
||||||
|
} uniform_type;
|
||||||
|
|
||||||
|
uniform(effect *shader, const char *name, uniform_type type);
|
||||||
|
|
||||||
|
void set_next(uniform *next);
|
||||||
|
void set_prev(uniform *prev);
|
||||||
|
|
||||||
|
void set(float x, float y, float z, float w);
|
||||||
|
void set(float x, float y, float z);
|
||||||
|
void set(float x, float y);
|
||||||
|
void set(float x);
|
||||||
|
void set(int x);
|
||||||
|
void set(matrix *mat);
|
||||||
|
void set(texture *tex);
|
||||||
|
|
||||||
|
void upload();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uniform *m_next;
|
||||||
|
uniform *m_prev;
|
||||||
|
|
||||||
|
float m_vec[4];
|
||||||
|
int m_ival;
|
||||||
|
matrix *m_mval;
|
||||||
|
texture *m_texture;
|
||||||
|
int m_count;
|
||||||
|
uniform_type m_type;
|
||||||
|
|
||||||
|
effect *m_shader;
|
||||||
|
D3DXHANDLE m_handle;
|
||||||
|
};
|
||||||
|
|
||||||
class effect
|
class effect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -177,6 +177,7 @@ public:
|
|||||||
// Setters / getters
|
// Setters / getters
|
||||||
int get_adapter() { return m_adapter; }
|
int get_adapter() { return m_adapter; }
|
||||||
int get_width() { return m_width; }
|
int get_width() { return m_width; }
|
||||||
|
vec2f get_dims() { return vec2f(m_width, m_height); }
|
||||||
int get_height() { return m_height; }
|
int get_height() { return m_height; }
|
||||||
int get_refresh() { return m_refresh; }
|
int get_refresh() { return m_refresh; }
|
||||||
|
|
||||||
|
@ -677,6 +677,7 @@ void winwindow_video_window_create(running_machine &machine, int index, win_moni
|
|||||||
|
|
||||||
// allocate a new window object
|
// allocate a new window object
|
||||||
window = global_alloc_clear(win_window_info(machine));
|
window = global_alloc_clear(win_window_info(machine));
|
||||||
|
printf("%d, %d\n", config->width, config->height);
|
||||||
window->maxwidth = config->width;
|
window->maxwidth = config->width;
|
||||||
window->maxheight = config->height;
|
window->maxheight = config->height;
|
||||||
window->refresh = config->refresh;
|
window->refresh = config->refresh;
|
||||||
|
@ -318,6 +318,7 @@ const options_entry windows_options::s_option_entries[] =
|
|||||||
{ WINOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
|
{ WINOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
|
||||||
{ WINOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
|
{ WINOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
|
||||||
{ WINOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
|
{ WINOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
|
||||||
|
{ WINOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
|
||||||
{ WINOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" },
|
{ WINOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" },
|
||||||
{ WINOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
|
{ WINOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
|
||||||
{ WINOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
|
{ WINOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
#define WINOPTION_WINDOW "window"
|
#define WINOPTION_WINDOW "window"
|
||||||
#define WINOPTION_MAXIMIZE "maximize"
|
#define WINOPTION_MAXIMIZE "maximize"
|
||||||
#define WINOPTION_KEEPASPECT "keepaspect"
|
#define WINOPTION_KEEPASPECT "keepaspect"
|
||||||
|
#define WINOPTION_UNEVENSTRETCH "unevenstretch"
|
||||||
#define WINOPTION_PRESCALE "prescale"
|
#define WINOPTION_PRESCALE "prescale"
|
||||||
#define WINOPTION_WAITVSYNC "waitvsync"
|
#define WINOPTION_WAITVSYNC "waitvsync"
|
||||||
#define WINOPTION_SYNCREFRESH "syncrefresh"
|
#define WINOPTION_SYNCREFRESH "syncrefresh"
|
||||||
@ -193,6 +194,7 @@ public:
|
|||||||
bool window() const { return bool_value(WINOPTION_WINDOW); }
|
bool window() const { return bool_value(WINOPTION_WINDOW); }
|
||||||
bool maximize() const { return bool_value(WINOPTION_MAXIMIZE); }
|
bool maximize() const { return bool_value(WINOPTION_MAXIMIZE); }
|
||||||
bool keep_aspect() const { return bool_value(WINOPTION_KEEPASPECT); }
|
bool keep_aspect() const { return bool_value(WINOPTION_KEEPASPECT); }
|
||||||
|
bool uneven_stretch() const { return bool_value(WINOPTION_UNEVENSTRETCH); }
|
||||||
int prescale() const { return int_value(WINOPTION_PRESCALE); }
|
int prescale() const { return int_value(WINOPTION_PRESCALE); }
|
||||||
bool wait_vsync() const { return bool_value(WINOPTION_WAITVSYNC); }
|
bool wait_vsync() const { return bool_value(WINOPTION_WAITVSYNC); }
|
||||||
bool sync_refresh() const { return bool_value(WINOPTION_SYNCREFRESH); }
|
bool sync_refresh() const { return bool_value(WINOPTION_SYNCREFRESH); }
|
||||||
|
Loading…
Reference in New Issue
Block a user