boo lambda-API refactor

This commit is contained in:
Jack Andersen 2016-03-30 09:16:01 -10:00
parent 6b1c435d0c
commit 77a8ce5f17
21 changed files with 517 additions and 395 deletions

View File

@ -22,10 +22,7 @@ class InformationCenter : public ViewerSpace
std::vector<hecl::SystemString> m_log; std::vector<hecl::SystemString> m_log;
View(InformationCenter& ic, specter::ViewResources& res) View(InformationCenter& ic, specter::ViewResources& res)
: specter::View(res, ic.m_vm.rootView()), m_ic(ic) : specter::View(res, ic.m_vm.rootView()), m_ic(ic) {}
{
commitResources(res);
}
}; };
std::unique_ptr<View> m_view; std::unique_ptr<View> m_view;

View File

@ -33,10 +33,7 @@ class ModelViewer : public ViewerSpace
boo::SWindowRect m_scissorRect; boo::SWindowRect m_scissorRect;
View(ModelViewer& mv, specter::ViewResources& res) View(ModelViewer& mv, specter::ViewResources& res)
: specter::View(res, mv.m_vm.rootView()), m_mv(mv) : specter::View(res, mv.m_vm.rootView()), m_mv(mv) {}
{
commitResources(res);
}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue *gfxQ); void draw(boo::IGraphicsCommandQueue *gfxQ);

View File

@ -173,7 +173,6 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding
View(ResourceBrowser& ro, specter::ViewResources& res) View(ResourceBrowser& ro, specter::ViewResources& res)
: specter::View(res, ro.m_vm.rootView()), m_ro(ro) : specter::View(res, ro.m_vm.rootView()), m_ro(ro)
{ {
commitResources(res);
m_resListing.m_view.reset(new specter::Table(res, *this, &ro.m_resListingBind, &ro.m_resListingBind, 3)); m_resListing.m_view.reset(new specter::Table(res, *this, &ro.m_resListingBind, &ro.m_resListingBind, 3));
} }

View File

@ -43,7 +43,6 @@ SplashScreen::SplashScreen(ViewManager& vm, specter::ViewResources& res)
m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects"); m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects");
m_textColorClear[3] = 0.0; m_textColorClear[3] = 0.0;
commitResources(res);
} }
void SplashScreen::think() void SplashScreen::think()

View File

@ -41,7 +41,7 @@ class ViewManager : public specter::IViewManager
ViewManager& m_vm; ViewManager& m_vm;
public: public:
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
: View(res, parent), m_vm(vm) {commitResources(res);} : View(res, parent), m_vm(vm) {}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ); void draw(boo::IGraphicsCommandQueue* gfxQ);
}; };

View File

@ -28,9 +28,13 @@ boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes)
if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK) if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK)
Log.report(logvisor::Fatal, "unable to decompress icons"); Log.report(logvisor::Fatal, "unable to decompress icons");
g_IconAtlas.initializeAtlas(viewRes.m_factory->newStaticTexture(width, height, mips, boo::TextureFormat::RGBA8, return viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
texels.get(), destSz)); {
return viewRes.m_factory->commit(); g_IconAtlas.initializeAtlas(ctx.newStaticTexture(width, height, mips,
boo::TextureFormat::RGBA8,
texels.get(), destSz));
return true;
});
} }
specter::Icon& GetIcon(SpaceIcon icon) specter::Icon& GetIcon(SpaceIcon icon)

View File

@ -222,13 +222,9 @@ public:
g_SpareTexture = spareTex; g_SpareTexture = spareTex;
} }
static boo::IGraphicsBufferD* NewDynamicGPUBuffer(boo::BufferUse use, size_t stride, size_t count) static boo::GraphicsDataToken CommitResources(const boo::FactoryCommitFunc& commitFunc)
{ {
return g_BooFactory->newDynamicBuffer(use, stride, count); return g_BooFactory->commitTransaction(commitFunc);
}
static boo::GraphicsDataToken CommitResources()
{
return g_BooFactory->commit();
} }
static void SetShaderDataBinding(boo::IShaderDataBinding* binding) static void SetShaderDataBinding(boo::IShaderDataBinding* binding)
{ {

View File

@ -22,31 +22,34 @@ void CLineRendererShaders::Initialize()
if (!CGraphics::g_BooFactory) if (!CGraphics::g_BooFactory)
return; return;
switch (CGraphics::g_BooFactory->platform()) m_gfxToken = CGraphics::CommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{ {
case boo::IGraphicsDataFactory::Platform::OGL: switch (ctx.platform())
m_bindFactory.reset(Initialize(*static_cast<boo::GLDataFactory*>(CGraphics::g_BooFactory))); {
break; case boo::IGraphicsDataFactory::Platform::OGL:
m_bindFactory.reset(Initialize(static_cast<boo::GLDataFactory::Context&>(ctx)));
break;
#if _WIN32 #if _WIN32
case boo::IGraphicsDataFactory::Platform::D3D11: case boo::IGraphicsDataFactory::Platform::D3D11:
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::Context&>(ctx)));
break; break;
#endif #endif
#if BOO_HAS_METAL #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::Context&>(ctx)));
break; break;
#endif #endif
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan: case boo::IGraphicsDataFactory::Platform::Vulkan:
m_bindFactory.reset(Initialize(*static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory))); m_bindFactory.reset(Initialize(static_cast<boo::VulkanDataFactory::Context&>(ctx)));
break; break;
#endif #endif
default: break; default: break;
} }
return true;
m_gfxToken = CGraphics::CommitResources(); });
} }
void CLineRenderer::Initialize() void CLineRenderer::Initialize()
@ -82,8 +85,10 @@ struct SDrawUniform
zeus::CColor moduColor; zeus::CColor moduColor;
}; };
void CLineRendererShaders::BuildShaderDataBinding(CLineRenderer& renderer, void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
boo::ITexture* texture, bool additive) CLineRenderer& renderer,
boo::ITexture* texture,
bool additive)
{ {
boo::IShaderPipeline* pipeline = nullptr; boo::IShaderPipeline* pipeline = nullptr;
if (texture) if (texture)
@ -101,7 +106,7 @@ void CLineRendererShaders::BuildShaderDataBinding(CLineRenderer& renderer,
pipeline = m_noTexAlpha; pipeline = m_noTexAlpha;
} }
m_bindFactory->BuildShaderDataBinding(renderer, pipeline, texture); m_bindFactory->BuildShaderDataBinding(ctx, renderer, pipeline, texture);
} }
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* texture, bool additive) CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* texture, bool additive)
@ -128,12 +133,15 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* t
break; break;
} }
m_vertBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Vertex, m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
texture ? sizeof(SDrawVertTex) : sizeof(SDrawVertNoTex), {
maxTriVerts); m_vertBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex,
m_uniformBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Uniform, sizeof(SDrawUniform), 1); texture ? sizeof(SDrawVertTex) : sizeof(SDrawVertNoTex),
CLineRendererShaders::BuildShaderDataBinding(*this, texture, additive); maxTriVerts);
m_gfxToken = CGraphics::CommitResources(); m_uniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(SDrawUniform), 1);
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive);
return true;
});
} }
static rstl::reserved_vector<SDrawVertTex, 256> g_StaticLineVertsTex; static rstl::reserved_vector<SDrawVertTex, 256> g_StaticLineVertsTex;

