mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
- "And he did give them CRT bloom, and it scorched their eyes so; and they wept
openly, for there was nothing left to see with" [MooglyGuy] * Enabled vector bloom and associated .ini controls * Added raster bloom and associated .ini controls, each bloom "level" is the linear weight of successively half-sized render targets * Removed D3D8 mode * Mass renaming in D3D renderer to use namespaces, initial planning step to HAL-based renderer implementation on Windows (i.e., GL on Windows) * Converted d3d_info, d3d_poly_info, and d3d_texture_info into classes * Added batching of vectors for possible speed increase * Minor cleanup of shader state setting
This commit is contained in:
parent
ec5c9bc680
commit
e028e20476
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8333,7 +8333,6 @@ src/osd/sdl/watchdog.c svneol=native#text/plain
|
||||
src/osd/sdl/watchdog.h svneol=native#text/plain
|
||||
src/osd/sdl/window.c svneol=native#text/plain
|
||||
src/osd/sdl/window.h svneol=native#text/plain
|
||||
src/osd/windows/d3d8intf.c svneol=native#text/plain
|
||||
src/osd/windows/d3d9intf.c svneol=native#text/plain
|
||||
src/osd/windows/d3dcomm.h svneol=native#text/plain
|
||||
src/osd/windows/d3dhlsl.c svneol=native#text/plain
|
||||
|
@ -124,7 +124,7 @@ sampler DiffuseSampler9 = sampler_state
|
||||
AddressW = CLAMP;
|
||||
};
|
||||
|
||||
sampler DiffuseSampler10 = sampler_state
|
||||
sampler DiffuseSamplerA = sampler_state
|
||||
{
|
||||
Texture = <DiffuseK>;
|
||||
MipFilter = LINEAR;
|
||||
@ -143,7 +143,12 @@ struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoord : TEXCOORD0;
|
||||
float4 TexCoord01 : TEXCOORD0;
|
||||
float4 TexCoord23 : TEXCOORD1;
|
||||
float4 TexCoord45 : TEXCOORD2;
|
||||
float4 TexCoord67 : TEXCOORD3;
|
||||
float4 TexCoord89 : TEXCOORD4;
|
||||
float2 TexCoordA : TEXCOORD5;
|
||||
};
|
||||
|
||||
struct VS_INPUT
|
||||
@ -156,7 +161,12 @@ struct VS_INPUT
|
||||
struct PS_INPUT
|
||||
{
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoord : TEXCOORD0;
|
||||
float4 TexCoord01 : TEXCOORD0;
|
||||
float4 TexCoord23 : TEXCOORD1;
|
||||
float4 TexCoord45 : TEXCOORD2;
|
||||
float4 TexCoord67 : TEXCOORD3;
|
||||
float4 TexCoord89 : TEXCOORD4;
|
||||
float2 TexCoordA : TEXCOORD5;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -164,18 +174,7 @@ struct PS_INPUT
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform float2 TargetSize;
|
||||
|
||||
uniform float DiffuseScaleA;
|
||||
uniform float DiffuseScaleB;
|
||||
uniform float DiffuseScaleC;
|
||||
uniform float DiffuseScaleD;
|
||||
uniform float DiffuseScaleE;
|
||||
uniform float DiffuseScaleF;
|
||||
uniform float DiffuseScaleG;
|
||||
uniform float DiffuseScaleH;
|
||||
uniform float DiffuseScaleI;
|
||||
uniform float DiffuseScaleJ;
|
||||
uniform float DiffuseScaleK;
|
||||
uniform float2 SourceSize;
|
||||
|
||||
VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
@ -188,7 +187,18 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
Output.Position.xy *= float2(2.0f, 2.0f);
|
||||
Output.Color = Input.Color;
|
||||
float2 inversePixel = 1.0f / TargetSize;
|
||||
Output.TexCoord = Input.Position.xy * inversePixel;
|
||||
float2 TexCoord = Input.Position.xy * inversePixel + float2(0.5f, 0.5f) * inversePixel;
|
||||
Output.TexCoord01.xy = TexCoord;
|
||||
Output.TexCoord01.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.5f;
|
||||
Output.TexCoord23.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.25f;
|
||||
Output.TexCoord23.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.125f;
|
||||
Output.TexCoord45.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0625f;
|
||||
Output.TexCoord45.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.03125f;
|
||||
Output.TexCoord67.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.015625f;
|
||||
Output.TexCoord67.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0078125f;
|
||||
Output.TexCoord89.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.00390625f;
|
||||
Output.TexCoord89.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.001953125f;
|
||||
Output.TexCoordA = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0009765625f;
|
||||
|
||||
return Output;
|
||||
}
|
||||
@ -197,21 +207,39 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
// Bloom Pixel Shader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform float4 Level0123Weight;
|
||||
uniform float4 Level4567Weight;
|
||||
uniform float3 Level89AWeight;
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord).rgb * DiffuseScaleA * 1.00f;
|
||||
float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord).rgb * DiffuseScaleB * 0.95f;
|
||||
float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord).rgb * DiffuseScaleC * 0.85f;
|
||||
float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord).rgb * DiffuseScaleD * 0.75f;
|
||||
float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord).rgb * DiffuseScaleE * 0.65f;
|
||||
float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord).rgb * DiffuseScaleF * 0.55f;
|
||||
float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord).rgb * DiffuseScaleG * 0.45f;
|
||||
float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord).rgb * DiffuseScaleH * 0.35f;
|
||||
float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord).rgb * DiffuseScaleI * 0.25f;
|
||||
float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord).rgb * DiffuseScaleJ * 0.15f;
|
||||
float3 texel10 = tex2D(DiffuseSampler10, Input.TexCoord).rgb * DiffuseScaleK * 0.10f;
|
||||
return float4(texel0 + texel1 + texel2 + texel3 + texel4 +
|
||||
texel5 + texel6 + texel7 + texel8 + texel9 + texel10, 1.0f);
|
||||
float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord01.xy).rgb;
|
||||
float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord01.zw).rgb;
|
||||
float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord23.xy).rgb;
|
||||
float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord23.zw).rgb;
|
||||
float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord45.xy).rgb;
|
||||
float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord45.zw).rgb;
|
||||
float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord67.xy).rgb;
|
||||
float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord67.zw).rgb;
|
||||
float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord89.xy).rgb;
|
||||
float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord89.zw).rgb;
|
||||
float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoordA).rgb;
|
||||
|
||||
texel0 = texel0 * Level0123Weight.x; // 1.0f;
|
||||
texel1 = texel1 * Level0123Weight.y; // 0.21f;
|
||||
texel2 = texel2 * Level0123Weight.z; // 0.19f;
|
||||
texel3 = texel3 * Level0123Weight.w; // 0.17f;
|
||||
texel4 = texel4 * Level4567Weight.x; // 0.15f;
|
||||
texel5 = texel5 * Level4567Weight.y; // 0.14f;
|
||||
texel6 = texel6 * Level4567Weight.z; // 0.13f;
|
||||
texel7 = texel7 * Level4567Weight.w; // 0.12f;
|
||||
texel8 = texel8 * Level89AWeight.x; // 0.11f;
|
||||
texel9 = texel9 * Level89AWeight.y; // 0.10f;
|
||||
texelA = texelA * Level89AWeight.z; // 0.09f;
|
||||
|
||||
float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
|
||||
texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
|
||||
return sum;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -234,7 +262,7 @@ technique TestTechnique
|
||||
Sampler[7] = <DiffuseSampler7>; // 16x16
|
||||
Sampler[8] = <DiffuseSampler8>; // 8x8
|
||||
Sampler[9] = <DiffuseSampler9>; // 4x4
|
||||
Sampler[10] = <DiffuseSampler10>; // 2x2
|
||||
Sampler[10] = <DiffuseSamplerA>; // 2x2
|
||||
|
||||
VertexShader = compile vs_3_0 vs_main();
|
||||
PixelShader = compile ps_3_0 ps_main();
|
||||
|
@ -46,11 +46,7 @@ struct PS_INPUT
|
||||
uniform float TargetWidth;
|
||||
uniform float TargetHeight;
|
||||
|
||||
uniform float RawWidth;
|
||||
uniform float RawHeight;
|
||||
|
||||
uniform float WidthRatio;
|
||||
uniform float HeightRatio;
|
||||
uniform float2 RawDims;
|
||||
|
||||
uniform float YIQEnable;
|
||||
|
||||
@ -58,7 +54,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
VS_OUTPUT Output = (VS_OUTPUT)0;
|
||||
|
||||
float2 invDims = float2(1.0f / RawWidth, 1.0f / RawHeight);
|
||||
float2 invDims = 1.0f / RawDims;
|
||||
Output.Position = float4(Input.Position.xyz, 1.0f);
|
||||
Output.Position.x /= TargetWidth;
|
||||
Output.Position.y /= TargetHeight;
|
||||
@ -67,7 +63,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
Output.Position.y -= 0.5f;
|
||||
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
|
||||
Output.Color = Input.Color;
|
||||
Output.TexCoord = Input.TexCoord + float2(0.5f, 0.5f) * invDims;
|
||||
Output.TexCoord = Input.TexCoord + 0.5f * invDims;
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float4 Color : COLOR0;
|
||||
//float2 RedCoord : TEXCOORD0;
|
||||
//float2 GrnCoord : TEXCOORD1;
|
||||
//float2 BluCoord : TEXCOORD2;
|
||||
float3 CoordX : TEXCOORD0;
|
||||
float3 CoordY : TEXCOORD1;
|
||||
float2 TexCoord : TEXCOORD2;
|
||||
@ -38,6 +41,9 @@ struct VS_INPUT
|
||||
struct PS_INPUT
|
||||
{
|
||||
float4 Color : COLOR0;
|
||||
//float2 RedCoord : TEXCOORD0;
|
||||
//float2 GrnCoord : TEXCOORD1;
|
||||
//float2 BluCoord : TEXCOORD2;
|
||||
float3 CoordX : TEXCOORD0;
|
||||
float3 CoordY : TEXCOORD1;
|
||||
float2 TexCoord : TEXCOORD2;
|
||||
@ -53,11 +59,9 @@ uniform float3 ConvergeY = float3(0.0f, 0.0f, 0.0f);
|
||||
uniform float TargetWidth;
|
||||
uniform float TargetHeight;
|
||||
|
||||
uniform float RawWidth;
|
||||
uniform float RawHeight;
|
||||
uniform float2 RawDims;
|
||||
|
||||
uniform float WidthRatio;
|
||||
uniform float HeightRatio;
|
||||
uniform float2 SizeRatio;
|
||||
|
||||
uniform float3 RadialConvergeX = float3(0.0f, 0.0f, 0.0f);
|
||||
uniform float3 RadialConvergeY = float3(0.0f, 0.0f, 0.0f);
|
||||
@ -68,9 +72,8 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
VS_OUTPUT Output = (VS_OUTPUT)0;
|
||||
|
||||
float2 TargetRawRatio = float2(TargetWidth / RawWidth, TargetWidth / RawWidth);
|
||||
float2 invDims = float2(1.0f / RawWidth, 1.0f / RawHeight);
|
||||
float2 Ratios = float2(1.0f / WidthRatio, 1.0f / HeightRatio);
|
||||
float2 invDims = 1.0f / RawDims;
|
||||
float2 Ratios = SizeRatio;
|
||||
Output.Position = float4(Input.Position.xyz, 1.0f);
|
||||
Output.Position.x /= TargetWidth;
|
||||
Output.Position.y /= TargetHeight;
|
||||
@ -81,8 +84,19 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
Output.Color = Input.Color;
|
||||
float2 TexCoord = Input.TexCoord;
|
||||
|
||||
Output.CoordX = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RadialConvergeX / RawWidth) + 0.5f) * Ratios.x + ConvergeX * invDims.x;
|
||||
Output.CoordY = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RadialConvergeY / RawHeight) + 0.5f) * Ratios.y + ConvergeY * invDims.y;
|
||||
float2 RadialRed = float2(RadialConvergeX.x, RadialConvergeY.x);
|
||||
float2 RadialGrn = float2(RadialConvergeX.y, RadialConvergeY.y);
|
||||
float2 RadialBlu = float2(RadialConvergeX.z, RadialConvergeY.z);
|
||||
float2 ConvergeRed = float2(ConvergeX.x, ConvergeY.x);
|
||||
float2 ConvergeGrn = float2(ConvergeX.y, ConvergeY.y);
|
||||
float2 ConvergeBlu = float2(ConvergeX.z, ConvergeY.z);
|
||||
float2 ScaledRatio = ((TexCoord * SizeRatio) - 0.5f);
|
||||
|
||||
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.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;
|
||||
|
||||
return Output;
|
||||
@ -94,39 +108,15 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 MagnetOffset = float2(32.0f / RawWidth, 32.0f / RawHeight);
|
||||
float2 MagnetCenter = float2(0.9f / WidthRatio, 0.9f / HeightRatio);
|
||||
float MagnetDistance = length((MagnetCenter - Input.TexCoord) * float2(WidthRatio, HeightRatio));
|
||||
float Deconverge = 1.0f - MagnetDistance / MagnetCenter;
|
||||
Deconverge = 1.0f;//clamp(Deconverge, 0.0f, 1.0f);
|
||||
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 GrnTexel = tex2D(DiffuseSampler, float2(Input.CoordX.y, Input.CoordY.y)).g;
|
||||
float BluTexel = tex2D(DiffuseSampler, float2(Input.CoordX.z, Input.CoordY.z)).b;
|
||||
|
||||
float2 TargetDims = float2(RawWidth, RawHeight);
|
||||
float2 DimOffset = 0.0f / TargetDims;
|
||||
float2 TexCoord = Input.TexCoord;
|
||||
float3 CoordX = Input.CoordX;
|
||||
float3 CoordY = Input.CoordY;
|
||||
|
||||
CoordX = lerp(TexCoord.x, CoordX, Deconverge);
|
||||
CoordY = lerp(TexCoord.y, CoordY, Deconverge);
|
||||
|
||||
float RedTexel = tex2D(DiffuseSampler, float2(CoordX.x, CoordY.x) - DimOffset).r;
|
||||
float GrnTexel = tex2D(DiffuseSampler, float2(CoordX.y, CoordY.y) - DimOffset).g;
|
||||
float BluTexel = tex2D(DiffuseSampler, float2(CoordX.z, CoordY.z) - DimOffset).b;
|
||||
|
||||
//RedTexel *= Input.RedCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f;
|
||||
//RedTexel *= Input.RedCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f;
|
||||
//RedTexel *= Input.RedCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth) ? 0.0f : 1.0f;
|
||||
//RedTexel *= Input.RedCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight) ? 0.0f : 1.0f;
|
||||
//GrnTexel *= Input.GrnCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f;
|
||||
//GrnTexel *= Input.GrnCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f;
|
||||
//GrnTexel *= Input.GrnCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth) ? 0.0f : 1.0f;
|
||||
//GrnTexel *= Input.GrnCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight) ? 0.0f : 1.0f;
|
||||
//BluTexel *= Input.BluCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f;
|
||||
//BluTexel *= Input.BluCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f;
|
||||
//BluTexel *= Input.BluCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth) ? 0.0f : 1.0f;
|
||||
//BluTexel *= Input.BluCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight) ? 0.0f : 1.0f;
|
||||
|
||||
//return float4(Input.TexCoord, 0.0f, 1.0f);
|
||||
return float4(RedTexel, GrnTexel, BluTexel, Alpha);
|
||||
}
|
||||
|
||||
|
@ -54,31 +54,27 @@ struct PS_INPUT
|
||||
uniform float2 TargetSize;
|
||||
uniform float2 SourceSize;
|
||||
|
||||
uniform float2 Defocus = float2(0.0f, 0.0f);
|
||||
|
||||
uniform float Brighten;
|
||||
|
||||
VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
VS_OUTPUT Output = (VS_OUTPUT)0;
|
||||
|
||||
Output.Position = float4(Input.Position.xyz, 1.0f);
|
||||
Output.Position.xy /= TargetSize;
|
||||
Output.Position.xy /= SourceSize;
|
||||
Output.Position.y = 1.0f - Output.Position.y;
|
||||
Output.Position.xy -= float2(0.5f, 0.5f);
|
||||
Output.Position.xy *= float2(2.0f, 2.0f);
|
||||
Output.Position.xy -= 0.5f;
|
||||
Output.Position.xy *= 2.0f;
|
||||
Output.Color = Input.Color;
|
||||
float2 inversePixel = 1.0f / TargetSize;
|
||||
Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.75f - 0.5f, 0.32f - 0.5f) * inversePixel;
|
||||
Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(0.35f - 0.5f, 0.65f - 0.5f) * inversePixel;
|
||||
Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.31f - 0.5f, 1.25f - 0.5f) * inversePixel;
|
||||
Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(0.58f - 0.5f, 1.61f - 0.5f) * inversePixel;
|
||||
Output.TexCoord45.xy = Input.Position.xy * inversePixel + float2(1.00f - 0.5f, 1.75f - 0.5f) * inversePixel;
|
||||
Output.TexCoord45.zw = Input.Position.xy * inversePixel + float2(1.35f - 0.5f, 1.64f - 0.5f) * inversePixel;
|
||||
Output.TexCoord67.xy = Input.Position.xy * inversePixel + float2(1.65f - 0.5f, 1.32f - 0.5f) * inversePixel;
|
||||
Output.TexCoord67.zw = Input.Position.xy * inversePixel + float2(1.72f - 0.5f, 0.93f - 0.5f) * inversePixel;
|
||||
Output.TexCoord89.xy = Input.Position.xy * inversePixel + float2(1.57f - 0.5f, 0.57f - 0.5f) * inversePixel;
|
||||
Output.TexCoord89.zw = Input.Position.xy * inversePixel + float2(1.25f - 0.5f, 0.33f - 0.5f) * inversePixel;
|
||||
Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.00f + 0.5f) * inversePixel;
|
||||
Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.00f + 0.5f) * inversePixel;
|
||||
Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.25f + 0.5f, 0.25f + 0.5f) * inversePixel;
|
||||
Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.25f + 0.5f) * inversePixel;
|
||||
Output.TexCoord45.xy = Input.Position.xy * inversePixel + float2(0.75f + 0.5f, 0.25f + 0.5f) * inversePixel;
|
||||
Output.TexCoord45.zw = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.50f + 0.5f) * inversePixel;
|
||||
Output.TexCoord67.xy = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.50f + 0.5f) * inversePixel;
|
||||
Output.TexCoord67.zw = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.75f + 0.5f) * inversePixel;
|
||||
Output.TexCoord89.xy = Input.Position.xy * inversePixel + float2(0.25f + 0.5f, 0.75f + 0.5f) * inversePixel;
|
||||
Output.TexCoord89.zw = Input.Position.xy * inversePixel + float2(0.75f + 0.5f, 0.75f + 0.5f) * inversePixel;
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
|
||||
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight);
|
||||
float2 TexCoord = Input.TexCoord;
|
||||
TexCoord = TexCoord + 0.5f * InvTexSize;
|
||||
TexCoord = TexCoord;// + float2(0.5f, -0.5f) * InvTexSize;
|
||||
Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * Defocus;
|
||||
Output.TexCoord1 = TexCoord + Coord1Offset * InvTexSize * Defocus;
|
||||
Output.TexCoord2 = TexCoord + Coord2Offset * InvTexSize * Defocus;
|
||||
|
@ -114,8 +114,8 @@ technique TestTechnique
|
||||
{
|
||||
Lighting = FALSE;
|
||||
|
||||
//Sampler[0] = <DiffuseSampler>;
|
||||
//Sampler[1] = <PreviousSampler>;
|
||||
Sampler[0] = <DiffuseSampler>;
|
||||
Sampler[1] = <PreviousSampler>;
|
||||
|
||||
VertexShader = compile vs_2_0 vs_main();
|
||||
PixelShader = compile ps_2_0 ps_main();
|
||||
|
23
hlsl/post.fx
23
hlsl/post.fx
@ -59,11 +59,9 @@ struct PS_INPUT
|
||||
uniform float TargetWidth;
|
||||
uniform float TargetHeight;
|
||||
|
||||
uniform float RawWidth;
|
||||
uniform float RawHeight;
|
||||
uniform float2 RawDims;
|
||||
|
||||
uniform float WidthRatio;
|
||||
uniform float HeightRatio;
|
||||
uniform float2 SizeRatio;
|
||||
|
||||
VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
@ -77,11 +75,8 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
Output.Position.y -= 0.5f;
|
||||
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
|
||||
Output.Color = Input.Color;
|
||||
Output.TexCoord = Input.TexCoord + 0.5f / float2(TargetWidth, TargetHeight);
|
||||
Output.TexCoord = Input.TexCoord + 0.5f / RawDims;//float2(TargetWidth, TargetHeight);
|
||||
|
||||
//float Zoom = 32.0f;
|
||||
//Output.TexCoord /= Zoom;
|
||||
//Output.TexCoord += float2(0.175f * (1.0f - 1.0f / Zoom) / WidthRatio, 0.175f * (1.0f - 1.0f / Zoom) / HeightRatio);
|
||||
return Output;
|
||||
}
|
||||
|
||||
@ -117,7 +112,7 @@ uniform float3 Floor = float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 Ratios = float2(WidthRatio, HeightRatio);
|
||||
float2 Ratios = 1.0f / SizeRatio;
|
||||
|
||||
// -- Screen Pincushion Calculation --
|
||||
float2 PinViewpointOffset = float2(0.0f, 0.0f);
|
||||
@ -153,14 +148,12 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord);
|
||||
|
||||
// -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
|
||||
clip((BaseCoord.x < 1.0f / RawWidth) ? -1 : 1);
|
||||
clip((BaseCoord.y < 1.0f / RawHeight) ? -1 : 1);
|
||||
clip((BaseCoord.x > (1.0f / WidthRatio + 1.0f / RawWidth)) ? -1 : 1);
|
||||
clip((BaseCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight)) ? -1 : 1);
|
||||
clip((BaseCoord < 1.0f / RawDims) ? -1 : 1);
|
||||
clip((BaseCoord > (SizeRatio + 1.0f / RawDims)) ? -1 : 1);
|
||||
|
||||
// -- Scanline Simulation --
|
||||
float InnerSine = ScanCoord.y * RawHeight * ScanlineScale;
|
||||
float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * RawHeight);
|
||||
float InnerSine = ScanCoord.y * RawDims.y * ScanlineScale;
|
||||
float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * RawDims.y);
|
||||
float3 ScanBrightness = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAmount);
|
||||
float3 Scanned = BaseTexel.rgb * ScanBrightness;
|
||||
|
||||
|
@ -41,11 +41,10 @@ struct PS_INPUT
|
||||
// Passthrough Vertex Shader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
float TargetWidth;
|
||||
float TargetHeight;
|
||||
uniform float TargetWidth;
|
||||
uniform float TargetHeight;
|
||||
|
||||
float RawWidth;
|
||||
float RawHeight;
|
||||
uniform float2 RawDims;
|
||||
|
||||
VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
@ -70,14 +69,13 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 RawDims = float2(RawWidth, RawHeight);
|
||||
float2 TexCoord = Input.TexCoord * RawDims;
|
||||
TexCoord -= frac(TexCoord);
|
||||
TexCoord += 0.5f;
|
||||
TexCoord /= RawDims;
|
||||
|
||||
float4 Center = tex2D(DiffuseSampler, TexCoord);
|
||||
return Center;
|
||||
//float2 TexCoord = Input.TexCoord * RawDims;
|
||||
//TexCoord -= frac(TexCoord);
|
||||
//TexCoord += 0.5f;
|
||||
//TexCoord /= RawDims;
|
||||
//
|
||||
//return tex2D(DiffuseSampler, TexCoord);
|
||||
return tex2D(DiffuseSampler, Input.TexCoord);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -57,8 +57,7 @@ struct PS_INPUT
|
||||
uniform float TargetWidth;
|
||||
uniform float TargetHeight;
|
||||
|
||||
uniform float RawWidth;
|
||||
uniform float RawHeight;
|
||||
uniform float2 RawDims;
|
||||
|
||||
uniform float WidthRatio;
|
||||
uniform float HeightRatio;
|
||||
@ -75,7 +74,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
Output.Position.y -= 0.5f;
|
||||
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
|
||||
Output.Coord0.xy = Input.TexCoord;
|
||||
Output.Coord0.zw = float2(1.0f / RawWidth, 0.0f);
|
||||
Output.Coord0.zw = float2(1.0f / RawDims.x, 0.0f);
|
||||
|
||||
return Output;
|
||||
}
|
||||
@ -98,8 +97,6 @@ uniform float QFreqResponse = 0.6f;
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 RawDims = float2(RawWidth, RawHeight);
|
||||
|
||||
float4 BaseTexel = tex2D(DiffuseSampler, Input.Coord0.xy + 0.5f / RawDims);
|
||||
|
||||
// YIQ convolution: N coefficients each
|
||||
@ -109,11 +106,11 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
float MaxC = 2.1183f;
|
||||
float MinC = -1.1183f;
|
||||
float CRange = MaxC - MinC;
|
||||
float Fc_y1 = (CCValue - NotchHalfWidth) * ScanTime / (RawWidth * 4.0f / WidthRatio);
|
||||
float Fc_y2 = (CCValue + NotchHalfWidth) * ScanTime / (RawWidth * 4.0f / WidthRatio);
|
||||
float Fc_y3 = YFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
|
||||
float Fc_i = IFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
|
||||
float Fc_q = QFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
|
||||
float Fc_y1 = (CCValue - NotchHalfWidth) * ScanTime / (RawDims.x * 4.0f / WidthRatio);
|
||||
float Fc_y2 = (CCValue + NotchHalfWidth) * ScanTime / (RawDims.x * 4.0f / WidthRatio);
|
||||
float Fc_y3 = YFreqResponse * ScanTime / (RawDims.x * 4.0f / WidthRatio);
|
||||
float Fc_i = IFreqResponse * ScanTime / (RawDims.x * 4.0f / WidthRatio);
|
||||
float Fc_q = QFreqResponse * ScanTime / (RawDims.x * 4.0f / WidthRatio);
|
||||
float PI = 3.1415926535897932384626433832795;
|
||||
float PI2 = 2.0f * PI;
|
||||
float PI2Length = PI2 / 82.0f;
|
||||
@ -126,7 +123,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
float4 CoordY = Input.Coord0.y;
|
||||
float2 TexCoord = float2(CoordX.r, CoordY.r);
|
||||
float4 C = tex2D(CompositeSampler, TexCoord + float2(0.625f, 0.4f) / RawDims) * CRange + MinC;
|
||||
float4 WT = W * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawHeight / HeightRatio) + BValue) + OValue;
|
||||
float4 WT = W * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawDims.y / HeightRatio) + BValue) + OValue;
|
||||
|
||||
float4 SincYIn1 = PI2 * Fc_y1 * n4;
|
||||
float4 SincYIn2 = PI2 * Fc_y2 * n4;
|
||||
|
@ -52,11 +52,9 @@ struct PS_INPUT
|
||||
uniform float TargetWidth;
|
||||
uniform float TargetHeight;
|
||||
|
||||
uniform float RawWidth;
|
||||
uniform float RawHeight;
|
||||
uniform float2 RawDims;
|
||||
|
||||
uniform float WidthRatio;
|
||||
uniform float HeightRatio;
|
||||
uniform float2 SizeRatio;
|
||||
|
||||
VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
@ -90,26 +88,24 @@ uniform float ScanTime = 52.6f;
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 Scaler = float2(RawWidth, RawHeight);
|
||||
float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio);
|
||||
float2 Coord0 = Input.Coord0 + float2(PValue * 0.00f, 0.0f) / RawDims;
|
||||
float2 Coord1 = Input.Coord1 + float2(PValue * 0.25f, 0.0f) / RawDims;
|
||||
float2 Coord2 = Input.Coord2 + float2(PValue * 0.50f, 0.0f) / RawDims;
|
||||
float2 Coord3 = Input.Coord3 + float2(PValue * 0.75f, 0.0f) / RawDims;
|
||||
|
||||
float2 Coord0 = Input.Coord0 + float2(PValue * 0.00f, 0.0f) / Scaler;
|
||||
float2 Coord1 = Input.Coord1 + float2(PValue * 0.25f, 0.0f) / Scaler;
|
||||
float2 Coord2 = Input.Coord2 + float2(PValue * 0.50f, 0.0f) / Scaler;
|
||||
float2 Coord3 = Input.Coord3 + float2(PValue * 0.75f, 0.0f) / Scaler;
|
||||
|
||||
float2 TexelOffset = 0.5f / Scaler;
|
||||
float2 TexelOffset = 0.5f / RawDims;
|
||||
float3 Texel0 = tex2D(DiffuseSampler, Coord0 + TexelOffset).rgb;
|
||||
float3 Texel1 = tex2D(DiffuseSampler, Coord1 + TexelOffset).rgb;
|
||||
float3 Texel2 = tex2D(DiffuseSampler, Coord2 + TexelOffset).rgb;
|
||||
float3 Texel3 = tex2D(DiffuseSampler, Coord3 + TexelOffset).rgb;
|
||||
|
||||
float2 InvSize = 1.0f / SizeRatio;
|
||||
float PI = 3.1415926535897932384626433832795;
|
||||
float W = PI * 2.0f * CCValue * ScanTime;
|
||||
float T0 = Coord0.x * WidthRatio + AValue * Coord0.y * 2.0f * (RawHeight / HeightRatio) + BValue;
|
||||
float T1 = Coord1.x * WidthRatio + AValue * Coord1.y * 2.0f * (RawHeight / HeightRatio) + BValue;
|
||||
float T2 = Coord2.x * WidthRatio + AValue * Coord2.y * 2.0f * (RawHeight / HeightRatio) + BValue;
|
||||
float T3 = Coord3.x * WidthRatio + AValue * Coord3.y * 2.0f * (RawHeight / HeightRatio) + BValue;
|
||||
float T0 = Coord0.x * InvSize.x + AValue * Coord0.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
|
||||
float T1 = Coord1.x * InvSize.x + AValue * Coord1.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
|
||||
float T2 = Coord2.x * InvSize.x + AValue * Coord2.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
|
||||
float T3 = Coord3.x * InvSize.x + AValue * Coord3.y * 2.0f * (RawDims.y / InvSize.y) + BValue;
|
||||
|
||||
float Y0 = dot(Texel0, float3(0.299f, 0.587f, 0.114f));
|
||||
float I0 = dot(Texel0, float3(0.595716f, -0.274453f, -0.321263f));
|
||||
|
@ -364,6 +364,7 @@ render_texture::render_texture()
|
||||
m_format(TEXFORMAT_ARGB32),
|
||||
m_bcglookup(NULL),
|
||||
m_bcglookup_entries(0),
|
||||
m_osddata(~0L),
|
||||
m_scaler(NULL),
|
||||
m_param(NULL),
|
||||
m_curseq(0)
|
||||
@ -397,6 +398,7 @@ void render_texture::reset(render_manager &manager, texture_scaler_func scaler,
|
||||
m_scaler = scaler;
|
||||
m_param = param;
|
||||
}
|
||||
m_osddata = ~0L;
|
||||
}
|
||||
|
||||
|
||||
@ -491,6 +493,8 @@ bool render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t
|
||||
if (dwidth < 1) dwidth = 1;
|
||||
if (dheight < 1) dheight = 1;
|
||||
|
||||
texinfo.osddata = m_osddata;
|
||||
|
||||
// are we scaler-free? if so, just return the source bitmap
|
||||
const rgb_t *palbase = (m_format == TEXFORMAT_PALETTE16 || m_format == TEXFORMAT_PALETTEA16) ? palette_entry_list_adjusted(m_bitmap->palette()) : NULL;
|
||||
if (m_scaler == NULL || (m_bitmap != NULL && swidth == dwidth && sheight == dheight))
|
||||
@ -502,7 +506,6 @@ bool render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t
|
||||
texinfo.width = swidth;
|
||||
texinfo.height = sheight;
|
||||
texinfo.palette = palbase;
|
||||
texinfo.osddata = m_osddata;
|
||||
texinfo.seqid = ++m_curseq;
|
||||
return true;
|
||||
}
|
||||
|
@ -1,707 +0,0 @@
|
||||
//============================================================
|
||||
//
|
||||
// d3d8intf.c - Direct3D 8.1 abstraction layer
|
||||
//
|
||||
//============================================================
|
||||
//
|
||||
// Copyright Aaron Giles
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or
|
||||
// without modification, are permitted provided that the
|
||||
// following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above
|
||||
// copyright notice, this list of conditions and the
|
||||
// following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the
|
||||
// above copyright notice, this list of conditions and
|
||||
// the following disclaimer in the documentation and/or
|
||||
// other materials provided with the distribution.
|
||||
// * Neither the name 'MAME' nor the names of its
|
||||
// contributors may be used to endorse or promote
|
||||
// products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGE (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//============================================================
|
||||
|
||||
// standard windows headers
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <d3d8.h>
|
||||
#define D3DXVECTOR4 void
|
||||
#undef interface
|
||||
|
||||
// MAME headers
|
||||
#include "emu.h"
|
||||
|
||||
// MAMEOS headers
|
||||
#include "d3dintf.h"
|
||||
#include "winmain.h"
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
typedef IDirect3D8 *(WINAPI *direct3dcreate8_ptr)(UINT SDKVersion);
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// PROTOTYPES
|
||||
//============================================================
|
||||
|
||||
static void set_interfaces(d3d_base *d3dptr);
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// INLINES
|
||||
//============================================================
|
||||
|
||||
INLINE void convert_present_params(const d3d_present_parameters *params, D3DPRESENT_PARAMETERS *d3d8params)
|
||||
{
|
||||
memset(d3d8params, 0, sizeof(*d3d8params));
|
||||
d3d8params->BackBufferWidth = params->BackBufferWidth;
|
||||
d3d8params->BackBufferHeight = params->BackBufferHeight;
|
||||
d3d8params->BackBufferFormat = params->BackBufferFormat;
|
||||
d3d8params->BackBufferCount = params->BackBufferCount;
|
||||
d3d8params->MultiSampleType = params->MultiSampleType;
|
||||
// d3d8params->MultiSampleQuality = params->MultiSampleQuality;
|
||||
d3d8params->SwapEffect = params->SwapEffect;
|
||||
d3d8params->hDeviceWindow = params->hDeviceWindow;
|
||||
d3d8params->Windowed = params->Windowed;
|
||||
d3d8params->EnableAutoDepthStencil = params->EnableAutoDepthStencil;
|
||||
d3d8params->AutoDepthStencilFormat = params->AutoDepthStencilFormat;
|
||||
d3d8params->Flags = params->Flags;
|
||||
d3d8params->FullScreen_RefreshRateInHz = params->FullScreen_RefreshRateInHz;
|
||||
d3d8params->FullScreen_PresentationInterval = params->PresentationInterval;
|
||||
if (d3d8params->Windowed)
|
||||
d3d8params->FullScreen_PresentationInterval = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// drawd3d8_init
|
||||
//============================================================
|
||||
|
||||
d3d_base *drawd3d8_init(void)
|
||||
{
|
||||
direct3dcreate8_ptr direct3dcreate8;
|
||||
HINSTANCE dllhandle;
|
||||
IDirect3D8 *d3d8;
|
||||
d3d_base *d3dptr;
|
||||
|
||||
// dynamically grab the create function from d3d8.dll
|
||||
dllhandle = LoadLibrary(TEXT("d3d8.dll"));
|
||||
if (dllhandle == NULL)
|
||||
{
|
||||
mame_printf_verbose("Direct3D: Unable to access d3d8.dll\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// import the create function
|
||||
direct3dcreate8 = (direct3dcreate8_ptr)GetProcAddress(dllhandle, "Direct3DCreate8");
|
||||
if (direct3dcreate8 == NULL)
|
||||
{
|
||||
mame_printf_verbose("Direct3D: Unable to find Direct3DCreate8\n");
|
||||
FreeLibrary(dllhandle);
|
||||
dllhandle = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// create our core direct 3d object
|
||||
d3d8 = (*direct3dcreate8)(D3D_SDK_VERSION);
|
||||
if (d3d8 == NULL)
|
||||
{
|
||||
mame_printf_verbose("Direct3D: Error attempting to initialize Direct3D8\n");
|
||||
FreeLibrary(dllhandle);
|
||||
dllhandle = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// allocate an object to hold our data
|
||||
d3dptr = global_alloc(d3d_base);
|
||||
d3dptr->version = 8;
|
||||
d3dptr->d3dobj = d3d8;
|
||||
d3dptr->dllhandle = dllhandle;
|
||||
d3dptr->post_fx_available = false;
|
||||
set_interfaces(d3dptr);
|
||||
|
||||
mame_printf_verbose("Direct3D: Using Direct3D 8\n");
|
||||
return d3dptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// Direct3D interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_check_device_format(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_CheckDeviceFormat(d3d8, adapter, devtype, adapterformat, usage, restype, format);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_check_device_type(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_CheckDeviceType(d3d8, adapter, devtype, format, backformat, windowed);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_create_device(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, d3d_present_parameters *params, d3d_device **dev)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
D3DPRESENT_PARAMETERS d3d8params;
|
||||
convert_present_params(params, &d3d8params);
|
||||
return IDirect3D8_CreateDevice(d3d8, adapter, devtype, focus, behavior, &d3d8params, (IDirect3DDevice8 **)dev);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_enum_adapter_modes(d3d_base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_EnumAdapterModes(d3d8, adapter, index, mode);
|
||||
}
|
||||
|
||||
|
||||
static UINT d3d_get_adapter_count(d3d_base *d3dptr)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_GetAdapterCount(d3d8);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_get_adapter_display_mode(d3d_base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_GetAdapterDisplayMode(d3d8, adapter, mode);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_get_adapter_identifier(d3d_base *d3dptr, UINT adapter, DWORD flags, d3d_adapter_identifier *identifier)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
D3DADAPTER_IDENTIFIER8 id;
|
||||
HRESULT result = IDirect3D8_GetAdapterIdentifier(d3d8, adapter, flags, &id);
|
||||
memcpy(identifier->Driver, id.Driver, sizeof(identifier->Driver));
|
||||
memcpy(identifier->Description, id.Description, sizeof(identifier->Description));
|
||||
identifier->DriverVersion = id.DriverVersion;
|
||||
identifier->VendorId = id.VendorId;
|
||||
identifier->DeviceId = id.DeviceId;
|
||||
identifier->SubSysId = id.SubSysId;
|
||||
identifier->Revision = id.Revision;
|
||||
identifier->DeviceIdentifier = id.DeviceIdentifier;
|
||||
identifier->WHQLLevel = id.WHQLLevel;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static UINT d3d_get_adapter_mode_count(d3d_base *d3dptr, UINT adapter, D3DFORMAT format)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_GetAdapterModeCount(d3d8, adapter);
|
||||
}
|
||||
|
||||
|
||||
static HMONITOR d3d_get_adapter_monitor(d3d_base *d3dptr, UINT adapter)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
return IDirect3D8_GetAdapterMonitor(d3d8, adapter);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_get_caps_dword(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, d3d_caps_index which, DWORD *value)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
D3DCAPS8 caps;
|
||||
HRESULT result = IDirect3D8_GetDeviceCaps(d3d8, adapter, devtype, &caps);
|
||||
switch (which)
|
||||
{
|
||||
case CAPS_PRESENTATION_INTERVALS: *value = caps.PresentationIntervals; break;
|
||||
case CAPS_CAPS2: *value = caps.DevCaps; break;
|
||||
case CAPS_DEV_CAPS: *value = caps.DevCaps; break;
|
||||
case CAPS_SRCBLEND_CAPS: *value = caps.SrcBlendCaps; break;
|
||||
case CAPS_DSTBLEND_CAPS: *value = caps.DestBlendCaps; break;
|
||||
case CAPS_TEXTURE_CAPS: *value = caps.TextureCaps; break;
|
||||
case CAPS_TEXTURE_FILTER_CAPS: *value = caps.TextureFilterCaps; break;
|
||||
case CAPS_TEXTURE_ADDRESS_CAPS: *value = caps.TextureAddressCaps; break;
|
||||
case CAPS_TEXTURE_OP_CAPS: *value = caps.TextureOpCaps; break;
|
||||
case CAPS_MAX_TEXTURE_ASPECT: *value = caps.MaxTextureAspectRatio; break;
|
||||
case CAPS_MAX_TEXTURE_WIDTH: *value = caps.MaxTextureWidth; break;
|
||||
case CAPS_MAX_TEXTURE_HEIGHT: *value = caps.MaxTextureHeight; break;
|
||||
case CAPS_STRETCH_RECT_FILTER: *value = 0; break;
|
||||
case CAPS_MAX_PS30_INSN_SLOTS: *value = 0; break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_release(d3d_base *d3dptr)
|
||||
{
|
||||
IDirect3D8 *d3d8 = (IDirect3D8 *)d3dptr->d3dobj;
|
||||
ULONG result = IDirect3D8_Release(d3d8);
|
||||
FreeLibrary(d3dptr->dllhandle);
|
||||
global_free(d3dptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static const d3d_interface d3d8_interface =
|
||||
{
|
||||
d3d_check_device_format,
|
||||
d3d_check_device_type,
|
||||
d3d_create_device,
|
||||
d3d_enum_adapter_modes,
|
||||
d3d_get_adapter_count,
|
||||
d3d_get_adapter_display_mode,
|
||||
d3d_get_adapter_identifier,
|
||||
d3d_get_adapter_mode_count,
|
||||
d3d_get_adapter_monitor,
|
||||
d3d_get_caps_dword,
|
||||
d3d_release
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// Direct3DDevice interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_device_begin_scene(d3d_device *dev)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_BeginScene(device);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_clear(d3d_device *dev, DWORD count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_Clear(device, count, rects, flags, color, z, stencil);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_offscreen_plain_surface(d3d_device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, d3d_surface **surface)
|
||||
{
|
||||
assert(FALSE);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_effect(d3d_device *dev, const WCHAR *name, d3d_effect **effect)
|
||||
{
|
||||
assert(FALSE);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_texture(d3d_device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, d3d_texture **texture)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_CreateTexture(device, width, height, levels, usage, format, pool, (IDirect3DTexture8 **)texture);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_vertex_buffer(d3d_device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, d3d_vertex_buffer **buf)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_CreateVertexBuffer(device, length, usage, fvf, pool, (IDirect3DVertexBuffer8 **)buf);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_draw_primitive(d3d_device *dev, D3DPRIMITIVETYPE type, UINT start, UINT count)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_DrawPrimitive(device, type, start, count);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_end_scene(d3d_device *dev)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_EndScene(device);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_get_raster_status(d3d_device *dev, D3DRASTER_STATUS *status)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_GetRasterStatus(device, status);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_get_render_target(d3d_device *dev, DWORD index, d3d_surface **surface)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
assert(index == 0);
|
||||
return IDirect3DDevice8_GetRenderTarget(device, (IDirect3DSurface8 **)surface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_get_render_target_data(d3d_device *dev, d3d_surface *rendertarget, d3d_surface *destsurface)
|
||||
{
|
||||
assert(false);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_present(d3d_device *dev, const RECT *source, const RECT *dest, HWND override, RGNDATA *dirty, DWORD flags)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_Present(device, source, dest, override, dirty);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_device_release(d3d_device *dev)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_Release(device);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_reset(d3d_device *dev, d3d_present_parameters *params)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
D3DPRESENT_PARAMETERS d3d8params;
|
||||
convert_present_params(params, &d3d8params);
|
||||
return IDirect3DDevice8_Reset(device, &d3d8params);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_device_set_gamma_ramp(d3d_device *dev, DWORD flags, const D3DGAMMARAMP *ramp)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
IDirect3DDevice8_SetGammaRamp(device, flags, ramp);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_render_state(d3d_device *dev, D3DRENDERSTATETYPE state, DWORD value)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_SetRenderState(device, state, value);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_render_target(d3d_device *dev, DWORD index, d3d_surface *surf)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
IDirect3DSurface8 *surface = (IDirect3DSurface8 *)surf;
|
||||
assert(index == 0);
|
||||
return IDirect3DDevice8_SetRenderTarget(device, surface, NULL);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_render_target(d3d_device *dev, UINT width, UINT height, D3DFORMAT format, d3d_surface **surface)
|
||||
{
|
||||
assert(false);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_stream_source(d3d_device *dev, UINT number, d3d_vertex_buffer *vbuf, UINT stride)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
IDirect3DVertexBuffer8 *vertexbuf = (IDirect3DVertexBuffer8 *)vbuf;
|
||||
return IDirect3DDevice8_SetStreamSource(device, number, vertexbuf, stride);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_texture(d3d_device *dev, DWORD stage, d3d_texture *tex)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
IDirect3DBaseTexture8 *texture = (IDirect3DBaseTexture8 *)tex;
|
||||
return IDirect3DDevice8_SetTexture(device, stage, texture);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_texture_stage_state(d3d_device *dev, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_SetTextureStageState(device, stage, state, value);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_vertex_format(d3d_device *dev, D3DFORMAT format)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_SetVertexShader(device, format);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_stretch_rect(d3d_device *dev, d3d_surface *source, const RECT *srcrect, d3d_surface *dest, const RECT *dstrect, D3DTEXTUREFILTERTYPE filter)
|
||||
{
|
||||
assert(FALSE);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_test_cooperative_level(d3d_device *dev)
|
||||
{
|
||||
IDirect3DDevice8 *device = (IDirect3DDevice8 *)dev;
|
||||
return IDirect3DDevice8_TestCooperativeLevel(device);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_device_interface d3d8_device_interface =
|
||||
{
|
||||
d3d_device_begin_scene,
|
||||
d3d_device_clear,
|
||||
d3d_device_create_offscreen_plain_surface,
|
||||
d3d_device_create_effect,
|
||||
d3d_device_create_texture,
|
||||
d3d_device_create_vertex_buffer,
|
||||
d3d_device_create_render_target,
|
||||
d3d_device_draw_primitive,
|
||||
d3d_device_end_scene,
|
||||
d3d_device_get_raster_status,
|
||||
d3d_device_get_render_target,
|
||||
d3d_device_get_render_target_data,
|
||||
d3d_device_present,
|
||||
d3d_device_release,
|
||||
d3d_device_reset,
|
||||
d3d_device_set_gamma_ramp,
|
||||
d3d_device_set_render_state,
|
||||
d3d_device_set_render_target,
|
||||
d3d_device_set_stream_source,
|
||||
d3d_device_set_texture,
|
||||
d3d_device_set_texture_stage_state,
|
||||
d3d_device_set_vertex_format,
|
||||
d3d_device_stretch_rect,
|
||||
d3d_device_test_cooperative_level
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// Direct3DSurface interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_surface_lock_rect(d3d_surface *surf, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags)
|
||||
{
|
||||
IDirect3DSurface8 *surface = (IDirect3DSurface8 *)surf;
|
||||
return IDirect3DSurface8_LockRect(surface, locked, rect, flags);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_surface_release(d3d_surface *surf)
|
||||
{
|
||||
IDirect3DSurface8 *surface = (IDirect3DSurface8 *)surf;
|
||||
return IDirect3DSurface8_Release(surface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_surface_unlock_rect(d3d_surface *surf)
|
||||
{
|
||||
IDirect3DSurface8 *surface = (IDirect3DSurface8 *)surf;
|
||||
return IDirect3DSurface8_UnlockRect(surface);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_surface_interface d3d8_surface_interface =
|
||||
{
|
||||
d3d_surface_lock_rect,
|
||||
d3d_surface_release,
|
||||
d3d_surface_unlock_rect
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// Direct3DTexture interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_texture_get_surface_level(d3d_texture *tex, UINT level, d3d_surface **surface)
|
||||
{
|
||||
IDirect3DTexture8 *texture = (IDirect3DTexture8 *)tex;
|
||||
return IDirect3DTexture8_GetSurfaceLevel(texture, level, (IDirect3DSurface8 **)surface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_texture_lock_rect(d3d_texture *tex, UINT level, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags)
|
||||
{
|
||||
IDirect3DTexture8 *texture = (IDirect3DTexture8 *)tex;
|
||||
return IDirect3DTexture8_LockRect(texture, level, locked, rect, flags);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_texture_release(d3d_texture *tex)
|
||||
{
|
||||
IDirect3DTexture8 *texture = (IDirect3DTexture8 *)tex;
|
||||
return IDirect3DTexture8_Release(texture);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_texture_unlock_rect(d3d_texture *tex, UINT level)
|
||||
{
|
||||
IDirect3DTexture8 *texture = (IDirect3DTexture8 *)tex;
|
||||
return IDirect3DTexture8_UnlockRect(texture, level);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_texture_interface d3d8_texture_interface =
|
||||
{
|
||||
d3d_texture_get_surface_level,
|
||||
d3d_texture_lock_rect,
|
||||
d3d_texture_release,
|
||||
d3d_texture_unlock_rect
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// Direct3DVertexBuffer interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_vertex_buffer_lock(d3d_vertex_buffer *vbuf, UINT offset, UINT size, VOID **data, DWORD flags)
|
||||
{
|
||||
IDirect3DVertexBuffer8 *vertexbuf = (IDirect3DVertexBuffer8 *)vbuf;
|
||||
return IDirect3DVertexBuffer8_Lock(vertexbuf, offset, size, (BYTE **)data, flags);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_vertex_buffer_release(d3d_vertex_buffer *vbuf)
|
||||
{
|
||||
IDirect3DVertexBuffer8 *vertexbuf = (IDirect3DVertexBuffer8 *)vbuf;
|
||||
return IDirect3DVertexBuffer8_Release(vertexbuf);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_vertex_buffer_unlock(d3d_vertex_buffer *vbuf)
|
||||
{
|
||||
IDirect3DVertexBuffer8 *vertexbuf = (IDirect3DVertexBuffer8 *)vbuf;
|
||||
return IDirect3DVertexBuffer8_Unlock(vertexbuf);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_vertex_buffer_interface d3d8_vertex_buffer_interface =
|
||||
{
|
||||
d3d_vertex_buffer_lock,
|
||||
d3d_vertex_buffer_release,
|
||||
d3d_vertex_buffer_unlock
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// Direct3DEffect interfaces
|
||||
//============================================================
|
||||
|
||||
static void d3d_effect_begin(d3d_effect *effect, UINT *passes, DWORD flags)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_end(d3d_effect *effect)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_begin_pass(d3d_effect *effect, UINT pass)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_end_pass(d3d_effect *effect)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_technique(d3d_effect *effect, const char *name)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_vector(d3d_effect *effect, const char *name, int count, float *vector)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_float(d3d_effect *effect, const char *name, float value)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_int(d3d_effect *effect, const char *name, int value)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_matrix(d3d_effect *effect, const char *name, d3d_matrix *matrix)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_texture(d3d_effect *effect, const char *name, d3d_texture *tex)
|
||||
{
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_effect_release(d3d_effect *effect)
|
||||
{
|
||||
assert(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const d3d_effect_interface d3d8_effect_interface =
|
||||
{
|
||||
d3d_effect_begin,
|
||||
d3d_effect_end,
|
||||
d3d_effect_begin_pass,
|
||||
d3d_effect_end_pass,
|
||||
d3d_effect_set_technique,
|
||||
d3d_effect_set_vector,
|
||||
d3d_effect_set_float,
|
||||
d3d_effect_set_int,
|
||||
d3d_effect_set_matrix,
|
||||
d3d_effect_set_texture,
|
||||
d3d_effect_release
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// set_interfaces
|
||||
//============================================================
|
||||
|
||||
static void set_interfaces(d3d_base *d3dptr)
|
||||
{
|
||||
d3dptr->d3d = d3d8_interface;
|
||||
d3dptr->device = d3d8_device_interface;
|
||||
d3dptr->surface = d3d8_surface_interface;
|
||||
d3dptr->texture = d3d8_texture_interface;
|
||||
d3dptr->vertexbuf = d3d8_vertex_buffer_interface;
|
||||
d3dptr->effect = d3d8_effect_interface;
|
||||
}
|
@ -65,17 +65,20 @@ typedef HRESULT (WINAPI *direct3dx9_loadeffect_ptr)(LPDIRECT3DDEVICE9 pDevice, L
|
||||
static direct3dx9_loadeffect_ptr g_load_effect = NULL;
|
||||
|
||||
|
||||
namespace d3d
|
||||
{
|
||||
|
||||
//============================================================
|
||||
// PROTOTYPES
|
||||
//============================================================
|
||||
|
||||
static void set_interfaces(d3d_base *d3dptr);
|
||||
static void set_interfaces(base *d3dptr);
|
||||
|
||||
//============================================================
|
||||
// INLINES
|
||||
//============================================================
|
||||
|
||||
INLINE void convert_present_params(const d3d_present_parameters *params, D3DPRESENT_PARAMETERS *d3d9params)
|
||||
INLINE void convert_present_params(const present_parameters *params, D3DPRESENT_PARAMETERS *d3d9params)
|
||||
{
|
||||
memset(d3d9params, 0, sizeof(*d3d9params));
|
||||
d3d9params->BackBufferWidth = params->BackBufferWidth;
|
||||
@ -100,12 +103,12 @@ INLINE void convert_present_params(const d3d_present_parameters *params, D3DPRES
|
||||
// drawd3d9_init
|
||||
//============================================================
|
||||
|
||||
d3d_base *drawd3d9_init(void)
|
||||
base *drawd3d9_init(void)
|
||||
{
|
||||
direct3dcreate9_ptr direct3dcreate9;
|
||||
HINSTANCE dllhandle;
|
||||
IDirect3D9 *d3d9;
|
||||
d3d_base *d3dptr;
|
||||
base *d3dptr;
|
||||
bool post_available = true;
|
||||
|
||||
// dynamically grab the create function from d3d9.dll
|
||||
@ -165,7 +168,7 @@ d3d_base *drawd3d9_init(void)
|
||||
}
|
||||
|
||||
// allocate an object to hold our data
|
||||
d3dptr = global_alloc(d3d_base);
|
||||
d3dptr = global_alloc(base);
|
||||
d3dptr->version = 9;
|
||||
d3dptr->d3dobj = d3d9;
|
||||
d3dptr->dllhandle = dllhandle;
|
||||
@ -182,20 +185,20 @@ d3d_base *drawd3d9_init(void)
|
||||
// Direct3D interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_check_device_format(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format)
|
||||
static HRESULT check_device_format(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_CheckDeviceFormat(d3d9, adapter, devtype, adapterformat, usage, restype, format);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_check_device_type(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed)
|
||||
static HRESULT check_device_type(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_CheckDeviceType(d3d9, adapter, devtype, format, backformat, windowed);
|
||||
}
|
||||
|
||||
static HRESULT d3d_create_device(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, d3d_present_parameters *params, d3d_device **dev)
|
||||
static HRESULT create_device(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, present_parameters *params, device **dev)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
D3DPRESENT_PARAMETERS d3d9params;
|
||||
@ -203,28 +206,28 @@ static HRESULT d3d_create_device(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devt
|
||||
return IDirect3D9_CreateDevice(d3d9, adapter, devtype, focus, behavior, &d3d9params, (IDirect3DDevice9 **)dev);
|
||||
}
|
||||
|
||||
static HRESULT d3d_enum_adapter_modes(d3d_base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode)
|
||||
static HRESULT enum_adapter_modes(base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_EnumAdapterModes(d3d9, adapter, format, index, mode);
|
||||
}
|
||||
|
||||
|
||||
static UINT d3d_get_adapter_count(d3d_base *d3dptr)
|
||||
static UINT get_adapter_count(base *d3dptr)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_GetAdapterCount(d3d9);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_get_adapter_display_mode(d3d_base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode)
|
||||
static HRESULT get_adapter_display_mode(base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_GetAdapterDisplayMode(d3d9, adapter, mode);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_get_adapter_identifier(d3d_base *d3dptr, UINT adapter, DWORD flags, d3d_adapter_identifier *identifier)
|
||||
static HRESULT get_adapter_identifier(base *d3dptr, UINT adapter, DWORD flags, adapter_identifier *identifier)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
D3DADAPTER_IDENTIFIER9 id;
|
||||
@ -242,21 +245,21 @@ static HRESULT d3d_get_adapter_identifier(d3d_base *d3dptr, UINT adapter, DWORD
|
||||
}
|
||||
|
||||
|
||||
static UINT d3d_get_adapter_mode_count(d3d_base *d3dptr, UINT adapter, D3DFORMAT format)
|
||||
static UINT get_adapter_mode_count(base *d3dptr, UINT adapter, D3DFORMAT format)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_GetAdapterModeCount(d3d9, adapter, format);
|
||||
}
|
||||
|
||||
|
||||
static HMONITOR d3d_get_adapter_monitor(d3d_base *d3dptr, UINT adapter)
|
||||
static HMONITOR get_adapter_monitor(base *d3dptr, UINT adapter)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
return IDirect3D9_GetAdapterMonitor(d3d9, adapter);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_get_caps_dword(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, d3d_caps_index which, DWORD *value)
|
||||
static HRESULT get_caps_dword(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, caps_index which, DWORD *value)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
D3DCAPS9 caps;
|
||||
@ -282,7 +285,7 @@ static HRESULT d3d_get_caps_dword(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE dev
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_release(d3d_base *d3dptr)
|
||||
static ULONG release(base *d3dptr)
|
||||
{
|
||||
IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
|
||||
ULONG result = IDirect3D9_Release(d3d9);
|
||||
@ -292,19 +295,19 @@ static ULONG d3d_release(d3d_base *d3dptr)
|
||||
}
|
||||
|
||||
|
||||
static const d3d_interface d3d9_interface =
|
||||
static const interface d3d9_interface =
|
||||
{
|
||||
d3d_check_device_format,
|
||||
d3d_check_device_type,
|
||||
d3d_create_device,
|
||||
d3d_enum_adapter_modes,
|
||||
d3d_get_adapter_count,
|
||||
d3d_get_adapter_display_mode,
|
||||
d3d_get_adapter_identifier,
|
||||
d3d_get_adapter_mode_count,
|
||||
d3d_get_adapter_monitor,
|
||||
d3d_get_caps_dword,
|
||||
d3d_release
|
||||
check_device_format,
|
||||
check_device_type,
|
||||
create_device,
|
||||
enum_adapter_modes,
|
||||
get_adapter_count,
|
||||
get_adapter_display_mode,
|
||||
get_adapter_identifier,
|
||||
get_adapter_mode_count,
|
||||
get_adapter_monitor,
|
||||
get_caps_dword,
|
||||
release
|
||||
};
|
||||
|
||||
|
||||
@ -313,27 +316,27 @@ static const d3d_interface d3d9_interface =
|
||||
// Direct3DDevice interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_device_begin_scene(d3d_device *dev)
|
||||
static HRESULT device_begin_scene(device *dev)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_BeginScene(device);
|
||||
}
|
||||
|
||||
static HRESULT d3d_device_clear(d3d_device *dev, DWORD count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
|
||||
static HRESULT device_clear(device *dev, DWORD count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_Clear(device, count, rects, flags, color, z, stencil);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_offscreen_plain_surface(d3d_device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, d3d_surface **surface)
|
||||
static HRESULT device_create_offscreen_plain_surface(device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, surface **surface)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_CreateOffscreenPlainSurface(device, width, height, format, pool, (IDirect3DSurface9 **)surface, NULL);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_effect(d3d_device *dev, const WCHAR *name, d3d_effect **effect)
|
||||
static HRESULT device_create_effect(device *dev, const WCHAR *name, effect **effect)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
|
||||
@ -356,56 +359,56 @@ static HRESULT d3d_device_create_effect(d3d_device *dev, const WCHAR *name, d3d_
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_texture(d3d_device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, d3d_texture **texture)
|
||||
static HRESULT device_create_texture(device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, texture **texture)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_CreateTexture(device, width, height, levels, usage, format, pool, (IDirect3DTexture9 **)texture, NULL);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_vertex_buffer(d3d_device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, d3d_vertex_buffer **buf)
|
||||
static HRESULT device_create_vertex_buffer(device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, vertex_buffer **buf)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_CreateVertexBuffer(device, length, usage, fvf, pool, (IDirect3DVertexBuffer9 **)buf, NULL);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_draw_primitive(d3d_device *dev, D3DPRIMITIVETYPE type, UINT start, UINT count)
|
||||
static HRESULT device_draw_primitive(device *dev, D3DPRIMITIVETYPE type, UINT start, UINT count)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_DrawPrimitive(device, type, start, count);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_end_scene(d3d_device *dev)
|
||||
static HRESULT device_end_scene(device *dev)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_EndScene(device);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_get_raster_status(d3d_device *dev, D3DRASTER_STATUS *status)
|
||||
static HRESULT device_get_raster_status(device *dev, D3DRASTER_STATUS *status)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_GetRasterStatus(device, 0, status);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_get_render_target(d3d_device *dev, DWORD index, d3d_surface **surface)
|
||||
static HRESULT device_get_render_target(device *dev, DWORD index, surface **surface)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_GetRenderTarget(device, index, (IDirect3DSurface9 **)surface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_get_render_target_data(d3d_device *dev, d3d_surface *rendertarget, d3d_surface *destsurface)
|
||||
static HRESULT device_get_render_target_data(device *dev, surface *rendertarget, surface *destsurface)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_GetRenderTargetData(device, (IDirect3DSurface9 *)rendertarget, (IDirect3DSurface9 *)destsurface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_present(d3d_device *dev, const RECT *source, const RECT *dest, HWND override, RGNDATA *dirty, DWORD flags)
|
||||
static HRESULT device_present(device *dev, const RECT *source, const RECT *dest, HWND override, RGNDATA *dirty, DWORD flags)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
if (flags != 0)
|
||||
@ -423,14 +426,14 @@ static HRESULT d3d_device_present(d3d_device *dev, const RECT *source, const REC
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_device_release(d3d_device *dev)
|
||||
static ULONG device_release(device *dev)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_Release(device);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_reset(d3d_device *dev, d3d_present_parameters *params)
|
||||
static HRESULT device_reset(device *dev, present_parameters *params)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
D3DPRESENT_PARAMETERS d3d9params;
|
||||
@ -439,21 +442,21 @@ static HRESULT d3d_device_reset(d3d_device *dev, d3d_present_parameters *params)
|
||||
}
|
||||
|
||||
|
||||
static void d3d_device_set_gamma_ramp(d3d_device *dev, DWORD flags, const D3DGAMMARAMP *ramp)
|
||||
static void device_set_gamma_ramp(device *dev, DWORD flags, const D3DGAMMARAMP *ramp)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
IDirect3DDevice9_SetGammaRamp(device, 0, flags, ramp);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_render_state(d3d_device *dev, D3DRENDERSTATETYPE state, DWORD value)
|
||||
static HRESULT device_set_render_state(device *dev, D3DRENDERSTATETYPE state, DWORD value)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_SetRenderState(device, state, value);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_render_target(d3d_device *dev, DWORD index, d3d_surface *surf)
|
||||
static HRESULT device_set_render_target(device *dev, DWORD index, surface *surf)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
IDirect3DSurface9 *surface = (IDirect3DSurface9 *)surf;
|
||||
@ -461,14 +464,14 @@ static HRESULT d3d_device_set_render_target(d3d_device *dev, DWORD index, d3d_su
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_create_render_target(d3d_device *dev, UINT width, UINT height, D3DFORMAT format, d3d_surface **surface)
|
||||
static HRESULT device_create_render_target(device *dev, UINT width, UINT height, D3DFORMAT format, surface **surface)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_CreateRenderTarget(device, width, height, format, D3DMULTISAMPLE_NONE, 0, false, (IDirect3DSurface9 **)surface, NULL);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_stream_source(d3d_device *dev, UINT number, d3d_vertex_buffer *vbuf, UINT stride)
|
||||
static HRESULT device_set_stream_source(device *dev, UINT number, vertex_buffer *vbuf, UINT stride)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
IDirect3DVertexBuffer9 *vertexbuf = (IDirect3DVertexBuffer9 *)vbuf;
|
||||
@ -476,7 +479,7 @@ static HRESULT d3d_device_set_stream_source(d3d_device *dev, UINT number, d3d_ve
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_texture(d3d_device *dev, DWORD stage, d3d_texture *tex)
|
||||
static HRESULT device_set_texture(device *dev, DWORD stage, texture *tex)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
IDirect3DBaseTexture9 *texture = (IDirect3DBaseTexture9 *)tex;
|
||||
@ -484,7 +487,7 @@ static HRESULT d3d_device_set_texture(d3d_device *dev, DWORD stage, d3d_texture
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_texture_stage_state(d3d_device *dev, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value)
|
||||
static HRESULT device_set_texture_stage_state(device *dev, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
|
||||
@ -515,14 +518,14 @@ static HRESULT d3d_device_set_texture_stage_state(d3d_device *dev, DWORD stage,
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_set_vertex_format(d3d_device *dev, D3DFORMAT format)
|
||||
static HRESULT device_set_vertex_format(device *dev, D3DFORMAT format)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_SetFVF(device, format);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_stretch_rect(d3d_device *dev, d3d_surface *source, const RECT *srcrect, d3d_surface *dest, const RECT *dstrect, D3DTEXTUREFILTERTYPE filter)
|
||||
static HRESULT device_stretch_rect(device *dev, surface *source, const RECT *srcrect, surface *dest, const RECT *dstrect, D3DTEXTUREFILTERTYPE filter)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
IDirect3DSurface9 *ssurface = (IDirect3DSurface9 *)source;
|
||||
@ -531,39 +534,39 @@ static HRESULT d3d_device_stretch_rect(d3d_device *dev, d3d_surface *source, con
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_device_test_cooperative_level(d3d_device *dev)
|
||||
static HRESULT device_test_cooperative_level(device *dev)
|
||||
{
|
||||
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
|
||||
return IDirect3DDevice9_TestCooperativeLevel(device);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_device_interface d3d9_device_interface =
|
||||
static const device_interface d3d9_device_interface =
|
||||
{
|
||||
d3d_device_begin_scene,
|
||||
d3d_device_clear,
|
||||
d3d_device_create_offscreen_plain_surface,
|
||||
d3d_device_create_effect,
|
||||
d3d_device_create_texture,
|
||||
d3d_device_create_vertex_buffer,
|
||||
d3d_device_create_render_target,
|
||||
d3d_device_draw_primitive,
|
||||
d3d_device_end_scene,
|
||||
d3d_device_get_raster_status,
|
||||
d3d_device_get_render_target,
|
||||
d3d_device_get_render_target_data,
|
||||
d3d_device_present,
|
||||
d3d_device_release,
|
||||
d3d_device_reset,
|
||||
d3d_device_set_gamma_ramp,
|
||||
d3d_device_set_render_state,
|
||||
d3d_device_set_render_target,
|
||||
d3d_device_set_stream_source,
|
||||
d3d_device_set_texture,
|
||||
d3d_device_set_texture_stage_state,
|
||||
d3d_device_set_vertex_format,
|
||||
d3d_device_stretch_rect,
|
||||
d3d_device_test_cooperative_level
|
||||
device_begin_scene,
|
||||
device_clear,
|
||||
device_create_offscreen_plain_surface,
|
||||
device_create_effect,
|
||||
device_create_texture,
|
||||
device_create_vertex_buffer,
|
||||
device_create_render_target,
|
||||
device_draw_primitive,
|
||||
device_end_scene,
|
||||
device_get_raster_status,
|
||||
device_get_render_target,
|
||||
device_get_render_target_data,
|
||||
device_present,
|
||||
device_release,
|
||||
device_reset,
|
||||
device_set_gamma_ramp,
|
||||
device_set_render_state,
|
||||
device_set_render_target,
|
||||
device_set_stream_source,
|
||||
device_set_texture,
|
||||
device_set_texture_stage_state,
|
||||
device_set_vertex_format,
|
||||
device_stretch_rect,
|
||||
device_test_cooperative_level
|
||||
};
|
||||
|
||||
|
||||
@ -572,32 +575,32 @@ static const d3d_device_interface d3d9_device_interface =
|
||||
// Direct3DSurface interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_surface_lock_rect(d3d_surface *surf, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags)
|
||||
static HRESULT surface_lock_rect(surface *surf, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags)
|
||||
{
|
||||
IDirect3DSurface9 *surface = (IDirect3DSurface9 *)surf;
|
||||
return IDirect3DSurface9_LockRect(surface, locked, rect, flags);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_surface_release(d3d_surface *surf)
|
||||
static ULONG surface_release(surface *surf)
|
||||
{
|
||||
IDirect3DSurface9 *surface = (IDirect3DSurface9 *)surf;
|
||||
return IDirect3DSurface9_Release(surface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_surface_unlock_rect(d3d_surface *surf)
|
||||
static HRESULT surface_unlock_rect(surface *surf)
|
||||
{
|
||||
IDirect3DSurface9 *surface = (IDirect3DSurface9 *)surf;
|
||||
return IDirect3DSurface9_UnlockRect(surface);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_surface_interface d3d9_surface_interface =
|
||||
static const surface_interface d3d9_surface_interface =
|
||||
{
|
||||
d3d_surface_lock_rect,
|
||||
d3d_surface_release,
|
||||
d3d_surface_unlock_rect
|
||||
surface_lock_rect,
|
||||
surface_release,
|
||||
surface_unlock_rect
|
||||
};
|
||||
|
||||
|
||||
@ -606,40 +609,40 @@ static const d3d_surface_interface d3d9_surface_interface =
|
||||
// Direct3DTexture interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_texture_get_surface_level(d3d_texture *tex, UINT level, d3d_surface **surface)
|
||||
static HRESULT texture_get_surface_level(texture *tex, UINT level, surface **surface)
|
||||
{
|
||||
IDirect3DTexture9 *texture = (IDirect3DTexture9 *)tex;
|
||||
return IDirect3DTexture9_GetSurfaceLevel(texture, level, (IDirect3DSurface9 **)surface);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_texture_lock_rect(d3d_texture *tex, UINT level, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags)
|
||||
static HRESULT texture_lock_rect(texture *tex, UINT level, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags)
|
||||
{
|
||||
IDirect3DTexture9 *texture = (IDirect3DTexture9 *)tex;
|
||||
return IDirect3DTexture9_LockRect(texture, level, locked, rect, flags);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_texture_release(d3d_texture *tex)
|
||||
static ULONG texture_release(texture *tex)
|
||||
{
|
||||
IDirect3DTexture9 *texture = (IDirect3DTexture9 *)tex;
|
||||
return IDirect3DTexture9_Release(texture);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_texture_unlock_rect(d3d_texture *tex, UINT level)
|
||||
static HRESULT texture_unlock_rect(texture *tex, UINT level)
|
||||
{
|
||||
IDirect3DTexture9 *texture = (IDirect3DTexture9 *)tex;
|
||||
return IDirect3DTexture9_UnlockRect(texture, level);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_texture_interface d3d9_texture_interface =
|
||||
static const texture_interface d3d9_texture_interface =
|
||||
{
|
||||
d3d_texture_get_surface_level,
|
||||
d3d_texture_lock_rect,
|
||||
d3d_texture_release,
|
||||
d3d_texture_unlock_rect
|
||||
texture_get_surface_level,
|
||||
texture_lock_rect,
|
||||
texture_release,
|
||||
texture_unlock_rect
|
||||
};
|
||||
|
||||
|
||||
@ -648,32 +651,32 @@ static const d3d_texture_interface d3d9_texture_interface =
|
||||
// Direct3DVertexBuffer interfaces
|
||||
//============================================================
|
||||
|
||||
static HRESULT d3d_vertex_buffer_lock(d3d_vertex_buffer *vbuf, UINT offset, UINT size, VOID **data, DWORD flags)
|
||||
static HRESULT vertex_buffer_lock(vertex_buffer *vbuf, UINT offset, UINT size, VOID **data, DWORD flags)
|
||||
{
|
||||
IDirect3DVertexBuffer9 *vertexbuf = (IDirect3DVertexBuffer9 *)vbuf;
|
||||
return IDirect3DVertexBuffer9_Lock(vertexbuf, offset, size, data, flags);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_vertex_buffer_release(d3d_vertex_buffer *vbuf)
|
||||
static ULONG vertex_buffer_release(vertex_buffer *vbuf)
|
||||
{
|
||||
IDirect3DVertexBuffer9 *vertexbuf = (IDirect3DVertexBuffer9 *)vbuf;
|
||||
return IDirect3DVertexBuffer9_Release(vertexbuf);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT d3d_vertex_buffer_unlock(d3d_vertex_buffer *vbuf)
|
||||
static HRESULT vertex_buffer_unlock(vertex_buffer *vbuf)
|
||||
{
|
||||
IDirect3DVertexBuffer9 *vertexbuf = (IDirect3DVertexBuffer9 *)vbuf;
|
||||
return IDirect3DVertexBuffer9_Unlock(vertexbuf);
|
||||
}
|
||||
|
||||
|
||||
static const d3d_vertex_buffer_interface d3d9_vertex_buffer_interface =
|
||||
static const vertex_buffer_interface d3d9_vertex_buffer_interface =
|
||||
{
|
||||
d3d_vertex_buffer_lock,
|
||||
d3d_vertex_buffer_release,
|
||||
d3d_vertex_buffer_unlock
|
||||
vertex_buffer_lock,
|
||||
vertex_buffer_release,
|
||||
vertex_buffer_unlock
|
||||
};
|
||||
|
||||
|
||||
@ -682,42 +685,42 @@ static const d3d_vertex_buffer_interface d3d9_vertex_buffer_interface =
|
||||
// Direct3DEffect interfaces
|
||||
//============================================================
|
||||
|
||||
static void d3d_effect_begin(d3d_effect *effect, UINT *passes, DWORD flags)
|
||||
static void effect_begin(effect *effect, UINT *passes, DWORD flags)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->Begin(passes, flags);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_end(d3d_effect *effect)
|
||||
static void effect_end(effect *effect)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->End();
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_begin_pass(d3d_effect *effect, UINT pass)
|
||||
static void effect_begin_pass(effect *effect, UINT pass)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->BeginPass(pass);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_end_pass(d3d_effect *effect)
|
||||
static void effect_end_pass(effect *effect)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->EndPass();
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_technique(d3d_effect *effect, const char *name)
|
||||
static void effect_set_technique(effect *effect, const char *name)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->SetTechnique(name);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_vector(d3d_effect *effect, const char *name, int count, float *vector)
|
||||
static void effect_set_vector(effect *effect, const char *name, int count, float *vector)
|
||||
{
|
||||
static D3DXVECTOR4 out_vector;
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
@ -733,54 +736,54 @@ static void d3d_effect_set_vector(d3d_effect *effect, const char *name, int coun
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_float(d3d_effect *effect, const char *name, float value)
|
||||
static void effect_set_float(effect *effect, const char *name, float value)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->SetFloat(name, value);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_int(d3d_effect *effect, const char *name, int value)
|
||||
static void effect_set_int(effect *effect, const char *name, int value)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->SetInt(name, value);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_matrix(d3d_effect *effect, const char *name, d3d_matrix *matrix)
|
||||
static void effect_set_matrix(effect *effect, const char *name, matrix *matrix)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->SetMatrix(name, (D3DXMATRIX*)matrix);
|
||||
}
|
||||
|
||||
|
||||
static void d3d_effect_set_texture(d3d_effect *effect, const char *name, d3d_texture *tex)
|
||||
static void effect_set_texture(effect *effect, const char *name, texture *tex)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
d3dfx->SetTexture(name, (IDirect3DTexture9*)tex);
|
||||
}
|
||||
|
||||
|
||||
static ULONG d3d_effect_release(d3d_effect *effect)
|
||||
static ULONG effect_release(effect *effect)
|
||||
{
|
||||
ID3DXEffect *d3dfx = (ID3DXEffect*)effect;
|
||||
return d3dfx->Release();
|
||||
}
|
||||
|
||||
|
||||
static const d3d_effect_interface d3d9_effect_interface =
|
||||
static const effect_interface d3d9_effect_interface =
|
||||
{
|
||||
d3d_effect_begin,
|
||||
d3d_effect_end,
|
||||
d3d_effect_begin_pass,
|
||||
d3d_effect_end_pass,
|
||||
d3d_effect_set_technique,
|
||||
d3d_effect_set_vector,
|
||||
d3d_effect_set_float,
|
||||
d3d_effect_set_int,
|
||||
d3d_effect_set_matrix,
|
||||
d3d_effect_set_texture,
|
||||
d3d_effect_release
|
||||
effect_begin,
|
||||
effect_end,
|
||||
effect_begin_pass,
|
||||
effect_end_pass,
|
||||
effect_set_technique,
|
||||
effect_set_vector,
|
||||
effect_set_float,
|
||||
effect_set_int,
|
||||
effect_set_matrix,
|
||||
effect_set_texture,
|
||||
effect_release
|
||||
};
|
||||
|
||||
|
||||
@ -789,7 +792,7 @@ static const d3d_effect_interface d3d9_effect_interface =
|
||||
// set_interfaces
|
||||
//============================================================
|
||||
|
||||
static void set_interfaces(d3d_base *d3dptr)
|
||||
static void set_interfaces(base *d3dptr)
|
||||
{
|
||||
d3dptr->d3d = d3d9_interface;
|
||||
d3dptr->device = d3d9_device_interface;
|
||||
@ -798,3 +801,5 @@ static void set_interfaces(d3d_base *d3dptr)
|
||||
d3dptr->vertexbuf = d3d9_vertex_buffer_interface;
|
||||
d3dptr->effect = d3d9_effect_interface;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -43,56 +43,211 @@
|
||||
#define __WIN_D3DCOMM__
|
||||
|
||||
//============================================================
|
||||
// CONSTANTS
|
||||
// FORWARD DECLARATIONS
|
||||
//============================================================
|
||||
|
||||
namespace d3d
|
||||
{
|
||||
|
||||
class texture_info;
|
||||
class renderer;
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
/* d3d_texture_info holds information about a texture */
|
||||
struct d3d_texture_info
|
||||
class vec2f
|
||||
{
|
||||
d3d_texture_info * next; // next texture in the list
|
||||
d3d_texture_info * prev; // prev texture in the list
|
||||
UINT32 hash; // hash value for the texture
|
||||
UINT32 flags; // rendering flags
|
||||
render_texinfo texinfo; // copy of the texture info
|
||||
float ustart, ustop; // beginning/ending U coordinates
|
||||
float vstart, vstop; // beginning/ending V coordinates
|
||||
int rawwidth, rawheight; // raw width/height of the texture
|
||||
int type; // what type of texture are we?
|
||||
int xborderpix; // number of border pixels in X
|
||||
int yborderpix; // number of border pixels in Y
|
||||
int xprescale; // what is our X prescale factor?
|
||||
int yprescale; // what is our Y prescale factor?
|
||||
int cur_frame; // what is our current frame?
|
||||
int prev_frame; // what was our last frame? (used to determine pause state)
|
||||
d3d_texture * d3dtex; // Direct3D texture pointer
|
||||
d3d_surface * d3dsurface; // Direct3D offscreen plain surface pointer
|
||||
d3d_texture * d3dfinaltex; // Direct3D final (post-scaled) texture
|
||||
int target_index; // Direct3D target index
|
||||
public:
|
||||
vec2f()
|
||||
{
|
||||
memset(&c, 0, sizeof(float) * 2);
|
||||
}
|
||||
vec2f(float x, float y)
|
||||
{
|
||||
c.x = x;
|
||||
c.y = y;
|
||||
}
|
||||
|
||||
vec2f operator+(const vec2f& a)
|
||||
{
|
||||
return vec2f(c.x + a.c.x, c.y + a.c.y);
|
||||
}
|
||||
|
||||
vec2f operator-(const vec2f& a)
|
||||
{
|
||||
return vec2f(c.x - a.c.x, c.y - a.c.y);
|
||||
}
|
||||
|
||||
struct
|
||||
{
|
||||
float x, y;
|
||||
} c;
|
||||
};
|
||||
|
||||
class texture_manager
|
||||
{
|
||||
public:
|
||||
texture_manager() { }
|
||||
texture_manager(renderer *d3d);
|
||||
~texture_manager() { }
|
||||
|
||||
void update_textures();
|
||||
|
||||
void create_resources();
|
||||
void delete_resources();
|
||||
|
||||
texture_info * find_texinfo(const render_texinfo *texture, UINT32 flags);
|
||||
UINT32 texture_compute_hash(const render_texinfo *texture, UINT32 flags);
|
||||
|
||||
texture_info * get_texlist() { return m_texlist; }
|
||||
void set_texlist(texture_info *texlist) { m_texlist = texlist; }
|
||||
bool is_dynamic_supported() { return (bool)m_dynamic_supported; }
|
||||
void set_dynamic_supported(bool dynamic_supported) { m_dynamic_supported = dynamic_supported; }
|
||||
bool is_stretch_supported() { return (bool)m_stretch_supported; }
|
||||
D3DFORMAT get_yuv_format() { return m_yuv_format; }
|
||||
|
||||
DWORD get_texture_caps() { return m_texture_caps; }
|
||||
DWORD get_max_texture_aspect() { return m_texture_max_aspect; }
|
||||
DWORD get_max_texture_width() { return m_texture_max_width; }
|
||||
DWORD get_max_texture_height() { return m_texture_max_height; }
|
||||
|
||||
texture_info * get_default_texture() { return m_default_texture; }
|
||||
texture_info * get_vector_texture() { return m_vector_texture; }
|
||||
|
||||
renderer * get_d3d() { return m_renderer; }
|
||||
|
||||
private:
|
||||
renderer * m_renderer;
|
||||
|
||||
texture_info * m_texlist; // list of active textures
|
||||
int m_dynamic_supported; // are dynamic textures supported?
|
||||
int m_stretch_supported; // is StretchRect with point filtering supported?
|
||||
D3DFORMAT m_yuv_format; // format to use for YUV textures
|
||||
|
||||
DWORD m_texture_caps; // textureCaps field
|
||||
DWORD m_texture_max_aspect; // texture maximum aspect ratio
|
||||
DWORD m_texture_max_width; // texture maximum width
|
||||
DWORD m_texture_max_height; // texture maximum height
|
||||
|
||||
bitmap_argb32 m_vector_bitmap; // experimental: bitmap for vectors
|
||||
texture_info * m_vector_texture; // experimental: texture for vectors
|
||||
|
||||
bitmap_rgb32 m_default_bitmap; // experimental: default bitmap
|
||||
texture_info * m_default_texture; // experimental: default texture
|
||||
};
|
||||
|
||||
|
||||
/* d3d_poly_info holds information about a single polygon/d3d primitive */
|
||||
struct d3d_poly_info
|
||||
/* texture_info holds information about a texture */
|
||||
class texture_info
|
||||
{
|
||||
D3DPRIMITIVETYPE type; // type of primitive
|
||||
UINT32 count; // total number of primitives
|
||||
UINT32 numverts; // total number of vertices
|
||||
UINT32 flags; // rendering flags
|
||||
DWORD modmode; // texture modulation mode
|
||||
d3d_texture_info * texture; // pointer to texture info
|
||||
float line_time; // used by vectors
|
||||
float line_length; // used by vectors
|
||||
public:
|
||||
texture_info(texture_manager *manager, const render_texinfo *texsource, UINT32 flags);
|
||||
~texture_info();
|
||||
|
||||
render_texinfo & get_texinfo() { return m_texinfo; }
|
||||
|
||||
int get_width() { return m_rawdims.c.x; }
|
||||
int get_height() { return m_rawdims.c.y; }
|
||||
int get_xscale() { return m_xprescale; }
|
||||
int get_yscale() { return m_yprescale; }
|
||||
|
||||
UINT32 get_flags() { return m_flags; }
|
||||
|
||||
void set_data(const render_texinfo *texsource, UINT32 flags);
|
||||
|
||||
texture_info * get_next() { return m_next; }
|
||||
texture_info * get_prev() { return m_prev; }
|
||||
|
||||
UINT32 get_hash() { return m_hash; }
|
||||
|
||||
void set_next(texture_info *next) { m_next = next; }
|
||||
void set_prev(texture_info *prev) { m_prev = prev; }
|
||||
|
||||
bool paused() { return m_cur_frame == m_prev_frame; }
|
||||
void advance_frame() { m_prev_frame = m_cur_frame; }
|
||||
void increment_frame_count() { m_cur_frame++; }
|
||||
void mask_frame_count(int mask) { m_cur_frame %= mask; }
|
||||
|
||||
int get_cur_frame() { return m_cur_frame; }
|
||||
int get_prev_frame() { return m_prev_frame; }
|
||||
|
||||
texture * get_tex() { return m_d3dtex; }
|
||||
surface * get_surface() { return m_d3dsurface; }
|
||||
texture * get_finaltex() { return m_d3dfinaltex; }
|
||||
|
||||
vec2f & get_uvstart() { return m_start; }
|
||||
vec2f & get_uvstop() { return m_stop; }
|
||||
vec2f & get_rawdims() { return m_rawdims; }
|
||||
|
||||
private:
|
||||
void prescale();
|
||||
void compute_size(int texwidth, int texheight);
|
||||
|
||||
texture_manager * m_texture_manager; // texture manager pointer
|
||||
|
||||
renderer * m_renderer; // renderer pointer
|
||||
|
||||
texture_info * m_next; // next texture in the list
|
||||
texture_info * m_prev; // prev texture in the list
|
||||
|
||||
UINT32 m_hash; // hash value for the texture
|
||||
UINT32 m_flags; // rendering flags
|
||||
render_texinfo m_texinfo; // copy of the texture info
|
||||
vec2f m_start; // beggining UV coordinates
|
||||
vec2f m_stop; // ending UV coordinates
|
||||
vec2f m_rawdims; // raw dims of the texture
|
||||
int m_type; // what type of texture are we?
|
||||
int m_xborderpix, m_yborderpix; // number of border pixels on X/Y
|
||||
int m_xprescale, m_yprescale; // X/Y prescale factor
|
||||
int m_cur_frame; // what is our current frame?
|
||||
int m_prev_frame; // what was our last frame? (used to determine pause state)
|
||||
texture * m_d3dtex; // Direct3D texture pointer
|
||||
surface * m_d3dsurface; // Direct3D offscreen plain surface pointer
|
||||
texture * m_d3dfinaltex; // Direct3D final (post-scaled) texture
|
||||
int m_target_index; // Direct3D target index
|
||||
};
|
||||
|
||||
/* d3d::poly_info holds information about a single polygon/d3d primitive */
|
||||
class poly_info
|
||||
{
|
||||
public:
|
||||
poly_info() { }
|
||||
|
||||
/* d3d_vertex describes a single vertex */
|
||||
struct d3d_vertex
|
||||
void init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
|
||||
UINT32 flags, d3d::texture_info *texture, UINT32 modmode);
|
||||
void init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
|
||||
UINT32 flags, d3d::texture_info *texture, UINT32 modmode,
|
||||
float line_time, float line_length);
|
||||
|
||||
D3DPRIMITIVETYPE get_type() { return m_type; }
|
||||
UINT32 get_count() { return m_count; }
|
||||
UINT32 get_vertcount() { return m_numverts; }
|
||||
UINT32 get_flags() { return m_flags; }
|
||||
|
||||
d3d::texture_info * get_texture() { return m_texture; }
|
||||
DWORD get_modmode() { return m_modmode; }
|
||||
|
||||
float get_line_time() { return m_line_time; }
|
||||
float get_line_length() { return m_line_length; }
|
||||
|
||||
private:
|
||||
D3DPRIMITIVETYPE m_type; // type of primitive
|
||||
UINT32 m_count; // total number of primitives
|
||||
UINT32 m_numverts; // total number of vertices
|
||||
UINT32 m_flags; // rendering flags
|
||||
|
||||
texture_info * m_texture; // pointer to texture info
|
||||
DWORD m_modmode; // texture modulation mode
|
||||
|
||||
float m_line_time; // used by vectors
|
||||
float m_line_length; // used by vectors
|
||||
};
|
||||
|
||||
}; // d3d
|
||||
|
||||
/* vertex describes a single vertex */
|
||||
struct vertex
|
||||
{
|
||||
float x, y, z; // X,Y,Z coordinates
|
||||
float rhw; // RHW when no HLSL, padding when HLSL
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -48,15 +48,19 @@
|
||||
// CONSTANTS
|
||||
//============================================================
|
||||
|
||||
#define HLSL_VECTOR (0)
|
||||
#define HLSL_VECTOR (1)
|
||||
#define CRT_BLOOM (1)
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
class d3d_render_target;
|
||||
class d3d_cache_target;
|
||||
struct d3d_info;
|
||||
namespace d3d
|
||||
{
|
||||
|
||||
class render_target;
|
||||
class cache_target;
|
||||
class renderer;
|
||||
|
||||
/* hlsl_options is the information about runtime-mutable Direct3D HLSL options */
|
||||
/* in the future this will be moved into an OSD/emu shared buffer */
|
||||
@ -111,22 +115,35 @@ struct hlsl_options
|
||||
float vector_time_period;
|
||||
float vector_length_scale;
|
||||
float vector_length_ratio;
|
||||
|
||||
// Bloom
|
||||
float bloom_level0_weight;
|
||||
float bloom_level1_weight;
|
||||
float bloom_level2_weight;
|
||||
float bloom_level3_weight;
|
||||
float bloom_level4_weight;
|
||||
float bloom_level5_weight;
|
||||
float bloom_level6_weight;
|
||||
float bloom_level7_weight;
|
||||
float bloom_level8_weight;
|
||||
float bloom_level9_weight;
|
||||
float bloom_level10_weight;
|
||||
};
|
||||
|
||||
class hlsl_info
|
||||
class shaders
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
hlsl_info();
|
||||
~hlsl_info();
|
||||
shaders();
|
||||
~shaders();
|
||||
|
||||
void init(d3d_base *d3dintf, win_window_info *window);
|
||||
void init(base *d3dintf, win_window_info *window);
|
||||
|
||||
bool enabled() { return master_enable; }
|
||||
void toggle();
|
||||
|
||||
bool vector_enabled() { return master_enable && vector_enable && (bool)HLSL_VECTOR; }
|
||||
d3d_render_target* get_vector_target();
|
||||
render_target* get_vector_target();
|
||||
void create_vector_target(render_primitive *prim);
|
||||
|
||||
void begin_frame();
|
||||
@ -135,28 +152,28 @@ public:
|
||||
void begin_draw();
|
||||
void end_draw();
|
||||
|
||||
void init_effect_info(d3d_poly_info *poly);
|
||||
void render_quad(d3d_poly_info *poly, int vertnum);
|
||||
void init_effect_info(poly_info *poly);
|
||||
void render_quad(poly_info *poly, int vertnum);
|
||||
|
||||
bool register_texture(d3d_texture_info *texture);
|
||||
bool register_prescaled_texture(d3d_texture_info *texture);
|
||||
bool add_render_target(d3d_info* d3d, d3d_texture_info* info, int width, int height, int xprescale, int yprescale, bool bloom = false);
|
||||
bool add_cache_target(d3d_info* d3d, d3d_texture_info* info, int width, int height, int xprescale, int yprescale, int screen_index);
|
||||
bool register_texture(texture_info *texture);
|
||||
bool register_prescaled_texture(texture_info *texture);
|
||||
bool add_render_target(renderer* d3d, texture_info* info, int width, int height, int xprescale, int yprescale);
|
||||
bool add_cache_target(renderer* d3d, texture_info* info, int width, int height, int xprescale, int yprescale, int screen_index);
|
||||
|
||||
void window_save();
|
||||
void window_record();
|
||||
bool recording() { return avi_output_file != NULL; }
|
||||
|
||||
void avi_update_snap(d3d_surface *surface);
|
||||
void render_snapshot(d3d_surface *surface);
|
||||
void avi_update_snap(surface *surface);
|
||||
void render_snapshot(surface *surface);
|
||||
void record_texture();
|
||||
void init_fsfx_quad(void *vertbuf);
|
||||
|
||||
void set_texture(d3d_texture_info *texture);
|
||||
d3d_render_target * find_render_target(d3d_texture_info *info);
|
||||
void remove_render_target(d3d_texture_info *texture);
|
||||
void set_texture(texture_info *texture);
|
||||
render_target * find_render_target(texture_info *info);
|
||||
void remove_render_target(texture_info *texture);
|
||||
void remove_render_target(int width, int height, UINT32 screen_index, UINT32 page_index);
|
||||
void remove_render_target(d3d_render_target *rt);
|
||||
void remove_render_target(render_target *rt);
|
||||
|
||||
int create_resources(bool reset);
|
||||
void delete_resources(bool reset);
|
||||
@ -165,23 +182,23 @@ public:
|
||||
slider_state *init_slider_list();
|
||||
|
||||
private:
|
||||
void blit(d3d_surface *dst, d3d_texture *src, d3d_surface *new_dst,
|
||||
void blit(surface *dst, texture *src, surface *new_dst,
|
||||
D3DPRIMITIVETYPE prim_type, UINT32 prim_index, UINT32 prim_count,
|
||||
int dstw, int dsth);
|
||||
void blit(d3d_surface *dst, d3d_texture *src, d3d_surface *new_dst,
|
||||
void blit(surface *dst, texture *src, surface *new_dst,
|
||||
D3DPRIMITIVETYPE prim_type, UINT32 prim_index, UINT32 prim_count);
|
||||
void enumerate_screens();
|
||||
|
||||
void end_avi_recording();
|
||||
void begin_avi_recording(const char *name);
|
||||
|
||||
bool register_texture(d3d_texture_info *texture, int width, int height, int xscale, int yscale);
|
||||
bool register_texture(texture_info *texture, int width, int height, int xscale, int yscale);
|
||||
|
||||
d3d_render_target* find_render_target(int width, int height, UINT32 screen_index, UINT32 page_index);
|
||||
d3d_cache_target * find_cache_target(UINT32 screen_index, int width, int height);
|
||||
void remove_cache_target(d3d_cache_target *cache);
|
||||
render_target* find_render_target(int width, int height, UINT32 screen_index, UINT32 page_index);
|
||||
cache_target * find_cache_target(UINT32 screen_index, int width, int height);
|
||||
void remove_cache_target(cache_target *cache);
|
||||
|
||||
d3d_base * d3dintf; // D3D interface
|
||||
base * d3dintf; // D3D interface
|
||||
win_window_info * window; // D3D window info
|
||||
|
||||
bool master_enable; // overall enable flag
|
||||
@ -199,7 +216,7 @@ private:
|
||||
int prescale_size_y; // prescale size y
|
||||
int preset; // preset, if relevant
|
||||
bitmap_argb32 shadow_bitmap; // shadow mask bitmap for post-processing shader
|
||||
d3d_texture_info * shadow_texture; // shadow mask texture for post-processing shader
|
||||
texture_info * shadow_texture; // shadow mask texture for post-processing shader
|
||||
hlsl_options * options; // current uniform state
|
||||
D3DPRIMITIVETYPE vecbuf_type;
|
||||
UINT32 vecbuf_index;
|
||||
@ -210,20 +227,20 @@ private:
|
||||
int avi_frame; // AVI frame
|
||||
attotime avi_frame_period; // AVI frame period
|
||||
attotime avi_next_frame_time; // AVI next frame time
|
||||
d3d_surface * avi_copy_surface; // AVI destination surface in system memory
|
||||
d3d_texture * avi_copy_texture; // AVI destination texture in system memory
|
||||
d3d_surface * avi_final_target; // AVI upscaled surface
|
||||
d3d_texture * avi_final_texture; // AVI upscaled texture
|
||||
surface * avi_copy_surface; // AVI destination surface in system memory
|
||||
texture * avi_copy_texture; // AVI destination texture in system memory
|
||||
surface * avi_final_target; // AVI upscaled surface
|
||||
texture * avi_final_texture; // AVI upscaled texture
|
||||
|
||||
d3d_surface * black_surface; // black dummy surface
|
||||
d3d_texture * black_texture; // black dummy texture
|
||||
surface * black_surface; // black dummy surface
|
||||
texture * black_texture; // black dummy texture
|
||||
|
||||
bool render_snap; // whether or not to take HLSL post-render snapshot
|
||||
bool snap_rendered; // whether we just rendered our HLSL post-render shot or not
|
||||
d3d_surface * snap_copy_target; // snapshot destination surface in system memory
|
||||
d3d_texture * snap_copy_texture; // snapshot destination surface in system memory
|
||||
d3d_surface * snap_target; // snapshot upscaled surface
|
||||
d3d_texture * snap_texture; // snapshot upscaled texture
|
||||
surface * snap_copy_target; // snapshot destination surface in system memory
|
||||
texture * snap_copy_texture; // snapshot destination surface in system memory
|
||||
surface * snap_target; // snapshot upscaled surface
|
||||
texture * snap_texture; // snapshot upscaled texture
|
||||
int snap_width; // snapshot width
|
||||
int snap_height; // snapshot height
|
||||
bool lines_pending; // whether or not we have lines to flush on the next quad
|
||||
@ -231,28 +248,34 @@ private:
|
||||
bool initialized; // whether or not we're initialize
|
||||
|
||||
// HLSL effects
|
||||
d3d_surface * backbuffer; // pointer to our device's backbuffer
|
||||
d3d_effect * curr_effect; // pointer to the currently active effect object
|
||||
d3d_effect * effect; // pointer to the primary-effect object
|
||||
d3d_effect * prescale_effect; // pointer to the prescale-effect object
|
||||
d3d_effect * post_effect; // pointer to the post-effect object
|
||||
d3d_effect * pincushion_effect; // pointer to the pincushion-effect object
|
||||
d3d_effect * focus_effect; // pointer to the focus-effect object
|
||||
d3d_effect * phosphor_effect; // pointer to the phosphor-effect object
|
||||
d3d_effect * deconverge_effect; // pointer to the deconvergence-effect object
|
||||
d3d_effect * color_effect; // pointer to the color-effect object
|
||||
d3d_effect * yiq_encode_effect; // pointer to the YIQ encoder effect object
|
||||
d3d_effect * yiq_decode_effect; // pointer to the YIQ decoder effect object
|
||||
#if HLSL_VECTOR
|
||||
d3d_effect * bloom_effect; // pointer to the bloom composite effect
|
||||
d3d_effect * downsample_effect; // pointer to the bloom downsample effect
|
||||
d3d_effect * vector_effect; // pointer to the vector-effect object
|
||||
surface * backbuffer; // pointer to our device's backbuffer
|
||||
effect * curr_effect; // pointer to the currently active effect object
|
||||
effect * default_effect; // pointer to the primary-effect object
|
||||
effect * prescale_effect; // pointer to the prescale-effect object
|
||||
effect * post_effect; // pointer to the post-effect object
|
||||
effect * pincushion_effect; // pointer to the pincushion-effect object
|
||||
effect * focus_effect; // pointer to the focus-effect object
|
||||
effect * phosphor_effect; // pointer to the phosphor-effect object
|
||||
effect * deconverge_effect; // pointer to the deconvergence-effect object
|
||||
effect * color_effect; // pointer to the color-effect object
|
||||
effect * yiq_encode_effect; // pointer to the YIQ encoder effect object
|
||||
effect * yiq_decode_effect; // pointer to the YIQ decoder effect object
|
||||
#if (HLSL_VECTOR || CRT_BLOOM)
|
||||
effect * bloom_effect; // pointer to the bloom composite effect
|
||||
effect * downsample_effect; // pointer to the bloom downsample effect
|
||||
#endif
|
||||
d3d_vertex * fsfx_vertices; // pointer to our full-screen-quad object
|
||||
#if (HLSL_VECTOR)
|
||||
effect * vector_effect; // pointer to the vector-effect object
|
||||
#endif
|
||||
vertex * fsfx_vertices; // pointer to our full-screen-quad object
|
||||
|
||||
public:
|
||||
d3d_render_target * targethead;
|
||||
d3d_cache_target * cachehead;
|
||||
render_target * targethead;
|
||||
cache_target * cachehead;
|
||||
|
||||
static hlsl_options s_hlsl_presets[4];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -56,8 +56,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if (DIRECT3D_VERSION >= 0x0900)
|
||||
// the following used to be TEXTURESTAGESTATES but are now SAMPLERSTATES
|
||||
#define D3DTSS_ADDRESSU 13
|
||||
#define D3DTSS_ADDRESSV 14
|
||||
#define D3DTSS_BORDERCOLOR 15
|
||||
@ -67,28 +65,29 @@
|
||||
#define D3DTSS_MIPMAPLODBIAS 19
|
||||
#define D3DTSS_MAXMIPLEVEL 20
|
||||
#define D3DTSS_MAXANISOTROPY 21
|
||||
#endif
|
||||
|
||||
namespace d3d
|
||||
{
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
struct d3d_base;
|
||||
struct d3d_device;
|
||||
struct d3d_surface;
|
||||
struct d3d_texture;
|
||||
struct d3d_vertex_buffer;
|
||||
struct d3d_effect;
|
||||
typedef D3DXVECTOR4 d3d_vector;
|
||||
typedef D3DMATRIX d3d_matrix;
|
||||
struct base;
|
||||
struct device;
|
||||
struct surface;
|
||||
struct texture;
|
||||
struct vertex_buffer;
|
||||
struct effect;
|
||||
typedef D3DXVECTOR4 vector;
|
||||
typedef D3DMATRIX matrix;
|
||||
|
||||
|
||||
//============================================================
|
||||
// Abstracted presentation parameters
|
||||
//============================================================
|
||||
|
||||
struct d3d_present_parameters
|
||||
struct present_parameters
|
||||
{
|
||||
UINT BackBufferWidth;
|
||||
UINT BackBufferHeight;
|
||||
@ -111,7 +110,7 @@ struct d3d_present_parameters
|
||||
// Abstracted device identifier
|
||||
//============================================================
|
||||
|
||||
struct d3d_adapter_identifier
|
||||
struct adapter_identifier
|
||||
{
|
||||
char Driver[512];
|
||||
char Description[512];
|
||||
@ -129,7 +128,7 @@ struct d3d_adapter_identifier
|
||||
// Caps enumeration
|
||||
//============================================================
|
||||
|
||||
enum d3d_caps_index
|
||||
enum caps_index
|
||||
{
|
||||
CAPS_PRESENTATION_INTERVALS,
|
||||
CAPS_CAPS2,
|
||||
@ -152,19 +151,19 @@ enum d3d_caps_index
|
||||
// Direct3D interfaces
|
||||
//============================================================
|
||||
|
||||
struct d3d_interface
|
||||
struct interface
|
||||
{
|
||||
HRESULT (*check_device_format)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format);
|
||||
HRESULT (*check_device_type)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed);
|
||||
HRESULT (*create_device)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, d3d_present_parameters *params, d3d_device **dev);
|
||||
HRESULT (*enum_adapter_modes)(d3d_base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode);
|
||||
UINT (*get_adapter_count)(d3d_base *d3dptr);
|
||||
HRESULT (*get_adapter_display_mode)(d3d_base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode);
|
||||
HRESULT (*get_adapter_identifier)(d3d_base *d3dptr, UINT adapter, DWORD flags, d3d_adapter_identifier *identifier);
|
||||
UINT (*get_adapter_mode_count)(d3d_base *d3dptr, UINT adapter, D3DFORMAT format);
|
||||
HMONITOR (*get_adapter_monitor)(d3d_base *d3dptr, UINT adapter);
|
||||
HRESULT (*get_caps_dword)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, d3d_caps_index which, DWORD *value);
|
||||
ULONG (*release)(d3d_base *d3dptr);
|
||||
HRESULT (*check_device_format)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format);
|
||||
HRESULT (*check_device_type)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed);
|
||||
HRESULT (*create_device)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, present_parameters *params, device **dev);
|
||||
HRESULT (*enum_adapter_modes)(base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode);
|
||||
UINT (*get_adapter_count)(base *d3dptr);
|
||||
HRESULT (*get_adapter_display_mode)(base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode);
|
||||
HRESULT (*get_adapter_identifier)(base *d3dptr, UINT adapter, DWORD flags, adapter_identifier *identifier);
|
||||
UINT (*get_adapter_mode_count)(base *d3dptr, UINT adapter, D3DFORMAT format);
|
||||
HMONITOR (*get_adapter_monitor)(base *d3dptr, UINT adapter);
|
||||
HRESULT (*get_caps_dword)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, caps_index which, DWORD *value);
|
||||
ULONG (*release)(base *d3dptr);
|
||||
};
|
||||
|
||||
|
||||
@ -172,32 +171,32 @@ struct d3d_interface
|
||||
// Direct3DDevice interfaces
|
||||
//============================================================
|
||||
|
||||
struct d3d_device_interface
|
||||
struct device_interface
|
||||
{
|
||||
HRESULT (*begin_scene)(d3d_device *dev);
|
||||
HRESULT (*clear)(d3d_device *dev, DWORD count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil);
|
||||
HRESULT (*create_offscreen_plain_surface)(d3d_device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, d3d_surface **surface);
|
||||
HRESULT (*create_effect)(d3d_device *dev, const WCHAR *name, d3d_effect **effect);
|
||||
HRESULT (*create_texture)(d3d_device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, d3d_texture **texture);
|
||||
HRESULT (*create_vertex_buffer)(d3d_device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, d3d_vertex_buffer **buf);
|
||||
HRESULT (*create_render_target)(d3d_device *dev, UINT width, UINT height, D3DFORMAT format, d3d_surface **surface);
|
||||
HRESULT (*draw_primitive)(d3d_device *dev, D3DPRIMITIVETYPE type, UINT start, UINT count);
|
||||
HRESULT (*end_scene)(d3d_device *dev);
|
||||
HRESULT (*get_raster_status)(d3d_device *dev, D3DRASTER_STATUS *status);
|
||||
HRESULT (*get_render_target)(d3d_device *dev, DWORD index, d3d_surface **surface);
|
||||
HRESULT (*get_render_target_data)(d3d_device *dev, d3d_surface *rendertarget, d3d_surface *destsurface);
|
||||
HRESULT (*present)(d3d_device *dev, const RECT *source, const RECT *dest, HWND override, RGNDATA *dirty, DWORD flags);
|
||||
ULONG (*release)(d3d_device *dev);
|
||||
HRESULT (*reset)(d3d_device *dev, d3d_present_parameters *params);
|
||||
void (*set_gamma_ramp)(d3d_device *dev, DWORD flags, const D3DGAMMARAMP *ramp);
|
||||
HRESULT (*set_render_state)(d3d_device *dev, D3DRENDERSTATETYPE state, DWORD value);
|
||||
HRESULT (*set_render_target)(d3d_device *dev, DWORD index, d3d_surface *surf);
|
||||
HRESULT (*set_stream_source)(d3d_device *dev, UINT number, d3d_vertex_buffer *vbuf, UINT stride);
|
||||
HRESULT (*set_texture)(d3d_device *dev, DWORD stage, d3d_texture *tex);
|
||||
HRESULT (*set_texture_stage_state)(d3d_device *dev, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value);
|
||||
HRESULT (*set_vertex_format)(d3d_device *dev, D3DFORMAT format);
|
||||
HRESULT (*stretch_rect)(d3d_device *dev, d3d_surface *source, const RECT *srcrect, d3d_surface *dest, const RECT *dstrect, D3DTEXTUREFILTERTYPE filter);
|
||||
HRESULT (*test_cooperative_level)(d3d_device *dev);
|
||||
HRESULT (*begin_scene)(device *dev);
|
||||
HRESULT (*clear)(device *dev, DWORD count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil);
|
||||
HRESULT (*create_offscreen_plain_surface)(device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, surface **surface);
|
||||
HRESULT (*create_effect)(device *dev, const WCHAR *name, effect **effect);
|
||||
HRESULT (*create_texture)(device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, texture **texture);
|
||||
HRESULT (*create_vertex_buffer)(device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, vertex_buffer **buf);
|
||||
HRESULT (*create_render_target)(device *dev, UINT width, UINT height, D3DFORMAT format, surface **surface);
|
||||
HRESULT (*draw_primitive)(device *dev, D3DPRIMITIVETYPE type, UINT start, UINT count);
|
||||
HRESULT (*end_scene)(device *dev);
|
||||
HRESULT (*get_raster_status)(device *dev, D3DRASTER_STATUS *status);
|
||||
HRESULT (*get_render_target)(device *dev, DWORD index, surface **surface);
|
||||
HRESULT (*get_render_target_data)(device *dev, surface *rendertarget, surface *destsurface);
|
||||
HRESULT (*present)(device *dev, const RECT *source, const RECT *dest, HWND override, RGNDATA *dirty, DWORD flags);
|
||||
ULONG (*release)(device *dev);
|
||||
HRESULT (*reset)(device *dev, present_parameters *params);
|
||||
void (*set_gamma_ramp)(device *dev, DWORD flags, const D3DGAMMARAMP *ramp);
|
||||
HRESULT (*set_render_state)(device *dev, D3DRENDERSTATETYPE state, DWORD value);
|
||||
HRESULT (*set_render_target)(device *dev, DWORD index, surface *surf);
|
||||
HRESULT (*set_stream_source)(device *dev, UINT number, vertex_buffer *vbuf, UINT stride);
|
||||
HRESULT (*set_texture)(device *dev, DWORD stage, texture *tex);
|
||||
HRESULT (*set_texture_stage_state)(device *dev, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value);
|
||||
HRESULT (*set_vertex_format)(device *dev, D3DFORMAT format);
|
||||
HRESULT (*stretch_rect)(device *dev, surface *source, const RECT *srcrect, surface *dest, const RECT *dstrect, D3DTEXTUREFILTERTYPE filter);
|
||||
HRESULT (*test_cooperative_level)(device *dev);
|
||||
};
|
||||
|
||||
|
||||
@ -205,11 +204,11 @@ struct d3d_device_interface
|
||||
// Direct3DSurface interfaces
|
||||
//============================================================
|
||||
|
||||
struct d3d_surface_interface
|
||||
struct surface_interface
|
||||
{
|
||||
HRESULT (*lock_rect)(d3d_surface *surf, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags);
|
||||
ULONG (*release)(d3d_surface *tex);
|
||||
HRESULT (*unlock_rect)(d3d_surface *surf);
|
||||
HRESULT (*lock_rect)(surface *surf, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags);
|
||||
ULONG (*release)(surface *tex);
|
||||
HRESULT (*unlock_rect)(surface *surf);
|
||||
};
|
||||
|
||||
|
||||
@ -217,12 +216,12 @@ struct d3d_surface_interface
|
||||
// Direct3DTexture interfaces
|
||||
//============================================================
|
||||
|
||||
struct d3d_texture_interface
|
||||
struct texture_interface
|
||||
{
|
||||
HRESULT (*get_surface_level)(d3d_texture *tex, UINT level, d3d_surface **surface);
|
||||
HRESULT (*lock_rect)(d3d_texture *tex, UINT level, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags);
|
||||
ULONG (*release)(d3d_texture *tex);
|
||||
HRESULT (*unlock_rect)(d3d_texture *tex, UINT level);
|
||||
HRESULT (*get_surface_level)(texture *tex, UINT level, surface **surface);
|
||||
HRESULT (*lock_rect)(texture *tex, UINT level, D3DLOCKED_RECT *locked, const RECT *rect, DWORD flags);
|
||||
ULONG (*release)(texture *tex);
|
||||
HRESULT (*unlock_rect)(texture *tex, UINT level);
|
||||
};
|
||||
|
||||
|
||||
@ -230,11 +229,11 @@ struct d3d_texture_interface
|
||||
// Direct3DVertexBuffer interfaces
|
||||
//============================================================
|
||||
|
||||
struct d3d_vertex_buffer_interface
|
||||
struct vertex_buffer_interface
|
||||
{
|
||||
HRESULT (*lock)(d3d_vertex_buffer *vbuf, UINT offset, UINT size, VOID **data, DWORD flags);
|
||||
ULONG (*release)(d3d_vertex_buffer *vbuf);
|
||||
HRESULT (*unlock)(d3d_vertex_buffer *vbuf);
|
||||
HRESULT (*lock)(vertex_buffer *vbuf, UINT offset, UINT size, VOID **data, DWORD flags);
|
||||
ULONG (*release)(vertex_buffer *vbuf);
|
||||
HRESULT (*unlock)(vertex_buffer *vbuf);
|
||||
};
|
||||
|
||||
|
||||
@ -242,19 +241,19 @@ struct d3d_vertex_buffer_interface
|
||||
// Direct3DEffect interfaces
|
||||
//============================================================
|
||||
|
||||
struct d3d_effect_interface
|
||||
struct effect_interface
|
||||
{
|
||||
void (*begin)(d3d_effect *effect, UINT *passes, DWORD flags);
|
||||
void (*end)(d3d_effect *effect);
|
||||
void (*begin_pass)(d3d_effect *effect, UINT pass);
|
||||
void (*end_pass)(d3d_effect *effect);
|
||||
void (*set_technique)(d3d_effect *effect, const char *name);
|
||||
void (*set_vector)(d3d_effect *effect, const char *name, int count, float *vector);
|
||||
void (*set_float)(d3d_effect *effect, const char *name, float value);
|
||||
void (*set_int)(d3d_effect *effect, const char *name, int value);
|
||||
void (*set_matrix)(d3d_effect *effect, const char *name, d3d_matrix *matrix);
|
||||
void (*set_texture)(d3d_effect *effect, const char *name, d3d_texture *tex);
|
||||
ULONG (*release)(d3d_effect *effect);
|
||||
void (*begin)(effect *effect, UINT *passes, DWORD flags);
|
||||
void (*end)(effect *effect);
|
||||
void (*begin_pass)(effect *effect, UINT pass);
|
||||
void (*end_pass)(effect *effect);
|
||||
void (*set_technique)(effect *effect, const char *name);
|
||||
void (*set_vector)(effect *effect, const char *name, int count, float *vector);
|
||||
void (*set_float)(effect *effect, const char *name, float value);
|
||||
void (*set_int)(effect *effect, const char *name, int value);
|
||||
void (*set_matrix)(effect *effect, const char *name, matrix *matrix);
|
||||
void (*set_texture)(effect *effect, const char *name, texture *tex);
|
||||
ULONG (*release)(effect *effect);
|
||||
};
|
||||
|
||||
|
||||
@ -262,7 +261,7 @@ struct d3d_effect_interface
|
||||
// Core D3D object
|
||||
//============================================================
|
||||
|
||||
struct d3d_base
|
||||
struct base
|
||||
{
|
||||
// internal objects
|
||||
int version;
|
||||
@ -271,12 +270,12 @@ struct d3d_base
|
||||
bool post_fx_available;
|
||||
|
||||
// interface pointers
|
||||
d3d_interface d3d;
|
||||
d3d_device_interface device;
|
||||
d3d_surface_interface surface;
|
||||
d3d_texture_interface texture;
|
||||
d3d_vertex_buffer_interface vertexbuf;
|
||||
d3d_effect_interface effect;
|
||||
interface d3d;
|
||||
device_interface device;
|
||||
surface_interface surface;
|
||||
texture_interface texture;
|
||||
vertex_buffer_interface vertexbuf;
|
||||
effect_interface effect;
|
||||
};
|
||||
|
||||
|
||||
@ -284,10 +283,8 @@ struct d3d_base
|
||||
// PROTOTYPES
|
||||
//============================================================
|
||||
|
||||
#if DIRECT3D_VERSION < 0x0900
|
||||
d3d_base *drawd3d8_init(void);
|
||||
#endif
|
||||
d3d_base *drawd3d9_init(void);
|
||||
base *drawd3d9_init(void);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,26 +51,31 @@
|
||||
//============================================================
|
||||
|
||||
#define VERTEX_BASE_FORMAT (D3DFVF_DIFFUSE | D3DFVF_TEX1)
|
||||
#define VERTEX_BUFFER_SIZE (2048*4+4)
|
||||
#define VERTEX_BUFFER_SIZE (10240*4+4)
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
struct d3d_info;
|
||||
namespace d3d
|
||||
{
|
||||
|
||||
/* d3d_cache_target is a simple linked list containing only a rednerable target and texture, used for phosphor effects */
|
||||
class d3d_cache_target
|
||||
class cache_target;
|
||||
class render_target;
|
||||
class renderer;
|
||||
|
||||
/* cache_target is a simple linked list containing only a rednerable target and texture, used for phosphor effects */
|
||||
class cache_target
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
d3d_cache_target() { }
|
||||
~d3d_cache_target();
|
||||
cache_target() { }
|
||||
~cache_target();
|
||||
|
||||
bool init(d3d_info *d3d, d3d_base *d3dintf, int width, int height, int prescale_x, int prescale_y, bool bloom);
|
||||
bool init(renderer *d3d, base *d3dintf, int width, int height, int prescale_x, int prescale_y);
|
||||
|
||||
d3d_surface *last_target;
|
||||
d3d_texture *last_texture;
|
||||
surface *last_target;
|
||||
texture *last_texture;
|
||||
|
||||
int target_width;
|
||||
int target_height;
|
||||
@ -80,22 +85,22 @@ public:
|
||||
|
||||
int screen_index;
|
||||
|
||||
d3d_cache_target *next;
|
||||
d3d_cache_target *prev;
|
||||
cache_target *next;
|
||||
cache_target *prev;
|
||||
|
||||
d3d_surface *bloom_target[11];
|
||||
d3d_texture *bloom_texture[11];
|
||||
surface *bloom_target[11];
|
||||
texture *bloom_texture[11];
|
||||
};
|
||||
|
||||
/* d3d_render_target is the information about a Direct3D render target chain */
|
||||
class d3d_render_target
|
||||
/* render_target is the information about a Direct3D render target chain */
|
||||
class render_target
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
d3d_render_target() { }
|
||||
~d3d_render_target();
|
||||
render_target() { }
|
||||
~render_target();
|
||||
|
||||
bool init(d3d_info *d3d, d3d_base *d3dintf, int width, int height, int prescale_x, int prescale_y, bool bloom = false);
|
||||
bool init(renderer *d3d, base *d3dintf, int width, int height, int prescale_x, int prescale_y);
|
||||
|
||||
int target_width;
|
||||
int target_height;
|
||||
@ -106,85 +111,148 @@ public:
|
||||
int screen_index;
|
||||
int page_index;
|
||||
|
||||
d3d_surface *prescaletarget;
|
||||
d3d_texture *prescaletexture;
|
||||
d3d_surface *smalltarget;
|
||||
d3d_texture *smalltexture;
|
||||
d3d_surface *target[5];
|
||||
d3d_texture *texture[5];
|
||||
surface *prescaletarget;
|
||||
texture *prescaletexture;
|
||||
surface *smalltarget;
|
||||
texture *smalltexture;
|
||||
surface *target[5];
|
||||
texture *render_texture[5];
|
||||
|
||||
d3d_render_target *next;
|
||||
d3d_render_target *prev;
|
||||
render_target *next;
|
||||
render_target *prev;
|
||||
|
||||
d3d_surface *bloom_target[11];
|
||||
d3d_texture *bloom_texture[11];
|
||||
surface *bloom_target[11];
|
||||
texture *bloom_texture[11];
|
||||
};
|
||||
|
||||
/* d3d_info is the information about Direct3D for the current screen */
|
||||
struct d3d_info
|
||||
/* renderer is the information about Direct3D for the current screen */
|
||||
class renderer
|
||||
{
|
||||
int adapter; // ordinal adapter number
|
||||
int width, height; // current width, height
|
||||
int refresh; // current refresh rate
|
||||
int create_error_count; // number of consecutive create errors
|
||||
public:
|
||||
renderer() { }
|
||||
renderer(win_window_info *window);
|
||||
~renderer();
|
||||
|
||||
win_window_info * window; // current window info
|
||||
int initialize();
|
||||
|
||||
d3d_device * device; // pointer to the Direct3DDevice object
|
||||
int gamma_supported; // is full screen gamma supported?
|
||||
d3d_present_parameters presentation; // set of presentation parameters
|
||||
D3DDISPLAYMODE origmode; // original display mode for the adapter
|
||||
D3DFORMAT pixformat; // pixel format we are using
|
||||
int device_create();
|
||||
int device_create_resources();
|
||||
void device_delete();
|
||||
void device_delete_resources();
|
||||
|
||||
d3d_vertex_buffer * vertexbuf; // pointer to the vertex buffer object
|
||||
d3d_vertex * lockedbuf; // pointer to the locked vertex buffer
|
||||
int numverts; // number of accumulated vertices
|
||||
int device_verify_caps();
|
||||
int device_test_cooperative();
|
||||
|
||||
d3d_poly_info poly[VERTEX_BUFFER_SIZE/3]; // array to hold polygons as they are created
|
||||
int numpolys; // number of accumulated polygons
|
||||
int config_adapter_mode();
|
||||
void pick_best_mode();
|
||||
int get_adapter_for_monitor();
|
||||
|
||||
bool restarting; // if we're restarting
|
||||
int update_window_size();
|
||||
|
||||
d3d_texture_info * texlist; // list of active textures
|
||||
int dynamic_supported; // are dynamic textures supported?
|
||||
int stretch_supported; // is StretchRect with point filtering supported?
|
||||
int mod2x_supported; // is D3DTOP_MODULATE2X supported?
|
||||
int mod4x_supported; // is D3DTOP_MODULATE4X supported?
|
||||
D3DFORMAT screen_format; // format to use for screen textures
|
||||
D3DFORMAT yuv_format; // format to use for YUV textures
|
||||
int pre_window_draw_check();
|
||||
void begin_frame();
|
||||
void end_frame();
|
||||
|
||||
DWORD texture_caps; // textureCaps field
|
||||
DWORD texture_max_aspect; // texture maximum aspect ratio
|
||||
DWORD texture_max_width; // texture maximum width
|
||||
DWORD texture_max_height; // texture maximum height
|
||||
void draw_line(const render_primitive *prim);
|
||||
void draw_quad(const render_primitive *prim);
|
||||
void batch_vector(const render_primitive *prim, float line_time);
|
||||
void batch_vectors();
|
||||
|
||||
d3d_texture_info * last_texture; // previous texture
|
||||
UINT32 last_texture_flags; // previous texture flags
|
||||
int last_blendenable; // previous blendmode
|
||||
int last_blendop; // previous blendmode
|
||||
int last_blendsrc; // previous blendmode
|
||||
int last_blenddst; // previous blendmode
|
||||
int last_filter; // previous texture filter
|
||||
int last_wrap; // previous wrap state
|
||||
DWORD last_modmode; // previous texture modulation
|
||||
vertex * mesh_alloc(int numverts);
|
||||
|
||||
bitmap_argb32 vector_bitmap; // experimental: bitmap for vectors
|
||||
d3d_texture_info * vector_texture; // experimental: texture for vectors
|
||||
void update_textures();
|
||||
|
||||
bitmap_rgb32 default_bitmap; // experimental: default bitmap
|
||||
d3d_texture_info * default_texture; // experimental: default texture
|
||||
void process_primitives();
|
||||
void primitive_flush_pending();
|
||||
|
||||
void * hlsl_buf; // HLSL vertex data
|
||||
hlsl_info * hlsl; // HLSL interface
|
||||
void set_texture(texture_info *texture);
|
||||
void set_filter(int filter);
|
||||
void set_wrap(D3DTEXTUREADDRESS wrap);
|
||||
void set_modmode(DWORD modmode);
|
||||
void set_blendmode(int blendmode);
|
||||
void reset_render_states();
|
||||
|
||||
// Setters / getters
|
||||
int get_adapter() { return m_adapter; }
|
||||
int get_width() { return m_width; }
|
||||
int get_height() { return m_height; }
|
||||
int get_refresh() { return m_refresh; }
|
||||
|
||||
win_window_info * get_window() { return m_window; }
|
||||
|
||||
device * get_device() { return m_device; }
|
||||
present_parameters * get_presentation() { return &m_presentation; }
|
||||
|
||||
vertex_buffer * get_vertex_buffer() { return m_vertexbuf; }
|
||||
vertex * get_locked_buffer() { return m_lockedbuf; }
|
||||
VOID ** get_locked_buffer_ptr() { return (VOID **)&m_lockedbuf; }
|
||||
void set_locked_buffer(vertex *lockedbuf) { m_lockedbuf = lockedbuf; }
|
||||
|
||||
void set_restarting(bool restarting) { m_restarting = restarting; }
|
||||
bool is_mod2x_supported() { return (bool)m_mod2x_supported; }
|
||||
bool is_mod4x_supported() { return (bool)m_mod4x_supported; }
|
||||
|
||||
D3DFORMAT get_screen_format() { return m_screen_format; }
|
||||
D3DFORMAT get_pixel_format() { return m_pixformat; }
|
||||
D3DDISPLAYMODE get_origmode() { return m_origmode; }
|
||||
|
||||
UINT32 get_last_texture_flags() { return m_last_texture_flags; }
|
||||
|
||||
texture_manager * get_texture_manager() { return m_texture_manager; }
|
||||
texture_info * get_default_texture() { return m_texture_manager->get_default_texture(); }
|
||||
texture_info * get_vector_texture() { return m_texture_manager->get_vector_texture(); }
|
||||
|
||||
shaders * get_shaders() { return m_shaders; }
|
||||
|
||||
private:
|
||||
int m_adapter; // ordinal adapter number
|
||||
int m_width; // current width
|
||||
int m_height; // current height
|
||||
int m_refresh; // current refresh rate
|
||||
int m_create_error_count; // number of consecutive create errors
|
||||
|
||||
win_window_info * m_window; // current window info
|
||||
|
||||
device * m_device; // pointer to the Direct3DDevice object
|
||||
int m_gamma_supported; // is full screen gamma supported?
|
||||
present_parameters m_presentation; // set of presentation parameters
|
||||
D3DDISPLAYMODE m_origmode; // original display mode for the adapter
|
||||
D3DFORMAT m_pixformat; // pixel format we are using
|
||||
|
||||
vertex_buffer * m_vertexbuf; // pointer to the vertex buffer object
|
||||
vertex * m_lockedbuf; // pointer to the locked vertex buffer
|
||||
int m_numverts; // number of accumulated vertices
|
||||
|
||||
vertex * m_vectorbatch; // pointer to the vector batch buffer
|
||||
int m_batchindex; // current index into the vector batch
|
||||
|
||||
poly_info m_poly[VERTEX_BUFFER_SIZE/3];// array to hold polygons as they are created
|
||||
int m_numpolys; // number of accumulated polygons
|
||||
|
||||
bool m_restarting; // if we're restarting
|
||||
|
||||
int m_mod2x_supported; // is D3DTOP_MODULATE2X supported?
|
||||
int m_mod4x_supported; // is D3DTOP_MODULATE4X supported?
|
||||
D3DFORMAT m_screen_format; // format to use for screen textures
|
||||
|
||||
texture_info * m_last_texture; // previous texture
|
||||
UINT32 m_last_texture_flags; // previous texture flags
|
||||
int m_last_blendenable; // previous blendmode
|
||||
int m_last_blendop; // previous blendmode
|
||||
int m_last_blendsrc; // previous blendmode
|
||||
int m_last_blenddst; // previous blendmode
|
||||
int m_last_filter; // previous texture filter
|
||||
D3DTEXTUREADDRESS m_last_wrap; // previous wrap state
|
||||
DWORD m_last_modmode; // previous texture modulation
|
||||
|
||||
void * m_hlsl_buf; // HLSL vertex data
|
||||
shaders * m_shaders; // HLSL interface
|
||||
|
||||
texture_manager * m_texture_manager; // texture manager
|
||||
|
||||
int m_line_count;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// PROTOTYPES
|
||||
//============================================================
|
||||
|
||||
d3d_texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsource, UINT32 flags);
|
||||
void texture_destroy(d3d_info *d3d, d3d_texture_info *info);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -322,11 +322,7 @@ OSDOBJS += \
|
||||
$(WINOBJ)/netdev_pcap.o
|
||||
endif
|
||||
|
||||
ifeq ($(DIRECT3D),9)
|
||||
CCOMFLAGS += -DDIRECT3D_VERSION=0x0900
|
||||
else
|
||||
OSDOBJS += $(WINOBJ)/d3d8intf.o
|
||||
endif
|
||||
|
||||
# extra dependencies
|
||||
$(WINOBJ)/drawdd.o : $(SRC)/emu/rendersw.c
|
||||
|
@ -329,7 +329,6 @@ const options_entry windows_options::s_option_entries[] =
|
||||
|
||||
// Direct3D-specific options
|
||||
{ NULL, NULL, OPTION_HEADER, "DIRECT3D-SPECIFIC OPTIONS" },
|
||||
{ WINOPTION_D3DVERSION "(8-9)", "9", OPTION_INTEGER, "specify the preferred Direct3D version (8 or 9)" },
|
||||
{ WINOPTION_FILTER ";d3dfilter;flt", "1", OPTION_BOOLEAN, "enable bilinear filtering on screen output" },
|
||||
|
||||
// post-processing options
|
||||
@ -397,6 +396,19 @@ const options_entry windows_options::s_option_entries[] =
|
||||
{ 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.)" },
|
||||
/* Bloom below this line */
|
||||
{ NULL, NULL, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" },
|
||||
{ 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" },
|
||||
|
@ -75,7 +75,6 @@
|
||||
#define WINOPTION_HWSTRETCH "hwstretch"
|
||||
|
||||
// Direct3D-specific options
|
||||
#define WINOPTION_D3DVERSION "d3dversion"
|
||||
#define WINOPTION_FILTER "filter"
|
||||
|
||||
// core post-processing options
|
||||
@ -134,6 +133,17 @@
|
||||
#define WINOPTION_VECTOR_TIME_PERIOD "vector_time_period"
|
||||
#define WINOPTION_VECTOR_LENGTH_SCALE "vector_length_scale"
|
||||
#define WINOPTION_VECTOR_LENGTH_RATIO "vector_length_ratio"
|
||||
#define WINOPTION_BLOOM_LEVEL0_WEIGHT "bloom_lvl0_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL1_WEIGHT "bloom_lvl1_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL2_WEIGHT "bloom_lvl2_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL3_WEIGHT "bloom_lvl3_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL4_WEIGHT "bloom_lvl4_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL5_WEIGHT "bloom_lvl5_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL6_WEIGHT "bloom_lvl6_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL7_WEIGHT "bloom_lvl7_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL8_WEIGHT "bloom_lvl8_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL9_WEIGHT "bloom_lvl9_weight"
|
||||
#define WINOPTION_BLOOM_LEVEL10_WEIGHT "bloom_lvl10_weight"
|
||||
|
||||
// per-window options
|
||||
#define WINOPTION_SCREEN "screen"
|
||||
@ -194,7 +204,6 @@ public:
|
||||
bool hwstretch() const { return bool_value(WINOPTION_HWSTRETCH); }
|
||||
|
||||
// Direct3D-specific options
|
||||
int d3d_version() const { return int_value(WINOPTION_D3DVERSION); }
|
||||
bool filter() const { return bool_value(WINOPTION_FILTER); }
|
||||
|
||||
// core post-processing options
|
||||
@ -247,6 +256,17 @@ public:
|
||||
float screen_vector_time_period() const { return float_value(WINOPTION_VECTOR_TIME_PERIOD); }
|
||||
float screen_vector_length_scale() const { return float_value(WINOPTION_VECTOR_LENGTH_SCALE); }
|
||||
float screen_vector_length_ratio() const { return float_value(WINOPTION_VECTOR_LENGTH_RATIO); }
|
||||
float screen_bloom_lvl0_weight() const { return float_value(WINOPTION_BLOOM_LEVEL0_WEIGHT); }
|
||||
float screen_bloom_lvl1_weight() const { return float_value(WINOPTION_BLOOM_LEVEL1_WEIGHT); }
|
||||
float screen_bloom_lvl2_weight() const { return float_value(WINOPTION_BLOOM_LEVEL2_WEIGHT); }
|
||||
float screen_bloom_lvl3_weight() const { return float_value(WINOPTION_BLOOM_LEVEL3_WEIGHT); }
|
||||
float screen_bloom_lvl4_weight() const { return float_value(WINOPTION_BLOOM_LEVEL4_WEIGHT); }
|
||||
float screen_bloom_lvl5_weight() const { return float_value(WINOPTION_BLOOM_LEVEL5_WEIGHT); }
|
||||
float screen_bloom_lvl6_weight() const { return float_value(WINOPTION_BLOOM_LEVEL6_WEIGHT); }
|
||||
float screen_bloom_lvl7_weight() const { return float_value(WINOPTION_BLOOM_LEVEL7_WEIGHT); }
|
||||
float screen_bloom_lvl8_weight() const { return float_value(WINOPTION_BLOOM_LEVEL8_WEIGHT); }
|
||||
float screen_bloom_lvl9_weight() const { return float_value(WINOPTION_BLOOM_LEVEL9_WEIGHT); }
|
||||
float screen_bloom_lvl10_weight() const { return float_value(WINOPTION_BLOOM_LEVEL10_WEIGHT); }
|
||||
const char *screen_offset() const { return value(WINOPTION_OFFSET); }
|
||||
const char *screen_scale() const { return value(WINOPTION_SCALE); }
|
||||
const char *screen_power() const { return value(WINOPTION_POWER); }
|
||||
|
Loading…
Reference in New Issue
Block a user