mirror of https://github.com/AxioDL/metaforce.git
Vulkan updates
This commit is contained in:
parent
764d75f38e
commit
7e7f789c28
|
@ -77,6 +77,7 @@ set(HECL_DATASPEC_PUSHES
|
||||||
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2);
|
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2);
|
||||||
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);")
|
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);")
|
||||||
add_subdirectory(hecl)
|
add_subdirectory(hecl)
|
||||||
|
add_definitions(${BOO_SYS_DEFINES})
|
||||||
add_subdirectory(libSpecter)
|
add_subdirectory(libSpecter)
|
||||||
set(SPECTER_INCLUDE_DIR libSpecter/include libSpecter/freetype2/include)
|
set(SPECTER_INCLUDE_DIR libSpecter/include libSpecter/freetype2/include)
|
||||||
add_subdirectory(NODLib)
|
add_subdirectory(NODLib)
|
||||||
|
|
|
@ -206,14 +206,12 @@ public:
|
||||||
{
|
{
|
||||||
g_BooMainCommandQueue->setShaderDataBinding(binding);
|
g_BooMainCommandQueue->setShaderDataBinding(binding);
|
||||||
}
|
}
|
||||||
static void DrawInstances(boo::Primitive prim, size_t start, size_t count, size_t instCount)
|
static void DrawInstances(size_t start, size_t count, size_t instCount)
|
||||||
{
|
{
|
||||||
g_BooMainCommandQueue->setDrawPrimitive(prim);
|
|
||||||
g_BooMainCommandQueue->drawInstances(start, count, instCount);
|
g_BooMainCommandQueue->drawInstances(start, count, instCount);
|
||||||
}
|
}
|
||||||
static void DrawArray(boo::Primitive prim, size_t start, size_t count)
|
static void DrawArray(size_t start, size_t count)
|
||||||
{
|
{
|
||||||
g_BooMainCommandQueue->setDrawPrimitive(prim);
|
|
||||||
g_BooMainCommandQueue->draw(start, count);
|
g_BooMainCommandQueue->draw(start, count);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -111,10 +111,11 @@ void CTexture::BuildI4FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildI8FromGCN(CInputStream& in)
|
void CTexture::BuildI8FromGCN(CInputStream& in)
|
||||||
|
@ -157,10 +158,11 @@ void CTexture::BuildI8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildIA4FromGCN(CInputStream& in)
|
void CTexture::BuildIA4FromGCN(CInputStream& in)
|
||||||
|
@ -204,10 +206,11 @@ void CTexture::BuildIA4FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildIA8FromGCN(CInputStream& in)
|
void CTexture::BuildIA8FromGCN(CInputStream& in)
|
||||||
|
@ -251,10 +254,11 @@ void CTexture::BuildIA8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in)
|
static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in)
|
||||||
|
@ -357,10 +361,11 @@ void CTexture::BuildC4FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildC8FromGCN(CInputStream& in)
|
void CTexture::BuildC8FromGCN(CInputStream& in)
|
||||||
|
@ -399,10 +404,11 @@ void CTexture::BuildC8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildC14X2FromGCN(CInputStream& in)
|
void CTexture::BuildC14X2FromGCN(CInputStream& in)
|
||||||
|
@ -449,10 +455,11 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
|
void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
|
||||||
|
@ -504,10 +511,11 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildRGBA8FromGCN(CInputStream& in)
|
void CTexture::BuildRGBA8FromGCN(CInputStream& in)
|
||||||
|
@ -559,10 +567,11 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
buf.get(), texelCount * 4,
|
buf.get(), texelCount * 4, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DXT1Block
|
struct DXT1Block
|
||||||
|
@ -621,10 +630,11 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextureS* tmp;
|
||||||
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips,
|
||||||
boo::TextureFormat::DXT1,
|
boo::TextureFormat::DXT1,
|
||||||
buf.get(), blockCount * 8,
|
buf.get(), blockCount * 8, tmp);
|
||||||
reinterpret_cast<boo::ITextureS**>(&m_booTex));
|
m_booTex = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTexture::CTexture(CInputStream& in)
|
CTexture::CTexture(CInputStream& in)
|
||||||
|
|
|
@ -31,10 +31,16 @@ void CLineRendererShaders::Initialize()
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||||
m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)));
|
m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)));
|
||||||
break;
|
break;
|
||||||
#elif BOO_HAS_METAL
|
#endif
|
||||||
|
#if BOO_HAS_METAL
|
||||||
case boo::IGraphicsDataFactory::Platform::Metal:
|
case boo::IGraphicsDataFactory::Platform::Metal:
|
||||||
m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)));
|
m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if BOO_HAS_VULKAN
|
||||||
|
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
||||||
|
m_bindFactory.reset(Initialize(*static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory)));
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -389,13 +395,13 @@ void CLineRenderer::Render(const Zeus::CColor& moduColor)
|
||||||
{
|
{
|
||||||
m_vertBuf->load(g_StaticLineVertsTex.data(), sizeof(SDrawVertTex) * g_StaticLineVertsTex.size());
|
m_vertBuf->load(g_StaticLineVertsTex.data(), sizeof(SDrawVertTex) * g_StaticLineVertsTex.size());
|
||||||
CGraphics::SetShaderDataBinding(m_shaderBind);
|
CGraphics::SetShaderDataBinding(m_shaderBind);
|
||||||
CGraphics::DrawArray(boo::Primitive::TriStrips, 0, g_StaticLineVertsTex.size());
|
CGraphics::DrawArray(0, g_StaticLineVertsTex.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_vertBuf->load(g_StaticLineVertsNoTex.data(), sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size());
|
m_vertBuf->load(g_StaticLineVertsNoTex.data(), sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size());
|
||||||
CGraphics::SetShaderDataBinding(m_shaderBind);
|
CGraphics::SetShaderDataBinding(m_shaderBind);
|
||||||
CGraphics::DrawArray(boo::Primitive::TriStrips, 0, g_StaticLineVertsNoTex.size());
|
CGraphics::DrawArray(0, g_StaticLineVertsNoTex.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "boo/graphicsdev/GL.hpp"
|
#include "boo/graphicsdev/GL.hpp"
|
||||||
#include "boo/graphicsdev/D3D.hpp"
|
#include "boo/graphicsdev/D3D.hpp"
|
||||||
#include "boo/graphicsdev/Metal.hpp"
|
#include "boo/graphicsdev/Metal.hpp"
|
||||||
|
#include "boo/graphicsdev/Vulkan.hpp"
|
||||||
|
|
||||||
namespace pshag
|
namespace pshag
|
||||||
{
|
{
|
||||||
|
@ -36,9 +37,13 @@ public:
|
||||||
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory);
|
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory);
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory);
|
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory);
|
||||||
#elif BOO_HAS_METAL
|
#endif
|
||||||
|
#if BOO_HAS_METAL
|
||||||
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory);
|
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory);
|
||||||
#endif
|
#endif
|
||||||
|
#if BOO_HAS_VULKAN
|
||||||
|
static IDataBindingFactory* Initialize(boo::VulkanDataFactory& factory);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
|
@ -81,7 +81,7 @@ static const char* FS_GLSL_NOTEX =
|
||||||
" colorOut = vtf.color;\n"
|
" colorOut = vtf.color;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
struct GLSLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
{
|
{
|
||||||
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture)
|
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,63 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
false, false, false);
|
false, false, false);
|
||||||
|
|
||||||
return new struct GLSLLineDataBindingFactory;
|
return new struct OGLLineDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BOO_HAS_VULKAN
|
||||||
|
struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
|
{
|
||||||
|
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture)
|
||||||
|
{
|
||||||
|
int texCount = 0;
|
||||||
|
boo::ITexture* textures[1];
|
||||||
|
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
|
textures[0] = texture;
|
||||||
|
texCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf};
|
||||||
|
|
||||||
|
renderer.m_shaderBind = CGraphics::g_BooFactory->newShaderDataBinding(pipeline, nullptr, renderer.m_vertBuf,
|
||||||
|
nullptr, nullptr, 1, uniforms,
|
||||||
|
texCount, textures);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::VulkanDataFactory& factory)
|
||||||
|
{
|
||||||
|
static const boo::VertexElementDescriptor VtxFmtTex[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
|
};
|
||||||
|
m_texVtxFmt = factory.newVertexFormat(3, VtxFmtTex);
|
||||||
|
|
||||||
|
static const boo::VertexElementDescriptor VtxFmtNoTex[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color}
|
||||||
|
};
|
||||||
|
m_noTexVtxFmt = factory.newVertexFormat(2, VtxFmtNoTex);
|
||||||
|
|
||||||
|
m_texAlpha = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, true, false);
|
||||||
|
m_texAdditive = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
false, false, false);
|
||||||
|
m_noTexAlpha = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, true, false);
|
||||||
|
m_noTexAdditive = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
false, false, false);
|
||||||
|
|
||||||
|
return new struct VulkanLineDataBindingFactory;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,10 +185,16 @@ void CElementGenShaders::Initialize()
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||||
m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)));
|
m_bindFactory.reset(Initialize(*static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)));
|
||||||
break;
|
break;
|
||||||
#elif BOO_HAS_METAL
|
#endif
|
||||||
|
#if BOO_HAS_METAL
|
||||||
case boo::IGraphicsDataFactory::Platform::Metal:
|
case boo::IGraphicsDataFactory::Platform::Metal:
|
||||||
m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)));
|
m_bindFactory.reset(Initialize(*static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if BOO_HAS_VULKAN
|
||||||
|
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
||||||
|
m_bindFactory.reset(Initialize(*static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory)));
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -1706,11 +1712,11 @@ void CElementGen::RenderParticles()
|
||||||
{
|
{
|
||||||
case CElementGenShaders::EShaderClass::Tex:
|
case CElementGenShaders::EShaderClass::Tex:
|
||||||
m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex));
|
m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex));
|
||||||
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instTexData.size());
|
CGraphics::DrawInstances(0, 4, g_instTexData.size());
|
||||||
break;
|
break;
|
||||||
case CElementGenShaders::EShaderClass::NoTex:
|
case CElementGenShaders::EShaderClass::NoTex:
|
||||||
m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex));
|
m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex));
|
||||||
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instNoTexData.size());
|
CGraphics::DrawInstances(0, 4, g_instNoTexData.size());
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -1845,11 +1851,11 @@ void CElementGen::RenderParticles()
|
||||||
{
|
{
|
||||||
case CElementGenShaders::EShaderClass::Tex:
|
case CElementGenShaders::EShaderClass::Tex:
|
||||||
m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex));
|
m_instBuf->load(g_instTexData.data(), g_instTexData.size() * sizeof(SParticleInstanceTex));
|
||||||
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instTexData.size());
|
CGraphics::DrawInstances(0, 4, g_instTexData.size());
|
||||||
break;
|
break;
|
||||||
case CElementGenShaders::EShaderClass::NoTex:
|
case CElementGenShaders::EShaderClass::NoTex:
|
||||||
m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex));
|
m_instBuf->load(g_instNoTexData.data(), g_instNoTexData.size() * sizeof(SParticleInstanceNoTex));
|
||||||
CGraphics::DrawInstances(boo::Primitive::TriStrips, 0, 4, g_instNoTexData.size());
|
CGraphics::DrawInstances(0, 4, g_instNoTexData.size());
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "boo/graphicsdev/GL.hpp"
|
#include "boo/graphicsdev/GL.hpp"
|
||||||
#include "boo/graphicsdev/D3D.hpp"
|
#include "boo/graphicsdev/D3D.hpp"
|
||||||
#include "boo/graphicsdev/Metal.hpp"
|
#include "boo/graphicsdev/Metal.hpp"
|
||||||
|
#include "boo/graphicsdev/Vulkan.hpp"
|
||||||
|
|
||||||
namespace pshag
|
namespace pshag
|
||||||
{
|
{
|
||||||
|
@ -63,9 +64,13 @@ public:
|
||||||
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory);
|
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory);
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory);
|
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory);
|
||||||
#elif BOO_HAS_METAL
|
#endif
|
||||||
|
#if BOO_HAS_METAL
|
||||||
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory);
|
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory);
|
||||||
#endif
|
#endif
|
||||||
|
#if BOO_HAS_VULKAN
|
||||||
|
static IDataBindingFactory* Initialize(boo::VulkanDataFactory& factory);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
|
@ -177,7 +177,7 @@ static const char* FS_GLSL_NOTEX =
|
||||||
" colorOut = vtf.color;\n"
|
" colorOut = vtf.color;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
struct GLSLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
|
struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
|
||||||
{
|
{
|
||||||
void BuildShaderDataBinding(CElementGen& gen,
|
void BuildShaderDataBinding(CElementGen& gen,
|
||||||
boo::IShaderPipeline* regPipeline,
|
boo::IShaderPipeline* regPipeline,
|
||||||
|
@ -333,7 +333,161 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLD
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
false, false, false);
|
false, false, false);
|
||||||
|
|
||||||
return new struct GLSLElementDataBindingFactory;
|
return new struct OGLElementDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BOO_HAS_VULKAN
|
||||||
|
struct VulkanElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
|
||||||
|
{
|
||||||
|
void BuildShaderDataBinding(CElementGen& gen,
|
||||||
|
boo::IShaderPipeline* regPipeline,
|
||||||
|
boo::IShaderPipeline* redToAlphaPipeline)
|
||||||
|
{
|
||||||
|
CGenDescription* desc = gen.GetDesc();
|
||||||
|
|
||||||
|
CUVElement* texr = desc->x54_TEXR.get();
|
||||||
|
CUVElement* tind = desc->x58_TIND.get();
|
||||||
|
int texCount = 0;
|
||||||
|
boo::ITexture* textures[3];
|
||||||
|
|
||||||
|
if (texr)
|
||||||
|
{
|
||||||
|
textures[0] = texr->GetValueTexture(0).GetObj()->GetBooTexture();
|
||||||
|
texCount = 1;
|
||||||
|
if (tind)
|
||||||
|
{
|
||||||
|
textures[1] = CGraphics::g_SpareTexture;
|
||||||
|
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
|
||||||
|
texCount = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
|
||||||
|
|
||||||
|
if (regPipeline)
|
||||||
|
gen.m_normalDataBind = CGraphics::g_BooFactory->newShaderDataBinding(regPipeline, nullptr, nullptr,
|
||||||
|
gen.m_instBuf, nullptr, 1, uniforms,
|
||||||
|
texCount, textures);
|
||||||
|
if (redToAlphaPipeline)
|
||||||
|
gen.m_redToAlphaDataBind = CGraphics::g_BooFactory->newShaderDataBinding(redToAlphaPipeline, nullptr, nullptr,
|
||||||
|
gen.m_instBuf, nullptr, 1, uniforms,
|
||||||
|
texCount, textures);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::VulkanDataFactory& factory)
|
||||||
|
{
|
||||||
|
static const boo::VertexElementDescriptor TexFmtTex[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
|
||||||
|
};
|
||||||
|
m_vtxFormatTex = factory.newVertexFormat(9, TexFmtTex);
|
||||||
|
|
||||||
|
static const boo::VertexElementDescriptor TexFmtIndTex[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 5},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 6},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 7}
|
||||||
|
};
|
||||||
|
m_vtxFormatIndTex = CGraphics::g_BooFactory->newVertexFormat(13, TexFmtIndTex);
|
||||||
|
|
||||||
|
static const boo::VertexElementDescriptor TexFmtNoTex[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
|
||||||
|
};
|
||||||
|
m_vtxFormatNoTex = CGraphics::g_BooFactory->newVertexFormat(5, TexFmtNoTex);
|
||||||
|
|
||||||
|
m_texZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, true, false);
|
||||||
|
m_texNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, true, false);
|
||||||
|
m_texZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, false, false);
|
||||||
|
m_texNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, false, false);
|
||||||
|
|
||||||
|
m_texAdditiveZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
true, false, false);
|
||||||
|
m_texAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
false, false, false);
|
||||||
|
|
||||||
|
m_texRedToAlphaZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, false, false);
|
||||||
|
m_texRedToAlphaNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, false, false);
|
||||||
|
|
||||||
|
m_indTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, true, false);
|
||||||
|
m_indTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, false, false);
|
||||||
|
m_indTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
true, true, false);
|
||||||
|
|
||||||
|
m_cindTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, true, false);
|
||||||
|
m_cindTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, false, false);
|
||||||
|
m_cindTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
true, true, false);
|
||||||
|
|
||||||
|
m_noTexZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, true, false);
|
||||||
|
m_noTexNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, true, false);
|
||||||
|
m_noTexZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
true, false, false);
|
||||||
|
m_noTexNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
false, false, false);
|
||||||
|
|
||||||
|
m_noTexAdditiveZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
true, false, false);
|
||||||
|
m_noTexAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
|
||||||
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
|
false, false, false);
|
||||||
|
|
||||||
|
return new struct VulkanElementDataBindingFactory;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit e8ab7ce9b252f02674c88b39a8cdf0a32cc3ba6e
|
Subproject commit 2ff161839491dd42362a680221f5ef4bc95f32cc
|
|
@ -1 +1 @@
|
||||||
Subproject commit 38b3396e0853e9bf446859a9d8b042044d9fd78e
|
Subproject commit c83c1f0b939115497f4a15cfbc2669445e07bdb7
|
Loading…
Reference in New Issue