View File

@ -16,7 +16,9 @@ class CLineRendererShaders
public: public:
struct IDataBindingFactory struct IDataBindingFactory
{ {
virtual void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, virtual void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CLineRenderer& renderer,
boo::IShaderPipeline* pipeline,
boo::ITexture* texture)=0; boo::ITexture* texture)=0;
}; };
@ -34,20 +36,21 @@ private:
static boo::GraphicsDataToken m_gfxToken; static boo::GraphicsDataToken m_gfxToken;
public: public:
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory); static IDataBindingFactory* Initialize(boo::GLDataFactory::Context& ctx);
#if _WIN32 #if _WIN32
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory); static IDataBindingFactory* Initialize(boo::ID3DDataFactory::Context& ctx);
#endif #endif
#if BOO_HAS_METAL #if BOO_HAS_METAL
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory); static IDataBindingFactory* Initialize(boo::MetalDataFactory::Context& ctx);
#endif #endif
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
static IDataBindingFactory* Initialize(boo::VulkanDataFactory& factory); static IDataBindingFactory* Initialize(boo::VulkanDataFactory::Context& ctx);
#endif #endif
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();
static void BuildShaderDataBinding(CLineRenderer& renderer, boo::ITexture* texture, bool additive); static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
boo::ITexture* texture, bool additive);
}; };
} }

View File

