Reflection sampler fixes

This commit is contained in:
Jack Andersen 2018-10-18 13:55:42 -10:00
parent 2e824b6bb5
commit 3698199403
3 changed files with 11 additions and 9 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit 7d1be415c6fd83468ede3641ffc07cfc06a6e9f9
Subproject commit 9d91cd459ed9cf302e4e4ce2a43485d3b9b2733a

View File

@ -129,9 +129,9 @@ std::string HLSL::GenerateReflectionExpr(ReflectionType type) const
default:
return "float3(0.0, 0.0, 0.0)";
case ReflectionType::Simple:
return "reflectionTex.Sample(samp, vtf.reflectTcgs[1]).rgb * vtf.reflectAlpha";
return "reflectionTex.Sample(reflectSamp, vtf.reflectTcgs[1]).rgb * vtf.reflectAlpha";
case ReflectionType::Indirect:
return "reflectionTex.Sample(samp, (reflectionIndTex.Sample(samp, vtf.reflectTcgs[0]).rg - "
return "reflectionTex.Sample(reflectSamp, (reflectionIndTex.Sample(samp, vtf.reflectTcgs[0]).rg - "
"float2(0.5, 0.5)) * float2(0.5, 0.5) + vtf.reflectTcgs[1]).rgb * vtf.reflectAlpha";
}
}
@ -239,7 +239,8 @@ std::string HLSL::makeFrag(size_t blockCount, const char** blockNames,
m_texMapEnd);
std::string retval =
"SamplerState samp : register(s0);\n"
"SamplerState clampSamp : register(s1);\n" +
"SamplerState clampSamp : register(s1);\n"
"SamplerState reflectSamp : register(s2);\n" +
GenerateVertToFragStruct(0, reflectionType != ReflectionType::None) +
texMapDecl + "\n" +
lightingSrc + "\n" +
@ -315,7 +316,8 @@ std::string HLSL::makeFrag(size_t blockCount, const char** blockNames,
std::string retval =
"SamplerState samp : register(s0);\n"
"SamplerState clampSamp : register(s1);\n" +
"SamplerState clampSamp : register(s1);\n"
"SamplerState reflectSamp : register(s2);\n" +
GenerateVertToFragStruct(extTexCount, reflectionType != ReflectionType::None) +
texMapDecl + "\n" +
lightingSrc + "\n" +

View File

@ -133,9 +133,9 @@ std::string Metal::GenerateReflectionExpr(ReflectionType type) const
default:
return "float3(0.0, 0.0, 0.0)";
case ReflectionType::Simple:
return "reflectionTex.sample(samp, vtf.reflectTcgs1).rgb * vtf.reflectAlpha";
return "reflectionTex.sample(reflectSamp, vtf.reflectTcgs1).rgb * vtf.reflectAlpha";
case ReflectionType::Indirect:
return "reflectionTex.sample(samp, (reflectionIndTex.sample(samp, vtf.reflectTcgs0).rg - "
return "reflectionTex.sample(reflectSamp, (reflectionIndTex.sample(samp, vtf.reflectTcgs0).rg - "
"float2(0.5, 0.5)) * float2(0.5, 0.5) + vtf.reflectTcgs1).rgb * vtf.reflectAlpha";
}
}
@ -254,7 +254,7 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
GenerateFragOutStruct() + "\n" +
lightingSrc + "\n" +
"fragment FragOut fmain(VertToFrag vtf [[ stage_in ]],\n"
"sampler samp [[ sampler(0) ]], sampler clampSamp [[ sampler(1) ]]" + texMapDecl + ")\n"
"sampler samp [[ sampler(0) ]], sampler clampSamp [[ sampler(1) ]], sampler reflectSamp [[ sampler(2) ]]" + texMapDecl + ")\n"
"{\n"
" FragOut out;\n";
@ -367,7 +367,7 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
lightingSrc + "\n" +
postSrc + "\n" +
"fragment FragOut fmain(VertToFrag vtf [[ stage_in ]],\n"
"sampler samp [[ sampler(0) ]], sampler clampSamp [[ sampler(1) ]]" + texMapDecl + ")\n"
"sampler samp [[ sampler(0) ]], sampler clampSamp [[ sampler(1) ]], sampler reflectSamp [[ sampler(2) ]]" + texMapDecl + ")\n"
"{\n"
" FragOut out;\n";