This commit is contained in:
Jack Andersen 2016-09-30 12:44:01 -10:00
commit 12964dd44b
6 changed files with 124 additions and 34 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
alphaPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
vtxFmtOut, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
additivePipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
additivePipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
vtxFmtOut, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
colorMultiplyPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
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<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
alphaPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
vtxFmtOut, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
additivePipeOut = ctx.newShaderPipeline(VS, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
additivePipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
vtxFmtOut, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
colorMultiplyPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
vtxFmtOut, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
return new CTexturedQuadFilterAlphaD3DDataBindingFactory;

View File

@ -5,7 +5,38 @@
namespace urde
{
static const char* VS =
static const char* VSFlip =
"#include <metal_stdlib>\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 <metal_stdlib>\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 <metal_stdlib>\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;
}

View File

@ -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;
}

View File

@ -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__