@ -86,7 +86,8 @@ static const char* FS_GLSL_NOTEX =
struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture) void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
boo::IShaderPipeline* pipeline, boo::ITexture* texture)
{ {
boo::IVertexFormat* vtxFmt = nullptr; boo::IVertexFormat* vtxFmt = nullptr;
int texCount = 0; int texCount = 0;
@ -102,7 +103,7 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{renderer.m_vertBuf, nullptr, boo::VertexSemantic::Color}, {renderer.m_vertBuf, nullptr, boo::VertexSemantic::Color},
{renderer.m_vertBuf, nullptr, boo::VertexSemantic::UV4} {renderer.m_vertBuf, nullptr, boo::VertexSemantic::UV4}
}; };
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(3, TexFmtTex); vtxFmt = ctx.newVertexFormat(3, TexFmtTex);
} }
else else
{ {
@ -111,31 +112,31 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{renderer.m_vertBuf, nullptr, boo::VertexSemantic::Position4}, {renderer.m_vertBuf, nullptr, boo::VertexSemantic::Position4},
{renderer.m_vertBuf, nullptr, boo::VertexSemantic::Color} {renderer.m_vertBuf, nullptr, boo::VertexSemantic::Color}
}; };
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(2, TexFmtNoTex); vtxFmt = ctx.newVertexFormat(2, TexFmtNoTex);
} }
boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf}; boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf};
renderer.m_shaderBind = CGraphics::g_BooFactory->newShaderDataBinding(pipeline, vtxFmt, renderer.m_vertBuf, renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, vtxFmt, renderer.m_vertBuf,
nullptr, nullptr, 1, uniforms, nullptr, nullptr, 1, uniforms,
texCount, textures); texCount, textures);
} }
}; };
CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::GLDataFactory& factory) CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::GLDataFactory::Context& ctx)
{ {
static const char* UniNames[] = {"LineUniform"}; static const char* UniNames[] = {"LineUniform"};
m_texAlpha = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texAlpha = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_texAdditive = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texAdditive = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_noTexAlpha = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 1, nullptr, 1, UniNames, m_noTexAlpha = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 1, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_noTexAdditive = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 1, nullptr, 1, UniNames, m_noTexAdditive = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 1, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
@ -145,7 +146,8 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CLineRenderer& renderer, boo::IShaderPipeline* pipeline, boo::ITexture* texture) void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
boo::IShaderPipeline* pipeline, boo::ITexture* texture)
{ {
int texCount = 0; int texCount = 0;
boo::ITexture* textures[1]; boo::ITexture* textures[1];
@ -158,13 +160,13 @@ struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf}; boo::IGraphicsBuffer* uniforms[] = {renderer.m_uniformBuf};
renderer.m_shaderBind = CGraphics::g_BooFactory->newShaderDataBinding(pipeline, nullptr, renderer.m_vertBuf, renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, renderer.m_vertBuf,
nullptr, nullptr, 1, uniforms, nullptr, nullptr, 1, uniforms,
texCount, textures); texCount, textures);
} }
}; };
CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::VulkanDataFactory& factory) CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo::VulkanDataFactory::Context& ctx)
{ {
static const boo::VertexElementDescriptor VtxFmtTex[] = static const boo::VertexElementDescriptor VtxFmtTex[] =
{ {
@ -172,25 +174,25 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
{nullptr, nullptr, boo::VertexSemantic::Color}, {nullptr, nullptr, boo::VertexSemantic::Color},
{nullptr, nullptr, boo::VertexSemantic::UV4} {nullptr, nullptr, boo::VertexSemantic::UV4}
}; };
m_texVtxFmt = factory.newVertexFormat(3, VtxFmtTex); m_texVtxFmt = ctx.newVertexFormat(3, VtxFmtTex);
static const boo::VertexElementDescriptor VtxFmtNoTex[] = static const boo::VertexElementDescriptor VtxFmtNoTex[] =
{ {
{nullptr, nullptr, boo::VertexSemantic::Position4}, {nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::Color} {nullptr, nullptr, boo::VertexSemantic::Color}
}; };
m_noTexVtxFmt = factory.newVertexFormat(2, VtxFmtNoTex); m_noTexVtxFmt = ctx.newVertexFormat(2, VtxFmtNoTex);
m_texAlpha = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt, m_texAlpha = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_texAdditive = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt, m_texAdditive = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_noTexAlpha = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt, m_noTexAlpha = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_noTexAdditive = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt, m_noTexAdditive = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);

View File

@ -7,6 +7,8 @@
#include "CToken.hpp" #include "CToken.hpp"
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
namespace urde namespace urde
{ {
class IObjectStore; class IObjectStore;
@ -25,37 +27,67 @@ struct CModelFlags
*/ */
}; };
class CBooSurface
{
};
class CBooModel class CBooModel
{ {
public: public:
struct CSurface /* urde addition: doesn't require hacky stashing of
* pointers within loaded CMDL buffer */
struct CSurfaceView
{ {
const u8* m_data; const u8* m_data;
CBooModel* m_parent = nullptr; CBooModel* m_parent = nullptr;
CSurface* m_next = nullptr; CSurfaceView* m_next = nullptr;
}; };
private: private:
std::vector<CSurface>* x0_surfaces; std::vector<CSurfaceView>* x0_surfaces;
const u8* x4_matSet; const u8* x4_matSet;
const void* x8_vbo; boo::IGraphicsBufferS* x8_vbo;
const void* xc_ibo; boo::IGraphicsBufferS* xc_ibo;
std::vector<TLockedToken<CTexture>>* x1c_textures; std::vector<TLockedToken<CTexture>>* x1c_textures;
zeus::CAABox x20_aabb; zeus::CAABox x20_aabb;
CSurface* x38_firstUnsortedSurface = nullptr; CSurfaceView* x38_firstUnsortedSurface = nullptr;
CSurface* x3c_firstSortedSurface = nullptr; CSurfaceView* x3c_firstSortedSurface = nullptr;
bool x40_24_ : 1; bool x40_24_ : 1;
bool x40_25_ : 1; bool x40_25_ : 1;
u8 x41_shortNormals; u8 x41_shortNormals;
/* urde addition: boo! */
boo::GraphicsDataToken m_gfxToken;
boo::IGraphicsBufferD* m_uniformBuffer;
boo::IShaderDataBinding* m_shaderDataBinding;
void DrawAlphaSurfaces(const CModelFlags& flags) const;
void DrawNormalSurfaces(const CModelFlags& flags) const;
void DrawSurfaces(const CModelFlags& flags) const;
void DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const;
public: public:
CBooModel(std::vector<CSurface>* surfaces, std::vector<TLockedToken<CTexture>>* textures, CBooModel(std::vector<CSurfaceView>* surfaces,
const u8* matSet, const void* vbo, const void* ibo, const zeus::CAABox& aabb, std::vector<TLockedToken<CTexture>>* textures,
const u8* matSet,
boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
const zeus::CAABox& aabb,
u8 shortNormals, bool unk); u8 shortNormals, bool unk);
static void MakeTexuresFromMats(const u8* dataIn, static void MakeTexuresFromMats(const u8* dataIn,
std::vector<TLockedToken<CTexture>>& toksOut, std::vector<TLockedToken<CTexture>>& toksOut,
IObjectStore& store); IObjectStore& store);
void TryLockTextures() const;
void UnlockTextures() const;
void DrawAlpha(const CModelFlags& flags) const;
void DrawNormal(const CModelFlags& flags) const;
void Draw(const CModelFlags& flags) const;
const u8* GetMaterialByIndex(int idx) const; const u8* GetMaterialByIndex(int idx) const;
static bool g_DrawingOccluders;
static void SetDrawingOccluders(bool occ) {g_DrawingOccluders = occ;}
}; };
class CModel class CModel
@ -69,11 +101,17 @@ public:
private: private:
std::unique_ptr<u8[]> x0_data; std::unique_ptr<u8[]> x0_data;
u32 x4_dataLen; u32 x4_dataLen;
std::vector<CBooModel::CSurface> x8_surfaces; std::vector<CBooModel::CSurfaceView> x8_surfaces;
std::vector<SShader> x18_matSets; std::vector<SShader> x18_matSets;
std::unique_ptr<CBooModel> x28_modelInst; std::unique_ptr<CBooModel> x28_modelInst;
CModel* x30_next = nullptr; CModel* x30_next = nullptr;
CModel* x34_prev = nullptr; CModel* x34_prev = nullptr;
/* urde addition: boo! */
boo::GraphicsDataToken m_gfxToken;
boo::IGraphicsBufferS* m_vbo;
boo::IGraphicsBufferS* m_ibo;
public: public:
CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store); CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store);
void Draw(const CModelFlags& flags) const; void Draw(const CModelFlags& flags) const;

View File

