macOS build fixes

This commit is contained in:
Jack Andersen 2018-10-18 16:44:41 -10:00
parent 27ca93178a
commit 395e5c191b
5 changed files with 19 additions and 11 deletions

View File

@ -123,6 +123,7 @@ if(COMMAND cotire)
set_target_properties(RuntimeCommon PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(RuntimeCommon)
endif()
add_dependencies(RuntimeCommon ${HECL_APPLICATION_REPS_TARGETS_LIST})
if(WINDOWS_STORE)
set_property(TARGET RuntimeCommon PROPERTY VS_WINRT_COMPONENT TRUE)

View File

@ -196,6 +196,7 @@ Texture2D zFrontfaceTex : register(t0);
Texture2D zBackfaceTex : register(t1);
Texture2D zLinearizer : register(t2);
SamplerState samp : register(s0);
SamplerState zLinearizerSamp : register(s3);
float4 main(in VertToFrag vtf) : SV_Target0
{
float frontY;
@ -204,8 +205,8 @@ float4 main(in VertToFrag vtf) : SV_Target0
float frontX = modf((1.0 - zFrontfaceTex.Sample(samp, vtf.uv).r) * linScale, frontY);
float backX = modf((1.0 - zBackfaceTex.Sample(samp, vtf.uv).r) * linScale, backY);
const float uvBias = 0.5 / 256.0;
float frontLin = zLinearizer.Sample(samp, float2(frontX * 255.0 / 256.0 + uvBias, frontY / 256.0 + uvBias)).r;
float backLin = zLinearizer.Sample(samp, float2(backX * 255.0 / 256.0 + uvBias, backY / 256.0 + uvBias)).r;
float frontLin = zLinearizer.Sample(zLinearizerSamp, float2(frontX * 255.0 / 256.0 + uvBias, frontY / 256.0 + uvBias)).r;
float backLin = zLinearizer.Sample(zLinearizerSamp, float2(backX * 255.0 / 256.0 + uvBias, backY / 256.0 + uvBias)).r;
return float4(vtf.color.rgb, (frontLin - backLin) * 10.0);
}
@ -219,6 +220,7 @@ struct VertToFrag
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
sampler samp [[ sampler(0) ]],
sampler zLinearizerSamp [[ sampler(3) ]],
texture2d<float> zFrontfaceTex [[ texture(0) ]],
texture2d<float> zBackfaceTex [[ texture(1) ]],
texture2d<float> zLinearizer [[ texture(2) ]])
@ -229,7 +231,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
float frontX = modf((1.0 - zFrontfaceTex.sample(samp, vtf.uv).r) * linScale, frontY);
float backX = modf((1.0 - zBackfaceTex.sample(samp, vtf.uv).r) * linScale, backY);
const float uvBias = 0.5 / 256.0;
float frontLin = zLinearizer.sample(samp, float2(frontX * 255.0 / 256.0 + uvBias, frontY / 256.0 + uvBias)).r;
float backLin = zLinearizer.sample(samp, float2(backX * 255.0 / 256.0 + uvBias, backY / 256.0 + uvBias)).r;
float frontLin = zLinearizer.sample(zLinearizerSamp, float2(frontX * 255.0 / 256.0 + uvBias, frontY / 256.0 + uvBias)).r;
float backLin = zLinearizer.sample(zLinearizerSamp, float2(backX * 255.0 / 256.0 + uvBias, backY / 256.0 + uvBias)).r;
return float4(vtf.color.rgb, (frontLin - backLin) * 10.0);
}

View File

@ -551,7 +551,7 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info)
// ZERO, TEX, ONE, C0
// Output reg 0, subtract, clamp, no bias
combiner += " float3 lightVec = lights[3].pos.xyz - vtf.mvPos.xyz;\n"
combiner += " float3 lightVec = lu.lights[3].pos.xyz - vtf.mvPos.xyz;\n"
" float lx = dot(vtf.mvTangent.xyz, lightVec);\n"
" float ly = dot(vtf.mvBinorm.xyz, lightVec);\n";
combiner += hecl::Format(" float4 emboss1 = bumpMap.sample(samp, vtf.uv%d) + float4(0.5);\n"
@ -648,9 +648,6 @@ static std::string _BuildAdditionalTCGs(const SFluidPlaneShaderInfo& info)
static std::string _BuildVS(const SFluidPlaneShaderInfo& info, bool tessellation)
{
if (tessellation)
return TessCS;
std::string additionalTCGs = _BuildAdditionalTCGs(info);
char *finalVSs;
@ -673,6 +670,13 @@ std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Metal, hecl::Pipel
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Metal, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
}
static std::string BuildES(const SFluidPlaneShaderInfo& info)
{
int nextTex = 0;
@ -700,6 +704,7 @@ static std::string BuildES(const SFluidPlaneShaderInfo& info)
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Metal, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)

2
hecl

@ -1 +1 @@
Subproject commit 2ffa49b8667479c6a5db31d41889d0452183a83b
Subproject commit 0d7f6d7f5b5fba3ec79abaa754ed589b3705763a

@ -1 +1 @@
Subproject commit bd1c3e99f2690f2b7e9543a053661f17dacfd757
Subproject commit a1e224269104af52add34a737e41d1b56727e142