2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 12:24:56 +00:00

Windows fixes

This commit is contained in:
Jack Andersen
2018-10-14 10:16:21 -10:00
parent 1559163f98
commit 1851308021
68 changed files with 1343 additions and 968 deletions

View File

@@ -63,7 +63,7 @@ public:
PipelineInfo({in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::SrcAlpha,
in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
boo::CullMode::None, tessellation ? 1 : 0}),
boo::CullMode::None, tessellation ? 1u : 0u}),
HasTessellation(tessellation) {}
const boo::VertexFormatInfo VtxFmt;
@@ -114,18 +114,6 @@ public:
#define UNIVERSAL_PIPELINES_shader_CFluidPlaneShader \
::Shader_CFluidPlaneShader \
::Shader_CFluidPlaneDoorShader
#define OPENGL_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::OpenGL) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::OpenGL)
#define VULKAN_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::Vulkan) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::Vulkan)
#define D3D11_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::D3D11) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::D3D11)
#define METAL_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::Metal) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::Metal)
#define NX_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::NX) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::NX)
#define STAGES_shader_CFluidPlaneShader(P, S) \
::StageObject_CFluidPlaneShader<P, S>, \
::StageObject_CFluidPlaneDoorShader<P, S>,

View File

@@ -668,57 +668,21 @@ static std::string _BuildVS(const SFluidPlaneShaderInfo& info, bool tessellation
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildVS(in, tessellation);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildVS(in, tessellation);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Vertex>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildVS(in, tessellation);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Fragment>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Control>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
@@ -752,20 +716,75 @@ static std::string BuildES(const SFluidPlaneShaderInfo& info)
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Evaluation>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return BuildES(in);
}
static std::string _BuildVS(const SFluidPlaneDoorShaderInfo& info)
{
char *finalVSs;
asprintf(&finalVSs, VS, "");
std::string ret(finalVSs);
free(finalVSs);
return ret;
}
static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info)
{
int nextTex = 0;
std::string textures;
std::string combiner;
if (info.m_hasPatternTex1)
{
textures += hecl::Format("Texture2D patternTex1 : register(t%d);\n", nextTex++);
}
if (info.m_hasPatternTex2)
{
textures += hecl::Format("Texture2D patternTex2 : register(t%d);\n", nextTex++);
}
if (info.m_hasColorTex)
{
textures += hecl::Format("Texture2D colorTex : register(t%d);\n", nextTex++);
}
// Tex0 * kColor0 * Tex1 + Tex2
if (info.m_hasPatternTex1 && info.m_hasPatternTex2)
{
combiner += " colorOut = patternTex1.Sample(samp, vtf.uvs[0]) * kColor0 *\n"
" patternTex2.Sample(samp, vtf.uvs[1]);\n";
}
else
{
combiner += " colorOut = float4(0.0);\n";
}
if (info.m_hasColorTex)
{
combiner += " colorOut += colorTex.Sample(samp, vtf.uvs[2]);\n";
}
combiner += " colorOut.a = kColor0.a;\n";
char *finalFSs;
asprintf(&finalFSs, FSDoor, textures.c_str(), combiner.c_str());
std::string ret(finalFSs);
free(finalFSs);
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
std::string StageObject_CFluidPlaneDoorShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneDoorShaderInfo& in)
{
return BuildES(in);
return _BuildVS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
std::string StageObject_CFluidPlaneDoorShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneDoorShaderInfo& in)
{
return BuildES(in);
return _BuildFS(in);
}