@ -1,16 +1,19 @@
#include "Graphics/CModel.hpp" #include "Graphics/CModel.hpp"
#include "Graphics/CGraphics.hpp"
#include "hecl/HMDLMeta.hpp"
namespace urde namespace urde
{ {
static logvisor::Module Log("urde::CModelBoo"); static logvisor::Module Log("urde::CModelBoo");
bool CBooModel::g_DrawingOccluders = false;
CBooModel::CBooModel(std::vector<CSurface>* surfaces, std::vector<TLockedToken<CTexture>>* textures, CBooModel::CBooModel(std::vector<CSurfaceView>* surfaces, std::vector<TLockedToken<CTexture>>* textures,
const u8* matSet, const void* vbo, const void* ibo, const zeus::CAABox& aabb, const u8* matSet, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo, const zeus::CAABox& aabb,
u8 shortNormals, bool unk) u8 shortNormals, bool unk)
: x0_surfaces(surfaces), x4_matSet(matSet), x8_vbo(vbo), xc_ibo(ibo), x1c_textures(textures), : x0_surfaces(surfaces), x4_matSet(matSet), x8_vbo(vbo), xc_ibo(ibo), x1c_textures(textures),
x20_aabb(aabb), x40_24_(unk), x40_25_(0), x41_shortNormals(shortNormals) x20_aabb(aabb), x40_24_(unk), x40_25_(0), x41_shortNormals(shortNormals)
{ {
for (CSurface& surf : *x0_surfaces) for (CSurfaceView& surf : *x0_surfaces)
surf.m_parent = this; surf.m_parent = this;
for (auto it=x0_surfaces->rbegin() ; it != x0_surfaces->rend() ; ++it) for (auto it=x0_surfaces->rbegin() ; it != x0_surfaces->rend() ; ++it)
@ -46,6 +49,42 @@ void CBooModel::MakeTexuresFromMats(const u8* dataIn,
} }
} }
void CBooModel::TryLockTextures() const
{
}
void CBooModel::UnlockTextures() const
{
}
void CBooModel::DrawAlphaSurfaces(const CModelFlags& flags) const
{
}
void CBooModel::DrawNormalSurfaces(const CModelFlags& flags) const
{
}
void CBooModel::DrawSurfaces(const CModelFlags& flags) const
{
}
void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const
{
}
void CBooModel::DrawAlpha(const CModelFlags& flags) const
{
}
void CBooModel::DrawNormal(const CModelFlags& flags) const
{
}
void CBooModel::Draw(const CModelFlags& flags) const
{
}
const u8* CBooModel::GetMaterialByIndex(int idx) const const u8* CBooModel::GetMaterialByIndex(int idx) const
{ {
const u32* matOffs = reinterpret_cast<const u32*>(x4_matSet + (x1c_textures->size() + 1) * 4); const u32* matOffs = reinterpret_cast<const u32*>(x4_matSet + (x1c_textures->size() + 1) * 4);
@ -95,17 +134,31 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store)
CBooModel::MakeTexuresFromMats(sec, shader.x0_textures, *store); CBooModel::MakeTexuresFromMats(sec, shader.x0_textures, *store);
} }
hecl::HMDLMeta hmdlMeta;
{
const u8* hmdlMetadata = MemoryFromPartData(dataCur, secSizeCur);
athena::io::MemoryReader r(hmdlMetadata, *secSizeCur);
hmdlMeta.read(r);
}
const u8* vboData = MemoryFromPartData(dataCur, secSizeCur); const u8* vboData = MemoryFromPartData(dataCur, secSizeCur);
const u8* iboData = MemoryFromPartData(dataCur, secSizeCur); const u8* iboData = MemoryFromPartData(dataCur, secSizeCur);
const u8* surfInfo = MemoryFromPartData(dataCur, secSizeCur); const u8* surfInfo = MemoryFromPartData(dataCur, secSizeCur);
m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vboData, hmdlMeta.vertStride, hmdlMeta.vertCount);
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, iboData, 4, hmdlMeta.indexCount);
return true;
});
u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(surfInfo)); u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(surfInfo));
x8_surfaces.reserve(surfCount); x8_surfaces.reserve(surfCount);
for (u32 i=0 ; i<surfCount ; ++i) for (u32 i=0 ; i<surfCount ; ++i)
{ {
const u8* sec = MemoryFromPartData(dataCur, secSizeCur); const u8* sec = MemoryFromPartData(dataCur, secSizeCur);
x8_surfaces.emplace_back(); x8_surfaces.emplace_back();
CBooModel::CSurface& surf = x8_surfaces.back(); CBooModel::CSurfaceView& surf = x8_surfaces.back();
surf.m_data = sec; surf.m_data = sec;
} }
@ -113,7 +166,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store)
zeus::CAABox aabb(hecl::SBig(aabbPtr[0]), hecl::SBig(aabbPtr[1]), hecl::SBig(aabbPtr[2]), zeus::CAABox aabb(hecl::SBig(aabbPtr[0]), hecl::SBig(aabbPtr[1]), hecl::SBig(aabbPtr[2]),
hecl::SBig(aabbPtr[3]), hecl::SBig(aabbPtr[4]), hecl::SBig(aabbPtr[5])); hecl::SBig(aabbPtr[3]), hecl::SBig(aabbPtr[4]), hecl::SBig(aabbPtr[5]));
x28_modelInst = std::make_unique<CBooModel>(&x8_surfaces, &x18_matSets[0].x0_textures, x28_modelInst = std::make_unique<CBooModel>(&x8_surfaces, &x18_matSets[0].x0_textures,
x18_matSets[0].x10_data, vboData, iboData, x18_matSets[0].x10_data, m_vbo, m_ibo,
aabb, flags & 0x2, true); aabb, flags & 0x2, true);
} }

View File

