From 7b8c9c114c2ee857c64bc15c3376bc8ecc888831 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 29 Sep 2016 17:33:35 -1000 Subject: [PATCH] macOS build sync --- CMakeLists.txt | 11 ++-- .../Shaders/CTexturedQuadFilterGLSL.cpp | 54 ++++++++++++++----- .../Shaders/CTexturedQuadFilterHLSL.cpp | 43 ++++++++++++--- .../Shaders/CTexturedQuadFilterMetal.cpp | 46 +++++++++++++--- Runtime/World/CEnergyDrainSource.cpp | 2 +- Runtime/World/CEnergyDrainSource.hpp | 2 +- hecl | 2 +- nod | 2 +- 8 files changed, 126 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ba619303..00ed05f08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,13 +19,13 @@ if(MSVC) set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions -Wno-narrowing") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions -Wno-narrowing -Wno-nullability-completeness") if(APPLE) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto=thin") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto=thin") endif() endif() @@ -79,6 +79,7 @@ namespace DataSpec }") set(HECL_DATASPEC_PUSHES " /* RetroCommon */ + hecl::Database::DATA_SPEC_REGISTRY.reserve(6); hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1); hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1PC); hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2); diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp index 0ad637b83..3c8b44856 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp @@ -5,7 +5,7 @@ namespace urde { -static const char* VS = +static const char* VSFlip = "#version 330\n" BOO_GLSL_BINDING_HEAD "layout(location=0) in vec4 posIn;\n" @@ -33,6 +33,34 @@ BOO_GLSL_BINDING_HEAD " gl_Position = FLIPFROMGL(gl_Position);\n" "}\n"; +static const char* VSNoFlip = +"#version 330\n" +BOO_GLSL_BINDING_HEAD +"layout(location=0) in vec4 posIn;\n" +"layout(location=1) in vec4 uvIn;\n" +"\n" +"UBINDING0 uniform TexuredQuadUniform\n" +"{\n" +" mat4 mtx;\n" +" vec4 color;\n" +" float uvScale;\n" +"};\n" +"\n" +"struct VertToFrag\n" +"{\n" +" vec4 color;\n" +" vec2 uv;\n" +"};\n" +"\n" +"SBINDING(0) out VertToFrag vtf;\n" +"void main()\n" +"{\n" +" vtf.color = color;\n" +" vtf.uv = -uvIn.xy * uvScale;\n" +" gl_Position = mtx * vec4(posIn.xyz, 1.0);\n" +" gl_Position = FLIPFROMGL(gl_Position);\n" +"}\n"; + static const char* FS = "#version 330\n" BOO_GLSL_BINDING_HEAD @@ -119,11 +147,11 @@ CTexturedQuadFilter::Initialize(boo::GLDataFactory::Context& ctx, { const char* texNames[] = {"tex"}; const char* uniNames[] = {"TexuredQuadUniform"}; - alphaPipeOut = ctx.newShaderPipeline(VS, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + alphaPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + additivePipeOut = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcColor, + colorMultiplyPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterGLDataBindingFactory; } @@ -142,11 +170,11 @@ CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx, {nullptr, nullptr, boo::VertexSemantic::UV4} }; vtxFmtOut = ctx.newVertexFormat(2, VtxVmt); - alphaPipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha, + alphaPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha, + additivePipeOut = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcColor, + colorMultiplyPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterVulkanDataBindingFactory; } @@ -204,11 +232,11 @@ CTexturedQuadFilterAlpha::Initialize(boo::GLDataFactory::Context& ctx, { const char* texNames[] = {"tex"}; const char* uniNames[] = {"TexuredQuadUniform"}; - alphaPipeOut = ctx.newShaderPipeline(VS, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + alphaPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + additivePipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcColor, + colorMultiplyPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterAlphaGLDataBindingFactory; } @@ -227,11 +255,11 @@ CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx, {nullptr, nullptr, boo::VertexSemantic::UV4} }; vtxFmtOut = ctx.newVertexFormat(2, VtxVmt); - alphaPipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcAlpha, + alphaPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcAlpha, + additivePipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcColor, + colorMultiplyPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterAlphaVulkanDataBindingFactory; } diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilterHLSL.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilterHLSL.cpp index 65d0d5e69..3bdaa4c87 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilterHLSL.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilterHLSL.cpp @@ -5,7 +5,36 @@ namespace urde { -static const char* VS = +static const char* VSFlip = +"struct VertData\n" +"{\n" +" float4 posIn : POSITION;\n" +" float4 uvIn : UV;\n" +"};\n" +"\n" +"cbuffer TexuredQuadUniform : register(b0)\n" +"{\n" +" float4x4 mat;\n" +" float4 color;\n" +"};\n" +"\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uv : UV;\n" +"};\n" +"\n" +"VertToFrag main(in VertData v)\n" +"{\n" +" VertToFrag vtf;\n" +" vtf.color = color;\n" +" vtf.uv = v.uvIn.xy;\n" +" vtf.position = mul(mat, float4(v.posIn.xyz, 1.0));\n" +" return vtf;\n" +"}\n"; + +static const char* VSNoFlip = "struct VertData\n" "{\n" " float4 posIn : POSITION;\n" @@ -99,13 +128,13 @@ CTexturedQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx, {nullptr, nullptr, boo::VertexSemantic::UV4} }; vtxFmtOut = ctx.newVertexFormat(2, VtxVmt); - alphaPipeOut = ctx.newShaderPipeline(VS, FS, ComPtr(), ComPtr(), ComPtr(), + alphaPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr(), ComPtr(), ComPtr(), vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FS, ComPtr(), ComPtr(), ComPtr(), + additivePipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr(), ComPtr(), ComPtr(), vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FS, ComPtr(), ComPtr(), ComPtr(), + colorMultiplyPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr(), ComPtr(), ComPtr(), vtxFmtOut, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterD3DDataBindingFactory; @@ -141,13 +170,13 @@ CTexturedQuadFilterAlpha::Initialize(boo::ID3DDataFactory::Context& ctx, {nullptr, nullptr, boo::VertexSemantic::UV4} }; vtxFmtOut = ctx.newVertexFormat(2, VtxVmt); - alphaPipeOut = ctx.newShaderPipeline(VS, FSAlpha, ComPtr(), ComPtr(), ComPtr(), + alphaPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr(), ComPtr(), ComPtr(), vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FSAlpha, ComPtr(), ComPtr(), ComPtr(), + additivePipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr(), ComPtr(), ComPtr(), vtxFmtOut, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FSAlpha, ComPtr(), ComPtr(), ComPtr(), + colorMultiplyPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr(), ComPtr(), ComPtr(), vtxFmtOut, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterAlphaD3DDataBindingFactory; diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp index d68af11c3..9b292a41f 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp @@ -5,7 +5,38 @@ namespace urde { -static const char* VS = +static const char* VSFlip = +"#include \n" +"using namespace metal;\n" +"struct VertData\n" +"{\n" +" float4 posIn [[ attribute(0) ]];\n" +" float4 uvIn [[ attribute(1) ]];\n" +"};\n" +"\n" +"struct TexuredQuadUniform\n" +"{\n" +" float4x4 mat;\n" +" float4 color;\n" +"};\n" +"\n" +"struct VertToFrag\n" +"{\n" +" float4 position [[ position ]];\n" +" float4 color;\n" +" float2 uv;\n" +"};\n" +"\n" +"vertex VertToFrag vmain(VertData v [[ stage_in ]], constant TexuredQuadUniform& tqu [[ buffer(2) ]])\n" +"{\n" +" VertToFrag vtf;\n" +" vtf.color = tqu.color;\n" +" vtf.uv = v.uvIn.xy;\n" +" vtf.position = tqu.mat * float4(v.posIn.xyz, 1.0);\n" +" return vtf;\n" +"}\n"; + +static const char* VSNoFlip = "#include \n" "using namespace metal;\n" "struct VertData\n" @@ -37,6 +68,7 @@ static const char* VS = " return vtf;\n" "}\n"; + static const char* FS = "#include \n" "using namespace metal;\n" @@ -101,11 +133,11 @@ CTexturedQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx, {nullptr, nullptr, boo::VertexSemantic::UV4} }; vtxFmtOut = ctx.newVertexFormat(2, VtxVmt); - alphaPipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, + alphaPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, + additivePipeOut = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor, + colorMultiplyPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterMetalDataBindingFactory; } @@ -140,11 +172,11 @@ CTexturedQuadFilterAlpha::Initialize(boo::MetalDataFactory::Context& ctx, {nullptr, nullptr, boo::VertexSemantic::UV4} }; vtxFmtOut = ctx.newVertexFormat(2, VtxVmt); - alphaPipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, + alphaPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false); - additivePipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, + additivePipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false); - colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor, + colorMultiplyPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor, boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false); return new CTexturedQuadFilterAlphaMetalDataBindingFactory; } diff --git a/Runtime/World/CEnergyDrainSource.cpp b/Runtime/World/CEnergyDrainSource.cpp index 5a1acd203..d8b4e3000 100644 --- a/Runtime/World/CEnergyDrainSource.cpp +++ b/Runtime/World/CEnergyDrainSource.cpp @@ -24,7 +24,7 @@ float CEnergyDrainSource::GetEnergyDrainIntensity() const return x4_intensity; } -bool CEnergyDrainSource::operator<(const CEnergyDrainSource& other) +bool CEnergyDrainSource::operator<(const CEnergyDrainSource& other) const { return x0_source < other.x0_source; } diff --git a/Runtime/World/CEnergyDrainSource.hpp b/Runtime/World/CEnergyDrainSource.hpp index 966ab3716..e9379786e 100644 --- a/Runtime/World/CEnergyDrainSource.hpp +++ b/Runtime/World/CEnergyDrainSource.hpp @@ -15,7 +15,7 @@ public: void SetEnergyDrainIntensity(float); float GetEnergyDrainIntensity() const; - bool operator<(const CEnergyDrainSource& other); + bool operator<(const CEnergyDrainSource& other) const; }; } #endif // __URDE_CENERGYDRAINSOURCE_HPP__ diff --git a/hecl b/hecl index 536a8e4f7..b92f102f3 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 536a8e4f7dfff11695585d910018211718ff7225 +Subproject commit b92f102f31b127db009fe00d04f16b1a5a57308f diff --git a/nod b/nod index 213289524..38de2ec4a 160000 --- a/nod +++ b/nod @@ -1 +1 @@ -Subproject commit 2132895242586251712d40405dd755ff703da638 +Subproject commit 38de2ec4a1f1974c8a7b02a78c593907886ae3aa