all shaders compile & validate
This commit is contained in:
@@ -2,24 +2,16 @@
|
||||
// Author: C. Forbes
|
||||
//--------------------------------------------------------
|
||||
|
||||
shared texture DiffuseTexture;
|
||||
shared float2 r1, r2; // matrix elements
|
||||
float2 r1, r2; // matrix elements
|
||||
|
||||
sampler s_DiffuseTexture = sampler_state {
|
||||
Texture = <DiffuseTexture>;
|
||||
MinFilter = None;
|
||||
MagFilter = None;
|
||||
MipFilter = None;
|
||||
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
AddressW = Wrap;
|
||||
sampler2D DiffuseTexture = sampler_state {
|
||||
MinFilter = Nearest;
|
||||
MagFilter = Nearest;
|
||||
};
|
||||
|
||||
struct VertexIn {
|
||||
float4 Position: POSITION;
|
||||
float2 Tex0: TEXCOORD0;
|
||||
float2 Tex1: TEXCOORD1;
|
||||
float4 Tex0: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexOut {
|
||||
@@ -35,40 +27,25 @@ VertexOut Simple_vp(VertexIn v) {
|
||||
VertexOut o;
|
||||
float2 p = v.Position.xy * r1 + r2;
|
||||
o.Position = float4(p.x,p.y,0,1);
|
||||
o.Tex0 = v.Tex0;
|
||||
o.Tex0 = v.Tex0.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 Simple_fp(FragmentIn f) : COLOR0 {
|
||||
float4 r = tex2D(s_DiffuseTexture, f.Tex0.xy);
|
||||
float4 r = tex2D(DiffuseTexture, f.Tex0);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
technique low_quality {
|
||||
pass p0 {
|
||||
AlphaBlendEnable = false;
|
||||
ZWriteEnable = false;
|
||||
ZEnable = false;
|
||||
CullMode = None;
|
||||
FillMode = Solid;
|
||||
VertexShader = compile vs_2_0 Simple_vp();
|
||||
PixelShader = compile ps_2_0 Simple_fp();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
technique high_quality {
|
||||
pass p0 {
|
||||
AlphaBlendEnable = true;
|
||||
ZWriteEnable = false;
|
||||
ZEnable = false;
|
||||
CullMode = None;
|
||||
FillMode = Solid;
|
||||
VertexShader = compile vs_2_0 Simple_vp();
|
||||
PixelShader = compile ps_2_0 Simple_fp();
|
||||
BlendEnable = true;
|
||||
DepthTestEnable = false;
|
||||
// CullMode = None;
|
||||
// FillMode = Solid;
|
||||
VertexProgram = compile arbvp1 Simple_vp();
|
||||
FragmentProgram = compile arbfp1 Simple_fp();
|
||||
|
||||
SrcBlend = SrcAlpha;
|
||||
DestBlend = InvSrcAlpha;
|
||||
//SrcBlend = SrcAlpha;
|
||||
//DestBlend = InvSrcAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,36 +2,26 @@
|
||||
// Author: C. Forbes
|
||||
//--------------------------------------------------------
|
||||
|
||||
shared texture DiffuseTexture, Palette;
|
||||
shared float2 Scroll;
|
||||
float2 Scroll;
|
||||
float2 r1, r2; // matrix elements
|
||||
|
||||
shared float2 r1, r2; // matrix elements
|
||||
|
||||
sampler s_DiffuseTexture = sampler_state {
|
||||
Texture = <DiffuseTexture>;
|
||||
MinFilter = None;
|
||||
MagFilter = None;
|
||||
MipFilter = None;
|
||||
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
AddressW = Wrap;
|
||||
sampler2D DiffuseTexture = sampler_state {
|
||||
MinFilter = Nearest;
|
||||
MagFilter = Nearest;
|
||||
WrapS = Repeat;
|
||||
WrapT = Repeat;
|
||||
};
|
||||
|
||||
sampler s_PaletteTexture = sampler_state {
|
||||
Texture = <Palette>;
|
||||
MinFilter = None;
|
||||
MagFilter = None;
|
||||
MipFilter = None;
|
||||
|
||||
AddressU = Clamp;
|
||||
AddressV = Clamp;
|
||||
sampler2D Palette = sampler_state {
|
||||
MinFilter = Nearest;
|
||||
MagFilter = Nearest;
|
||||
WrapS = Repeat;
|
||||
WrapT = Repeat;
|
||||
};
|
||||
|
||||
struct VertexIn {
|
||||
float4 Position: POSITION;
|
||||
float2 Tex0: TEXCOORD0;
|
||||
float2 Tex1: TEXCOORD1;
|
||||
float4 Tex0: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexOut {
|
||||
@@ -40,11 +30,6 @@ struct VertexOut {
|
||||
float4 ChannelMask: TEXCOORD1;
|
||||
};
|
||||
|
||||
struct FragmentIn {
|
||||
float3 Tex0: TEXCOORD0;
|
||||
float4 ChannelMask: TEXCOORD1;
|
||||
};
|
||||
|
||||
float4 DecodeChannelMask( float x )
|
||||
{
|
||||
if (x > 0)
|
||||
@@ -55,45 +40,27 @@ float4 DecodeChannelMask( float x )
|
||||
|
||||
VertexOut Simple_vp(VertexIn v) {
|
||||
VertexOut o;
|
||||
|
||||
float2 p = v.Position.xy * r1 + r2;
|
||||
o.Position = float4(p.x,p.y,0,1);
|
||||
o.Tex0 = float3(v.Tex0.x, v.Tex0.y, v.Tex1.x);
|
||||
o.ChannelMask = DecodeChannelMask( v.Tex1.y );
|
||||
o.Tex0 = float3(v.Tex0.x, v.Tex0.y, v.Tex0.z);
|
||||
o.ChannelMask = DecodeChannelMask( v.Tex0.w );
|
||||
return o;
|
||||
}
|
||||
|
||||
const float2 texelOffset = float2( 0, 1.0f/32.0f );
|
||||
|
||||
float4 Palette_fp(FragmentIn f) : COLOR0 {
|
||||
float4 x = tex2D(s_DiffuseTexture, f.Tex0.xy);
|
||||
float4 Palette_fp(VertexOut f) : COLOR0 {
|
||||
float4 x = tex2D(DiffuseTexture, f.Tex0.xy);
|
||||
float2 p = float2( dot(x, f.ChannelMask), f.Tex0.z );
|
||||
return tex2D(s_PaletteTexture, p + texelOffset);
|
||||
return tex2D(Palette, p + texelOffset);
|
||||
}
|
||||
|
||||
technique low_quality {
|
||||
pass p0 {
|
||||
AlphaBlendEnable = false;
|
||||
ZWriteEnable = false;
|
||||
ZEnable = false;
|
||||
CullMode = None;
|
||||
FillMode = Solid;
|
||||
VertexShader = compile vs_2_0 Simple_vp();
|
||||
PixelShader = compile ps_2_0 Palette_fp();
|
||||
}
|
||||
}
|
||||
|
||||
technique high_quality {
|
||||
pass p0 {
|
||||
AlphaBlendEnable = true;
|
||||
ZWriteEnable = false;
|
||||
ZEnable = false;
|
||||
CullMode = None;
|
||||
FillMode = Solid;
|
||||
VertexShader = compile vs_2_0 Simple_vp();
|
||||
PixelShader = compile ps_2_0 Palette_fp();
|
||||
|
||||
SrcBlend = SrcAlpha;
|
||||
DestBlend = InvSrcAlpha;
|
||||
BlendEnable = false;
|
||||
DepthTestEnable = false;
|
||||
CullFaceEnable = false;
|
||||
VertexProgram = compile arbvp1 Simple_vp();
|
||||
FragmentProgram = compile arbfp1 Palette_fp();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user