@ -192,53 +192,56 @@ void CMoviePlayer::Initialize()
{ {
static const char* BlockNames[] = {"SpecterViewBlock"}; static const char* BlockNames[] = {"SpecterViewBlock"};
if (!CGraphics::g_BooFactory->bindingNeedsVertexFormat()) GraphicsData = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{ {
boo::VertexElementDescriptor texvdescs[] = if (!ctx.bindingNeedsVertexFormat())
{ {
{nullptr, nullptr, boo::VertexSemantic::Position4}, boo::VertexElementDescriptor texvdescs[] =
{nullptr, nullptr, boo::VertexSemantic::UV4} {
}; {nullptr, nullptr, boo::VertexSemantic::Position4},
YUVVTXFmt = CGraphics::g_BooFactory->newVertexFormat(2, texvdescs); {nullptr, nullptr, boo::VertexSemantic::UV4}
} };
YUVVTXFmt = ctx.newVertexFormat(2, texvdescs);
}
switch (CGraphics::g_BooFactory->platform()) switch (ctx.platform())
{ {
case boo::IGraphicsDataFactory::Platform::OGL: case boo::IGraphicsDataFactory::Platform::OGL:
YUVShaderPipeline = static_cast<boo::GLDataFactory*>(CGraphics::g_BooFactory)->newShaderPipeline YUVShaderPipeline = static_cast<boo::GLDataFactory::Context&>(ctx).newShaderPipeline
(VS_GLSL_YUV, FS_GLSL_YUV, 3, "texs", 1, BlockNames, (VS_GLSL_YUV, FS_GLSL_YUV, 3, "texs", 1, BlockNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
break; break;
#if _WIN32 #if _WIN32
case boo::IGraphicsDataFactory::Platform::D3D11: case boo::IGraphicsDataFactory::Platform::D3D11:
case boo::IGraphicsDataFactory::Platform::D3D12: case boo::IGraphicsDataFactory::Platform::D3D12:
YUVShaderPipeline = static_cast<boo::ID3DDataFactory*>(CGraphics::g_BooFactory)->newShaderPipeline YUVShaderPipeline = static_cast<boo::ID3DDataFactory::Context&>(ctx).newShaderPipeline
(VS_HLSL_YUV, FS_HLSL_YUV, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), YUVVTXFmt, (VS_HLSL_YUV, FS_HLSL_YUV, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), YUVVTXFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
break; break;
#endif #endif
#if BOO_HAS_METAL #if BOO_HAS_METAL
case boo::IGraphicsDataFactory::Platform::Metal: case boo::IGraphicsDataFactory::Platform::Metal:
YUVShaderPipeline = static_cast<boo::MetalDataFactory*>(CGraphics::g_BooFactory)->newShaderPipeline YUVShaderPipeline = static_cast<boo::MetalDataFactory::Context&>(ctx).newShaderPipeline
(VS_METAL_YUV, FS_METAL_YUV, YUVVTXFmt, 1, (VS_METAL_YUV, FS_METAL_YUV, YUVVTXFmt, 1,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
break; break;
#endif #endif
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan: case boo::IGraphicsDataFactory::Platform::Vulkan:
YUVShaderPipeline = static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory)->newShaderPipeline YUVShaderPipeline = static_cast<boo::VulkanDataFactory::Context&>(ctx).newShaderPipeline
(VS_GLSL_YUV, FS_GLSL_YUV, YUVVTXFmt, (VS_GLSL_YUV, FS_GLSL_YUV, YUVVTXFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
break; break;
#endif #endif
default: break; default: break;
} }
return true;
});
GraphicsData = CGraphics::CommitResources();
TjHandle = tjInitDecompress(); TjHandle = tjInitDecompress();
} }
@ -410,81 +413,80 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
if (xf0_preLoadFrames > 0) if (xf0_preLoadFrames > 0)
xa0_bufferQueue.reserve(xf0_preLoadFrames); xa0_bufferQueue.reserve(xf0_preLoadFrames);
/* Establish GPU resources */ /* All set for GPU resources */
m_blockBuf = CGraphics::g_BooFactory->newDynamicBuffer(boo::BufferUse::Uniform, m_token = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
sizeof(m_viewVertBlock), 1);
m_vertBuf = CGraphics::g_BooFactory->newDynamicBuffer(boo::BufferUse::Vertex,
sizeof(specter::View::TexShaderVert), 4);
boo::IVertexFormat* vtxFmt = YUVVTXFmt;
if (CGraphics::g_BooFactory->bindingNeedsVertexFormat())
{ {
boo::VertexElementDescriptor texvdescs[] = m_blockBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(m_viewVertBlock), 1);
{ m_vertBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(specter::View::TexShaderVert), 4);
{m_vertBuf, nullptr, boo::VertexSemantic::Position4},
{m_vertBuf, nullptr, boo::VertexSemantic::UV4}
};
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(2, texvdescs);
}
/* Allocate textures here (rather than at decode time) */ boo::IVertexFormat* vtxFmt = YUVVTXFmt;
x80_textures.reserve(3); if (ctx.bindingNeedsVertexFormat())
for (int i=0 ; i<3 ; ++i)
{
x80_textures.emplace_back();
CTHPTextureSet& set = x80_textures.back();
if (deinterlace)
{ {
/* urde addition: this way interlaced THPs don't look horrible */ boo::VertexElementDescriptor texvdescs[] =
set.Y[0] = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.Y[1] = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.U = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.V = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
boo::IGraphicsBuffer* bufs[] = {m_blockBuf};
for (int j=0 ; j<2 ; ++j)
{ {
boo::ITexture* texs[] = {set.Y[j], set.U, set.V}; {m_vertBuf, nullptr, boo::VertexSemantic::Position4},
set.binding[j] = CGraphics::g_BooFactory->newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf, {m_vertBuf, nullptr, boo::VertexSemantic::UV4}
nullptr, nullptr, 1, bufs, 3, texs); };
} vtxFmt = ctx.newVertexFormat(2, texvdescs);
} }
else
{
/* normal progressive presentation */
set.Y[0] = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width,
x6c_videoInfo.height,
boo::TextureFormat::I8);
set.U = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.V = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
boo::IGraphicsBuffer* bufs[] = {m_blockBuf}; /* Allocate textures here (rather than at decode time) */
boo::ITexture* texs[] = {set.Y[0], set.U, set.V}; x80_textures.reserve(3);
set.binding[0] = CGraphics::g_BooFactory->newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf, for (int i=0 ; i<3 ; ++i)
nullptr, nullptr, 1, bufs, 3, texs); {
x80_textures.emplace_back();
CTHPTextureSet& set = x80_textures.back();
if (deinterlace)
{
/* urde addition: this way interlaced THPs don't look horrible */
set.Y[0] = ctx.newDynamicTexture(x6c_videoInfo.width,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.Y[1] = ctx.newDynamicTexture(x6c_videoInfo.width,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.U = ctx.newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.V = ctx.newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
boo::IGraphicsBuffer* bufs[] = {m_blockBuf};
for (int j=0 ; j<2 ; ++j)
{
boo::ITexture* texs[] = {set.Y[j], set.U, set.V};
set.binding[j] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf,
nullptr, nullptr, 1, bufs, 3, texs);
}
}
else
{
/* normal progressive presentation */
set.Y[0] = ctx.newDynamicTexture(x6c_videoInfo.width,
x6c_videoInfo.height,
boo::TextureFormat::I8);
set.U = ctx.newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
set.V = ctx.newDynamicTexture(x6c_videoInfo.width / 2,
x6c_videoInfo.height / 2,
boo::TextureFormat::I8);
boo::IGraphicsBuffer* bufs[] = {m_blockBuf};
boo::ITexture* texs[] = {set.Y[0], set.U, set.V};
set.binding[0] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf,
nullptr, nullptr, 1, bufs, 3, texs);
}
if (xf4_25_hasAudio)
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);
} }
if (xf4_25_hasAudio) return true;
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]); });
}
/* Temporary planar YUV decode buffer, resulting planes copied to Boo */ /* Temporary planar YUV decode buffer, resulting planes copied to Boo */
m_yuvBuf.reset(new uint8_t[tjBufSizeYUV(x6c_videoInfo.width, x6c_videoInfo.height, TJ_420)]); m_yuvBuf.reset(new uint8_t[tjBufSizeYUV(x6c_videoInfo.width, x6c_videoInfo.height, TJ_420)]);
/* All set for GPU resources */
m_token = CGraphics::CommitResources();
/* Schedule initial read */ /* Schedule initial read */
PostDVDReadRequestIfNeeded(); PostDVDReadRequestIfNeeded();

View File

