Previous 199869 Revisions Next

r26927 Saturday 4th January, 2014 at 03:17:31 UTC by Ryan Holtz
- Fix for pixel gaps between multi-screen games in HLSL mode. [MooglyGuy]
[hlsl]bloom.fx post.fx
[src/osd/windows]d3dhlsl.c drawd3d.c

trunk/hlsl/post.fx
r26926r26927
66
77sampler DiffuseSampler = sampler_state
88{
9   Texture   = <DiffuseTexture>;
10   MipFilter = LINEAR;
11   MinFilter = LINEAR;
12   MagFilter = LINEAR;
13   AddressU = CLAMP;
14   AddressV = CLAMP;
15   AddressW = CLAMP;
9    Texture   = <DiffuseTexture>;
10    MipFilter = LINEAR;
11    MinFilter = LINEAR;
12    MagFilter = LINEAR;
13    AddressU = CLAMP;
14    AddressV = CLAMP;
15    AddressW = CLAMP;
1616};
1717
1818texture ShadowTexture;
1919
2020sampler ShadowSampler = sampler_state
2121{
22   Texture   = <ShadowTexture>;
23   MipFilter = LINEAR;
24   MinFilter = LINEAR;
25   MagFilter = LINEAR;
26   AddressU = WRAP;
27   AddressV = WRAP;
28   AddressW = WRAP;
22    Texture   = <ShadowTexture>;
23    MipFilter = LINEAR;
24    MinFilter = LINEAR;
25    MagFilter = LINEAR;
26    AddressU = WRAP;
27    AddressV = WRAP;
28    AddressW = WRAP;
2929};
3030
3131//-----------------------------------------------------------------------------
r26926r26927
3434
3535struct VS_OUTPUT
3636{
37   float4 Position : POSITION;
38   float4 Color : COLOR0;
39   float2 TexCoord : TEXCOORD0;
37    float4 Position : POSITION;
38    float4 Color : COLOR0;
39    float2 TexCoord : TEXCOORD0;
4040};
4141
4242struct VS_INPUT
4343{
44   float4 Position : POSITION;
45   float4 Color : COLOR0;
46   float2 TexCoord : TEXCOORD0;
47   float2 Unused : TEXCOORD1;
44    float4 Position : POSITION;
45    float4 Color : COLOR0;
46    float2 TexCoord : TEXCOORD0;
47    float2 Unused : TEXCOORD1;
4848};
4949
5050struct PS_INPUT
5151{
52   float4 Color : COLOR0;
53   float2 TexCoord : TEXCOORD0;
52    float4 Color : COLOR0;
53    float2 TexCoord : TEXCOORD0;
5454};
5555
5656//-----------------------------------------------------------------------------
r26926r26927
6363
6464VS_OUTPUT vs_main(VS_INPUT Input)
6565{
66   VS_OUTPUT Output = (VS_OUTPUT)0;
67   
68   Output.Position = float4(Input.Position.xyz, 1.0f);
69   Output.Position.xy /= ScreenDims;
70   Output.Position.y = 1.0f - Output.Position.y;
71   Output.Position.xy -= 0.5f;
72   Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
73   Output.Color = Input.Color;
74   Output.TexCoord = Input.TexCoord + 0.5f / SourceDims;
66    VS_OUTPUT Output = (VS_OUTPUT)0;
67   
68    Output.Position = float4(Input.Position.xyz, 1.0f);
69    Output.Position.xy /= ScreenDims;
70    Output.Position.y = 1.0f - Output.Position.y;
71    Output.Position.xy -= 0.5f;
72    Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
73    Output.Color = Input.Color;
74    Output.TexCoord = Input.TexCoord + 0.5f / SourceDims;
7575
76   return Output;
76    return Output;
7777}
7878
7979//-----------------------------------------------------------------------------
r26926r26927
102102
103103float4 ps_main(PS_INPUT Input) : COLOR
104104{
105   float2 UsedArea = 1.0f / SourceRect;
106   float2 HalfRect = SourceRect * 0.5f;
107   float2 R2 = 1.0f / pow(length(UsedArea), 2.0f);
108   // -- Screen Pincushion Calculation --
109   float2 PinUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
110   float PincushionR2 = pow(length(PinUnitCoord), 2.0f) * R2;
111   float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
112   float2 BaseCoord = Input.TexCoord;
113   float2 ScanCoord = BaseCoord - 0.5f / ScreenDims;
114   
115   BaseCoord -= HalfRect;
116   BaseCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
117   BaseCoord += HalfRect;
118   BaseCoord += PincushionCurve;
105    float2 UsedArea = 1.0f / SourceRect;
106    float2 HalfRect = SourceRect * 0.5f;
107    float2 R2 = 1.0f / pow(length(UsedArea), 2.0f);
108    // -- Screen Pincushion Calculation --
109    float2 PinUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
110    float PincushionR2 = pow(length(PinUnitCoord), 2.0f) * R2;
111    float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
112    float2 BaseCoord = Input.TexCoord;
113    float2 ScanCoord = BaseCoord - 0.5f / ScreenDims;
114   
115    BaseCoord -= HalfRect;
116    BaseCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
117    BaseCoord += HalfRect;
118    BaseCoord += PincushionCurve;
119119
120   ScanCoord -= HalfRect;
121   ScanCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
122   ScanCoord += HalfRect;
123   ScanCoord += PincushionCurve;
120    ScanCoord -= HalfRect;
121    ScanCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
122    ScanCoord += HalfRect;
123    ScanCoord += PincushionCurve;
124124
125   float2 CurveClipUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
126   float CurvatureClipR2 = pow(length(CurveClipUnitCoord), 2.0f) * R2;
127   float2 CurvatureClipCurve = CurveClipUnitCoord * CurvatureAmount * CurvatureClipR2;
128   float2 ScreenClipCoord = Input.TexCoord;
129   ScreenClipCoord -= HalfRect;
130   ScreenClipCoord *= 1.0f - CurvatureAmount * UsedArea * 0.2f; // Warning: Magic constant
131   ScreenClipCoord += HalfRect;
132   ScreenClipCoord += CurvatureClipCurve;
125    float2 CurveClipUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
126    float CurvatureClipR2 = pow(length(CurveClipUnitCoord), 2.0f) * R2;
127    float2 CurvatureClipCurve = CurveClipUnitCoord * CurvatureAmount * CurvatureClipR2;
128    float2 ScreenClipCoord = Input.TexCoord;
129    ScreenClipCoord -= HalfRect;
130    ScreenClipCoord *= 1.0f - CurvatureAmount * UsedArea * 0.2f; // Warning: Magic constant
131    ScreenClipCoord += HalfRect;
132    ScreenClipCoord += CurvatureClipCurve;
133133
134   // RGB Pincushion Calculation
135   float3 PincushionCurveX = PinUnitCoord.x * PincushionAmount * PincushionR2;
136   float3 PincushionCurveY = PinUnitCoord.y * PincushionAmount * PincushionR2;
134    // RGB Pincushion Calculation
135    float3 PincushionCurveX = PinUnitCoord.x * PincushionAmount * PincushionR2;
136    float3 PincushionCurveY = PinUnitCoord.y * PincushionAmount * PincushionR2;
137137
138   float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord);
138    float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord);
139139
140   // -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
141   clip((BaseCoord < 1.0f / SourceDims) ? -1 : 1);
142   clip((BaseCoord > (SourceRect + 1.0f / SourceDims)) ? -1 : 1);
140    // -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
141    clip((BaseCoord < 1.0f / SourceDims) ? -1 : 1);
142    clip((BaseCoord > (SourceRect + 1.0f / SourceDims)) ? -1 : 1);
143143
144   // -- Scanline Simulation --
145   float InnerSine = ScanCoord.y * SourceDims.y * ScanlineScale;
146   float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * SourceDims.y);
147   float3 ScanBrightness = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAlpha);
148   float3 Scanned = BaseTexel.rgb * ScanBrightness;
144    // -- Scanline Simulation --
145    float InnerSine = ScanCoord.y * SourceDims.y * ScanlineScale;
146    float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * SourceDims.y);
147    float3 ScanBrightness = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAlpha);
148    float3 Scanned = BaseTexel.rgb * ScanBrightness;
149149
150   // -- Color Compression (increasing the floor of the signal without affecting the ceiling) --
151   Scanned = Floor + (1.0f - Floor) * Scanned;
150    // -- Color Compression (increasing the floor of the signal without affecting the ceiling) --
151    Scanned = Floor + (1.0f - Floor) * Scanned;
152152
153   // Shadow mask
154   // Note: This is broken right now and needs fixed
155   float2 ShadowFrac = frac(BaseCoord * ShadowCount);
156   float2 ShadowCoord = ShadowFrac * ShadowUV + 0.5f / ShadowDims;
157   float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord).rgb, ShadowAlpha);
158   
159   // -- Final Pixel --
160   float4 Output = float4(Scanned * ShadowTexel, BaseTexel.a) * Input.Color;
161   
162   Output.r = pow(Output.r, Power.r);
163   Output.g = pow(Output.g, Power.g);
164   Output.b = pow(Output.b, Power.b);
165   Output.a = 1.0f;
153    // Shadow mask
154    // Note: This is broken right now and needs fixed
155    float2 ShadowFrac = frac(BaseCoord * ShadowCount);
156    float2 ShadowCoord = ShadowFrac * ShadowUV + 0.5f / ShadowDims;
157    float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord).rgb, ShadowAlpha);
158   
159    // -- Final Pixel --
160    float4 Output = float4(Scanned * ShadowTexel, BaseTexel.a) * Input.Color;
161   
162    Output.r = pow(Output.r, Power.r);
163    Output.g = pow(Output.g, Power.g);
164    Output.b = pow(Output.b, Power.b);
165    Output.a = 1.0f;
166166
167   return Output;
167    return Output;
168168}
169169
170170//-----------------------------------------------------------------------------
r26926r26927
173173
174174technique ScanMaskTechnique
175175{
176   pass Pass0
177   {
178      Lighting = FALSE;
176    pass Pass0
177    {
178        Lighting = FALSE;
179179
180      //Sampler[0] = <DiffuseSampler>;
180        //Sampler[0] = <DiffuseSampler>;
181181
182      VertexShader = compile vs_3_0 vs_main();
183      PixelShader  = compile ps_3_0 ps_main();
184   }
182        VertexShader = compile vs_3_0 vs_main();
183        PixelShader  = compile ps_3_0 ps_main();
184    }
185185}
trunk/hlsl/bloom.fx
r26926r26927
1616
1717sampler DiffuseSampler0 = sampler_state
1818{
19   Texture   = <DiffuseA>;
20   MipFilter = LINEAR;
21   MinFilter = LINEAR;
22   MagFilter = LINEAR;
23   AddressU = CLAMP;
24   AddressV = CLAMP;
25   AddressW = CLAMP;
19    Texture   = <DiffuseA>;
20    MipFilter = NONE;
21    MinFilter = NONE;
22    MagFilter = NONE;
23    AddressU = CLAMP;
24    AddressV = CLAMP;
25    AddressW = CLAMP;
2626};
2727
2828sampler DiffuseSampler1 = sampler_state
2929{
30   Texture   = <DiffuseB>;
31   MipFilter = LINEAR;
32   MinFilter = LINEAR;
33   MagFilter = LINEAR;
34   AddressU = CLAMP;
35   AddressV = CLAMP;
36   AddressW = CLAMP;
30    Texture   = <DiffuseB>;
31    MipFilter = LINEAR;
32    MinFilter = LINEAR;
33    MagFilter = LINEAR;
34    AddressU = CLAMP;
35    AddressV = CLAMP;
36    AddressW = CLAMP;
3737};
3838
3939sampler DiffuseSampler2 = sampler_state
4040{
41   Texture   = <DiffuseC>;
42   MipFilter = LINEAR;
43   MinFilter = LINEAR;
44   MagFilter = LINEAR;
45   AddressU = CLAMP;
46   AddressV = CLAMP;
47   AddressW = CLAMP;
41    Texture   = <DiffuseC>;
42    MipFilter = LINEAR;
43    MinFilter = LINEAR;
44    MagFilter = LINEAR;
45    AddressU = CLAMP;
46    AddressV = CLAMP;
47    AddressW = CLAMP;
4848};
4949
5050sampler DiffuseSampler3 = sampler_state
5151{
52   Texture   = <DiffuseD>;
53   MipFilter = LINEAR;
54   MinFilter = LINEAR;
55   MagFilter = LINEAR;
56   AddressU = CLAMP;
57   AddressV = CLAMP;
58   AddressW = CLAMP;
52    Texture   = <DiffuseD>;
53    MipFilter = LINEAR;
54    MinFilter = LINEAR;
55    MagFilter = LINEAR;
56    AddressU = CLAMP;
57    AddressV = CLAMP;
58    AddressW = CLAMP;
5959};
6060
6161sampler DiffuseSampler4 = sampler_state
6262{
63   Texture   = <DiffuseE>;
64   MipFilter = LINEAR;
65   MinFilter = LINEAR;
66   MagFilter = LINEAR;
67   AddressU = CLAMP;
68   AddressV = CLAMP;
69   AddressW = CLAMP;
63    Texture   = <DiffuseE>;
64    MipFilter = LINEAR;
65    MinFilter = LINEAR;
66    MagFilter = LINEAR;
67    AddressU = CLAMP;
68    AddressV = CLAMP;
69    AddressW = CLAMP;
7070};
7171
7272sampler DiffuseSampler5 = sampler_state
7373{
74   Texture   = <DiffuseF>;
75   MipFilter = LINEAR;
76   MinFilter = LINEAR;
77   MagFilter = LINEAR;
78   AddressU = CLAMP;
79   AddressV = CLAMP;
80   AddressW = CLAMP;
74    Texture   = <DiffuseF>;
75    MipFilter = LINEAR;
76    MinFilter = LINEAR;
77    MagFilter = LINEAR;
78    AddressU = CLAMP;
79    AddressV = CLAMP;
80    AddressW = CLAMP;
8181};
8282
8383sampler DiffuseSampler6 = sampler_state
8484{
85   Texture   = <DiffuseG>;
86   MipFilter = LINEAR;
87   MinFilter = LINEAR;
88   MagFilter = LINEAR;
89   AddressU = CLAMP;
90   AddressV = CLAMP;
91   AddressW = CLAMP;
85    Texture   = <DiffuseG>;
86    MipFilter = LINEAR;
87    MinFilter = LINEAR;
88    MagFilter = LINEAR;
89    AddressU = CLAMP;
90    AddressV = CLAMP;
91    AddressW = CLAMP;
9292};
9393
9494sampler DiffuseSampler7 = sampler_state
9595{
96   Texture   = <DiffuseH>;
97   MipFilter = LINEAR;
98   MinFilter = LINEAR;
99   MagFilter = LINEAR;
100   AddressU = CLAMP;
101   AddressV = CLAMP;
102   AddressW = CLAMP;
96    Texture   = <DiffuseH>;
97    MipFilter = LINEAR;
98    MinFilter = LINEAR;
99    MagFilter = LINEAR;
100    AddressU = CLAMP;
101    AddressV = CLAMP;
102    AddressW = CLAMP;
103103};
104104
105105sampler DiffuseSampler8 = sampler_state
106106{
107   Texture   = <DiffuseI>;
108   MipFilter = LINEAR;
109   MinFilter = LINEAR;
110   MagFilter = LINEAR;
111   AddressU = CLAMP;
112   AddressV = CLAMP;
113   AddressW = CLAMP;
107    Texture   = <DiffuseI>;
108    MipFilter = LINEAR;
109    MinFilter = LINEAR;
110    MagFilter = LINEAR;
111    AddressU = CLAMP;
112    AddressV = CLAMP;
113    AddressW = CLAMP;
114114};
115115
116116sampler DiffuseSampler9 = sampler_state
117117{
118   Texture   = <DiffuseJ>;
119   MipFilter = LINEAR;
120   MinFilter = LINEAR;
121   MagFilter = LINEAR;
122   AddressU = CLAMP;
123   AddressV = CLAMP;
124   AddressW = CLAMP;
118    Texture   = <DiffuseJ>;
119    MipFilter = LINEAR;
120    MinFilter = LINEAR;
121    MagFilter = LINEAR;
122    AddressU = CLAMP;
123    AddressV = CLAMP;
124    AddressW = CLAMP;
125125};
126126
127127sampler DiffuseSamplerA = sampler_state
128128{
129   Texture   = <DiffuseK>;
130   MipFilter = LINEAR;
131   MinFilter = LINEAR;
132   MagFilter = LINEAR;
133   AddressU = CLAMP;
134   AddressV = CLAMP;
135   AddressW = CLAMP;
129    Texture   = <DiffuseK>;
130    MipFilter = LINEAR;
131    MinFilter = LINEAR;
132    MagFilter = LINEAR;
133    AddressU = CLAMP;
134    AddressV = CLAMP;
135    AddressW = CLAMP;
136136};
137137
138138//-----------------------------------------------------------------------------
r26926r26927
141141
142142struct VS_OUTPUT
143143{
144   float4 Position : POSITION;
145   float4 Color : COLOR0;
146   float2 TexCoord : TEXCOORD0;
144    float4 Position : POSITION;
145    float4 Color : COLOR0;
146    float2 TexCoord : TEXCOORD0;
147147};
148148
149149struct VS_INPUT
150150{
151   float3 Position : POSITION;
152   float4 Color : COLOR0;
153   float2 TexCoord : TEXCOORD0;
154   float2 Unused : TEXCOORD1;
151    float3 Position : POSITION;
152    float4 Color : COLOR0;
153    float2 TexCoord : TEXCOORD0;
154    float2 Unused : TEXCOORD1;
155155};
156156
157157struct PS_INPUT
158158{
159   float4 Color : COLOR0;
160   float2 TexCoord : TEXCOORD0;
159    float4 Color : COLOR0;
160    float2 TexCoord : TEXCOORD0;
161161};
162162
163163//-----------------------------------------------------------------------------
164164// Bloom Vertex Shader
165165//-----------------------------------------------------------------------------
166166
167uniform float2 TargetSize;
167uniform float2 ScreenSize;
168uniform float2 TextureSize;
168169
169170VS_OUTPUT vs_main(VS_INPUT Input)
170171{
171   VS_OUTPUT Output = (VS_OUTPUT)0;
172   
173   Output.Position = float4(Input.Position.xyz, 1.0f);
174   Output.Position.xy /= TargetSize;
175   Output.Position.y = 1.0f - Output.Position.y;
176   Output.Position.xy -= float2(0.5f, 0.5f);
177   Output.Position.xy *= float2(2.0f, 2.0f);
178   Output.Color = Input.Color;
179   Output.TexCoord = (Input.Position.xy  + 0.5f) / TargetSize;
172    VS_OUTPUT Output = (VS_OUTPUT)0;
173   
174    Output.Position = float4(Input.Position.xyz, 1.0f);
175    Output.Position.xy /= ScreenSize;
176    Output.Position.y = 1.0f - Output.Position.y;
177    Output.Position.xy -= float2(0.5f, 0.5f);
178    Output.Position.xy *= float2(2.0f, 2.0f);
179    Output.Color = Input.Color;
180    Output.TexCoord = (Input.Position.xy + 0.5f) / ScreenSize;
180181
181   return Output;
182    return Output;
182183}
183184
184185//-----------------------------------------------------------------------------
r26926r26927
191192
192193float4 ps_main(PS_INPUT Input) : COLOR
193194{
194   float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord).rgb;
195   float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord).rgb;
196   float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord).rgb;
197   float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord).rgb;
198   float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord).rgb;
199   float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord).rgb;
200   float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord).rgb;
201   float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord).rgb;
202   float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord).rgb;
203   float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord).rgb;
204   float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoord).rgb;
195    float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord).rgb;
196    float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord).rgb;
197    float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord).rgb;
198    float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord).rgb;
199    float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord).rgb;
200    float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord).rgb;
201    float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord).rgb;
202    float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord).rgb;
203    float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord).rgb;
204    float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord).rgb;
205    float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoord).rgb;
205206
206   texel0 = texel0 * Level0123Weight.x;
207   texel1 = texel1 * Level0123Weight.y;
208   texel2 = texel2 * Level0123Weight.z;
209   texel3 = texel3 * Level0123Weight.w;
210   texel4 = texel4 * Level4567Weight.x;
211   texel5 = texel5 * Level4567Weight.y;
212   texel6 = texel6 * Level4567Weight.z;
213   texel7 = texel7 * Level4567Weight.w;
214   texel8 = texel8 * Level89AWeight.x;
215   texel9 = texel9 * Level89AWeight.y;
216   texelA = texelA * Level89AWeight.z;
207    texel0 = texel0 * Level0123Weight.x;
208    texel1 = texel1 * Level0123Weight.y;
209    texel2 = texel2 * Level0123Weight.z;
210    texel3 = texel3 * Level0123Weight.w;
211    texel4 = texel4 * Level4567Weight.x;
212    texel5 = texel5 * Level4567Weight.y;
213    texel6 = texel6 * Level4567Weight.z;
214    texel7 = texel7 * Level4567Weight.w;
215    texel8 = texel8 * Level89AWeight.x;
216    texel9 = texel9 * Level89AWeight.y;
217    texelA = texelA * Level89AWeight.z;
217218
218   float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
219           texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
220   return sum;
219    float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
220            texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
221    return sum;
221222}
222223
223224//-----------------------------------------------------------------------------
r26926r26927
226227
227228technique TestTechnique
228229{
229   pass Pass0
230   {
231      Lighting = FALSE;
230    pass Pass0
231    {
232        Lighting = FALSE;
232233
233      Sampler[0] = <DiffuseSampler0>; // 2048x2048
234      Sampler[1] = <DiffuseSampler1>; // 1024x1024
235      Sampler[2] = <DiffuseSampler2>; // 512x512
236      Sampler[3] = <DiffuseSampler3>; // 256x256
237      Sampler[4] = <DiffuseSampler4>; // 128x128
238      Sampler[5] = <DiffuseSampler5>; // 64x64
239      Sampler[6] = <DiffuseSampler6>; // 32x32
240      Sampler[7] = <DiffuseSampler7>; // 16x16
241      Sampler[8] = <DiffuseSampler8>; // 8x8
242      Sampler[9] = <DiffuseSampler9>; // 4x4
243      Sampler[10] = <DiffuseSamplerA>; // 2x2
234        Sampler[0] = <DiffuseSampler0>; // 2048x2048
235        Sampler[1] = <DiffuseSampler1>; // 1024x1024
236        Sampler[2] = <DiffuseSampler2>; // 512x512
237        Sampler[3] = <DiffuseSampler3>; // 256x256
238        Sampler[4] = <DiffuseSampler4>; // 128x128
239        Sampler[5] = <DiffuseSampler5>; // 64x64
240        Sampler[6] = <DiffuseSampler6>; // 32x32
241        Sampler[7] = <DiffuseSampler7>; // 16x16
242        Sampler[8] = <DiffuseSampler8>; // 8x8
243        Sampler[9] = <DiffuseSampler9>; // 4x4
244        Sampler[10] = <DiffuseSamplerA>; // 2x2
244245
245      VertexShader = compile vs_3_0 vs_main();
246      PixelShader  = compile ps_3_0 ps_main();
247   }
246        VertexShader = compile vs_3_0 vs_main();
247        PixelShader  = compile ps_3_0 ps_main();
248    }
248249}
trunk/src/osd/windows/d3dhlsl.c
r26926r26927
10511051   post_effect->add_uniform("Power", uniform::UT_VEC3, uniform::CU_POST_POWER);
10521052   post_effect->add_uniform("Floor", uniform::UT_VEC3, uniform::CU_POST_FLOOR);
10531053
1054   bloom_effect->add_uniform("SourceRect", uniform::UT_VEC2, uniform::CU_SOURCE_RECT);
1055
10541056   initialized = true;
10551057
10561058   return 0;
r26926r26927
16291631
16301632   HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, rt->target[2]);
16311633
1632   result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(1,0,0,0), 0, 0);
1634   result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
16331635   if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
16341636
16351637   curr_effect->begin(&num_passes, 0);
r26926r26927
16971699   }
16981700
16991701   curr_effect = bloom_effect;
1702   curr_effect->update_uniforms();
17001703
17011704   float weight0123[4] = { options->bloom_level0_weight, options->bloom_level1_weight, options->bloom_level2_weight, options->bloom_level3_weight };
17021705   float weight4567[4] = { options->bloom_level4_weight, options->bloom_level5_weight, options->bloom_level6_weight, options->bloom_level7_weight };
17031706   float weight89A[3]  = { options->bloom_level8_weight, options->bloom_level9_weight, options->bloom_level10_weight };
1707   float temp0[2] = { 1024.0f, 512.0f };
17041708   curr_effect->set_vector("Level0123Weight", 4, weight0123);
17051709   curr_effect->set_vector("Level4567Weight", 4, weight4567);
17061710   curr_effect->set_vector("Level89AWeight", 3, weight89A);
1707   curr_effect->set_vector("TargetSize", 2, &screendims.c.x);
1711   curr_effect->set_vector("ScreenSize", 2, &screendims.c.x);
1712   curr_effect->set_vector("TextureSize", 2, temp0);
17081713
17091714   curr_effect->set_texture("DiffuseA", rt->render_texture[2]);
17101715
trunk/src/osd/windows/drawd3d.c
r26926r26927
16901690      return;
16911691
16921692   // fill in the vertexes clockwise
1693   vertex[0].x = prim->bounds.x0 - 0.5f;
1694   vertex[0].y = prim->bounds.y0 - 0.5f;
1695   vertex[1].x = prim->bounds.x1 - 0.5f;
1696   vertex[1].y = prim->bounds.y0 - 0.5f;
1697   vertex[2].x = prim->bounds.x0 - 0.5f;
1698   vertex[2].y = prim->bounds.y1 - 0.5f;
1699   vertex[3].x = prim->bounds.x1 - 0.5f;
1700   vertex[3].y = prim->bounds.y1 - 0.5f;
1693   vertex[0].x = roundf(prim->bounds.x0) - 0.5f;
1694   vertex[0].y = roundf(prim->bounds.y0) - 0.5f;
1695   vertex[1].x = roundf(prim->bounds.x1) - 0.5f;
1696   vertex[1].y = roundf(prim->bounds.y0) - 0.5f;
1697   vertex[2].x = roundf(prim->bounds.x0) - 0.5f;
1698   vertex[2].y = roundf(prim->bounds.y1) - 0.5f;
1699   vertex[3].x = roundf(prim->bounds.x1) - 0.5f;
1700   vertex[3].y = roundf(prim->bounds.y1) - 0.5f;
17011701   float width = prim->bounds.x1 - prim->bounds.x0;
17021702   float height = prim->bounds.y1 - prim->bounds.y0;
17031703

Previous 199869 Revisions Next


© 1997-2024 The MAME Team