mirror of https://github.com/AxioDL/metaforce.git
HLSL shaders for TIND (needs proper framebuffer coords in)
This commit is contained in:
parent
741ac2c0ca
commit
8d9a9d8f9b
|
@ -75,7 +75,7 @@ static const char* VS_HLSL_INDTEX =
|
||||||
" float4 posIn[4] : POSITION;\n"
|
" float4 posIn[4] : POSITION;\n"
|
||||||
" float4 colorIn : COLOR;\n"
|
" float4 colorIn : COLOR;\n"
|
||||||
" float4 uvsInTexrTind[4] : UV0;\n"
|
" float4 uvsInTexrTind[4] : UV0;\n"
|
||||||
" float4 uvsInScene[4] : UV4;\n"
|
" float4 uvsInScene : UV4;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"cbuffer ParticleUniform : register(b0)\n"
|
"cbuffer ParticleUniform : register(b0)\n"
|
||||||
|
@ -88,8 +88,8 @@ static const char* VS_HLSL_INDTEX =
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 position : SV_Position;\n"
|
" float4 position : SV_Position;\n"
|
||||||
" float4 color : COLOR;\n"
|
" float4 color : COLOR;\n"
|
||||||
" float2 uvTexr : UV0;\n"
|
" float4 uvScene : UV0;\n"
|
||||||
" float2 uvScene : UV1;\n"
|
" float2 uvTexr : UV1;\n"
|
||||||
" float2 uvTind : UV2;\n"
|
" float2 uvTind : UV2;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -97,8 +97,8 @@ static const char* VS_HLSL_INDTEX =
|
||||||
"{\n"
|
"{\n"
|
||||||
" VertToFrag vtf;\n"
|
" VertToFrag vtf;\n"
|
||||||
" vtf.color = v.colorIn * moduColor;\n"
|
" vtf.color = v.colorIn * moduColor;\n"
|
||||||
|
" vtf.uvScene = v.uvsInScene;\n"
|
||||||
" vtf.uvTexr = v.uvsInTexrTind[vertId].xy;\n"
|
" vtf.uvTexr = v.uvsInTexrTind[vertId].xy;\n"
|
||||||
" vtf.uvScene = v.uvsInScene[vertId].xy;\n"
|
|
||||||
" vtf.uvTind = v.uvsInTexrTind[vertId].zw;\n"
|
" vtf.uvTind = v.uvsInTexrTind[vertId].zw;\n"
|
||||||
" vtf.position = mul(mvp, v.posIn[vertId]);\n"
|
" vtf.position = mul(mvp, v.posIn[vertId]);\n"
|
||||||
" return vtf;\n"
|
" return vtf;\n"
|
||||||
|
@ -113,21 +113,23 @@ static const char* FS_HLSL_INDTEX =
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 position : SV_Position;\n"
|
" float4 position : SV_Position;\n"
|
||||||
" float4 color : COLOR;\n"
|
" float4 color : COLOR;\n"
|
||||||
" float2 uvTexr : UV0;\n"
|
" float4 uvScene : UV0;\n"
|
||||||
" float2 uvScene : UV1;\n"
|
" float2 uvTexr : UV1;\n"
|
||||||
" float2 uvTind : UV2;\n"
|
" float2 uvTind : UV2;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;\n"
|
" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).zw;\n"
|
||||||
" float4 sceneTexel = tex1.Sample(samp, vtf.uvScene + tindTexel);\n"
|
" float4 sceneTexel = tex1.Sample(samp, lerp(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
|
||||||
" float4 texrTexel = tex0.Sample(samp, vtf.uvTexr);\n"
|
" float4 texrTexel = tex0.Sample(samp, vtf.uvTexr);\n"
|
||||||
" float4 colr = vtf.color * sceneTexel + texrTexel;\n"
|
" return float4(tindTexel, 0.0, 1.0);\n"
|
||||||
" return float4(colr.rgb, vtf.color.a * texrTexel.a);"
|
" float4 colorOut = vtf.color * sceneTexel + texrTexel;\n"
|
||||||
|
" colorOut.a = vtf.color.a * texrTexel.a;\n"
|
||||||
|
" return colorOut;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static const char* FS_METAL_CINDTEX =
|
static const char* FS_HLSL_CINDTEX =
|
||||||
"SamplerState samp : register(s0);\n"
|
"SamplerState samp : register(s0);\n"
|
||||||
"Texture2D tex0 : register(t0);\n"
|
"Texture2D tex0 : register(t0);\n"
|
||||||
"Texture2D tex1 : register(t1);\n"
|
"Texture2D tex1 : register(t1);\n"
|
||||||
|
@ -136,15 +138,15 @@ static const char* FS_METAL_CINDTEX =
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 position : SV_Position;\n"
|
" float4 position : SV_Position;\n"
|
||||||
" float4 color : COLOR;\n"
|
" float4 color : COLOR;\n"
|
||||||
" float2 uvTexr : UV0;\n"
|
" float4 uvScene : UV0;\n"
|
||||||
" float2 uvScene : UV1;\n"
|
" float2 uvTexr : UV1;\n"
|
||||||
" float2 uvTind : UV2;\n"
|
" float2 uvTind : UV2;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;\n"
|
" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;\n"
|
||||||
" float4 sceneTexel = tex1.Sample(samp, vtf.uvScene + tindTexel);\n"
|
" float4 sceneTexel = tex1.Sample(samp, lerp(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
|
||||||
" return vtf.color * sceneTexel * tex0.Sample(samp, vtf.uvTexr);\n"
|
" return vtf.color * sceneTexel * tex0.Sample(samp, vtf.uvTexr);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
@ -252,12 +254,9 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::ID3
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4},
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4}
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 5},
|
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 6},
|
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 7}
|
|
||||||
};
|
};
|
||||||
m_vtxFormatIndTex = CGraphics::g_BooFactory->newVertexFormat(13, TexFmtIndTex);
|
m_vtxFormatIndTex = CGraphics::g_BooFactory->newVertexFormat(10, TexFmtIndTex);
|
||||||
|
|
||||||
static const boo::VertexElementDescriptor TexFmtNoTex[] =
|
static const boo::VertexElementDescriptor TexFmtNoTex[] =
|
||||||
{
|
{
|
||||||
|
@ -307,28 +306,28 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::ID3
|
||||||
m_indTexZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_indTexZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
true, true, false);
|
false, true, false);
|
||||||
m_indTexNoZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_indTexNoZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
true, false, false);
|
false, false, false);
|
||||||
m_indTexAdditive = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_indTexAdditive = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
true, true, false);
|
false, true, false);
|
||||||
|
|
||||||
m_cindTexZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_METAL_CINDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_cindTexZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_CINDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
true, true, false);
|
false, true, false);
|
||||||
m_cindTexNoZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_METAL_CINDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_cindTexNoZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_CINDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
true, false, false);
|
false, false, false);
|
||||||
m_cindTexAdditive = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_METAL_CINDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_cindTexAdditive = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_CINDTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatIndTex,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
true, true, false);
|
false, true, false);
|
||||||
|
|
||||||
m_noTexZTestZWrite = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
m_noTexZTestZWrite = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
ComPtr<ID3DBlob>(), m_vtxFormatNoTex,
|
ComPtr<ID3DBlob>(), m_vtxFormatNoTex,
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 4a8feddfc53f17221baebe6924899d7bbd27e021
|
Subproject commit 2f38f89c0f840b4166d62bcd77172365884ed3ab
|
Loading…
Reference in New Issue