@ -111,11 +111,12 @@ void CTexture::BuildI4FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildI8FromGCN(CInputStream& in) void CTexture::BuildI8FromGCN(CInputStream& in)
@ -158,11 +159,12 @@ void CTexture::BuildI8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildIA4FromGCN(CInputStream& in) void CTexture::BuildIA4FromGCN(CInputStream& in)
@ -206,11 +208,12 @@ void CTexture::BuildIA4FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildIA8FromGCN(CInputStream& in) void CTexture::BuildIA8FromGCN(CInputStream& in)
@ -254,11 +257,12 @@ void CTexture::BuildIA8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in) static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in)
@ -361,11 +365,12 @@ void CTexture::BuildC4FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildC8FromGCN(CInputStream& in) void CTexture::BuildC8FromGCN(CInputStream& in)
@ -404,11 +409,12 @@ void CTexture::BuildC8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildC14X2FromGCN(CInputStream& in) void CTexture::BuildC14X2FromGCN(CInputStream& in)
@ -455,11 +461,12 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildRGB5A3FromGCN(CInputStream& in) void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
@ -511,11 +518,12 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
void CTexture::BuildRGBA8FromGCN(CInputStream& in) void CTexture::BuildRGBA8FromGCN(CInputStream& in)
@ -567,11 +575,12 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::RGBA8, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
buf.get(), texelCount * 4, tmp); buf.get(), texelCount * 4);
m_booTex = tmp; return true;
});
} }
struct DXT1Block struct DXT1Block
@ -630,11 +639,12 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
h /= 2; h /= 2;
} }
boo::ITextureS* tmp; m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_booToken = CGraphics::g_BooFactory->newStaticTextureNoContext(x4_w, x6_h, x8_mips, {
boo::TextureFormat::DXT1, m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT1,
buf.get(), blockCount * 8, tmp); buf.get(), blockCount * 8);
m_booTex = tmp; return true;
});
} }
CTexture::CTexture(CInputStream& in) CTexture::CTexture(CInputStream& in)

View File

@ -63,74 +63,74 @@ void CTextRenderBuffer::CommitResources()
return; return;
m_committed = true; m_committed = true;
m_uniBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Uniform, m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
sizeof(BooUniform), 1);
for (BooFontCharacters& chs : m_fontCharacters)
{ {
chs.m_instBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Vertex, m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(BooUniform), 1);
sizeof(BooCharacterInstance),
chs.m_charCount); for (BooFontCharacters& chs : m_fontCharacters)
boo::IVertexFormat* vFmt = g_TextVtxFmt;
if (CGraphics::g_BooFactory->bindingNeedsVertexFormat())
{ {
boo::VertexElementDescriptor elems[] = chs.m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex,
sizeof(BooCharacterInstance),
chs.m_charCount);
boo::IVertexFormat* vFmt = g_TextVtxFmt;
if (ctx.bindingNeedsVertexFormat())
{ {
{chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0}, boo::VertexElementDescriptor elems[] =
{chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1}, {
{chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2}, {chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
{chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, {chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
{chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0}, {chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
{chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1}, {chs.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2}, {chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
{chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}, {chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
{chs.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0}, {chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
{chs.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 1}, {chs.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
}; {chs.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
vFmt = CGraphics::g_BooFactory->newVertexFormat(10, elems); {chs.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 1},
};
vFmt = ctx.newVertexFormat(10, elems);
}
boo::IGraphicsBuffer* uniforms[] = {m_uniBuf};
boo::ITexture* texs[] = {chs.m_font.GetObj()->GetTexture()->GetBooTexture()};
chs.m_dataBinding = ctx.newShaderDataBinding(g_TextShaderPipeline, vFmt,
nullptr, chs.m_instBuf, nullptr,
1, uniforms, 1, texs);
} }
boo::IGraphicsBuffer* uniforms[] = {m_uniBuf}; for (BooImage& img : m_images)
boo::ITexture* texs[] = {chs.m_font.GetObj()->GetTexture()->GetBooTexture()};
chs.m_dataBinding = CGraphics::g_BooFactory->newShaderDataBinding(g_TextShaderPipeline, vFmt,
nullptr, chs.m_instBuf, nullptr,
1, uniforms, 1, texs);
}
for (BooImage& img : m_images)
{
img.m_instBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Vertex,
sizeof(BooImageInstance), 1);
boo::IVertexFormat* vFmt = g_TextImageVtxFmt;
if (CGraphics::g_BooFactory->bindingNeedsVertexFormat())
{ {
boo::VertexElementDescriptor elems[] = img.m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(BooImageInstance), 1);
boo::IVertexFormat* vFmt = g_TextImageVtxFmt;
if (ctx.bindingNeedsVertexFormat())
{ {
{img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0}, boo::VertexElementDescriptor elems[] =
{img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1}, {
{img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2}, {img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
{img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, {img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
{img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0}, {img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
{img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1}, {img.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2}, {img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
{img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}, {img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
{img.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0}, {img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
}; {img.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
vFmt = CGraphics::g_BooFactory->newVertexFormat(9, elems); {img.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
} };
vFmt = ctx.newVertexFormat(9, elems);
}
boo::IGraphicsBuffer* uniforms[] = {m_uniBuf}; boo::IGraphicsBuffer* uniforms[] = {m_uniBuf};
img.m_dataBinding.reserve(img.m_imageDef.x4_texs.size()); img.m_dataBinding.reserve(img.m_imageDef.x4_texs.size());
for (TToken<CTexture>& tex : img.m_imageDef.x4_texs) for (TToken<CTexture>& tex : img.m_imageDef.x4_texs)
{ {
boo::ITexture* texs[] = {tex->GetBooTexture()}; boo::ITexture* texs[] = {tex->GetBooTexture()};
img.m_dataBinding.push_back(CGraphics::g_BooFactory->newShaderDataBinding(g_TextImageShaderPipeline, vFmt, img.m_dataBinding.push_back(ctx.newShaderDataBinding(g_TextImageShaderPipeline, vFmt,
nullptr, img.m_instBuf, nullptr, nullptr, img.m_instBuf, nullptr,
1, uniforms, 1, texs)); 1, uniforms, 1, texs));
}
} }
} return true;
});
m_booToken = CGraphics::CommitResources();
} }
void CTextRenderBuffer::SetMode(EMode mode) void CTextRenderBuffer::SetMode(EMode mode)

View File

@ -242,7 +242,13 @@ int CMain::appMain(boo::IApplication* app)
boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue(); boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
boo::SWindowRect windowRect = mainWindow->getWindowFrame(); boo::SWindowRect windowRect = mainWindow->getWindowFrame();
boo::ITextureR* renderTex = mainWindow->getMainContextDataFactory()->newRenderTexture(windowRect.size[0], windowRect.size[1], true, true); boo::ITextureR* renderTex;
boo::GraphicsDataToken data = mainWindow->getMainContextDataFactory()->commitTransaction(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
renderTex = ctx.newRenderTexture(windowRect.size[0], windowRect.size[1], true, true);
return true;
});
float rgba[4] = { 0.2f, 0.2f, 0.2f, 1.0f}; float rgba[4] = { 0.2f, 0.2f, 0.2f, 1.0f};
gfxQ->setClearColor(rgba); gfxQ->setClearColor(rgba);

View File

@ -72,7 +72,7 @@ CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen&
return EShaderClass::NoTex; return EShaderClass::NoTex;
} }
void CElementGenShaders::BuildShaderDataBinding(CElementGen& gen) void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CElementGen& gen)
{ {
CGenDescription* desc = gen.x1c_genDesc.GetObj(); CGenDescription* desc = gen.x1c_genDesc.GetObj();
boo::IShaderPipeline* regPipeline = nullptr; boo::IShaderPipeline* regPipeline = nullptr;
@ -168,7 +168,7 @@ void CElementGenShaders::BuildShaderDataBinding(CElementGen& gen)
} }
} }
m_bindFactory->BuildShaderDataBinding(gen, regPipeline, redToAlphaPipeline); m_bindFactory->BuildShaderDataBinding(ctx, gen, regPipeline, redToAlphaPipeline);
} }
void CElementGenShaders::Initialize() void CElementGenShaders::Initialize()
@ -176,31 +176,33 @@ void CElementGenShaders::Initialize()
if (!CGraphics::g_BooFactory) if (!CGraphics::g_BooFactory)
return; return;
switch (CGraphics::g_BooFactory->platform()) m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{ {
case boo::IGraphicsDataFactory::Platform::OGL: switch (ctx.platform())
m_bindFactory.reset(Initialize(*static_cast<boo::GLDataFactory*>(CGraphics::g_BooFactory))); {
break; case boo::IGraphicsDataFactory::Platform::OGL:
m_bindFactory.reset(Initialize(static_cast<boo::GLDataFactory::Context&>(ctx)));
break;
#if _WIN32 #if _WIN32
case boo::IGraphicsDataFactory::Platform::D3D11: case boo::IGraphicsDataFactory::Platform::D3D11:
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::Context&>(ctx)));
break; break;
#endif #endif
#if BOO_HAS_METAL #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::Context&>(ctx)));
break; break;
#endif #endif
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan: case boo::IGraphicsDataFactory::Platform::Vulkan:
m_bindFactory.reset(Initialize(*static_cast<boo::VulkanDataFactory*>(CGraphics::g_BooFactory))); m_bindFactory.reset(Initialize(static_cast<boo::VulkanDataFactory::Context&>(ctx)));
break; break;
#endif #endif
default: break; default: break;
} }
return true;
m_gfxToken = CGraphics::CommitResources(); });
} }
void CElementGenShaders::Shutdown() void CElementGenShaders::Shutdown()
@ -442,10 +444,13 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
sizeof(SParticleInstanceNoTex) sizeof(SParticleInstanceNoTex)
}; };
size_t maxInsts = x224_29_MBLR ? (m_maxMBSP * x70_MAXP) : x70_MAXP; size_t maxInsts = x224_29_MBLR ? (m_maxMBSP * x70_MAXP) : x70_MAXP;
m_instBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Vertex, ShadClsSizes[int(m_shaderClass)], maxInsts); m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
m_uniformBuf = CGraphics::NewDynamicGPUBuffer(boo::BufferUse::Uniform, sizeof(SParticleUniforms), 1); {
CElementGenShaders::BuildShaderDataBinding(*this); m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, ShadClsSizes[int(m_shaderClass)], maxInsts);
m_gfxToken = CGraphics::CommitResources(); m_uniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(SParticleUniforms), 1);
CElementGenShaders::BuildShaderDataBinding(ctx, *this);
return true;
});
} }
} }

View File

@ -16,7 +16,8 @@ class CElementGenShaders
public: public:
struct IDataBindingFactory struct IDataBindingFactory
{ {
virtual void BuildShaderDataBinding(CElementGen& gen, virtual void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGen& gen,
boo::IShaderPipeline* regPipeline, boo::IShaderPipeline* regPipeline,
boo::IShaderPipeline* redToAlphaPipeline)=0; boo::IShaderPipeline* redToAlphaPipeline)=0;
}; };
@ -61,21 +62,21 @@ private:
static boo::GraphicsDataToken m_gfxToken; static boo::GraphicsDataToken m_gfxToken;
public: public:
static IDataBindingFactory* Initialize(boo::GLDataFactory& factory); static IDataBindingFactory* Initialize(boo::GLDataFactory::Context& ctx);
#if _WIN32 #if _WIN32
static IDataBindingFactory* Initialize(boo::ID3DDataFactory& factory); static IDataBindingFactory* Initialize(boo::ID3DDataFactory::Context& ctx);
#endif #endif
#if BOO_HAS_METAL #if BOO_HAS_METAL
static IDataBindingFactory* Initialize(boo::MetalDataFactory& factory); static IDataBindingFactory* Initialize(boo::MetalDataFactory::Context& ctx);
#endif #endif
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
static IDataBindingFactory* Initialize(boo::VulkanDataFactory& factory); static IDataBindingFactory* Initialize(boo::VulkanDataFactory::Context& ctx);
#endif #endif
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();
static EShaderClass GetShaderClass(CElementGen& gen); static EShaderClass GetShaderClass(CElementGen& gen);
static void BuildShaderDataBinding(CElementGen& gen); static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CElementGen& gen);
}; };
} }

View File

@ -186,7 +186,8 @@ static const char* FS_GLSL_NOTEX =
struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CElementGen& gen, void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGen& gen,
boo::IShaderPipeline* regPipeline, boo::IShaderPipeline* regPipeline,
boo::IShaderPipeline* redToAlphaPipeline) boo::IShaderPipeline* redToAlphaPipeline)
{ {
@ -221,7 +222,7 @@ struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}, {gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4}, {gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4},
}; };
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(10, TexFmtIndTex); vtxFmt = ctx.newVertexFormat(10, TexFmtIndTex);
} }
else else
{ {
@ -237,7 +238,7 @@ struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2}, {gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3} {gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
}; };
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(9, TexFmtTex); vtxFmt = ctx.newVertexFormat(9, TexFmtTex);
} }
} }
else else
@ -250,90 +251,90 @@ struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, {gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{gen.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced} {gen.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
}; };
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(5, TexFmtNoTex); vtxFmt = ctx.newVertexFormat(5, TexFmtNoTex);
} }
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf}; boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
if (regPipeline) if (regPipeline)
gen.m_normalDataBind = CGraphics::g_BooFactory->newShaderDataBinding(regPipeline, vtxFmt, nullptr, gen.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, vtxFmt, nullptr,
gen.m_instBuf, nullptr, 1, uniforms, gen.m_instBuf, nullptr, 1, uniforms,
texCount, textures); texCount, textures);
if (redToAlphaPipeline) if (redToAlphaPipeline)
gen.m_redToAlphaDataBind = CGraphics::g_BooFactory->newShaderDataBinding(redToAlphaPipeline, vtxFmt, nullptr, gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, vtxFmt, nullptr,
gen.m_instBuf, nullptr, 1, uniforms, gen.m_instBuf, nullptr, 1, uniforms,
texCount, textures); texCount, textures);
} }
}; };
CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLDataFactory& factory) CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLDataFactory::Context& ctx)
{ {
static const char* UniNames[] = {"ParticleUniform"}; static const char* UniNames[] = {"ParticleUniform"};
m_texZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_texNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_texZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_texNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_texAdditiveZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_texAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames, m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_texRedToAlphaZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, 1, "texs", 1, UniNames, m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_texRedToAlphaNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, 1, "texs", 1, UniNames, m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, 1, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_indTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, "texs", 1, UniNames, m_indTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_indTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, "texs", 1, UniNames, m_indTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_indTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, "texs", 1, UniNames, m_indTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_cindTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, "texs", 1, UniNames, m_cindTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_cindTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, "texs", 1, UniNames, m_cindTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_cindTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, "texs", 1, UniNames, m_cindTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, "texs", 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_noTexZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, m_noTexZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_noTexNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_noTexZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_noTexNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_noTexAdditiveZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_noTexAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
@ -343,7 +344,8 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLD
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
struct VulkanElementDataBindingFactory : CElementGenShaders::IDataBindingFactory struct VulkanElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
{ {
void BuildShaderDataBinding(CElementGen& gen, void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGen& gen,
boo::IShaderPipeline* regPipeline, boo::IShaderPipeline* regPipeline,
boo::IShaderPipeline* redToAlphaPipeline) boo::IShaderPipeline* redToAlphaPipeline)
{ {
@ -369,17 +371,17 @@ struct VulkanElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf}; boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
if (regPipeline) if (regPipeline)
gen.m_normalDataBind = CGraphics::g_BooFactory->newShaderDataBinding(regPipeline, nullptr, nullptr, gen.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms, gen.m_instBuf, nullptr, 1, uniforms,
texCount, textures); texCount, textures);
if (redToAlphaPipeline) if (redToAlphaPipeline)
gen.m_redToAlphaDataBind = CGraphics::g_BooFactory->newShaderDataBinding(redToAlphaPipeline, nullptr, nullptr, gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms, gen.m_instBuf, nullptr, 1, uniforms,
texCount, textures); texCount, textures);
} }
}; };
CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::VulkanDataFactory& factory) CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::VulkanDataFactory::Context& ctx)
{ {
static const boo::VertexElementDescriptor TexFmtTex[] = static const boo::VertexElementDescriptor TexFmtTex[] =
{ {
@ -393,7 +395,7 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::Vul
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2}, {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, 3}
}; };
m_vtxFormatTex = factory.newVertexFormat(9, TexFmtTex); m_vtxFormatTex = ctx.newVertexFormat(9, TexFmtTex);
static const boo::VertexElementDescriptor TexFmtIndTex[] = static const boo::VertexElementDescriptor TexFmtIndTex[] =
{ {
@ -411,7 +413,7 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::Vul
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 6}, {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 6},
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 7} {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 7}
}; };
m_vtxFormatIndTex = CGraphics::g_BooFactory->newVertexFormat(13, TexFmtIndTex); m_vtxFormatIndTex = ctx.newVertexFormat(13, TexFmtIndTex);
static const boo::VertexElementDescriptor TexFmtNoTex[] = static const boo::VertexElementDescriptor TexFmtNoTex[] =
{ {
@ -421,72 +423,72 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::Vul
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced} {nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
}; };
m_vtxFormatNoTex = CGraphics::g_BooFactory->newVertexFormat(5, TexFmtNoTex); m_vtxFormatNoTex = ctx.newVertexFormat(5, TexFmtNoTex);
m_texZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex, m_texZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_texNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex, m_texNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_texZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex, m_texZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_texNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex, m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_texAdditiveZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex, m_texAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_texAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex, m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_texRedToAlphaZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex, m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_texRedToAlphaNoZTest = factory.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex, m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_indTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex, m_indTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_indTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex, m_indTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_indTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex, m_indTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_cindTexZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex, m_cindTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_cindTexNoZWrite = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex, m_cindTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_cindTexAdditive = factory.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex, m_cindTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_noTexZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex, m_noTexZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, false); boo::Primitive::TriStrips, true, true, false);
m_noTexNoZTestZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex, m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, false); boo::Primitive::TriStrips, false, true, false);
m_noTexZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex, m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_noTexNoZTestNoZWrite = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex, m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);
m_noTexAdditiveZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex, m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, false); boo::Primitive::TriStrips, true, false, false);
m_noTexAdditiveNoZTest = factory.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex, m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, false); boo::Primitive::TriStrips, false, false, false);

2
hecl

@ -1 +1 @@
Subproject commit a661a04b9049dbce8e90ce7f41f2bc6c9c886fb3 Subproject commit d7a73c35d5e8100a8171a27ccd3323ce4c15b653

@ -1 +1 @@
Subproject commit 7e6944962177fa250cbe89216648667c058ddb90 Subproject commit 785f830c777e38d89fd0a34171be1286c9af5c83