mirror of https://github.com/AxioDL/metaforce.git
Changes to support boo object tracker API
This commit is contained in:
parent
d301491bd6
commit
3894749675
|
@ -204,8 +204,8 @@ void ViewManager::init(boo::IApplication* app)
|
||||||
m_mainWindow->setTitle(_S("URDE [") + hecl::SystemString(m_mainPlatformName) + _S("]"));
|
m_mainWindow->setTitle(_S("URDE [") + hecl::SystemString(m_mainPlatformName) + _S("]"));
|
||||||
m_mainCommandQueue = m_mainWindow->getCommandQueue();
|
m_mainCommandQueue = m_mainWindow->getCommandQueue();
|
||||||
m_viewResources.init(m_mainBooFactory, &m_fontCache, &m_themeData, pixelFactor);
|
m_viewResources.init(m_mainBooFactory, &m_fontCache, &m_themeData, pixelFactor);
|
||||||
m_iconsToken = InitializeIcons(m_viewResources);
|
InitializeIcons(m_viewResources);
|
||||||
m_badgeToken = InitializeBadging(m_viewResources);
|
InitializeBadging(m_viewResources);
|
||||||
m_viewResources.prepFontCacheAsync(m_mainWindow.get());
|
m_viewResources.prepFontCacheAsync(m_mainWindow.get());
|
||||||
specter::RootView* root = SetupRootView();
|
specter::RootView* root = SetupRootView();
|
||||||
m_showSplash = true;
|
m_showSplash = true;
|
||||||
|
@ -292,7 +292,8 @@ void ViewManager::stop()
|
||||||
m_videoVoice.reset();
|
m_videoVoice.reset();
|
||||||
m_projManager.shutdown();
|
m_projManager.shutdown();
|
||||||
CDvdFile::Shutdown();
|
CDvdFile::Shutdown();
|
||||||
m_iconsToken.doDestroy();
|
DestroyIcons();
|
||||||
|
DestroyBadging();
|
||||||
m_viewResources.destroyResData();
|
m_viewResources.destroyResData();
|
||||||
m_fontCache.destroyAtlases();
|
m_fontCache.destroyAtlases();
|
||||||
m_mainWindow->getCommandQueue()->stopRenderer();
|
m_mainWindow->getCommandQueue()->stopRenderer();
|
||||||
|
|
|
@ -37,12 +37,10 @@ class ViewManager : public specter::IViewManager
|
||||||
specter::FontCache m_fontCache;
|
specter::FontCache m_fontCache;
|
||||||
specter::DefaultThemeData m_themeData;
|
specter::DefaultThemeData m_themeData;
|
||||||
specter::ViewResources m_viewResources;
|
specter::ViewResources m_viewResources;
|
||||||
boo::GraphicsDataToken m_iconsToken;
|
|
||||||
boo::GraphicsDataToken m_badgeToken;
|
|
||||||
specter::Translator m_translator;
|
specter::Translator m_translator;
|
||||||
boo::IGraphicsDataFactory* m_mainBooFactory = nullptr;
|
boo::IGraphicsDataFactory* m_mainBooFactory = nullptr;
|
||||||
boo::IGraphicsCommandQueue* m_mainCommandQueue = nullptr;
|
boo::IGraphicsCommandQueue* m_mainCommandQueue = nullptr;
|
||||||
boo::ITextureR* m_renderTex = nullptr;
|
boo::ObjToken<boo::ITextureR> m_renderTex;
|
||||||
const boo::SystemChar* m_mainPlatformName;
|
const boo::SystemChar* m_mainPlatformName;
|
||||||
|
|
||||||
std::unique_ptr<specter::RootView> m_rootView;
|
std::unique_ptr<specter::RootView> m_rootView;
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace urde
|
||||||
static logvisor::Module Log("URDE::badging");
|
static logvisor::Module Log("URDE::badging");
|
||||||
static specter::Icon g_BadgeIcon;
|
static specter::Icon g_BadgeIcon;
|
||||||
|
|
||||||
boo::GraphicsDataToken InitializeBadging(specter::ViewResources& viewRes)
|
void InitializeBadging(specter::ViewResources& viewRes)
|
||||||
{
|
{
|
||||||
athena::io::MemoryReader r(URDE_BADGE, URDE_BADGE_SZ);
|
athena::io::MemoryReader r(URDE_BADGE, URDE_BADGE_SZ);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ boo::GraphicsDataToken InitializeBadging(specter::ViewResources& viewRes)
|
||||||
if (uncompress(texels.get(), &destSz, URDE_BADGE + pos, URDE_BADGE_SZ - pos) != Z_OK)
|
if (uncompress(texels.get(), &destSz, URDE_BADGE + pos, URDE_BADGE_SZ - pos) != Z_OK)
|
||||||
Log.report(logvisor::Fatal, "unable to decompress badge");
|
Log.report(logvisor::Fatal, "unable to decompress badge");
|
||||||
|
|
||||||
return viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
specter::IconAtlas<1, 1> atlas;
|
specter::IconAtlas<1, 1> atlas;
|
||||||
|
|
||||||
|
@ -40,6 +40,11 @@ boo::GraphicsDataToken InitializeBadging(specter::ViewResources& viewRes)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DestroyBadging()
|
||||||
|
{
|
||||||
|
g_BadgeIcon.m_tex.reset();
|
||||||
|
}
|
||||||
|
|
||||||
specter::Icon& GetBadge()
|
specter::Icon& GetBadge()
|
||||||
{
|
{
|
||||||
return g_BadgeIcon;
|
return g_BadgeIcon;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
boo::GraphicsDataToken InitializeBadging(specter::ViewResources& viewRes);
|
void InitializeBadging(specter::ViewResources& viewRes);
|
||||||
|
void DestroyBadging();
|
||||||
|
|
||||||
specter::Icon& GetBadge();
|
specter::Icon& GetBadge();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ static logvisor::Module Log("URDE::icons");
|
||||||
|
|
||||||
specter::IconAtlas<8,8> g_IconAtlas;
|
specter::IconAtlas<8,8> g_IconAtlas;
|
||||||
|
|
||||||
boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes)
|
void InitializeIcons(specter::ViewResources& viewRes)
|
||||||
{
|
{
|
||||||
athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
|
athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
|
||||||
size_t fmt = r.readUint32Big();
|
size_t fmt = r.readUint32Big();
|
||||||
|
@ -28,7 +28,7 @@ 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");
|
||||||
|
|
||||||
return viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
g_IconAtlas.initializeAtlas(ctx.newStaticTexture(width, height, mips,
|
g_IconAtlas.initializeAtlas(ctx.newStaticTexture(width, height, mips,
|
||||||
boo::TextureFormat::RGBA8,
|
boo::TextureFormat::RGBA8,
|
||||||
|
@ -38,6 +38,11 @@ boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DestroyIcons()
|
||||||
|
{
|
||||||
|
g_IconAtlas.destroyAtlas();
|
||||||
|
}
|
||||||
|
|
||||||
specter::Icon& GetIcon(SpaceIcon icon)
|
specter::Icon& GetIcon(SpaceIcon icon)
|
||||||
{
|
{
|
||||||
switch (icon)
|
switch (icon)
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes);
|
void InitializeIcons(specter::ViewResources& viewRes);
|
||||||
|
void DestroyIcons();
|
||||||
|
|
||||||
enum class SpaceIcon
|
enum class SpaceIcon
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ void CMapArea::PostConstruct()
|
||||||
m_surfaces.back().PostConstruct(x44_buf.get(), index);
|
m_surfaces.back().PostConstruct(x44_buf.get(), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gfxToken = CGraphics::CommitResources([this, &index](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([this, &index](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, x3c_vertexStart, 12, x2c_vertexCount);
|
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, x3c_vertexStart, 12, x2c_vertexCount);
|
||||||
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, index.data(), 4, index.size());
|
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, index.data(), 4, index.size());
|
||||||
|
|
|
@ -29,8 +29,12 @@ public:
|
||||||
{
|
{
|
||||||
CMapSurfaceShader m_surfacePrims;
|
CMapSurfaceShader m_surfacePrims;
|
||||||
std::vector<CLineRenderer> m_linePrims;
|
std::vector<CLineRenderer> m_linePrims;
|
||||||
Instance(boo::IGraphicsDataFactory::Context& ctx, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo)
|
Instance(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
|
const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
|
||||||
|
const boo::ObjToken<boo::IGraphicsBufferS>& ibo)
|
||||||
: m_surfacePrims(ctx, vbo, ibo) {}
|
: m_surfacePrims(ctx, vbo, ibo) {}
|
||||||
|
Instance(Instance&&) = default;
|
||||||
|
Instance& operator=(Instance&&) = default;
|
||||||
};
|
};
|
||||||
std::vector<Instance> m_instances;
|
std::vector<Instance> m_instances;
|
||||||
public:
|
public:
|
||||||
|
@ -67,9 +71,8 @@ private:
|
||||||
u8* x40_surfaceStart;
|
u8* x40_surfaceStart;
|
||||||
std::vector<CMapAreaSurface> m_surfaces;
|
std::vector<CMapAreaSurface> m_surfaces;
|
||||||
std::unique_ptr<u8[]> x44_buf;
|
std::unique_ptr<u8[]> x44_buf;
|
||||||
boo::GraphicsDataToken m_gfxToken;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferS> m_ibo;
|
||||||
boo::IGraphicsBufferS* m_ibo;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMapArea(CInputStream& in, u32 size);
|
CMapArea(CInputStream& in, u32 size);
|
||||||
|
|
|
@ -278,9 +278,8 @@ bool CMappableObject::IsVisibleToAutoMapper(bool worldVis, const CMapWorldInfo&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::GraphicsDataToken CMappableObject::g_gfxToken = {};
|
boo::ObjToken<boo::IGraphicsBufferS> CMappableObject::g_doorVbo;
|
||||||
boo::IGraphicsBufferS* CMappableObject::g_doorVbo;
|
boo::ObjToken<boo::IGraphicsBufferS> CMappableObject::g_doorIbo;
|
||||||
boo::IGraphicsBufferS* CMappableObject::g_doorIbo;
|
|
||||||
|
|
||||||
void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks)
|
void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks)
|
||||||
{
|
{
|
||||||
|
@ -296,7 +295,7 @@ void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks)
|
||||||
doorVerts[6].assign(.2f * -center.z, center.y, 0.f);
|
doorVerts[6].assign(.2f * -center.z, center.y, 0.f);
|
||||||
doorVerts[7].assign(.2f * -center.z, center.y, 2.f * center.x);
|
doorVerts[7].assign(.2f * -center.z, center.y, 2.f * center.x);
|
||||||
|
|
||||||
g_gfxToken = CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
g_doorVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, skDoorVerts, 16, 8);
|
g_doorVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, skDoorVerts, 16, 8);
|
||||||
g_doorIbo = ctx.newStaticBuffer(boo::BufferUse::Index, DoorIndices, 4, 24);
|
g_doorIbo = ctx.newStaticBuffer(boo::BufferUse::Index, DoorIndices, 4, 24);
|
||||||
|
@ -306,6 +305,7 @@ void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks)
|
||||||
|
|
||||||
void CMappableObject::Shutdown()
|
void CMappableObject::Shutdown()
|
||||||
{
|
{
|
||||||
g_gfxToken.doDestroy();
|
g_doorVbo.reset();
|
||||||
|
g_doorIbo.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,8 @@ class CMapWorldInfo;
|
||||||
class CMappableObject
|
class CMappableObject
|
||||||
{
|
{
|
||||||
friend class CMapArea;
|
friend class CMapArea;
|
||||||
static boo::GraphicsDataToken g_gfxToken;
|
static boo::ObjToken<boo::IGraphicsBufferS> g_doorVbo;
|
||||||
static boo::IGraphicsBufferS* g_doorVbo;
|
static boo::ObjToken<boo::IGraphicsBufferS> g_doorIbo;
|
||||||
static boo::IGraphicsBufferS* g_doorIbo;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class EMappableObjectType
|
enum class EMappableObjectType
|
||||||
|
|
|
@ -672,7 +672,7 @@ CBooRenderer::CBooRenderer(IObjectStore& store, IFactory& resFac)
|
||||||
|
|
||||||
m_staticEntropy = store.GetObj("RandomStaticEntropy");
|
m_staticEntropy = store.GetObj("RandomStaticEntropy");
|
||||||
|
|
||||||
m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
GenerateFogVolumeRampTex(ctx);
|
GenerateFogVolumeRampTex(ctx);
|
||||||
GenerateSphereRampTex(ctx);
|
GenerateSphereRampTex(ctx);
|
||||||
|
|
|
@ -97,7 +97,6 @@ class CBooRenderer : public IRenderer
|
||||||
IFactory& x8_factory;
|
IFactory& x8_factory;
|
||||||
IObjectStore& xc_store;
|
IObjectStore& xc_store;
|
||||||
TLockedToken<CTexture> m_staticEntropy;
|
TLockedToken<CTexture> m_staticEntropy;
|
||||||
boo::GraphicsDataToken m_gfxToken;
|
|
||||||
// CFont x10_fnt;
|
// CFont x10_fnt;
|
||||||
u32 x18_ = 0;
|
u32 x18_ = 0;
|
||||||
std::list<CAreaListItem> x1c_areaListItems;
|
std::list<CAreaListItem> x1c_areaListItems;
|
||||||
|
@ -120,17 +119,17 @@ class CBooRenderer : public IRenderer
|
||||||
//boo::ITextureS* xe4_blackTex = nullptr;
|
//boo::ITextureS* xe4_blackTex = nullptr;
|
||||||
bool xee_24_ : 1;
|
bool xee_24_ : 1;
|
||||||
|
|
||||||
boo::ITextureR* x14c_reflectionTex = nullptr;
|
boo::ObjToken<boo::ITextureR> x14c_reflectionTex;
|
||||||
//boo::ITextureS* x150_mirrorRamp = nullptr;
|
//boo::ITextureS* x150_mirrorRamp = nullptr;
|
||||||
boo::ITextureS* x1b8_fogVolumeRamp = nullptr;
|
boo::ObjToken<boo::ITextureS> x1b8_fogVolumeRamp;
|
||||||
boo::ITextureS* x220_sphereRamp = nullptr;
|
boo::ObjToken<boo::ITextureS> x220_sphereRamp;
|
||||||
TLockedToken<CTexture> m_thermoPaletteTex;
|
TLockedToken<CTexture> m_thermoPaletteTex;
|
||||||
boo::ITexture* x288_thermoPalette = nullptr;
|
boo::ObjToken<boo::ITexture> x288_thermoPalette;
|
||||||
TLockedToken<CTexture> m_ballFadeTex;
|
TLockedToken<CTexture> m_ballFadeTex;
|
||||||
boo::ITexture* m_ballFade = nullptr;
|
boo::ObjToken<boo::ITexture> m_ballFade;
|
||||||
boo::ITextureR* m_ballShadowId = nullptr;
|
boo::ObjToken<boo::ITextureR> m_ballShadowId;
|
||||||
boo::IGraphicsBufferS* m_scanLinesEvenVBO = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_scanLinesEvenVBO;
|
||||||
boo::IGraphicsBufferS* m_scanLinesOddVBO = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_scanLinesOddVBO;
|
||||||
int m_ballShadowIdW = 64;
|
int m_ballShadowIdW = 64;
|
||||||
int m_ballShadowIdH = 64;
|
int m_ballShadowIdH = 64;
|
||||||
|
|
||||||
|
@ -275,11 +274,11 @@ public:
|
||||||
void ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb,
|
void ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb,
|
||||||
const CModel* model, const CSkinnedModel* sModel);
|
const CModel* model, const CSkinnedModel* sModel);
|
||||||
|
|
||||||
boo::ITexture* GetThermoPalette() {return x288_thermoPalette;}
|
const boo::ObjToken<boo::ITexture>& GetThermoPalette() {return x288_thermoPalette;}
|
||||||
boo::ITextureS* GetFogRampTex() {return x1b8_fogVolumeRamp;}
|
const boo::ObjToken<boo::ITextureS>& GetFogRampTex() {return x1b8_fogVolumeRamp;}
|
||||||
boo::ITexture* GetRandomStaticEntropyTex() const {return m_staticEntropy->GetBooTexture();}
|
const boo::ObjToken<boo::ITexture>& GetRandomStaticEntropyTex() const {return m_staticEntropy->GetBooTexture();}
|
||||||
boo::IGraphicsBuffer* GetScanLinesEvenVBO() const {return m_scanLinesEvenVBO;}
|
const boo::ObjToken<boo::IGraphicsBufferS>& GetScanLinesEvenVBO() const {return m_scanLinesEvenVBO;}
|
||||||
boo::IGraphicsBuffer* GetScanLinesOddVBO() const {return m_scanLinesOddVBO;}
|
const boo::ObjToken<boo::IGraphicsBufferS>& GetScanLinesOddVBO() const {return m_scanLinesOddVBO;}
|
||||||
|
|
||||||
static void BindMainDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(CGraphics::g_SpareTexture);}
|
static void BindMainDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(CGraphics::g_SpareTexture);}
|
||||||
void BindReflectionDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(x14c_reflectionTex);}
|
void BindReflectionDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(x14c_reflectionTex);}
|
||||||
|
|
|
@ -515,7 +515,7 @@ void CGraphics::TickRenderTimings()
|
||||||
boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
|
boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
|
||||||
boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
|
boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
|
||||||
boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
|
boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
|
||||||
boo::ITextureR* CGraphics::g_SpareTexture = nullptr;
|
boo::ObjToken<boo::ITextureR> CGraphics::g_SpareTexture;
|
||||||
const boo::SystemChar* CGraphics::g_BooPlatformName = nullptr;
|
const boo::SystemChar* CGraphics::g_BooPlatformName = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,11 +300,11 @@ public:
|
||||||
static const boo::SystemChar* g_BooPlatformName;
|
static const boo::SystemChar* g_BooPlatformName;
|
||||||
static boo::IGraphicsDataFactory* g_BooFactory;
|
static boo::IGraphicsDataFactory* g_BooFactory;
|
||||||
static boo::IGraphicsCommandQueue* g_BooMainCommandQueue;
|
static boo::IGraphicsCommandQueue* g_BooMainCommandQueue;
|
||||||
static boo::ITextureR* g_SpareTexture;
|
static boo::ObjToken<boo::ITextureR> g_SpareTexture;
|
||||||
|
|
||||||
static void InitializeBoo(boo::IGraphicsDataFactory* factory,
|
static void InitializeBoo(boo::IGraphicsDataFactory* factory,
|
||||||
boo::IGraphicsCommandQueue* cc,
|
boo::IGraphicsCommandQueue* cc,
|
||||||
boo::ITextureR* spareTex)
|
const boo::ObjToken<boo::ITextureR>& spareTex)
|
||||||
{
|
{
|
||||||
g_BooPlatform = factory->platform();
|
g_BooPlatform = factory->platform();
|
||||||
g_BooPlatformName = factory->platformName();
|
g_BooPlatformName = factory->platformName();
|
||||||
|
@ -313,16 +313,16 @@ public:
|
||||||
g_SpareTexture = spareTex;
|
g_SpareTexture = spareTex;
|
||||||
}
|
}
|
||||||
|
|
||||||
const boo::SystemChar* PlatformName()
|
static const boo::SystemChar* PlatformName()
|
||||||
{
|
{
|
||||||
return g_BooPlatformName;
|
return g_BooPlatformName;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boo::GraphicsDataToken CommitResources(const boo::FactoryCommitFunc& commitFunc)
|
static void CommitResources(const boo::FactoryCommitFunc& commitFunc)
|
||||||
{
|
{
|
||||||
return g_BooFactory->commitTransaction(commitFunc);
|
g_BooFactory->commitTransaction(commitFunc);
|
||||||
}
|
}
|
||||||
static void SetShaderDataBinding(boo::IShaderDataBinding* binding)
|
static void SetShaderDataBinding(const boo::ObjToken<boo::IShaderDataBinding>& binding)
|
||||||
{
|
{
|
||||||
g_BooMainCommandQueue->setShaderDataBinding(binding);
|
g_BooMainCommandQueue->setShaderDataBinding(binding);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ hecl::VertexBufferPool<CLineRenderer::SDrawVertNoTex> CLineRenderer::s_vertPoolN
|
||||||
hecl::UniformBufferPool<CLineRenderer::SDrawUniform> CLineRenderer::s_uniformPool = {};
|
hecl::UniformBufferPool<CLineRenderer::SDrawUniform> CLineRenderer::s_uniformPool = {};
|
||||||
|
|
||||||
CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
|
CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EPrimitiveMode mode, u32 maxVerts, boo::ITexture* texture, bool additive)
|
EPrimitiveMode mode, u32 maxVerts,
|
||||||
|
const boo::ObjToken<boo::ITexture>& texture, bool additive)
|
||||||
: m_mode(mode), m_maxVerts(maxVerts)
|
: m_mode(mode), m_maxVerts(maxVerts)
|
||||||
{
|
{
|
||||||
if (maxVerts < 2)
|
if (maxVerts < 2)
|
||||||
|
@ -31,7 +32,7 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
LineRendererLog.report(logvisor::Fatal, _S("maxVerts < 2, maxVerts = %i"), maxVerts);
|
LineRendererLog.report(logvisor::Fatal, _S("maxVerts < 2, maxVerts = %i"), maxVerts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_textured = texture != nullptr;
|
m_textured = texture;
|
||||||
|
|
||||||
u32 maxTriVerts;
|
u32 maxTriVerts;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
@ -57,7 +58,8 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive);
|
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* texture, bool additive)
|
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts,
|
||||||
|
const boo::ObjToken<boo::ITexture>& texture, bool additive)
|
||||||
: m_mode(mode), m_maxVerts(maxVerts)
|
: m_mode(mode), m_maxVerts(maxVerts)
|
||||||
{
|
{
|
||||||
if (maxVerts < 2)
|
if (maxVerts < 2)
|
||||||
|
@ -65,7 +67,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* t
|
||||||
LineRendererLog.report(logvisor::Fatal, _S("maxVerts < 2, maxVerts = %i"), maxVerts);
|
LineRendererLog.report(logvisor::Fatal, _S("maxVerts < 2, maxVerts = %i"), maxVerts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_textured = texture != nullptr;
|
m_textured = texture;
|
||||||
|
|
||||||
u32 maxTriVerts;
|
u32 maxTriVerts;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
@ -88,7 +90,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* t
|
||||||
|
|
||||||
m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory);
|
m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory);
|
||||||
|
|
||||||
m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive);
|
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -67,15 +67,14 @@ private:
|
||||||
static hecl::UniformBufferPool<SDrawUniform> s_uniformPool;
|
static hecl::UniformBufferPool<SDrawUniform> s_uniformPool;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
boo::GraphicsDataToken m_gfxToken;
|
|
||||||
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
|
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
|
||||||
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
|
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
|
||||||
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
||||||
boo::IShaderDataBinding* m_shaderBind = nullptr;
|
boo::ObjToken<boo::IShaderDataBinding> m_shaderBind;
|
||||||
|
|
||||||
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
|
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EPrimitiveMode mode, u32 maxVerts, boo::ITexture* texture, bool additive);
|
EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture, bool additive);
|
||||||
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, boo::ITexture* texture, bool additive);
|
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture, bool additive);
|
||||||
CLineRenderer(CLineRenderer&&) = default;
|
CLineRenderer(CLineRenderer&&) = default;
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
|
@ -134,24 +134,23 @@ private:
|
||||||
size_t m_uniformDataSize = 0;
|
size_t m_uniformDataSize = 0;
|
||||||
struct ModelInstance
|
struct ModelInstance
|
||||||
{
|
{
|
||||||
boo::GraphicsDataToken m_gfxToken;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuffer;
|
||||||
boo::IGraphicsBufferD* m_uniformBuffer;
|
std::vector<std::vector<boo::ObjToken<boo::IShaderDataBinding>>> m_shaderDataBindings;
|
||||||
std::vector<std::vector<boo::IShaderDataBinding*>> m_shaderDataBindings;
|
boo::ObjToken<boo::IVertexFormat> m_dynamicVtxFmt;
|
||||||
boo::IVertexFormat* m_dynamicVtxFmt = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferD> m_dynamicVbo;
|
||||||
boo::IGraphicsBufferD* m_dynamicVbo = nullptr;
|
|
||||||
|
|
||||||
boo::IGraphicsBuffer* GetBooVBO(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
|
boo::ObjToken<boo::IGraphicsBuffer> GetBooVBO(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
|
||||||
boo::IVertexFormat* GetBooVtxFmt(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
|
boo::ObjToken<boo::IVertexFormat> GetBooVtxFmt(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
|
||||||
};
|
};
|
||||||
std::vector<ModelInstance> m_instances;
|
std::vector<ModelInstance> m_instances;
|
||||||
|
|
||||||
boo::IVertexFormat* m_staticVtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> m_staticVtxFmt;
|
||||||
boo::IGraphicsBufferS* m_staticVbo = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_staticVbo;
|
||||||
boo::IGraphicsBufferS* m_staticIbo = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_staticIbo;
|
||||||
|
|
||||||
boo::ITexture* m_txtrOverrides[8] = {};
|
boo::ObjToken<boo::ITexture> m_txtrOverrides[8];
|
||||||
|
|
||||||
boo::ITexture* m_lastDrawnShadowMap = nullptr;
|
boo::ObjToken<boo::ITexture> m_lastDrawnShadowMap;
|
||||||
|
|
||||||
ModelInstance* PushNewModelInstance();
|
ModelInstance* PushNewModelInstance();
|
||||||
void DrawAlphaSurfaces(const CModelFlags& flags) const;
|
void DrawAlphaSurfaces(const CModelFlags& flags) const;
|
||||||
|
@ -172,9 +171,9 @@ private:
|
||||||
public:
|
public:
|
||||||
~CBooModel();
|
~CBooModel();
|
||||||
CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurface>* surfaces, SShader& shader,
|
CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
const boo::ObjToken<boo::IVertexFormat>& vtxFmt, const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
|
||||||
const zeus::CAABox& aabb, u8 renderMask,
|
const boo::ObjToken<boo::IGraphicsBufferS>& ibo, const zeus::CAABox& aabb, u8 renderMask,
|
||||||
int numInsts, boo::ITexture* txtrOverrides[8]);
|
int numInsts, const boo::ObjToken<boo::ITexture> txtrOverrides[8]);
|
||||||
|
|
||||||
static void MakeTexturesFromMats(const MaterialSet& matSet,
|
static void MakeTexturesFromMats(const MaterialSet& matSet,
|
||||||
std::vector<TCachedToken<CTexture>>& toksOut,
|
std::vector<TCachedToken<CTexture>>& toksOut,
|
||||||
|
@ -193,7 +192,7 @@ public:
|
||||||
void SyncLoadTextures() const;
|
void SyncLoadTextures() const;
|
||||||
void Touch(int shaderIdx) const;
|
void Touch(int shaderIdx) const;
|
||||||
void VerifyCurrentShader(int shaderIdx);
|
void VerifyCurrentShader(int shaderIdx);
|
||||||
boo::IGraphicsBufferD* UpdateUniformData(const CModelFlags& flags,
|
boo::ObjToken<boo::IGraphicsBufferD> UpdateUniformData(const CModelFlags& flags,
|
||||||
const CSkinRules* cskr,
|
const CSkinRules* cskr,
|
||||||
const CPoseAsTransforms* pose) const;
|
const CPoseAsTransforms* pose) const;
|
||||||
void DrawAlpha(const CModelFlags& flags,
|
void DrawAlpha(const CModelFlags& flags,
|
||||||
|
@ -229,9 +228,9 @@ public:
|
||||||
static void EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf,
|
static void EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf,
|
||||||
zeus::CMatrix4f* mtxsOut, float& alphaOut);
|
zeus::CMatrix4f* mtxsOut, float& alphaOut);
|
||||||
|
|
||||||
static boo::ITexture* g_shadowMap;
|
static boo::ObjToken<boo::ITexture> g_shadowMap;
|
||||||
static zeus::CTransform g_shadowTexXf;
|
static zeus::CTransform g_shadowTexXf;
|
||||||
static void EnableShadowMaps(boo::ITexture* map, const zeus::CTransform& texXf);
|
static void EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf);
|
||||||
static void DisableShadowMaps();
|
static void DisableShadowMaps();
|
||||||
|
|
||||||
static void SetDummyTextures(bool b) { g_DummyTextures = true; }
|
static void SetDummyTextures(bool b) { g_DummyTextures = true; }
|
||||||
|
@ -253,12 +252,11 @@ class CModel
|
||||||
int x38_lastFrame;
|
int x38_lastFrame;
|
||||||
|
|
||||||
/* urde addition: boo! */
|
/* urde addition: boo! */
|
||||||
boo::GraphicsDataToken m_gfxToken;
|
boo::ObjToken<boo::IVertexFormat> m_staticVtxFmt;
|
||||||
boo::IVertexFormat* m_staticVtxFmt = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_staticVbo;
|
||||||
boo::IGraphicsBufferS* m_staticVbo = nullptr;
|
|
||||||
hecl::HMDLMeta m_hmdlMeta;
|
hecl::HMDLMeta m_hmdlMeta;
|
||||||
std::unique_ptr<uint8_t[]> m_dynamicVertexData;
|
std::unique_ptr<uint8_t[]> m_dynamicVertexData;
|
||||||
boo::IGraphicsBufferS* m_ibo = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_ibo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet;
|
using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet;
|
||||||
|
@ -274,7 +272,7 @@ public:
|
||||||
CBooModel& GetInstance() {return *x28_modelInst;}
|
CBooModel& GetInstance() {return *x28_modelInst;}
|
||||||
const CBooModel& GetInstance() const {return *x28_modelInst;}
|
const CBooModel& GetInstance() const {return *x28_modelInst;}
|
||||||
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx, int subInsts,
|
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx, int subInsts,
|
||||||
boo::ITexture* txtrOverrides[8] = nullptr,
|
const boo::ObjToken<boo::ITexture> txtrOverrides[8] = nullptr,
|
||||||
bool lockParent = true);
|
bool lockParent = true);
|
||||||
void UpdateLastFrame() const { const_cast<CModel&>(*this).x38_lastFrame = CGraphics::GetFrameCounter(); }
|
void UpdateLastFrame() const { const_cast<CModel&>(*this).x38_lastFrame = CGraphics::GetFrameCounter(); }
|
||||||
|
|
||||||
|
@ -282,7 +280,7 @@ public:
|
||||||
zeus::CVector3f GetPoolVertex(size_t idx) const;
|
zeus::CVector3f GetPoolVertex(size_t idx) const;
|
||||||
size_t GetPoolNormalOffset(size_t idx) const;
|
size_t GetPoolNormalOffset(size_t idx) const;
|
||||||
zeus::CVector3f GetPoolNormal(size_t idx) const;
|
zeus::CVector3f GetPoolNormal(size_t idx) const;
|
||||||
void ApplyVerticesCPU(boo::IGraphicsBufferD* vertBuf,
|
void ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf,
|
||||||
const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const;
|
const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const;
|
||||||
|
|
||||||
void _WarmupShaders();
|
void _WarmupShaders();
|
||||||
|
|
|
@ -125,10 +125,10 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::ITexture* CBooModel::g_shadowMap = nullptr;
|
boo::ObjToken<boo::ITexture> CBooModel::g_shadowMap;
|
||||||
zeus::CTransform CBooModel::g_shadowTexXf;
|
zeus::CTransform CBooModel::g_shadowTexXf;
|
||||||
|
|
||||||
void CBooModel::EnableShadowMaps(boo::ITexture* map, const zeus::CTransform& texXf)
|
void CBooModel::EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf)
|
||||||
{
|
{
|
||||||
g_shadowMap = map;
|
g_shadowMap = map;
|
||||||
g_shadowTexXf = texXf;
|
g_shadowTexXf = texXf;
|
||||||
|
@ -149,9 +149,9 @@ CBooModel::~CBooModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurface>* surfaces, SShader& shader,
|
CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
const boo::ObjToken<boo::IVertexFormat>& vtxFmt, const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
|
||||||
const zeus::CAABox& aabb, u8 renderMask,
|
const boo::ObjToken<boo::IGraphicsBufferS>& ibo, const zeus::CAABox& aabb, u8 renderMask,
|
||||||
int numInsts, boo::ITexture* txtrOverrides[8])
|
int numInsts, const boo::ObjToken<boo::ITexture> txtrOverrides[8])
|
||||||
: m_modelTok(token), m_model(parent), x0_surfaces(surfaces), x4_matSet(&shader.m_matSet),
|
: m_modelTok(token), m_model(parent), x0_surfaces(surfaces), x4_matSet(&shader.m_matSet),
|
||||||
m_matSetIdx(shader.m_matSetIdx), m_pipelines(&shader.m_shaders), x1c_textures(shader.x0_textures),
|
m_matSetIdx(shader.m_matSetIdx), m_pipelines(&shader.m_shaders), x1c_textures(shader.x0_textures),
|
||||||
x20_aabb(aabb), x40_24_texturesLoaded(false), x40_25_modelVisible(0), x41_mask(renderMask),
|
x20_aabb(aabb), x40_24_texturesLoaded(false), x40_25_modelVisible(0), x41_mask(renderMask),
|
||||||
|
@ -194,11 +194,12 @@ CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurf
|
||||||
PushNewModelInstance();
|
PushNewModelInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IGraphicsBuffer* CBooModel::ModelInstance::GetBooVBO(const CBooModel& model,
|
boo::ObjToken<boo::IGraphicsBuffer>
|
||||||
|
CBooModel::ModelInstance::GetBooVBO(const CBooModel& model,
|
||||||
boo::IGraphicsDataFactory::Context& ctx)
|
boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
if (model.m_staticVbo)
|
if (model.m_staticVbo)
|
||||||
return model.m_staticVbo;
|
return model.m_staticVbo.get();
|
||||||
if (!m_dynamicVbo && model.m_model)
|
if (!m_dynamicVbo && model.m_model)
|
||||||
{
|
{
|
||||||
const CModel& parent = *model.m_model;
|
const CModel& parent = *model.m_model;
|
||||||
|
@ -207,10 +208,11 @@ boo::IGraphicsBuffer* CBooModel::ModelInstance::GetBooVBO(const CBooModel& model
|
||||||
m_dynamicVbo->load(parent.m_dynamicVertexData.get(),
|
m_dynamicVbo->load(parent.m_dynamicVertexData.get(),
|
||||||
parent.m_hmdlMeta.vertStride * parent.m_hmdlMeta.vertCount);
|
parent.m_hmdlMeta.vertStride * parent.m_hmdlMeta.vertCount);
|
||||||
}
|
}
|
||||||
return m_dynamicVbo;
|
return m_dynamicVbo.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IVertexFormat* CBooModel::ModelInstance::GetBooVtxFmt(const CBooModel& model,
|
boo::ObjToken<boo::IVertexFormat>
|
||||||
|
CBooModel::ModelInstance::GetBooVtxFmt(const CBooModel& model,
|
||||||
boo::IGraphicsDataFactory::Context& ctx)
|
boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
if (model.m_staticVtxFmt)
|
if (model.m_staticVtxFmt)
|
||||||
|
@ -219,7 +221,7 @@ boo::IVertexFormat* CBooModel::ModelInstance::GetBooVtxFmt(const CBooModel& mode
|
||||||
{
|
{
|
||||||
const CModel& parent = *model.m_model;
|
const CModel& parent = *model.m_model;
|
||||||
m_dynamicVtxFmt = hecl::Runtime::HMDLData::NewVertexFormat(ctx, parent.m_hmdlMeta,
|
m_dynamicVtxFmt = hecl::Runtime::HMDLData::NewVertexFormat(ctx, parent.m_hmdlMeta,
|
||||||
GetBooVBO(model, ctx), parent.m_ibo);
|
GetBooVBO(model, ctx), parent.m_ibo.get());
|
||||||
}
|
}
|
||||||
return m_dynamicVtxFmt;
|
return m_dynamicVtxFmt;
|
||||||
}
|
}
|
||||||
|
@ -241,8 +243,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
weightVecCount = model->m_hmdlMeta.weightCount;
|
weightVecCount = model->m_hmdlMeta.weightCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
newInst.m_gfxToken = CGraphics::CommitResources(
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
|
||||||
{
|
{
|
||||||
/* Determine space required by uniform buffer */
|
/* Determine space required by uniform buffer */
|
||||||
std::vector<size_t> skinOffs;
|
std::vector<size_t> skinOffs;
|
||||||
|
@ -311,22 +312,22 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
m_uniformDataSize = uniBufSize;
|
m_uniformDataSize = uniBufSize;
|
||||||
newInst.m_uniformBuffer = ctx.newDynamicBuffer(boo::BufferUse::Uniform, uniBufSize, 1);
|
newInst.m_uniformBuffer = ctx.newDynamicBuffer(boo::BufferUse::Uniform, uniBufSize, 1);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {newInst.m_uniformBuffer,
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {newInst.m_uniformBuffer.get(),
|
||||||
newInst.m_uniformBuffer,
|
newInst.m_uniformBuffer.get(),
|
||||||
newInst.m_uniformBuffer,
|
newInst.m_uniformBuffer.get(),
|
||||||
newInst.m_uniformBuffer};
|
newInst.m_uniformBuffer.get()};
|
||||||
|
|
||||||
/* Binding for each surface */
|
/* Binding for each surface */
|
||||||
newInst.m_shaderDataBindings.reserve(x0_surfaces->size());
|
newInst.m_shaderDataBindings.reserve(x0_surfaces->size());
|
||||||
|
|
||||||
boo::ITexture* mbShadowTexs[8] = {g_Renderer->m_ballShadowId,
|
boo::ObjToken<boo::ITexture> mbShadowTexs[8] = {g_Renderer->m_ballShadowId.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->m_ballFade,
|
g_Renderer->m_ballFade.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp};
|
g_Renderer->x220_sphereRamp.get()};
|
||||||
size_t thisOffs[4];
|
size_t thisOffs[4];
|
||||||
size_t thisSizes[4];
|
size_t thisSizes[4];
|
||||||
|
|
||||||
|
@ -341,29 +342,29 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
{
|
{
|
||||||
const MaterialSet::Material& mat = x4_matSet->materials.at(surf.m_data.matIdx);
|
const MaterialSet::Material& mat = x4_matSet->materials.at(surf.m_data.matIdx);
|
||||||
|
|
||||||
boo::ITexture* texs[8] = {g_Renderer->x220_sphereRamp,
|
boo::ObjToken<boo::ITexture> texs[8] = {g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp,
|
g_Renderer->x220_sphereRamp.get(),
|
||||||
g_Renderer->x220_sphereRamp};
|
g_Renderer->x220_sphereRamp.get()};
|
||||||
u32 texCount = 0;
|
u32 texCount = 0;
|
||||||
for (atUint32 idx : mat.textureIdxs)
|
for (atUint32 idx : mat.textureIdxs)
|
||||||
{
|
{
|
||||||
if (boo::ITexture* overtex = m_txtrOverrides[texCount])
|
if (boo::ObjToken<boo::ITexture> overtex = m_txtrOverrides[texCount])
|
||||||
{
|
{
|
||||||
texs[texCount++] = overtex;
|
texs[texCount++] = overtex;
|
||||||
}
|
}
|
||||||
else if (g_DummyTextures)
|
else if (g_DummyTextures)
|
||||||
{
|
{
|
||||||
texs[texCount++] = g_Renderer->x220_sphereRamp;
|
texs[texCount++] = g_Renderer->x220_sphereRamp.get();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCachedToken<CTexture>& tex = x1c_textures[idx];
|
TCachedToken<CTexture>& tex = x1c_textures[idx];
|
||||||
if (boo::ITexture* btex = tex.GetObj()->GetBooTexture())
|
if (boo::ObjToken<boo::ITexture> btex = tex.GetObj()->GetBooTexture())
|
||||||
texs[texCount++] = btex;
|
texs[texCount++] = btex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,9 +390,9 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
if (useReflection)
|
if (useReflection)
|
||||||
{
|
{
|
||||||
if (g_Renderer->x14c_reflectionTex)
|
if (g_Renderer->x14c_reflectionTex)
|
||||||
texs[texCount] = g_Renderer->x14c_reflectionTex;
|
texs[texCount] = g_Renderer->x14c_reflectionTex.get();
|
||||||
else
|
else
|
||||||
texs[texCount] = g_Renderer->x220_sphereRamp;
|
texs[texCount] = g_Renderer->x220_sphereRamp.get();
|
||||||
thisOffs[3] = curReflect;
|
thisOffs[3] = curReflect;
|
||||||
curReflect += 256;
|
curReflect += 256;
|
||||||
}
|
}
|
||||||
|
@ -404,16 +405,16 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
const std::shared_ptr<hecl::Runtime::ShaderPipelines>& pipelines = m_pipelines->at(surf.m_data.matIdx);
|
const std::shared_ptr<hecl::Runtime::ShaderPipelines>& pipelines = m_pipelines->at(surf.m_data.matIdx);
|
||||||
|
|
||||||
newInst.m_shaderDataBindings.emplace_back();
|
newInst.m_shaderDataBindings.emplace_back();
|
||||||
std::vector<boo::IShaderDataBinding*>& extendeds = newInst.m_shaderDataBindings.back();
|
std::vector<boo::ObjToken<boo::IShaderDataBinding>>& extendeds = newInst.m_shaderDataBindings.back();
|
||||||
extendeds.reserve(pipelines->m_pipelines.size());
|
extendeds.reserve(pipelines->m_pipelines.size());
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (boo::IShaderPipeline* pipeline : pipelines->m_pipelines)
|
for (const boo::ObjToken<boo::IShaderPipeline>& pipeline : pipelines->m_pipelines)
|
||||||
{
|
{
|
||||||
boo::ITexture** ltexs;
|
boo::ObjToken<boo::ITexture>* ltexs;
|
||||||
if (idx == EExtendedShader::Thermal)
|
if (idx == EExtendedShader::Thermal)
|
||||||
{
|
{
|
||||||
texs[7] = g_Renderer->x220_sphereRamp;
|
texs[7] = g_Renderer->x220_sphereRamp.get();
|
||||||
ltexs = texs;
|
ltexs = texs;
|
||||||
}
|
}
|
||||||
else if (idx == EExtendedShader::MorphBallShadow)
|
else if (idx == EExtendedShader::MorphBallShadow)
|
||||||
|
@ -425,7 +426,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
if (g_shadowMap)
|
if (g_shadowMap)
|
||||||
texs[7] = g_shadowMap;
|
texs[7] = g_shadowMap;
|
||||||
else
|
else
|
||||||
texs[7] = g_Renderer->x220_sphereRamp;
|
texs[7] = g_Renderer->x220_sphereRamp.get();
|
||||||
ltexs = texs;
|
ltexs = texs;
|
||||||
}
|
}
|
||||||
else if (useReflection)
|
else if (useReflection)
|
||||||
|
@ -438,7 +439,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
}
|
}
|
||||||
extendeds.push_back(
|
extendeds.push_back(
|
||||||
ctx.newShaderDataBinding(pipeline, newInst.GetBooVtxFmt(*this, ctx),
|
ctx.newShaderDataBinding(pipeline, newInst.GetBooVtxFmt(*this, ctx),
|
||||||
newInst.GetBooVBO(*this, ctx), nullptr, m_staticIbo, 4, bufs,
|
newInst.GetBooVBO(*this, ctx), nullptr, m_staticIbo.get(), 4, bufs,
|
||||||
stages, thisOffs, thisSizes, 8, ltexs, nullptr, nullptr));
|
stages, thisOffs, thisSizes, 8, ltexs, nullptr, nullptr));
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
@ -613,8 +614,8 @@ void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) c
|
||||||
if (data.flags.shadowOccluderMesh() && !g_DrawingOccluders)
|
if (data.flags.shadowOccluderMesh() && !g_DrawingOccluders)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::vector<boo::IShaderDataBinding*>& extendeds = inst.m_shaderDataBindings[surf.selfIdx];
|
const std::vector<boo::ObjToken<boo::IShaderDataBinding>>& extendeds = inst.m_shaderDataBindings[surf.selfIdx];
|
||||||
boo::IShaderDataBinding* binding = extendeds[0];
|
boo::ObjToken<boo::IShaderDataBinding> binding = extendeds[0];
|
||||||
if (flags.m_extendedShader < extendeds.size())
|
if (flags.m_extendedShader < extendeds.size())
|
||||||
binding = extendeds[flags.m_extendedShader];
|
binding = extendeds[flags.m_extendedShader];
|
||||||
|
|
||||||
|
@ -842,7 +843,7 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IGraphicsBufferD* CBooModel::UpdateUniformData(const CModelFlags& flags,
|
boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFlags& flags,
|
||||||
const CSkinRules* cskr,
|
const CSkinRules* cskr,
|
||||||
const CPoseAsTransforms* pose) const
|
const CPoseAsTransforms* pose) const
|
||||||
{
|
{
|
||||||
|
@ -1057,7 +1058,7 @@ static const u8* MemoryFromPartData(const u8*& dataCur, const u32*& secSizeCur)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CBooModel> CModel::MakeNewInstance(int shaderIdx, int subInsts,
|
std::unique_ptr<CBooModel> CModel::MakeNewInstance(int shaderIdx, int subInsts,
|
||||||
boo::ITexture* txtrOverrides[8],
|
const boo::ObjToken<boo::ITexture> txtrOverrides[8],
|
||||||
bool lockParent)
|
bool lockParent)
|
||||||
{
|
{
|
||||||
if (shaderIdx >= x18_matSets.size())
|
if (shaderIdx >= x18_matSets.size())
|
||||||
|
@ -1137,7 +1138,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||||
for (CBooModel::SShader& matSet : x18_matSets)
|
for (CBooModel::SShader& matSet : x18_matSets)
|
||||||
matSet.BuildShaders(m_hmdlMeta);
|
matSet.BuildShaders(m_hmdlMeta);
|
||||||
|
|
||||||
m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
/* Index buffer is always static */
|
/* Index buffer is always static */
|
||||||
if (m_hmdlMeta.indexCount)
|
if (m_hmdlMeta.indexCount)
|
||||||
|
@ -1149,7 +1150,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||||
if (m_hmdlMeta.vertCount)
|
if (m_hmdlMeta.vertCount)
|
||||||
m_staticVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vboData,
|
m_staticVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vboData,
|
||||||
m_hmdlMeta.vertStride, m_hmdlMeta.vertCount);
|
m_hmdlMeta.vertStride, m_hmdlMeta.vertCount);
|
||||||
m_staticVtxFmt = hecl::Runtime::HMDLData::NewVertexFormat(ctx, m_hmdlMeta, m_staticVbo, m_ibo);
|
m_staticVtxFmt = hecl::Runtime::HMDLData::NewVertexFormat(ctx, m_hmdlMeta, m_staticVbo.get(), m_ibo.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1258,7 +1259,7 @@ zeus::CVector3f CModel::GetPoolNormal(size_t idx) const
|
||||||
return {floats[0], floats[1], floats[2]};
|
return {floats[0], floats[1], floats[2]};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModel::ApplyVerticesCPU(boo::IGraphicsBufferD* vertBuf,
|
void CModel::ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf,
|
||||||
const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const
|
const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const
|
||||||
{
|
{
|
||||||
u8* data = reinterpret_cast<u8*>(vertBuf->map(m_hmdlMeta.vertStride * m_hmdlMeta.vertCount));
|
u8* data = reinterpret_cast<u8*>(vertBuf->map(m_hmdlMeta.vertStride * m_hmdlMeta.vertCount));
|
||||||
|
@ -1279,7 +1280,7 @@ void CModel::ApplyVerticesCPU(boo::IGraphicsBufferD* vertBuf,
|
||||||
void CModel::_WarmupShaders()
|
void CModel::_WarmupShaders()
|
||||||
{
|
{
|
||||||
CBooModel::SetDummyTextures(true);
|
CBooModel::SetDummyTextures(true);
|
||||||
CBooModel::EnableShadowMaps(g_Renderer->x220_sphereRamp, zeus::CTransform::Identity());
|
CBooModel::EnableShadowMaps(g_Renderer->x220_sphereRamp.get(), zeus::CTransform::Identity());
|
||||||
CGraphics::CProjectionState backupProj = CGraphics::GetProjectionState();
|
CGraphics::CProjectionState backupProj = CGraphics::GetProjectionState();
|
||||||
zeus::CTransform backupViewPoint = CGraphics::g_ViewMatrix;
|
zeus::CTransform backupViewPoint = CGraphics::g_ViewMatrix;
|
||||||
zeus::CTransform backupModel = CGraphics::g_GXModelMatrix;
|
zeus::CTransform backupModel = CGraphics::g_GXModelMatrix;
|
||||||
|
|
|
@ -176,9 +176,8 @@ static const u16 StaticVolumeLookup[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
/* shared boo resources */
|
/* shared boo resources */
|
||||||
static boo::GraphicsDataToken GraphicsData;
|
static boo::ObjToken<boo::IVertexFormat> YUVVTXFmt;
|
||||||
static boo::IVertexFormat* YUVVTXFmt = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> YUVShaderPipeline;
|
||||||
static boo::IShaderPipeline* YUVShaderPipeline = nullptr;
|
|
||||||
static tjhandle TjHandle = nullptr;
|
static tjhandle TjHandle = nullptr;
|
||||||
|
|
||||||
/* RSF audio state */
|
/* RSF audio state */
|
||||||
|
@ -199,7 +198,7 @@ static const char* TexNames[] = {"texY", "texU", "texV"};
|
||||||
|
|
||||||
void CMoviePlayer::Initialize()
|
void CMoviePlayer::Initialize()
|
||||||
{
|
{
|
||||||
GraphicsData = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
if (!ctx.bindingNeedsVertexFormat())
|
if (!ctx.bindingNeedsVertexFormat())
|
||||||
{
|
{
|
||||||
|
@ -231,7 +230,7 @@ void CMoviePlayer::Initialize()
|
||||||
#if BOO_HAS_METAL
|
#if BOO_HAS_METAL
|
||||||
case boo::IGraphicsDataFactory::Platform::Metal:
|
case boo::IGraphicsDataFactory::Platform::Metal:
|
||||||
YUVShaderPipeline = static_cast<boo::MetalDataFactory::Context&>(ctx).newShaderPipeline
|
YUVShaderPipeline = static_cast<boo::MetalDataFactory::Context&>(ctx).newShaderPipeline
|
||||||
(VS_METAL_YUV, FS_METAL_YUV, YUVVTXFmt, 1,
|
(VS_METAL_YUV, FS_METAL_YUV, nullptr, nullptr, YUVVTXFmt, 1,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
break;
|
break;
|
||||||
|
@ -254,7 +253,8 @@ void CMoviePlayer::Initialize()
|
||||||
|
|
||||||
void CMoviePlayer::Shutdown()
|
void CMoviePlayer::Shutdown()
|
||||||
{
|
{
|
||||||
GraphicsData.doDestroy();
|
YUVVTXFmt.reset();
|
||||||
|
YUVShaderPipeline.reset();
|
||||||
tjDestroy(TjHandle);
|
tjDestroy(TjHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,18 +424,18 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
||||||
xa0_bufferQueue.reserve(xf0_preLoadFrames);
|
xa0_bufferQueue.reserve(xf0_preLoadFrames);
|
||||||
|
|
||||||
/* All set for GPU resources */
|
/* All set for GPU resources */
|
||||||
m_token = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_blockBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(m_viewVertBlock), 1);
|
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 = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(specter::View::TexShaderVert), 4);
|
||||||
|
|
||||||
boo::IVertexFormat* vtxFmt = YUVVTXFmt;
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = YUVVTXFmt;
|
||||||
if (ctx.bindingNeedsVertexFormat())
|
if (ctx.bindingNeedsVertexFormat())
|
||||||
{
|
{
|
||||||
boo::VertexElementDescriptor texvdescs[] =
|
boo::VertexElementDescriptor texvdescs[] =
|
||||||
{
|
{
|
||||||
{m_vertBuf, nullptr, boo::VertexSemantic::Position4},
|
{m_vertBuf.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{m_vertBuf, nullptr, boo::VertexSemantic::UV4}
|
{m_vertBuf.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmt = ctx.newVertexFormat(2, texvdescs);
|
vtxFmt = ctx.newVertexFormat(2, texvdescs);
|
||||||
}
|
}
|
||||||
|
@ -458,11 +458,11 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
||||||
set.V = ctx.newDynamicTexture(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2,
|
set.V = ctx.newDynamicTexture(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2,
|
||||||
boo::TextureFormat::I8, boo::TextureClampMode::Repeat);
|
boo::TextureFormat::I8, boo::TextureClampMode::Repeat);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {m_blockBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_blockBuf.get()};
|
||||||
for (int j=0 ; j<2 ; ++j)
|
for (int j=0 ; j<2 ; ++j)
|
||||||
{
|
{
|
||||||
boo::ITexture* texs[] = {set.Y[j], set.U, set.V};
|
boo::ObjToken<boo::ITexture> texs[] = {set.Y[j].get(), set.U.get(), set.V.get()};
|
||||||
set.binding[j] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf,
|
set.binding[j] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf.get(),
|
||||||
nullptr, nullptr, 1, bufs, nullptr,
|
nullptr, nullptr, 1, bufs, nullptr,
|
||||||
3, texs, nullptr, nullptr);
|
3, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -477,9 +477,9 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
||||||
set.V = ctx.newDynamicTexture(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2,
|
set.V = ctx.newDynamicTexture(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2,
|
||||||
boo::TextureFormat::I8, boo::TextureClampMode::Repeat);
|
boo::TextureFormat::I8, boo::TextureClampMode::Repeat);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {m_blockBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_blockBuf.get()};
|
||||||
boo::ITexture* texs[] = {set.Y[0], set.U, set.V};
|
boo::ObjToken<boo::ITexture> texs[] = {set.Y[0].get(), set.U.get(), set.V.get()};
|
||||||
set.binding[0] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf,
|
set.binding[0] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf.get(),
|
||||||
nullptr, nullptr, 1, bufs, nullptr,
|
nullptr, nullptr, 1, bufs, nullptr,
|
||||||
3, texs, nullptr, nullptr);
|
3, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -686,9 +686,9 @@ void CMoviePlayer::DrawFrame()
|
||||||
|
|
||||||
/* draw appropriate field */
|
/* draw appropriate field */
|
||||||
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
|
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
|
||||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding
|
CGraphics::SetShaderDataBinding
|
||||||
(tex.binding[m_deinterlace ? (xfc_fieldIndex != 0) : 0]);
|
(tex.binding[m_deinterlace ? (xfc_fieldIndex != 0) : 0]);
|
||||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
|
|
||||||
/* ensure second field is being displayed by VI to signal advance
|
/* ensure second field is being displayed by VI to signal advance
|
||||||
* (faked in urde with continuous xor) */
|
* (faked in urde with continuous xor) */
|
||||||
|
|
|
@ -83,13 +83,13 @@ private:
|
||||||
|
|
||||||
struct CTHPTextureSet
|
struct CTHPTextureSet
|
||||||
{
|
{
|
||||||
boo::ITextureD* Y[2] = {};
|
boo::ObjToken<boo::ITextureD> Y[2];
|
||||||
boo::ITextureD* U = nullptr;
|
boo::ObjToken<boo::ITextureD> U;
|
||||||
boo::ITextureD* V = nullptr;
|
boo::ObjToken<boo::ITextureD> V;
|
||||||
u32 playedSamples = 0;
|
u32 playedSamples = 0;
|
||||||
u32 audioSamples = 0;
|
u32 audioSamples = 0;
|
||||||
std::unique_ptr<s16[]> audioBuf;
|
std::unique_ptr<s16[]> audioBuf;
|
||||||
boo::IShaderDataBinding* binding[2] = {};
|
boo::ObjToken<boo::IShaderDataBinding> binding[2];
|
||||||
};
|
};
|
||||||
std::vector<CTHPTextureSet> x80_textures;
|
std::vector<CTHPTextureSet> x80_textures;
|
||||||
std::unique_ptr<uint8_t[]> x90_requestBuf;
|
std::unique_ptr<uint8_t[]> x90_requestBuf;
|
||||||
|
@ -116,7 +116,6 @@ private:
|
||||||
u32 xf8_ = 0;
|
u32 xf8_ = 0;
|
||||||
u32 xfc_fieldIndex = 0;
|
u32 xfc_fieldIndex = 0;
|
||||||
|
|
||||||
boo::GraphicsDataToken m_token;
|
|
||||||
std::unique_ptr<uint8_t[]> m_yuvBuf;
|
std::unique_ptr<uint8_t[]> m_yuvBuf;
|
||||||
|
|
||||||
union
|
union
|
||||||
|
@ -130,8 +129,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
specter::View::ViewBlock m_viewVertBlock;
|
specter::View::ViewBlock m_viewVertBlock;
|
||||||
boo::IGraphicsBufferD* m_blockBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_blockBuf;
|
||||||
boo::IGraphicsBufferD* m_vertBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vertBuf;
|
||||||
|
|
||||||
specter::View::TexShaderVert m_frame[4];
|
specter::View::TexShaderVert m_frame[4];
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ CRainSplashGenerator::CRainSplashGenerator(const zeus::CVector3f& scale, u32 max
|
||||||
x48_24 = false;
|
x48_24 = false;
|
||||||
x48_25_raining = true;
|
x48_25_raining = true;
|
||||||
x0_rainSplashes.reserve(maxSplashes);
|
x0_rainSplashes.reserve(maxSplashes);
|
||||||
m_gfxTok = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
for (int i=0 ; i<maxSplashes ; ++i)
|
for (int i=0 ; i<maxSplashes ; ++i)
|
||||||
x0_rainSplashes.emplace_back(ctx);
|
x0_rainSplashes.emplace_back(ctx);
|
||||||
|
|
|
@ -58,7 +58,6 @@ class CRainSplashGenerator
|
||||||
u32 x44_genRate;
|
u32 x44_genRate;
|
||||||
bool x48_24 : 1;
|
bool x48_24 : 1;
|
||||||
bool x48_25_raining : 1;
|
bool x48_25_raining : 1;
|
||||||
boo::GraphicsDataToken m_gfxTok;
|
|
||||||
void UpdateRainSplashRange(CStateManager& mgr, int start, int end, float dt);
|
void UpdateRainSplashRange(CStateManager& mgr, int start, int end, float dt);
|
||||||
void UpdateRainSplashes(CStateManager& mgr, float magnitude, float dt);
|
void UpdateRainSplashes(CStateManager& mgr, float magnitude, float dt);
|
||||||
void DoDraw(const zeus::CTransform& xf) const;
|
void DoDraw(const zeus::CTransform& xf) const;
|
||||||
|
|
|
@ -38,7 +38,7 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
|
||||||
{
|
{
|
||||||
if (morphEffect || g_PointGenFunc)
|
if (morphEffect || g_PointGenFunc)
|
||||||
{
|
{
|
||||||
boo::IGraphicsBufferD* vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr);
|
boo::ObjToken<boo::IGraphicsBufferD> vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr);
|
||||||
x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model);
|
x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model);
|
||||||
if (morphEffect)
|
if (morphEffect)
|
||||||
morphEffect->MorphVertices(m_vertWorkspace, morphMagnitudes, x10_skinRules, pose);
|
morphEffect->MorphVertices(m_vertWorkspace, morphMagnitudes, x10_skinRules, pose);
|
||||||
|
|
|
@ -31,9 +31,8 @@ private:
|
||||||
u16 x4_w;
|
u16 x4_w;
|
||||||
u16 x6_h;
|
u16 x6_h;
|
||||||
u32 x8_mips;
|
u32 x8_mips;
|
||||||
boo::GraphicsDataToken m_booToken;
|
boo::ObjToken<boo::ITexture> m_booTex;
|
||||||
boo::ITexture* m_booTex;
|
boo::ObjToken<boo::ITexture> m_paletteTex;
|
||||||
boo::ITexture* m_paletteTex;
|
|
||||||
std::unique_ptr<u8[]> m_otex;
|
std::unique_ptr<u8[]> m_otex;
|
||||||
EFontType m_ftype = EFontType::None;
|
EFontType m_ftype = EFontType::None;
|
||||||
|
|
||||||
|
@ -69,11 +68,11 @@ public:
|
||||||
u16 GetHeight() const {return x6_h;}
|
u16 GetHeight() const {return x6_h;}
|
||||||
u32 GetNumMips() const {return x8_mips;}
|
u32 GetNumMips() const {return x8_mips;}
|
||||||
void Load(int slot, EClampMode clamp) const;
|
void Load(int slot, EClampMode clamp) const;
|
||||||
boo::ITexture* GetBooTexture() const {return m_booTex;}
|
const boo::ObjToken<boo::ITexture>& GetBooTexture() const {return m_booTex;}
|
||||||
boo::ITexture* GetPaletteTexture() const {return m_paletteTex;}
|
const boo::ObjToken<boo::ITexture>& GetPaletteTexture() const {return m_paletteTex;}
|
||||||
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
||||||
std::unique_ptr<u8[]>& paletteOut) const;
|
std::unique_ptr<u8[]>& paletteOut) const;
|
||||||
boo::ITexture* GetFontTexture(EFontType tp);
|
const boo::ObjToken<boo::ITexture>& GetFontTexture(EFontType tp);
|
||||||
};
|
};
|
||||||
|
|
||||||
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag,
|
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag,
|
||||||
|
|
|
@ -112,10 +112,10 @@ void CTexture::BuildI4FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -160,10 +160,10 @@ void CTexture::BuildI8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -209,10 +209,10 @@ void CTexture::BuildIA4FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -258,10 +258,10 @@ void CTexture::BuildIA8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -366,10 +366,10 @@ void CTexture::BuildC4FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -410,10 +410,10 @@ void CTexture::BuildC8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -462,10 +462,10 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -519,10 +519,10 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -576,10 +576,10 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -640,10 +640,10 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT1,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT1,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), blockCount * 8);
|
boo::TextureClampMode::Repeat, buf.get(), blockCount * 8).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -656,10 +656,10 @@ void CTexture::BuildRGBA8(const void* data, size_t length)
|
||||||
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")",
|
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")",
|
||||||
length, expectedSize);
|
length, expectedSize);
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, data, expectedSize);
|
boo::TextureClampMode::Repeat, data, expectedSize).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -671,15 +671,15 @@ void CTexture::BuildC8(const void* data, size_t length)
|
||||||
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")",
|
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")",
|
||||||
length, texelCount);
|
length, texelCount);
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
||||||
const u8* paletteTexels = reinterpret_cast<const u8*>(data) + 4;
|
const u8* paletteTexels = reinterpret_cast<const u8*>(data) + 4;
|
||||||
const u8* texels = reinterpret_cast<const u8*>(data) + 4 + nentries * 4;
|
const u8* texels = reinterpret_cast<const u8*>(data) + 4 + nentries * 4;
|
||||||
m_paletteTex = ctx.newStaticTexture(nentries, 1, 1, boo::TextureFormat::RGBA8,
|
m_paletteTex = ctx.newStaticTexture(nentries, 1, 1, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, paletteTexels, nentries * 4);
|
boo::TextureClampMode::Repeat, paletteTexels, nentries * 4).get();
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::I8,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::I8,
|
||||||
boo::TextureClampMode::Repeat, texels, texelCount);
|
boo::TextureClampMode::Repeat, texels, texelCount).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -778,10 +778,10 @@ void CTexture::BuildC8Font(const void* data, EFontType ftype)
|
||||||
h /= 2;
|
h /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_booToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_booTex = ctx.newStaticArrayTexture(x4_w, x6_h, layerCount, x8_mips, boo::TextureFormat::RGBA8,
|
m_booTex = ctx.newStaticArrayTexture(x4_w, x6_h, layerCount, x8_mips, boo::TextureFormat::RGBA8,
|
||||||
boo::TextureClampMode::Repeat, buf.get(), texelCount * layerCount * 4);
|
boo::TextureClampMode::Repeat, buf.get(), texelCount * layerCount * 4).get();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -977,7 +977,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::ITexture* CTexture::GetFontTexture(EFontType tp)
|
const boo::ObjToken<boo::ITexture>& CTexture::GetFontTexture(EFontType tp)
|
||||||
{
|
{
|
||||||
if (m_ftype != tp && x0_fmt == ETexelFormat::C8PC)
|
if (m_ftype != tp && x0_fmt == ETexelFormat::C8PC)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace urde
|
||||||
CAABoxShader::CAABoxShader(bool zOnly)
|
CAABoxShader::CAABoxShader(bool zOnly)
|
||||||
: m_zOnly(zOnly)
|
: m_zOnly(zOnly)
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector3f), 34);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector3f), 34);
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
|
@ -69,12 +69,10 @@ void CAABoxShader::draw(const zeus::CColor& color)
|
||||||
m_uniform.m_color = color;
|
m_uniform.m_color = color;
|
||||||
m_uniBuf->load(&m_uniform, sizeof(Uniform));
|
m_uniBuf->load(&m_uniform, sizeof(Uniform));
|
||||||
|
|
||||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
CGraphics::SetShaderDataBinding(m_dataBind);
|
||||||
CGraphics::g_BooMainCommandQueue->draw(0, 34);
|
CGraphics::DrawArray(0, 34);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAABoxShader::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CAABoxShader)
|
URDE_SPECIALIZE_SHADER(CAABoxShader)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,9 @@ class CAABoxShader
|
||||||
zeus::CMatrix4f m_xf;
|
zeus::CMatrix4f m_xf;
|
||||||
zeus::CColor m_color;
|
zeus::CColor m_color;
|
||||||
};
|
};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
bool m_zOnly;
|
bool m_zOnly;
|
||||||
|
|
||||||
|
|
|
@ -44,25 +44,25 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CAABoxShader)
|
URDE_DECL_SPECIALIZE_SHADER(CAABoxShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
static boo::IShaderPipeline* s_zOnlyPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_zOnlyPipeline;
|
||||||
|
|
||||||
struct CAABoxShaderGLDataBindingFactory : TShader<CAABoxShader>::IDataBindingFactory
|
struct CAABoxShaderGLDataBindingFactory : TShader<CAABoxShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CAABoxShader& filter)
|
CAABoxShader& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
return cctx.newShaderDataBinding(filter.m_zOnly ? s_zOnlyPipeline : s_Pipeline,
|
return cctx.newShaderDataBinding(filter.m_zOnly ? s_zOnlyPipeline : s_Pipeline,
|
||||||
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -95,6 +95,13 @@ TShader<CAABoxShader>::IDataBindingFactory* CAABoxShader::Initialize(boo::GLData
|
||||||
return new CAABoxShaderGLDataBindingFactory;
|
return new CAABoxShaderGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CAABoxShader::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
s_zOnlyPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CAABoxShader>::IDataBindingFactory* CAABoxShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
TShader<CAABoxShader>::IDataBindingFactory* CAABoxShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,20 +48,20 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CAABoxShader)
|
URDE_DECL_SPECIALIZE_SHADER(CAABoxShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
static boo::IShaderPipeline* s_zOnlyPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_zOnlyPipeline;
|
||||||
|
|
||||||
struct CAABoxShaderMetalDataBindingFactory : TShader<CAABoxShader>::IDataBindingFactory
|
struct CAABoxShaderMetalDataBindingFactory : TShader<CAABoxShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CAABoxShader& filter)
|
CAABoxShader& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
return cctx.newShaderDataBinding(filter.m_zOnly ? s_zOnlyPipeline : s_Pipeline, s_VtxFmt,
|
return cctx.newShaderDataBinding(filter.m_zOnly ? s_zOnlyPipeline : s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -73,13 +73,23 @@ TShader<CAABoxShader>::IDataBindingFactory* CAABoxShader::Initialize(boo::MetalD
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, true, true, false, boo::CullMode::None);
|
boo::ZTest::LEqual, true, true, false, boo::CullMode::None);
|
||||||
s_zOnlyPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_zOnlyPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, true, false, false, boo::CullMode::None);
|
boo::ZTest::LEqual, true, false, false, boo::CullMode::None);
|
||||||
return new CAABoxShaderMetalDataBindingFactory;
|
return new CAABoxShaderMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CAABoxShader::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
s_zOnlyPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace urde
|
||||||
|
|
||||||
CCameraBlurFilter::CCameraBlurFilter()
|
CCameraBlurFilter::CCameraBlurFilter()
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
|
@ -55,12 +55,10 @@ void CCameraBlurFilter::draw(float amount)
|
||||||
m_uniform.m_opacity = std::min(amount / 2.f, 1.f);
|
m_uniform.m_opacity = std::min(amount / 2.f, 1.f);
|
||||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||||
|
|
||||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
CGraphics::SetShaderDataBinding(m_dataBind);
|
||||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCameraBlurFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CCameraBlurFilter)
|
URDE_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,9 @@ class CCameraBlurFilter
|
||||||
zeus::CVector4f m_uv[6];
|
zeus::CVector4f m_uv[6];
|
||||||
float m_opacity = 1.f;
|
float m_opacity = 1.f;
|
||||||
};
|
};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -79,26 +79,26 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CCameraBlurFilter& filter)
|
CCameraBlurFilter& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
|
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get()};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline,
|
return cctx.newShaderDataBinding(s_Pipeline,
|
||||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -130,6 +130,12 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
|
||||||
return new CCameraBlurFilterGLDataBindingFactory;
|
return new CCameraBlurFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CCameraBlurFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,20 +90,20 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CCameraBlurFilterMetalDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
struct CCameraBlurFilterMetalDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CCameraBlurFilter& filter)
|
CCameraBlurFilter& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
|
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get()};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -116,10 +116,18 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
return new CCameraBlurFilterMetalDataBindingFactory;
|
return new CCameraBlurFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CCameraBlurFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace urde
|
||||||
|
|
||||||
CColoredQuadFilter::CColoredQuadFilter(EFilterType type)
|
CColoredQuadFilter::CColoredQuadFilter(EFilterType type)
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
struct Vert
|
struct Vert
|
||||||
{
|
{
|
||||||
|
@ -88,8 +88,6 @@ void CWideScreenFilter::SetViewportToFull()
|
||||||
CGraphics::g_BooMainCommandQueue->setViewport(rect);
|
CGraphics::g_BooMainCommandQueue->setViewport(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CColoredQuadFilter::Shutdown() {}
|
|
||||||
|
|
||||||
const zeus::CRectangle CColoredQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
const zeus::CRectangle CColoredQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
||||||
|
|
||||||
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||||
|
|
|
@ -22,10 +22,9 @@ class CColoredQuadFilter
|
||||||
zeus::CMatrix4f m_matrix;
|
zeus::CMatrix4f m_matrix;
|
||||||
zeus::CColor m_color;
|
zeus::CColor m_color;
|
||||||
};
|
};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -43,12 +43,12 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -59,26 +59,25 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CColoredQuadFilter& filter)
|
||||||
CColoredQuadFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type),
|
return cctx.newShaderDataBinding(SelectPipeline(type),
|
||||||
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -116,6 +115,14 @@ CColoredQuadFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CColoredQuadFilterGLDataBindingFactory;
|
return new CColoredQuadFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CColoredQuadFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory*
|
TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory*
|
||||||
CColoredQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CColoredQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -47,12 +47,12 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -63,21 +63,20 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CColoredQuadFilterMetalDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
struct CColoredQuadFilterMetalDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CColoredQuadFilter& filter)
|
||||||
CColoredQuadFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -90,16 +89,28 @@ CColoredQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AddPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
s_MultPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
return new CColoredQuadFilterMetalDataBindingFactory;
|
return new CColoredQuadFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CColoredQuadFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,37 +4,37 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texZTestZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texNoZTestZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texZTestNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestNoZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texNoZTestNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestNoZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texAdditiveZTest = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texAdditiveZTest;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texAdditiveNoZTest = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texAdditiveNoZTest;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texRedToAlphaZTest = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaZTest;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texRedToAlphaNoZTest = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaNoZTest;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texZTestNoZWriteSub = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestNoZWriteSub;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texNoZTestNoZWriteSub = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestNoZWriteSub;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texRedToAlphaZTestSub = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaZTestSub;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_texRedToAlphaNoZTestSub = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaNoZTestSub;
|
||||||
|
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_indTexZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_indTexNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexNoZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_indTexAdditive = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexAdditive;
|
||||||
|
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_cindTexZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_cindTexNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexNoZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_cindTexAdditive = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexAdditive;
|
||||||
|
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_noTexZTestZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexZTestZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_noTexNoZTestZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexNoZTestZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_noTexZTestNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexZTestNoZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_noTexNoZTestNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexNoZTestNoZWrite;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_noTexAdditiveZTest = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexAdditiveZTest;
|
||||||
boo::IShaderPipeline* CElementGenShaders::m_noTexAdditiveNoZTest = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexAdditiveNoZTest;
|
||||||
|
|
||||||
boo::IVertexFormat* CElementGenShaders::m_vtxFormatTex = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CElementGenShaders::m_vtxFormatTex;
|
||||||
boo::IVertexFormat* CElementGenShaders::m_vtxFormatIndTex = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CElementGenShaders::m_vtxFormatIndTex;
|
||||||
boo::IVertexFormat* CElementGenShaders::m_vtxFormatNoTex = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CElementGenShaders::m_vtxFormatNoTex;
|
||||||
|
|
||||||
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen)
|
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen)
|
||||||
{
|
{
|
||||||
|
@ -54,12 +54,12 @@ CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen&
|
||||||
void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, 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::ObjToken<boo::IShaderPipeline> regPipeline;
|
||||||
boo::IShaderPipeline* regPipelineSub = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> regPipelineSub;
|
||||||
boo::IShaderPipeline* redToAlphaPipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipeline;
|
||||||
boo::IShaderPipeline* redToAlphaPipelineSub = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipelineSub;
|
||||||
boo::IShaderPipeline* regPipelinePmus = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> regPipelinePmus;
|
||||||
boo::IShaderPipeline* redToAlphaPipelinePmus = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipelinePmus;
|
||||||
|
|
||||||
if (desc->x54_x40_TEXR)
|
if (desc->x54_x40_TEXR)
|
||||||
{
|
{
|
||||||
|
@ -183,8 +183,6 @@ void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Conte
|
||||||
TShader<CElementGenShaders>::BuildShaderDataBinding(ctx, shad);
|
TShader<CElementGenShaders>::BuildShaderDataBinding(ctx, shad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CElementGenShaders::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CElementGenShaders)
|
URDE_SPECIALIZE_SHADER(CElementGenShaders)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,52 +27,52 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static boo::IShaderPipeline* m_texZTestZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texZTestZWrite;
|
||||||
static boo::IShaderPipeline* m_texNoZTestZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestZWrite;
|
||||||
static boo::IShaderPipeline* m_texZTestNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texZTestNoZWrite;
|
||||||
static boo::IShaderPipeline* m_texNoZTestNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestNoZWrite;
|
||||||
static boo::IShaderPipeline* m_texAdditiveZTest;
|
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZTest;
|
||||||
static boo::IShaderPipeline* m_texAdditiveNoZTest;
|
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveNoZTest;
|
||||||
static boo::IShaderPipeline* m_texRedToAlphaZTest;
|
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaZTest;
|
||||||
static boo::IShaderPipeline* m_texRedToAlphaNoZTest;
|
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaNoZTest;
|
||||||
static boo::IShaderPipeline* m_texZTestNoZWriteSub;
|
static boo::ObjToken<boo::IShaderPipeline> m_texZTestNoZWriteSub;
|
||||||
static boo::IShaderPipeline* m_texNoZTestNoZWriteSub;
|
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestNoZWriteSub;
|
||||||
static boo::IShaderPipeline* m_texRedToAlphaZTestSub;
|
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaZTestSub;
|
||||||
static boo::IShaderPipeline* m_texRedToAlphaNoZTestSub;
|
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaNoZTestSub;
|
||||||
|
|
||||||
static boo::IShaderPipeline* m_indTexZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_indTexZWrite;
|
||||||
static boo::IShaderPipeline* m_indTexNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_indTexNoZWrite;
|
||||||
static boo::IShaderPipeline* m_indTexAdditive;
|
static boo::ObjToken<boo::IShaderPipeline> m_indTexAdditive;
|
||||||
|
|
||||||
static boo::IShaderPipeline* m_cindTexZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_cindTexZWrite;
|
||||||
static boo::IShaderPipeline* m_cindTexNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_cindTexNoZWrite;
|
||||||
static boo::IShaderPipeline* m_cindTexAdditive;
|
static boo::ObjToken<boo::IShaderPipeline> m_cindTexAdditive;
|
||||||
|
|
||||||
static boo::IShaderPipeline* m_noTexZTestZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexZTestZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexNoZTestZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZTestZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexZTestNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexZTestNoZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexNoZTestNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZTestNoZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexAdditiveZTest;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZTest;
|
||||||
static boo::IShaderPipeline* m_noTexAdditiveNoZTest;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveNoZTest;
|
||||||
|
|
||||||
static boo::IVertexFormat* m_vtxFormatTex; /* No OpenGL */
|
static boo::ObjToken<boo::IVertexFormat> m_vtxFormatTex; /* No OpenGL */
|
||||||
static boo::IVertexFormat* m_vtxFormatIndTex; /* No OpenGL */
|
static boo::ObjToken<boo::IVertexFormat> m_vtxFormatIndTex; /* No OpenGL */
|
||||||
static boo::IVertexFormat* m_vtxFormatNoTex; /* No OpenGL */
|
static boo::ObjToken<boo::IVertexFormat> m_vtxFormatNoTex; /* No OpenGL */
|
||||||
|
|
||||||
CElementGen& m_gen;
|
CElementGen& m_gen;
|
||||||
boo::IShaderPipeline* m_regPipeline;
|
boo::ObjToken<boo::IShaderPipeline> m_regPipeline;
|
||||||
boo::IShaderPipeline* m_regPipelineSub;
|
boo::ObjToken<boo::IShaderPipeline> m_regPipelineSub;
|
||||||
boo::IShaderPipeline* m_redToAlphaPipeline;
|
boo::ObjToken<boo::IShaderPipeline> m_redToAlphaPipeline;
|
||||||
boo::IShaderPipeline* m_redToAlphaPipelineSub;
|
boo::ObjToken<boo::IShaderPipeline> m_redToAlphaPipelineSub;
|
||||||
boo::IShaderPipeline* m_regPipelinePmus;
|
boo::ObjToken<boo::IShaderPipeline> m_regPipelinePmus;
|
||||||
boo::IShaderPipeline* m_redToAlphaPipelinePmus;
|
boo::ObjToken<boo::IShaderPipeline> m_redToAlphaPipelinePmus;
|
||||||
CElementGenShaders(CElementGen& gen,
|
CElementGenShaders(CElementGen& gen,
|
||||||
boo::IShaderPipeline* regPipeline,
|
const boo::ObjToken<boo::IShaderPipeline>& regPipeline,
|
||||||
boo::IShaderPipeline* regPipelineSub,
|
const boo::ObjToken<boo::IShaderPipeline>& regPipelineSub,
|
||||||
boo::IShaderPipeline* redToAlphaPipeline,
|
const boo::ObjToken<boo::IShaderPipeline>& redToAlphaPipeline,
|
||||||
boo::IShaderPipeline* redToAlphaPipelineSub,
|
const boo::ObjToken<boo::IShaderPipeline>& redToAlphaPipelineSub,
|
||||||
boo::IShaderPipeline* regPipelinePmus,
|
const boo::ObjToken<boo::IShaderPipeline>& regPipelinePmus,
|
||||||
boo::IShaderPipeline* redToAlphaPipelinePmus)
|
const boo::ObjToken<boo::IShaderPipeline>& redToAlphaPipelinePmus)
|
||||||
: m_gen(gen), m_regPipeline(regPipeline), m_regPipelineSub(regPipelineSub),
|
: m_gen(gen), m_regPipeline(regPipeline), m_regPipelineSub(regPipelineSub),
|
||||||
m_redToAlphaPipeline(redToAlphaPipeline), m_redToAlphaPipelineSub(redToAlphaPipelineSub),
|
m_redToAlphaPipeline(redToAlphaPipeline), m_redToAlphaPipelineSub(redToAlphaPipelineSub),
|
||||||
m_regPipelinePmus(regPipelinePmus), m_redToAlphaPipelinePmus(redToAlphaPipelinePmus) {}
|
m_regPipelinePmus(regPipelinePmus), m_redToAlphaPipelinePmus(redToAlphaPipelinePmus) {}
|
||||||
|
|
|
@ -192,18 +192,18 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
|
struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CElementGenShaders& shaders)
|
CElementGenShaders& shaders)
|
||||||
{
|
{
|
||||||
CElementGen& gen = shaders.m_gen;
|
CElementGen& gen = shaders.m_gen;
|
||||||
CGenDescription* desc = gen.GetDesc();
|
CGenDescription* desc = gen.GetDesc();
|
||||||
|
|
||||||
boo::IVertexFormat* vtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> vtxFmt;
|
||||||
boo::IVertexFormat* vtxFmtPmus = nullptr;
|
boo::ObjToken<boo::IVertexFormat> vtxFmtPmus;
|
||||||
CUVElement* texr = desc->x54_x40_TEXR.get();
|
CUVElement* texr = desc->x54_x40_TEXR.get();
|
||||||
CUVElement* tind = desc->x58_x44_TIND.get();
|
CUVElement* tind = desc->x58_x44_TIND.get();
|
||||||
int texCount = 0;
|
int texCount = 0;
|
||||||
boo::ITexture* textures[3];
|
boo::ObjToken<boo::ITexture> textures[3];
|
||||||
|
|
||||||
if (texr)
|
if (texr)
|
||||||
{
|
{
|
||||||
|
@ -213,22 +213,22 @@ struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
|
||||||
{
|
{
|
||||||
if (tind)
|
if (tind)
|
||||||
{
|
{
|
||||||
textures[1] = CGraphics::g_SpareTexture;
|
textures[1] = CGraphics::g_SpareTexture.get();
|
||||||
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
|
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
|
||||||
texCount = 3;
|
texCount = 3;
|
||||||
|
|
||||||
const boo::VertexElementDescriptor TexFmtIndTex[] =
|
const boo::VertexElementDescriptor TexFmtIndTex[] =
|
||||||
{
|
{
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4},
|
||||||
};
|
};
|
||||||
vtxFmt = ctx.newVertexFormat(10, TexFmtIndTex);
|
vtxFmt = ctx.newVertexFormat(10, TexFmtIndTex);
|
||||||
}
|
}
|
||||||
|
@ -236,15 +236,15 @@ struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor TexFmtTex[] =
|
const boo::VertexElementDescriptor TexFmtTex[] =
|
||||||
{
|
{
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
|
||||||
};
|
};
|
||||||
vtxFmt = ctx.newVertexFormat(9, TexFmtTex);
|
vtxFmt = ctx.newVertexFormat(9, TexFmtTex);
|
||||||
}
|
}
|
||||||
|
@ -253,15 +253,15 @@ struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor TexFmtTex[] =
|
const boo::VertexElementDescriptor TexFmtTex[] =
|
||||||
{
|
{
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}
|
||||||
};
|
};
|
||||||
vtxFmtPmus = ctx.newVertexFormat(9, TexFmtTex);
|
vtxFmtPmus = ctx.newVertexFormat(9, TexFmtTex);
|
||||||
}
|
}
|
||||||
|
@ -272,11 +272,11 @@ struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor TexFmtNoTex[] =
|
const boo::VertexElementDescriptor TexFmtNoTex[] =
|
||||||
{
|
{
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{gen.m_instBuf, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
|
{gen.m_instBuf.get(), nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
|
||||||
};
|
};
|
||||||
vtxFmt = ctx.newVertexFormat(5, TexFmtNoTex);
|
vtxFmt = ctx.newVertexFormat(5, TexFmtNoTex);
|
||||||
}
|
}
|
||||||
|
@ -284,11 +284,11 @@ struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor TexFmtNoTex[] =
|
const boo::VertexElementDescriptor TexFmtNoTex[] =
|
||||||
{
|
{
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
{gen.m_instBufPmus, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
|
{gen.m_instBufPmus.get(), nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}
|
||||||
};
|
};
|
||||||
vtxFmtPmus = ctx.newVertexFormat(5, TexFmtNoTex);
|
vtxFmtPmus = ctx.newVertexFormat(5, TexFmtNoTex);
|
||||||
}
|
}
|
||||||
|
@ -296,38 +296,38 @@ struct OGLElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
|
||||||
|
|
||||||
if (gen.m_instBuf)
|
if (gen.m_instBuf)
|
||||||
{
|
{
|
||||||
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||||
|
|
||||||
if (shaders.m_regPipeline)
|
if (shaders.m_regPipeline)
|
||||||
gen.m_normalDataBind = ctx.newShaderDataBinding(shaders.m_regPipeline, vtxFmt, nullptr,
|
gen.m_normalDataBind = ctx.newShaderDataBinding(shaders.m_regPipeline, vtxFmt, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shaders.m_regPipelineSub)
|
if (shaders.m_regPipelineSub)
|
||||||
gen.m_normalSubDataBind = ctx.newShaderDataBinding(shaders.m_regPipelineSub, vtxFmt, nullptr,
|
gen.m_normalSubDataBind = ctx.newShaderDataBinding(shaders.m_regPipelineSub, vtxFmt, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shaders.m_redToAlphaPipeline)
|
if (shaders.m_redToAlphaPipeline)
|
||||||
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipeline, vtxFmt, nullptr,
|
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipeline, vtxFmt, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shaders.m_redToAlphaPipelineSub)
|
if (shaders.m_redToAlphaPipelineSub)
|
||||||
gen.m_redToAlphaSubDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelineSub, vtxFmt, nullptr,
|
gen.m_redToAlphaSubDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelineSub, vtxFmt, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen.m_instBufPmus)
|
if (gen.m_instBufPmus)
|
||||||
{
|
{
|
||||||
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBufPmus};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBufPmus.get()};
|
||||||
texCount = std::min(texCount, 1);
|
texCount = std::min(texCount, 1);
|
||||||
|
|
||||||
if (shaders.m_regPipelinePmus)
|
if (shaders.m_regPipelinePmus)
|
||||||
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(shaders.m_regPipelinePmus, vtxFmtPmus, nullptr,
|
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(shaders.m_regPipelinePmus, vtxFmtPmus, nullptr,
|
||||||
gen.m_instBufPmus, nullptr, 1, uniforms,
|
gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shaders.m_redToAlphaPipelinePmus)
|
if (shaders.m_redToAlphaPipelinePmus)
|
||||||
gen.m_redToAlphaDataBindPmus = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelinePmus, vtxFmtPmus, nullptr,
|
gen.m_redToAlphaDataBindPmus = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelinePmus, vtxFmtPmus, nullptr,
|
||||||
gen.m_instBufPmus, nullptr, 1, uniforms,
|
gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,6 +449,38 @@ TShader<CElementGenShaders>::IDataBindingFactory* CElementGenShaders::Initialize
|
||||||
return new struct OGLElementDataBindingFactory;
|
return new struct OGLElementDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CElementGenShaders::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
m_texZTestZWrite.reset();
|
||||||
|
m_texNoZTestZWrite.reset();
|
||||||
|
m_texZTestNoZWrite.reset();
|
||||||
|
m_texNoZTestNoZWrite.reset();
|
||||||
|
m_texAdditiveZTest.reset();
|
||||||
|
m_texAdditiveNoZTest.reset();
|
||||||
|
m_texRedToAlphaZTest.reset();
|
||||||
|
m_texRedToAlphaNoZTest.reset();
|
||||||
|
m_texZTestNoZWriteSub.reset();
|
||||||
|
m_texNoZTestNoZWriteSub.reset();
|
||||||
|
m_texRedToAlphaZTestSub.reset();
|
||||||
|
m_texRedToAlphaNoZTestSub.reset();
|
||||||
|
|
||||||
|
m_indTexZWrite.reset();
|
||||||
|
m_indTexNoZWrite.reset();
|
||||||
|
m_indTexAdditive.reset();
|
||||||
|
|
||||||
|
m_cindTexZWrite.reset();
|
||||||
|
m_cindTexNoZWrite.reset();
|
||||||
|
m_cindTexAdditive.reset();
|
||||||
|
|
||||||
|
m_noTexZTestZWrite.reset();
|
||||||
|
m_noTexNoZTestZWrite.reset();
|
||||||
|
m_noTexZTestNoZWrite.reset();
|
||||||
|
m_noTexNoZTestNoZWrite.reset();
|
||||||
|
m_noTexAdditiveZTest.reset();
|
||||||
|
m_noTexAdditiveNoZTest.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
struct VulkanElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
|
struct VulkanElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
|
|
|
@ -210,7 +210,7 @@ static const char* FS_METAL_NOTEX =
|
||||||
|
|
||||||
struct MetalElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
|
struct MetalElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CElementGenShaders& shader)
|
CElementGenShaders& shader)
|
||||||
{
|
{
|
||||||
CElementGen& gen = shader.m_gen;
|
CElementGen& gen = shader.m_gen;
|
||||||
|
@ -219,7 +219,7 @@ struct MetalElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindin
|
||||||
CUVElement* texr = desc->x54_x40_TEXR.get();
|
CUVElement* texr = desc->x54_x40_TEXR.get();
|
||||||
CUVElement* tind = desc->x58_x44_TIND.get();
|
CUVElement* tind = desc->x58_x44_TIND.get();
|
||||||
int texCount = 0;
|
int texCount = 0;
|
||||||
boo::ITexture* textures[3];
|
boo::ObjToken<boo::ITexture> textures[3];
|
||||||
|
|
||||||
if (texr)
|
if (texr)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +227,7 @@ struct MetalElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindin
|
||||||
texCount = 1;
|
texCount = 1;
|
||||||
if (tind)
|
if (tind)
|
||||||
{
|
{
|
||||||
textures[1] = CGraphics::g_SpareTexture;
|
textures[1] = CGraphics::g_SpareTexture.get();
|
||||||
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
|
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
|
||||||
texCount = 3;
|
texCount = 3;
|
||||||
}
|
}
|
||||||
|
@ -235,42 +235,42 @@ struct MetalElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindin
|
||||||
|
|
||||||
if (gen.m_instBuf)
|
if (gen.m_instBuf)
|
||||||
{
|
{
|
||||||
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||||
|
|
||||||
if (shader.m_regPipeline)
|
if (shader.m_regPipeline)
|
||||||
gen.m_normalDataBind = ctx.newShaderDataBinding(shader.m_regPipeline, nullptr, nullptr,
|
gen.m_normalDataBind = ctx.newShaderDataBinding(shader.m_regPipeline, nullptr, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shader.m_regPipelineSub)
|
if (shader.m_regPipelineSub)
|
||||||
gen.m_normalSubDataBind = ctx.newShaderDataBinding(shader.m_regPipelineSub, nullptr, nullptr,
|
gen.m_normalSubDataBind = ctx.newShaderDataBinding(shader.m_regPipelineSub, nullptr, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shader.m_redToAlphaPipeline)
|
if (shader.m_redToAlphaPipeline)
|
||||||
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(shader.m_redToAlphaPipeline, nullptr, nullptr,
|
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(shader.m_redToAlphaPipeline, nullptr, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shader.m_redToAlphaPipelineSub)
|
if (shader.m_redToAlphaPipelineSub)
|
||||||
gen.m_redToAlphaSubDataBind = ctx.newShaderDataBinding(shader.m_redToAlphaPipelineSub, nullptr, nullptr,
|
gen.m_redToAlphaSubDataBind = ctx.newShaderDataBinding(shader.m_redToAlphaPipelineSub, nullptr, nullptr,
|
||||||
gen.m_instBuf, nullptr, 1, uniforms,
|
gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen.m_instBufPmus)
|
if (gen.m_instBufPmus)
|
||||||
{
|
{
|
||||||
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBufPmus};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBufPmus.get()};
|
||||||
texCount = std::min(texCount, 1);
|
texCount = std::min(texCount, 1);
|
||||||
|
|
||||||
if (shader.m_regPipelinePmus)
|
if (shader.m_regPipelinePmus)
|
||||||
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(shader.m_regPipelinePmus, nullptr, nullptr,
|
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(shader.m_regPipelinePmus, nullptr, nullptr,
|
||||||
gen.m_instBufPmus, nullptr, 1, uniforms,
|
gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (shader.m_redToAlphaPipelinePmus)
|
if (shader.m_redToAlphaPipelinePmus)
|
||||||
gen.m_redToAlphaDataBindPmus = ctx.newShaderDataBinding(shader.m_redToAlphaPipelinePmus, nullptr, nullptr,
|
gen.m_redToAlphaDataBindPmus = ctx.newShaderDataBinding(shader.m_redToAlphaPipelinePmus, nullptr, nullptr,
|
||||||
gen.m_instBufPmus, nullptr, 1, uniforms,
|
gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -315,116 +315,152 @@ TShader<CElementGenShaders>::IDataBindingFactory* CElementGenShaders::Initialize
|
||||||
};
|
};
|
||||||
m_vtxFormatNoTex = ctx.newVertexFormat(5, TexFmtNoTex);
|
m_vtxFormatNoTex = ctx.newVertexFormat(5, TexFmtNoTex);
|
||||||
|
|
||||||
m_texZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
||||||
m_texNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
m_texZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
m_texAdditiveZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texAdditiveZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, m_vtxFormatTex,
|
m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, m_vtxFormatTex,
|
m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
m_texZTestNoZWriteSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texZTestNoZWriteSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_texNoZTestNoZWriteSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
|
m_texNoZTestNoZWriteSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false,
|
boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
|
|
||||||
m_texRedToAlphaZTestSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, m_vtxFormatTex,
|
m_texRedToAlphaZTestSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_texRedToAlphaNoZTestSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, m_vtxFormatTex,
|
m_texRedToAlphaNoZTestSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false,
|
boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
|
|
||||||
m_indTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
|
m_indTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
m_indTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
|
m_indTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
m_indTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
|
m_indTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
m_cindTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, m_vtxFormatIndTex,
|
m_cindTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
m_cindTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, m_vtxFormatIndTex,
|
m_cindTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
m_cindTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, m_vtxFormatIndTex,
|
m_cindTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
m_noTexZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
|
m_noTexZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
||||||
m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
|
m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
|
m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
|
m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
|
m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_vtxFormatNoTex,
|
m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||||
CGraphics::g_ViewportSamples,
|
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
return new struct MetalElementDataBindingFactory;
|
return new struct MetalElementDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CElementGenShaders::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
m_texZTestZWrite.reset();
|
||||||
|
m_texNoZTestZWrite.reset();
|
||||||
|
m_texZTestNoZWrite.reset();
|
||||||
|
m_texNoZTestNoZWrite.reset();
|
||||||
|
m_texAdditiveZTest.reset();
|
||||||
|
m_texAdditiveNoZTest.reset();
|
||||||
|
m_texRedToAlphaZTest.reset();
|
||||||
|
m_texRedToAlphaNoZTest.reset();
|
||||||
|
m_texZTestNoZWriteSub.reset();
|
||||||
|
m_texNoZTestNoZWriteSub.reset();
|
||||||
|
m_texRedToAlphaZTestSub.reset();
|
||||||
|
m_texRedToAlphaNoZTestSub.reset();
|
||||||
|
|
||||||
|
m_indTexZWrite.reset();
|
||||||
|
m_indTexNoZWrite.reset();
|
||||||
|
m_indTexAdditive.reset();
|
||||||
|
|
||||||
|
m_cindTexZWrite.reset();
|
||||||
|
m_cindTexNoZWrite.reset();
|
||||||
|
m_cindTexAdditive.reset();
|
||||||
|
|
||||||
|
m_noTexZTestZWrite.reset();
|
||||||
|
m_noTexNoZTestZWrite.reset();
|
||||||
|
m_noTexZTestNoZWrite.reset();
|
||||||
|
m_noTexNoZTestNoZWrite.reset();
|
||||||
|
m_noTexAdditiveZTest.reset();
|
||||||
|
m_noTexAdditiveNoZTest.reset();
|
||||||
|
|
||||||
|
m_vtxFormatTex.reset();
|
||||||
|
m_vtxFormatIndTex.reset();
|
||||||
|
m_vtxFormatNoTex.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
|
||||||
{
|
{
|
||||||
m_maxVerts = totalVerts;
|
m_maxVerts = totalVerts;
|
||||||
m_tex = tex;
|
m_tex = tex;
|
||||||
m_token = CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), m_maxVerts);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), m_maxVerts);
|
||||||
for (int i=0 ; i<3 ; ++i)
|
for (int i=0 ; i<3 ; ++i)
|
||||||
|
@ -77,6 +77,4 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CEnergyBarShader)
|
URDE_SPECIALIZE_SHADER(CEnergyBarShader)
|
||||||
|
|
||||||
void CEnergyBarShader::Shutdown() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,9 @@ private:
|
||||||
zeus::CMatrix4f m_matrix;
|
zeus::CMatrix4f m_matrix;
|
||||||
zeus::CColor m_color;
|
zeus::CColor m_color;
|
||||||
};
|
};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf[3];
|
||||||
boo::IGraphicsBufferD* m_uniBuf[3];
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind[3];
|
||||||
boo::IShaderDataBinding* m_dataBind[3];
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
const CTexture* m_tex = nullptr;
|
const CTexture* m_tex = nullptr;
|
||||||
size_t m_maxVerts = 0;
|
size_t m_maxVerts = 0;
|
||||||
|
|
|
@ -50,30 +50,30 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
|
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CEnergyBarShaderGLDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
|
struct CEnergyBarShaderGLDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CEnergyBarShader& filter)
|
CEnergyBarShader& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
boo::IGraphicsBuffer* bufs[1];
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[1];
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
|
||||||
for (int i=0 ; i<3 ; ++i)
|
for (int i=0 ; i<3 ; ++i)
|
||||||
{
|
{
|
||||||
bufs[0] = filter.m_uniBuf[i];
|
bufs[0] = filter.m_uniBuf[i].get();
|
||||||
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline,
|
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline,
|
||||||
vtxFmt, filter.m_vbo, nullptr, nullptr,
|
vtxFmt, filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
return filter.m_dataBind[0];
|
return filter.m_dataBind[0];
|
||||||
|
@ -113,6 +113,12 @@ CEnergyBarShader::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CEnergyBarShaderGLDataBindingFactory;
|
return new CEnergyBarShaderGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CEnergyBarShader::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CEnergyBarShader>::IDataBindingFactory*
|
TShader<CEnergyBarShader>::IDataBindingFactory*
|
||||||
CEnergyBarShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CEnergyBarShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -54,23 +54,23 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
|
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CEnergyBarShaderMetalDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
|
struct CEnergyBarShaderMetalDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CEnergyBarShader& filter)
|
CEnergyBarShader& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[1];
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[1];
|
||||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
|
||||||
for (int i=0 ; i<3 ; ++i)
|
for (int i=0 ; i<3 ; ++i)
|
||||||
{
|
{
|
||||||
bufs[0] = filter.m_uniBuf[i];
|
bufs[0] = filter.m_uniBuf[i].get();
|
||||||
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
return filter.m_dataBind[0];
|
return filter.m_dataBind[0];
|
||||||
|
@ -86,11 +86,19 @@ CEnergyBarShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual,
|
||||||
false, true, false, boo::CullMode::None);
|
false, true, false, boo::CullMode::None);
|
||||||
return new CEnergyBarShaderMetalDataBindingFactory;
|
return new CEnergyBarShaderMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CEnergyBarShader::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,38 +89,38 @@ u16 CFluidPlaneShader::Cache::MakeCacheKey(const SFluidPlaneDoorShaderInfo& info
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
boo::IShaderPipeline* CFluidPlaneShader::Cache::GetOrBuildShader(const T& info)
|
boo::ObjToken<boo::IShaderPipeline> CFluidPlaneShader::Cache::GetOrBuildShader(const T& info)
|
||||||
{
|
{
|
||||||
u16 key = MakeCacheKey(info);
|
u16 key = MakeCacheKey(info);
|
||||||
auto& slot = CacheSlot(info, key);
|
auto& slot = CacheSlot(info, key);
|
||||||
if (slot.second != nullptr)
|
if (slot)
|
||||||
return slot.second;
|
return slot;
|
||||||
|
|
||||||
if (CGraphics::g_BooFactory == nullptr)
|
if (CGraphics::g_BooFactory == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
slot.first = CGraphics::CommitResources(
|
CGraphics::CommitResources(
|
||||||
[&](boo::IGraphicsDataFactory::Context& ctx)
|
[&](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
switch (ctx.platform())
|
switch (ctx.platform())
|
||||||
{
|
{
|
||||||
case boo::IGraphicsDataFactory::Platform::OpenGL:
|
case boo::IGraphicsDataFactory::Platform::OpenGL:
|
||||||
slot.second = BuildShader(static_cast<boo::GLDataFactory::Context&>(ctx), info);
|
slot = BuildShader(static_cast<boo::GLDataFactory::Context&>(ctx), info);
|
||||||
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:
|
||||||
slot.second = BuildShader(static_cast<boo::ID3DDataFactory::Context&>(ctx), info);
|
slot = BuildShader(static_cast<boo::ID3DDataFactory::Context&>(ctx), info);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_METAL
|
#if BOO_HAS_METAL
|
||||||
case boo::IGraphicsDataFactory::Platform::Metal:
|
case boo::IGraphicsDataFactory::Platform::Metal:
|
||||||
slot.second = BuildShader(static_cast<boo::MetalDataFactory::Context&>(ctx), info);
|
slot = BuildShader(static_cast<boo::MetalDataFactory::Context&>(ctx), info);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
||||||
slot.second = BuildShader(static_cast<boo::VulkanDataFactory::Context&>(ctx), info);
|
slot = BuildShader(static_cast<boo::VulkanDataFactory::Context&>(ctx), info);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
|
@ -128,31 +128,25 @@ boo::IShaderPipeline* CFluidPlaneShader::Cache::GetOrBuildShader(const T& info)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
return slot.second;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
template boo::IShaderPipeline*
|
template boo::ObjToken<boo::IShaderPipeline>
|
||||||
CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneShaderInfo>(const SFluidPlaneShaderInfo& info);
|
CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneShaderInfo>(const SFluidPlaneShaderInfo& info);
|
||||||
template boo::IShaderPipeline*
|
template boo::ObjToken<boo::IShaderPipeline>
|
||||||
CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneDoorShaderInfo>(const SFluidPlaneDoorShaderInfo& info);
|
CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneDoorShaderInfo>(const SFluidPlaneDoorShaderInfo& info);
|
||||||
|
|
||||||
void CFluidPlaneShader::Cache::Clear()
|
void CFluidPlaneShader::Cache::Clear()
|
||||||
{
|
{
|
||||||
for (auto& p : m_cache)
|
for (auto& p : m_cache)
|
||||||
{
|
p.reset();
|
||||||
p.first.doDestroy();
|
|
||||||
p.second = nullptr;
|
|
||||||
}
|
|
||||||
for (auto& p : m_doorCache)
|
for (auto& p : m_doorCache)
|
||||||
{
|
p.reset();
|
||||||
p.first.doDestroy();
|
|
||||||
p.second = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFluidPlaneShader::PrepareBinding(boo::IShaderPipeline* pipeline, u32 maxVertCount, bool door)
|
void CFluidPlaneShader::PrepareBinding(const boo::ObjToken<boo::IShaderPipeline>& pipeline, u32 maxVertCount, bool door)
|
||||||
{
|
{
|
||||||
m_gfxTok = CGraphics::CommitResources(
|
CGraphics::CommitResources(
|
||||||
[&](boo::IGraphicsDataFactory::Context& ctx)
|
[&](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), maxVertCount);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), maxVertCount);
|
||||||
|
@ -211,7 +205,7 @@ CFluidPlaneShader::CFluidPlaneShader(CFluidPlane::EFluidType type,
|
||||||
m_envBumpMap.operator bool(),
|
m_envBumpMap.operator bool(),
|
||||||
m_lightmap.operator bool(),
|
m_lightmap.operator bool(),
|
||||||
doubleLightmapBlend, additive);
|
doubleLightmapBlend, additive);
|
||||||
boo::IShaderPipeline* pipeline = _cache.GetOrBuildShader(shaderInfo);
|
boo::ObjToken<boo::IShaderPipeline> pipeline = _cache.GetOrBuildShader(shaderInfo);
|
||||||
PrepareBinding(pipeline, maxVertCount, false);
|
PrepareBinding(pipeline, maxVertCount, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +220,7 @@ CFluidPlaneShader::CFluidPlaneShader(const std::experimental::optional<TLockedTo
|
||||||
SFluidPlaneDoorShaderInfo shaderInfo(m_patternTex1.operator bool(),
|
SFluidPlaneDoorShaderInfo shaderInfo(m_patternTex1.operator bool(),
|
||||||
m_patternTex2.operator bool(),
|
m_patternTex2.operator bool(),
|
||||||
m_colorTex.operator bool());
|
m_colorTex.operator bool());
|
||||||
boo::IShaderPipeline* pipeline = _cache.GetOrBuildShader(shaderInfo);
|
boo::ObjToken<boo::IShaderPipeline> pipeline = _cache.GetOrBuildShader(shaderInfo);
|
||||||
PrepareBinding(pipeline, maxVertCount, true);
|
PrepareBinding(pipeline, maxVertCount, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,17 +82,17 @@ public:
|
||||||
private:
|
private:
|
||||||
class Cache
|
class Cache
|
||||||
{
|
{
|
||||||
std::pair<boo::GraphicsDataToken, boo::IShaderPipeline*> m_cache[1024] = {};
|
boo::ObjToken<boo::IShaderPipeline> m_cache[1024] = {};
|
||||||
std::pair<boo::GraphicsDataToken, boo::IShaderPipeline*> m_doorCache[8] = {};
|
boo::ObjToken<boo::IShaderPipeline> m_doorCache[8] = {};
|
||||||
std::pair<boo::GraphicsDataToken, boo::IShaderPipeline*>&
|
boo::ObjToken<boo::IShaderPipeline>&
|
||||||
CacheSlot(const SFluidPlaneShaderInfo& info, int i) { return m_cache[i]; }
|
CacheSlot(const SFluidPlaneShaderInfo& info, int i) { return m_cache[i]; }
|
||||||
std::pair<boo::GraphicsDataToken, boo::IShaderPipeline*>&
|
boo::ObjToken<boo::IShaderPipeline>&
|
||||||
CacheSlot(const SFluidPlaneDoorShaderInfo& info, int i) { return m_doorCache[i]; }
|
CacheSlot(const SFluidPlaneDoorShaderInfo& info, int i) { return m_doorCache[i]; }
|
||||||
static u16 MakeCacheKey(const SFluidPlaneShaderInfo& info);
|
static u16 MakeCacheKey(const SFluidPlaneShaderInfo& info);
|
||||||
static u16 MakeCacheKey(const SFluidPlaneDoorShaderInfo& info);
|
static u16 MakeCacheKey(const SFluidPlaneDoorShaderInfo& info);
|
||||||
public:
|
public:
|
||||||
template<class T>
|
template<class T>
|
||||||
boo::IShaderPipeline* GetOrBuildShader(const T& info);
|
boo::ObjToken<boo::IShaderPipeline> GetOrBuildShader(const T& info);
|
||||||
void Clear();
|
void Clear();
|
||||||
};
|
};
|
||||||
static Cache _cache;
|
static Cache _cache;
|
||||||
|
@ -113,23 +113,28 @@ private:
|
||||||
std::experimental::optional<TLockedToken<CTexture>> m_envMap;
|
std::experimental::optional<TLockedToken<CTexture>> m_envMap;
|
||||||
std::experimental::optional<TLockedToken<CTexture>> m_envBumpMap;
|
std::experimental::optional<TLockedToken<CTexture>> m_envBumpMap;
|
||||||
std::experimental::optional<TLockedToken<CTexture>> m_lightmap;
|
std::experimental::optional<TLockedToken<CTexture>> m_lightmap;
|
||||||
boo::GraphicsDataToken m_gfxTok;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind;
|
|
||||||
|
|
||||||
static boo::IShaderPipeline* BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
|
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::GLDataFactory::Context& ctx,
|
||||||
static boo::IShaderPipeline* BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info);
|
const SFluidPlaneShaderInfo& info);
|
||||||
boo::IShaderDataBinding* BuildBinding(boo::GLDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
|
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::GLDataFactory::Context& ctx,
|
||||||
|
const SFluidPlaneDoorShaderInfo& info);
|
||||||
|
boo::ObjToken<boo::IShaderDataBinding> BuildBinding(boo::GLDataFactory::Context& ctx,
|
||||||
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door);
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
static boo::IShaderPipeline* BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
|
static boo::IShaderPipeline* BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
|
||||||
static boo::IShaderPipeline* BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info);
|
static boo::IShaderPipeline* BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info);
|
||||||
boo::IShaderDataBinding* BuildBinding(boo::ID3DDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
|
boo::IShaderDataBinding* BuildBinding(boo::ID3DDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_METAL
|
#if BOO_HAS_METAL
|
||||||
static boo::IShaderPipeline* BuildShader(boo::MetalDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
|
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::MetalDataFactory::Context& ctx,
|
||||||
static boo::IShaderPipeline* BuildShader(boo::MetalDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info);
|
const SFluidPlaneShaderInfo& info);
|
||||||
boo::IShaderDataBinding* BuildBinding(boo::MetalDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
|
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::MetalDataFactory::Context& ctx,
|
||||||
|
const SFluidPlaneDoorShaderInfo& info);
|
||||||
|
boo::ObjToken<boo::IShaderDataBinding> BuildBinding(boo::MetalDataFactory::Context& ctx,
|
||||||
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door);
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
static boo::IShaderPipeline* BuildShader(boo::VulkanDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
|
static boo::IShaderPipeline* BuildShader(boo::VulkanDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
|
||||||
|
@ -137,7 +142,7 @@ private:
|
||||||
boo::IShaderDataBinding* BuildBinding(boo::VulkanDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
|
boo::IShaderDataBinding* BuildBinding(boo::VulkanDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void PrepareBinding(boo::IShaderPipeline* pipeline, u32 maxVertCount, bool door);
|
void PrepareBinding(const boo::ObjToken<boo::IShaderPipeline>& pipeline, u32 maxVertCount, bool door);
|
||||||
public:
|
public:
|
||||||
CFluidPlaneShader(CFluidPlane::EFluidType type,
|
CFluidPlaneShader(CFluidPlane::EFluidType type,
|
||||||
const std::experimental::optional<TLockedToken<CTexture>>& patternTex1,
|
const std::experimental::optional<TLockedToken<CTexture>>& patternTex1,
|
||||||
|
|
|
@ -509,7 +509,7 @@ static void _BuildShader(std::string& finalVS, std::string& finalFS, int& nextTe
|
||||||
finalFS = hecl::Format(FSDoor, textures.c_str(), combiner.c_str());
|
finalFS = hecl::Format(FSDoor, textures.c_str(), combiner.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderPipeline*
|
boo::ObjToken<boo::IShaderPipeline>
|
||||||
CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info)
|
CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info)
|
||||||
{
|
{
|
||||||
int nextTex = 0;
|
int nextTex = 0;
|
||||||
|
@ -524,7 +524,7 @@ CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPla
|
||||||
boo::CullMode::None);
|
boo::CullMode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderPipeline*
|
boo::ObjToken<boo::IShaderPipeline>
|
||||||
CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info)
|
CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info)
|
||||||
{
|
{
|
||||||
int nextTex = 0;
|
int nextTex = 0;
|
||||||
|
@ -595,25 +595,26 @@ CFluidPlaneShader::BuildShader(boo::VulkanDataFactory::Context& ctx, const SFlui
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::GLDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding>
|
||||||
boo::IShaderPipeline* pipeline, bool door)
|
CFluidPlaneShader::BuildBinding(boo::GLDataFactory::Context& ctx,
|
||||||
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door)
|
||||||
{
|
{
|
||||||
boo::VertexElementDescriptor elements[] =
|
boo::VertexElementDescriptor elements[] =
|
||||||
{
|
{
|
||||||
{m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{m_vbo, nullptr, boo::VertexSemantic::Normal4, 0},
|
{m_vbo.get(), nullptr, boo::VertexSemantic::Normal4, 0},
|
||||||
{m_vbo, nullptr, boo::VertexSemantic::Normal4, 1},
|
{m_vbo.get(), nullptr, boo::VertexSemantic::Normal4, 1},
|
||||||
{m_vbo, nullptr, boo::VertexSemantic::Normal4, 2},
|
{m_vbo.get(), nullptr, boo::VertexSemantic::Normal4, 2},
|
||||||
{m_vbo, nullptr, boo::VertexSemantic::Color}
|
{m_vbo.get(), nullptr, boo::VertexSemantic::Color}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(5, elements);
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = ctx.newVertexFormat(5, elements);
|
||||||
boo::IGraphicsBuffer* ubufs[] = { m_uniBuf, m_uniBuf, m_uniBuf };
|
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = { m_uniBuf.get(), m_uniBuf.get(), m_uniBuf.get() };
|
||||||
boo::PipelineStage ubufStages[] = { boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
|
boo::PipelineStage ubufStages[] = { boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
|
||||||
boo::PipelineStage::Fragment };
|
boo::PipelineStage::Fragment };
|
||||||
size_t ubufOffs[] = {0, 0, 768};
|
size_t ubufOffs[] = {0, 0, 768};
|
||||||
size_t ubufSizes[] = {768, 768, 256};
|
size_t ubufSizes[] = {768, 768, 256};
|
||||||
size_t texCount = 0;
|
size_t texCount = 0;
|
||||||
boo::ITexture* texs[7] = {};
|
boo::ObjToken<boo::ITexture> texs[7];
|
||||||
if (m_patternTex1)
|
if (m_patternTex1)
|
||||||
texs[texCount++] = (*m_patternTex1)->GetBooTexture();
|
texs[texCount++] = (*m_patternTex1)->GetBooTexture();
|
||||||
if (m_patternTex2)
|
if (m_patternTex2)
|
||||||
|
@ -628,7 +629,7 @@ boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::GLDataFactory::Con
|
||||||
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
|
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
|
||||||
if (m_lightmap)
|
if (m_lightmap)
|
||||||
texs[texCount++] = (*m_lightmap)->GetBooTexture();
|
texs[texCount++] = (*m_lightmap)->GetBooTexture();
|
||||||
return ctx.newShaderDataBinding(pipeline, vtxFmt, m_vbo, nullptr, nullptr, door ? 1 : 3,
|
return ctx.newShaderDataBinding(pipeline, vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
|
||||||
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
|
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
static boo::IVertexFormat* s_vtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_vtxFmt;
|
||||||
|
|
||||||
static const char* VS =
|
static const char* VS =
|
||||||
"#include <metal_stdlib>\n"
|
"#include <metal_stdlib>\n"
|
||||||
|
@ -148,10 +148,10 @@ static const char* FSDoor =
|
||||||
" return colorOut;\n"
|
" return colorOut;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
boo::IShaderPipeline*
|
boo::ObjToken<boo::IShaderPipeline>
|
||||||
CFluidPlaneShader::BuildShader(boo::MetalDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info)
|
CFluidPlaneShader::BuildShader(boo::MetalDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info)
|
||||||
{
|
{
|
||||||
if (s_vtxFmt == nullptr)
|
if (!s_vtxFmt)
|
||||||
{
|
{
|
||||||
boo::VertexElementDescriptor elements[] =
|
boo::VertexElementDescriptor elements[] =
|
||||||
{
|
{
|
||||||
|
@ -467,17 +467,18 @@ CFluidPlaneShader::BuildShader(boo::MetalDataFactory::Context& ctx, const SFluid
|
||||||
std::string finalVS = hecl::Format(VS, additionalTCGs.c_str());
|
std::string finalVS = hecl::Format(VS, additionalTCGs.c_str());
|
||||||
std::string finalFS = hecl::Format(FS, textures.c_str(), combiner.c_str());
|
std::string finalFS = hecl::Format(FS, textures.c_str(), combiner.c_str());
|
||||||
|
|
||||||
return ctx.newShaderPipeline(finalVS.c_str(), finalFS.c_str(), s_vtxFmt, CGraphics::g_ViewportSamples,
|
return ctx.newShaderPipeline(finalVS.c_str(), finalFS.c_str(), nullptr, nullptr,
|
||||||
|
s_vtxFmt, CGraphics::g_ViewportSamples,
|
||||||
info.m_additive ? boo::BlendFactor::One : boo::BlendFactor::SrcAlpha,
|
info.m_additive ? boo::BlendFactor::One : boo::BlendFactor::SrcAlpha,
|
||||||
info.m_additive ? boo::BlendFactor::One : boo::BlendFactor::InvSrcAlpha,
|
info.m_additive ? boo::BlendFactor::One : boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
|
||||||
boo::CullMode::None);
|
boo::CullMode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderPipeline*
|
boo::ObjToken<boo::IShaderPipeline>
|
||||||
CFluidPlaneShader::BuildShader(boo::MetalDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info)
|
CFluidPlaneShader::BuildShader(boo::MetalDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info)
|
||||||
{
|
{
|
||||||
if (s_vtxFmt == nullptr)
|
if (!s_vtxFmt)
|
||||||
{
|
{
|
||||||
boo::VertexElementDescriptor elements[] =
|
boo::VertexElementDescriptor elements[] =
|
||||||
{
|
{
|
||||||
|
@ -523,22 +524,23 @@ CFluidPlaneShader::BuildShader(boo::MetalDataFactory::Context& ctx, const SFluid
|
||||||
std::string finalVS = hecl::Format(VS, additionalTCGs.c_str());
|
std::string finalVS = hecl::Format(VS, additionalTCGs.c_str());
|
||||||
std::string finalFS = hecl::Format(FSDoor, textures.c_str(), combiner.c_str());
|
std::string finalFS = hecl::Format(FSDoor, textures.c_str(), combiner.c_str());
|
||||||
|
|
||||||
return ctx.newShaderPipeline(finalVS.c_str(), finalFS.c_str(), s_vtxFmt, CGraphics::g_ViewportSamples,
|
return ctx.newShaderPipeline(finalVS.c_str(), finalFS.c_str(), nullptr, nullptr,
|
||||||
|
s_vtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
|
||||||
boo::CullMode::None);
|
boo::CullMode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::MetalDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> CFluidPlaneShader::BuildBinding(boo::MetalDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline, bool door)
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door)
|
||||||
{
|
{
|
||||||
boo::IGraphicsBuffer* ubufs[] = { m_uniBuf, m_uniBuf, m_uniBuf };
|
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = { m_uniBuf.get(), m_uniBuf.get(), m_uniBuf.get() };
|
||||||
boo::PipelineStage ubufStages[] = { boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
|
boo::PipelineStage ubufStages[] = { boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
|
||||||
boo::PipelineStage::Fragment };
|
boo::PipelineStage::Fragment };
|
||||||
size_t ubufOffs[] = {0, 0, 768};
|
size_t ubufOffs[] = {0, 0, 768};
|
||||||
size_t ubufSizes[] = {768, 768, 256};
|
size_t ubufSizes[] = {768, 768, 256};
|
||||||
size_t texCount = 0;
|
size_t texCount = 0;
|
||||||
boo::ITexture* texs[7] = {};
|
boo::ObjToken<boo::ITexture> texs[7];
|
||||||
if (m_patternTex1)
|
if (m_patternTex1)
|
||||||
texs[texCount++] = (*m_patternTex1)->GetBooTexture();
|
texs[texCount++] = (*m_patternTex1)->GetBooTexture();
|
||||||
if (m_patternTex2)
|
if (m_patternTex2)
|
||||||
|
@ -553,7 +555,7 @@ boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::MetalDataFactory::
|
||||||
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
|
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
|
||||||
if (m_lightmap)
|
if (m_lightmap)
|
||||||
texs[texCount++] = (*m_lightmap)->GetBooTexture();
|
texs[texCount++] = (*m_lightmap)->GetBooTexture();
|
||||||
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo, nullptr, nullptr, door ? 1 : 3,
|
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
|
||||||
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
|
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace urde
|
||||||
|
|
||||||
CFogVolumeFilter::CFogVolumeFilter()
|
CFogVolumeFilter::CFogVolumeFilter()
|
||||||
{
|
{
|
||||||
m_token = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
struct Vert
|
struct Vert
|
||||||
{
|
{
|
||||||
|
@ -39,8 +39,6 @@ void CFogVolumeFilter::draw1WayPass(const zeus::CColor& color)
|
||||||
CGraphics::DrawArray(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFogVolumeFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CFogVolumeFilter)
|
URDE_SPECIALIZE_SHADER(CFogVolumeFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,10 @@ class CFogVolumeFilter
|
||||||
friend struct CFogVolumeFilterMetalDataBindingFactory;
|
friend struct CFogVolumeFilterMetalDataBindingFactory;
|
||||||
friend struct CFogVolumeFilterD3DDataBindingFactory;
|
friend struct CFogVolumeFilterD3DDataBindingFactory;
|
||||||
|
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind1Way;
|
||||||
boo::IShaderDataBinding* m_dataBind1Way;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind2Way;
|
||||||
boo::IShaderDataBinding* m_dataBind2Way;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFogVolumeFilter();
|
CFogVolumeFilter();
|
||||||
|
|
|
@ -86,34 +86,34 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_1WayPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_1WayPipeline;
|
||||||
static boo::IShaderPipeline* s_2WayPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_2WayPipeline;
|
||||||
|
|
||||||
struct CFogVolumeFilterGLDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
|
struct CFogVolumeFilterGLDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CFogVolumeFilter& filter)
|
CFogVolumeFilter& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* VtxVmtObj = cctx.newVertexFormat(2, VtxVmt);
|
boo::ObjToken<boo::IVertexFormat> VtxVmtObj = cctx.newVertexFormat(2, VtxVmt);
|
||||||
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
|
boo::ObjToken<boo::ITexture> texs[] = { CGraphics::g_SpareTexture.get(), CGraphics::g_SpareTexture.get(),
|
||||||
g_Renderer->GetFogRampTex() };
|
g_Renderer->GetFogRampTex().get() };
|
||||||
int bindIdxs[] = {0, 1, 0};
|
int bindIdxs[] = {0, 1, 0};
|
||||||
bool bindDepth[] = {true, true, false};
|
bool bindDepth[] = {true, true, false};
|
||||||
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = {filter.m_uniBuf.get()};
|
||||||
|
|
||||||
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, VtxVmtObj,
|
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, VtxVmtObj,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, ubufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
|
||||||
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
||||||
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, VtxVmtObj,
|
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, VtxVmtObj,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, ubufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
|
||||||
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
||||||
return filter.m_dataBind1Way;
|
return filter.m_dataBind1Way;
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,13 @@ CFogVolumeFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CFogVolumeFilterGLDataBindingFactory;
|
return new CFogVolumeFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CFogVolumeFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_1WayPipeline.reset();
|
||||||
|
s_2WayPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CFogVolumeFilter>::IDataBindingFactory*
|
TShader<CFogVolumeFilter>::IDataBindingFactory*
|
||||||
CFogVolumeFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CFogVolumeFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -90,27 +90,27 @@ static const char* FS2Way =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_1WayPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_1WayPipeline;
|
||||||
static boo::IShaderPipeline* s_2WayPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_2WayPipeline;
|
||||||
|
|
||||||
struct CFogVolumeFilterMetalDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
|
struct CFogVolumeFilterMetalDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CFogVolumeFilter& filter)
|
CFogVolumeFilter& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
|
boo::ObjToken<boo::ITexture> texs[] = { CGraphics::g_SpareTexture.get(), CGraphics::g_SpareTexture.get(),
|
||||||
g_Renderer->GetFogRampTex() };
|
g_Renderer->GetFogRampTex().get() };
|
||||||
int bindIdxs[] = {0, 1, 0};
|
int bindIdxs[] = {0, 1, 0};
|
||||||
bool bindDepth[] = {true, true, false};
|
bool bindDepth[] = {true, true, false};
|
||||||
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = {filter.m_uniBuf.get()};
|
||||||
|
|
||||||
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, s_VtxFmt,
|
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, ubufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
|
||||||
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
||||||
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, s_VtxFmt,
|
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, ubufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
|
||||||
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
|
||||||
return filter.m_dataBind1Way;
|
return filter.m_dataBind1Way;
|
||||||
}
|
}
|
||||||
|
@ -125,13 +125,23 @@ CFogVolumeFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_1WayPipeline = ctx.newShaderPipeline(VS, FS1Way, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::DstAlpha,
|
s_1WayPipeline = ctx.newShaderPipeline(VS, FS1Way, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::DstAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_2WayPipeline = ctx.newShaderPipeline(VS, FS2Way, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_2WayPipeline = ctx.newShaderPipeline(VS, FS2Way, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
return new CFogVolumeFilterMetalDataBindingFactory;
|
return new CFogVolumeFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CFogVolumeFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_1WayPipeline.reset();
|
||||||
|
s_2WayPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace urde
|
||||||
void CFogVolumePlaneShader::CommitResources(size_t capacity)
|
void CFogVolumePlaneShader::CommitResources(size_t capacity)
|
||||||
{
|
{
|
||||||
m_vertCapacity = capacity;
|
m_vertCapacity = capacity;
|
||||||
m_token = CGraphics::CommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector4f), capacity);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector4f), capacity);
|
||||||
TShader<CFogVolumePlaneShader>::BuildShaderDataBinding(ctx, *this);
|
TShader<CFogVolumePlaneShader>::BuildShaderDataBinding(ctx, *this);
|
||||||
|
@ -60,8 +60,6 @@ void CFogVolumePlaneShader::draw(int pass)
|
||||||
CGraphics::DrawArray(0, m_verts.size());
|
CGraphics::DrawArray(0, m_verts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFogVolumePlaneShader::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CFogVolumePlaneShader)
|
URDE_SPECIALIZE_SHADER(CFogVolumePlaneShader)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,8 @@ class CFogVolumePlaneShader
|
||||||
friend struct CFogVolumePlaneShaderMetalDataBindingFactory;
|
friend struct CFogVolumePlaneShaderMetalDataBindingFactory;
|
||||||
friend struct CFogVolumePlaneShaderD3DDataBindingFactory;
|
friend struct CFogVolumePlaneShaderD3DDataBindingFactory;
|
||||||
|
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBinds[4];
|
||||||
boo::IShaderDataBinding* m_dataBinds[4];
|
|
||||||
std::vector<zeus::CVector4f> m_verts;
|
std::vector<zeus::CVector4f> m_verts;
|
||||||
size_t m_vertCapacity = 0;
|
size_t m_vertCapacity = 0;
|
||||||
|
|
||||||
|
|
|
@ -26,24 +26,24 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
|
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipelines[4] = {};
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipelines[4];
|
||||||
|
|
||||||
struct CFogVolumePlaneShaderGLDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
|
struct CFogVolumePlaneShaderGLDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CFogVolumePlaneShader& filter)
|
CFogVolumePlaneShader& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* VtxVmtObj = cctx.newVertexFormat(1, VtxVmt);
|
boo::ObjToken<boo::IVertexFormat> VtxVmtObj = cctx.newVertexFormat(1, VtxVmt);
|
||||||
for (int i=0 ; i<4 ; ++i)
|
for (int i=0 ; i<4 ; ++i)
|
||||||
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], VtxVmtObj,
|
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], VtxVmtObj,
|
||||||
filter.m_vbo, nullptr, nullptr, 0, nullptr,
|
filter.m_vbo.get(), nullptr, nullptr, 0, nullptr,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
return filter.m_dataBinds[0];
|
return filter.m_dataBinds[0];
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,15 @@ CFogVolumePlaneShader::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CFogVolumePlaneShaderGLDataBindingFactory;
|
return new CFogVolumePlaneShaderGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CFogVolumePlaneShader::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipelines[0].reset();
|
||||||
|
s_Pipelines[1].reset();
|
||||||
|
s_Pipelines[2].reset();
|
||||||
|
s_Pipelines[3].reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CFogVolumePlaneShader>::IDataBindingFactory*
|
TShader<CFogVolumePlaneShader>::IDataBindingFactory*
|
||||||
CFogVolumePlaneShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CFogVolumePlaneShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -39,19 +39,19 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
|
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipelines[4] = {};
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipelines[4];
|
||||||
|
|
||||||
struct CFogVolumePlaneShaderMetalDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
|
struct CFogVolumePlaneShaderMetalDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CFogVolumePlaneShader& filter)
|
CFogVolumePlaneShader& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
for (int i=0 ; i<4 ; ++i)
|
for (int i=0 ; i<4 ; ++i)
|
||||||
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
|
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 0, nullptr,
|
filter.m_vbo.get(), nullptr, nullptr, 0, nullptr,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
return filter.m_dataBinds[0];
|
return filter.m_dataBinds[0];
|
||||||
}
|
}
|
||||||
|
@ -65,19 +65,33 @@ CFogVolumePlaneShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, true, false, false, boo::CullMode::Frontface);
|
boo::ZTest::LEqual, true, false, false, boo::CullMode::Frontface);
|
||||||
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, false, false, boo::CullMode::Frontface);
|
boo::ZTest::None, false, false, false, boo::CullMode::Frontface);
|
||||||
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, true, false, false, boo::CullMode::Backface);
|
boo::ZTest::LEqual, true, false, false, boo::CullMode::Backface);
|
||||||
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
|
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
|
||||||
return new CFogVolumePlaneShaderMetalDataBindingFactory;
|
return new CFogVolumePlaneShaderMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CFogVolumePlaneShader::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipelines[0].reset();
|
||||||
|
s_Pipelines[1].reset();
|
||||||
|
s_Pipelines[2].reset();
|
||||||
|
s_Pipelines[3].reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,24 +3,23 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
boo::IShaderPipeline* CLineRendererShaders::m_texAlpha = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAlpha;
|
||||||
boo::IShaderPipeline* CLineRendererShaders::m_texAdditive = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAdditive;
|
||||||
|
|
||||||
boo::IShaderPipeline* CLineRendererShaders::m_noTexAlpha = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlpha;
|
||||||
boo::IShaderPipeline* CLineRendererShaders::m_noTexAdditive = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAdditive;
|
||||||
|
|
||||||
boo::IVertexFormat* CLineRendererShaders::m_texVtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CLineRendererShaders::m_texVtxFmt;
|
||||||
boo::IVertexFormat* CLineRendererShaders::m_noTexVtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CLineRendererShaders::m_noTexVtxFmt;
|
||||||
|
|
||||||
std::unique_ptr<CLineRendererShaders::IDataBindingFactory> CLineRendererShaders::m_bindFactory;
|
std::unique_ptr<CLineRendererShaders::IDataBindingFactory> CLineRendererShaders::m_bindFactory;
|
||||||
boo::GraphicsDataToken CLineRendererShaders::m_gfxToken;
|
|
||||||
|
|
||||||
void CLineRendererShaders::Initialize()
|
void CLineRendererShaders::Initialize()
|
||||||
{
|
{
|
||||||
if (!CGraphics::g_BooFactory)
|
if (!CGraphics::g_BooFactory)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_gfxToken = CGraphics::CommitResources(
|
CGraphics::CommitResources(
|
||||||
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
switch (ctx.platform())
|
switch (ctx.platform())
|
||||||
|
@ -52,15 +51,20 @@ void CLineRendererShaders::Initialize()
|
||||||
|
|
||||||
void CLineRendererShaders::Shutdown()
|
void CLineRendererShaders::Shutdown()
|
||||||
{
|
{
|
||||||
m_gfxToken.doDestroy();
|
m_texAlpha.reset();
|
||||||
|
m_texAdditive.reset();
|
||||||
|
m_noTexAlpha.reset();
|
||||||
|
m_noTexAdditive.reset();
|
||||||
|
m_texVtxFmt.reset();
|
||||||
|
m_noTexVtxFmt.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CLineRenderer& renderer,
|
CLineRenderer& renderer,
|
||||||
boo::ITexture* texture,
|
const boo::ObjToken<boo::ITexture>& texture,
|
||||||
bool additive)
|
bool additive)
|
||||||
{
|
{
|
||||||
boo::IShaderPipeline* pipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
if (additive)
|
if (additive)
|
||||||
|
|
|
@ -18,22 +18,21 @@ public:
|
||||||
{
|
{
|
||||||
virtual void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
virtual void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CLineRenderer& renderer,
|
CLineRenderer& renderer,
|
||||||
boo::IShaderPipeline* pipeline,
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
|
||||||
boo::ITexture* texture)=0;
|
const boo::ObjToken<boo::ITexture>& texture)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static boo::IShaderPipeline* m_texAlpha;
|
static boo::ObjToken<boo::IShaderPipeline> m_texAlpha;
|
||||||
static boo::IShaderPipeline* m_texAdditive;
|
static boo::ObjToken<boo::IShaderPipeline> m_texAdditive;
|
||||||
|
|
||||||
static boo::IShaderPipeline* m_noTexAlpha;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlpha;
|
||||||
static boo::IShaderPipeline* m_noTexAdditive;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditive;
|
||||||
|
|
||||||
static boo::IVertexFormat* m_texVtxFmt;
|
static boo::ObjToken<boo::IVertexFormat> m_texVtxFmt;
|
||||||
static boo::IVertexFormat* m_noTexVtxFmt;
|
static boo::ObjToken<boo::IVertexFormat> m_noTexVtxFmt;
|
||||||
|
|
||||||
static std::unique_ptr<IDataBindingFactory> m_bindFactory;
|
static std::unique_ptr<IDataBindingFactory> m_bindFactory;
|
||||||
static boo::GraphicsDataToken m_gfxToken;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static IDataBindingFactory* Initialize(boo::GLDataFactory::Context& ctx);
|
static IDataBindingFactory* Initialize(boo::GLDataFactory::Context& ctx);
|
||||||
|
@ -50,7 +49,7 @@ public:
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
||||||
boo::ITexture* texture, bool additive);
|
const boo::ObjToken<boo::ITexture>& texture, bool additive);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,15 +88,19 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
{
|
{
|
||||||
void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline, boo::ITexture* texture)
|
CLineRenderer& renderer,
|
||||||
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
|
||||||
|
const boo::ObjToken<boo::ITexture>& texture)
|
||||||
{
|
{
|
||||||
boo::IVertexFormat* vtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> vtxFmt;
|
||||||
int texCount = 0;
|
int texCount = 0;
|
||||||
boo::ITexture* textures[1];
|
boo::ObjToken<boo::ITexture> textures[1];
|
||||||
|
|
||||||
std::pair<boo::IGraphicsBufferD*, hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
|
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
|
||||||
std::pair<boo::IGraphicsBufferD*, hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
|
hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
|
||||||
|
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
|
||||||
|
hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
|
||||||
renderer.m_uniformBuf.getBufferInfo();
|
renderer.m_uniformBuf.getBufferInfo();
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
|
@ -105,9 +109,9 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
texCount = 1;
|
texCount = 1;
|
||||||
const boo::VertexElementDescriptor TexFmtTex[] =
|
const boo::VertexElementDescriptor TexFmtTex[] =
|
||||||
{
|
{
|
||||||
{vbufInfo.first, nullptr, boo::VertexSemantic::Position4},
|
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{vbufInfo.first, nullptr, boo::VertexSemantic::Color},
|
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Color},
|
||||||
{vbufInfo.first, nullptr, boo::VertexSemantic::UV4}
|
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmt = ctx.newVertexFormat(3, TexFmtTex);
|
vtxFmt = ctx.newVertexFormat(3, TexFmtTex);
|
||||||
}
|
}
|
||||||
|
@ -116,18 +120,18 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
|
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
|
||||||
const boo::VertexElementDescriptor TexFmtNoTex[] =
|
const boo::VertexElementDescriptor TexFmtNoTex[] =
|
||||||
{
|
{
|
||||||
{vbufInfo.first, nullptr, boo::VertexSemantic::Position4},
|
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{vbufInfo.first, nullptr, boo::VertexSemantic::Color}
|
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Color}
|
||||||
};
|
};
|
||||||
vtxFmt = ctx.newVertexFormat(2, TexFmtNoTex);
|
vtxFmt = ctx.newVertexFormat(2, TexFmtNoTex);
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IGraphicsBuffer* uniforms[] = {ubufInfo.first};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
size_t ubufOffs[] = {size_t(ubufInfo.second)};
|
size_t ubufOffs[] = {size_t(ubufInfo.second)};
|
||||||
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
||||||
|
|
||||||
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, vtxFmt, vbufInfo.first,
|
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, vtxFmt, vbufInfo.first.get(),
|
||||||
nullptr, nullptr, 1, uniforms, stages,
|
nullptr, nullptr, 1, uniforms, stages,
|
||||||
ubufOffs, ubufSizes, texCount, textures,
|
ubufOffs, ubufSizes, texCount, textures,
|
||||||
nullptr, nullptr, vbufInfo.second);
|
nullptr, nullptr, vbufInfo.second);
|
||||||
|
|
|
@ -103,14 +103,18 @@ static const char* FS_METAL_NOTEX =
|
||||||
|
|
||||||
struct MetalLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
struct MetalLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
{
|
{
|
||||||
void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline, boo::ITexture* texture)
|
CLineRenderer& renderer,
|
||||||
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
|
||||||
|
const boo::ObjToken<boo::ITexture>& texture)
|
||||||
{
|
{
|
||||||
int texCount = 0;
|
int texCount = 0;
|
||||||
boo::ITexture* textures[1];
|
boo::ObjToken<boo::ITexture> textures[1];
|
||||||
|
|
||||||
std::pair<boo::IGraphicsBufferD*, hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
|
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
|
||||||
std::pair<boo::IGraphicsBufferD*, hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
|
hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
|
||||||
|
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
|
||||||
|
hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
|
||||||
renderer.m_uniformBuf.getBufferInfo();
|
renderer.m_uniformBuf.getBufferInfo();
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
|
@ -123,12 +127,12 @@ struct MetalLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
|
||||||
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
|
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IGraphicsBuffer* uniforms[] = {ubufInfo.first};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
size_t ubufOffs[] = {ubufInfo.second};
|
size_t ubufOffs[] = {ubufInfo.second};
|
||||||
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
||||||
|
|
||||||
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, vbufInfo.first,
|
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, vbufInfo.first.get(),
|
||||||
nullptr, nullptr, 1, uniforms, stages,
|
nullptr, nullptr, 1, uniforms, stages,
|
||||||
ubufOffs, ubufSizes, texCount, textures,
|
ubufOffs, ubufSizes, texCount, textures,
|
||||||
nullptr, nullptr, vbufInfo.second);
|
nullptr, nullptr, vbufInfo.second);
|
||||||
|
@ -152,19 +156,19 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
|
||||||
};
|
};
|
||||||
m_noTexVtxFmt = ctx.newVertexFormat(2, VtxFmtNoTex);
|
m_noTexVtxFmt = ctx.newVertexFormat(2, VtxFmtNoTex);
|
||||||
|
|
||||||
m_texAlpha = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_texVtxFmt,
|
m_texAlpha = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr, m_texVtxFmt,
|
||||||
CGraphics::g_ViewportSamples,
|
CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
m_texAdditive = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_texVtxFmt,
|
m_texAdditive = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr, m_texVtxFmt,
|
||||||
CGraphics::g_ViewportSamples,
|
CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
m_noTexAlpha = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_noTexVtxFmt,
|
m_noTexAlpha = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt,
|
||||||
CGraphics::g_ViewportSamples,
|
CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||||
m_noTexAdditive = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_noTexVtxFmt,
|
m_noTexAdditive = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt,
|
||||||
CGraphics::g_ViewportSamples,
|
CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
|
|
|
@ -4,8 +4,8 @@ namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CMapSurfaceShader::CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx,
|
CMapSurfaceShader::CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IGraphicsBufferS* vbo,
|
const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
|
||||||
boo::IGraphicsBufferS* ibo)
|
const boo::ObjToken<boo::IGraphicsBufferS>& ibo)
|
||||||
: m_vbo(vbo), m_ibo(ibo)
|
: m_vbo(vbo), m_ibo(ibo)
|
||||||
{
|
{
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
|
@ -24,6 +24,4 @@ void CMapSurfaceShader::draw(const zeus::CColor& color, u32 start, u32 count)
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CMapSurfaceShader)
|
URDE_SPECIALIZE_SHADER(CMapSurfaceShader)
|
||||||
|
|
||||||
void CMapSurfaceShader::Shutdown() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,14 @@ class CMapSurfaceShader
|
||||||
zeus::CColor color;
|
zeus::CColor color;
|
||||||
};
|
};
|
||||||
|
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_ibo;
|
boo::ObjToken<boo::IGraphicsBufferS> m_ibo;
|
||||||
boo::IShaderDataBinding* m_dataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx, boo::IGraphicsBufferS* vbo,
|
CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx, const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
|
||||||
boo::IGraphicsBufferS* ibo);
|
const boo::ObjToken<boo::IGraphicsBufferS>& ibo);
|
||||||
void draw(const zeus::CColor& color, u32 start, u32 count);
|
void draw(const zeus::CColor& color, u32 start, u32 count);
|
||||||
|
|
||||||
using _CLS = CMapSurfaceShader;
|
using _CLS = CMapSurfaceShader;
|
||||||
|
|
|
@ -44,25 +44,25 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CMapSurfaceShader)
|
URDE_DECL_SPECIALIZE_SHADER(CMapSurfaceShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CMapSurfaceShaderGLDataBindingFactory : TShader<CMapSurfaceShader>::IDataBindingFactory
|
struct CMapSurfaceShaderGLDataBindingFactory : TShader<CMapSurfaceShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CMapSurfaceShader& filter)
|
CMapSurfaceShader& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, filter.m_ibo, boo::VertexSemantic::Position4}
|
{filter.m_vbo.get(), filter.m_ibo.get(), boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline,
|
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline,
|
||||||
vtxFmt, filter.m_vbo, nullptr, filter.m_ibo,
|
vtxFmt, filter.m_vbo.get(), nullptr, filter.m_ibo.get(),
|
||||||
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
return filter.m_dataBind;
|
return filter.m_dataBind;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,12 @@ CMapSurfaceShader::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CMapSurfaceShaderGLDataBindingFactory;
|
return new CMapSurfaceShaderGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CMapSurfaceShader::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CMapSurfaceShader>::IDataBindingFactory*
|
TShader<CMapSurfaceShader>::IDataBindingFactory*
|
||||||
CMapSurfaceShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CMapSurfaceShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -48,19 +48,19 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CMapSurfaceShader)
|
URDE_DECL_SPECIALIZE_SHADER(CMapSurfaceShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CMapSurfaceShaderMetalDataBindingFactory : TShader<CMapSurfaceShader>::IDataBindingFactory
|
struct CMapSurfaceShaderMetalDataBindingFactory : TShader<CMapSurfaceShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CMapSurfaceShader& filter)
|
CMapSurfaceShader& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, filter.m_ibo, 1, bufs,
|
filter.m_vbo.get(), nullptr, filter.m_ibo.get(), 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
return filter.m_dataBind;
|
return filter.m_dataBind;
|
||||||
}
|
}
|
||||||
|
@ -74,10 +74,18 @@ CMapSurfaceShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
||||||
return new CMapSurfaceShaderMetalDataBindingFactory;
|
return new CMapSurfaceShaderMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CMapSurfaceShader::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_texZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texZWrite;
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_texNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texNoZWrite;
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_texAdditiveZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texAdditiveZWrite;
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_texAdditiveNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texAdditiveNoZWrite;
|
||||||
|
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_noTexZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexZWrite;
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_noTexNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexNoZWrite;
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_noTexAdditiveZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveZWrite;
|
||||||
boo::IShaderPipeline* CParticleSwooshShaders::m_noTexAdditiveNoZWrite = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
|
||||||
|
|
||||||
boo::IVertexFormat* CParticleSwooshShaders::m_vtxFormat = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CParticleSwooshShaders::m_vtxFormat;
|
||||||
|
|
||||||
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen)
|
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CPar
|
||||||
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen)
|
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen)
|
||||||
{
|
{
|
||||||
CSwooshDescription* desc = gen.GetDesc();
|
CSwooshDescription* desc = gen.GetDesc();
|
||||||
boo::IShaderPipeline* pipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
||||||
|
|
||||||
if (desc->x3c_TEXR)
|
if (desc->x3c_TEXR)
|
||||||
{
|
{
|
||||||
|
@ -71,8 +71,6 @@ void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::C
|
||||||
TShader<CParticleSwooshShaders>::BuildShaderDataBinding(ctx, shad);
|
TShader<CParticleSwooshShaders>::BuildShaderDataBinding(ctx, shad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSwooshShaders::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CParticleSwooshShaders)
|
URDE_SPECIALIZE_SHADER(CParticleSwooshShaders)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,21 +33,21 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static boo::IShaderPipeline* m_texZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texZWrite;
|
||||||
static boo::IShaderPipeline* m_texNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texNoZWrite;
|
||||||
static boo::IShaderPipeline* m_texAdditiveZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZWrite;
|
||||||
static boo::IShaderPipeline* m_texAdditiveNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveNoZWrite;
|
||||||
|
|
||||||
static boo::IShaderPipeline* m_noTexZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexAdditiveZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZWrite;
|
||||||
static boo::IShaderPipeline* m_noTexAdditiveNoZWrite;
|
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveNoZWrite;
|
||||||
|
|
||||||
static boo::IVertexFormat* m_vtxFormat; /* No OpenGL */
|
static boo::ObjToken<boo::IVertexFormat> m_vtxFormat; /* No OpenGL */
|
||||||
|
|
||||||
CParticleSwoosh& m_gen;
|
CParticleSwoosh& m_gen;
|
||||||
boo::IShaderPipeline* m_pipeline;
|
boo::ObjToken<boo::IShaderPipeline> m_pipeline;
|
||||||
CParticleSwooshShaders(CParticleSwoosh& gen, boo::IShaderPipeline* pipeline)
|
CParticleSwooshShaders(CParticleSwoosh& gen, const boo::ObjToken<boo::IShaderPipeline>& pipeline)
|
||||||
: m_gen(gen), m_pipeline(pipeline) {}
|
: m_gen(gen), m_pipeline(pipeline) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -66,25 +66,25 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
struct OGLParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
|
struct OGLParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CParticleSwooshShaders& shaders)
|
CParticleSwooshShaders& shaders)
|
||||||
{
|
{
|
||||||
CParticleSwoosh& gen = shaders.m_gen;
|
CParticleSwoosh& gen = shaders.m_gen;
|
||||||
CSwooshDescription* desc = gen.GetDesc();
|
CSwooshDescription* desc = gen.GetDesc();
|
||||||
|
|
||||||
CUVElement* texr = desc->x3c_TEXR.get();
|
CUVElement* texr = desc->x3c_TEXR.get();
|
||||||
boo::ITexture* textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxFmt[] =
|
const boo::VertexElementDescriptor VtxFmt[] =
|
||||||
{
|
{
|
||||||
{gen.m_vertBuf, nullptr, boo::VertexSemantic::Position4},
|
{gen.m_vertBuf.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{gen.m_vertBuf, nullptr, boo::VertexSemantic::UV4},
|
{gen.m_vertBuf.get(), nullptr, boo::VertexSemantic::UV4},
|
||||||
{gen.m_vertBuf, nullptr, boo::VertexSemantic::Color},
|
{gen.m_vertBuf.get(), nullptr, boo::VertexSemantic::Color},
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(3, VtxFmt);
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = ctx.newVertexFormat(3, VtxFmt);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||||
gen.m_dataBind = ctx.newShaderDataBinding(shaders.m_pipeline, vtxFmt, gen.m_vertBuf,
|
gen.m_dataBind = ctx.newShaderDataBinding(shaders.m_pipeline, vtxFmt, gen.m_vertBuf.get(),
|
||||||
nullptr, nullptr, 1, uniforms,
|
nullptr, nullptr, 1, uniforms,
|
||||||
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
|
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -133,6 +133,20 @@ TShader<CParticleSwooshShaders>::IDataBindingFactory* CParticleSwooshShaders::In
|
||||||
return new struct OGLParticleSwooshDataBindingFactory;
|
return new struct OGLParticleSwooshDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CParticleSwooshShaders::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
m_texZWrite.reset();
|
||||||
|
m_texNoZWrite.reset();
|
||||||
|
m_texAdditiveZWrite.reset();
|
||||||
|
m_texAdditiveNoZWrite.reset();
|
||||||
|
|
||||||
|
m_noTexZWrite.reset();
|
||||||
|
m_noTexNoZWrite.reset();
|
||||||
|
m_noTexAdditiveZWrite.reset();
|
||||||
|
m_noTexAdditiveNoZWrite.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
struct VulkanParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
|
struct VulkanParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,18 +70,18 @@ static const char* FS_NOTEX =
|
||||||
|
|
||||||
struct MetalParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
|
struct MetalParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CParticleSwooshShaders& shaders)
|
CParticleSwooshShaders& shaders)
|
||||||
{
|
{
|
||||||
CParticleSwoosh& gen = shaders.m_gen;
|
CParticleSwoosh& gen = shaders.m_gen;
|
||||||
CSwooshDescription* desc = gen.GetDesc();
|
CSwooshDescription* desc = gen.GetDesc();
|
||||||
|
|
||||||
CUVElement* texr = desc->x3c_TEXR.get();
|
CUVElement* texr = desc->x3c_TEXR.get();
|
||||||
boo::ITexture* textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
||||||
|
|
||||||
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||||
gen.m_dataBind = ctx.newShaderDataBinding(shaders.m_pipeline, CParticleSwooshShaders::m_vtxFormat,
|
gen.m_dataBind = ctx.newShaderDataBinding(shaders.m_pipeline, CParticleSwooshShaders::m_vtxFormat,
|
||||||
gen.m_vertBuf, nullptr, nullptr, 1, uniforms,
|
gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms,
|
||||||
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
|
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -97,36 +97,44 @@ TShader<CParticleSwooshShaders>::IDataBindingFactory* CParticleSwooshShaders::In
|
||||||
};
|
};
|
||||||
m_vtxFormat = ctx.newVertexFormat(3, VtxFmt);
|
m_vtxFormat = ctx.newVertexFormat(3, VtxFmt);
|
||||||
|
|
||||||
m_texZWrite = ctx.newShaderPipeline(VS, FS_TEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_texZWrite = ctx.newShaderPipeline(VS, FS_TEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_texNoZWrite = ctx.newShaderPipeline(VS, FS_TEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_texNoZWrite = ctx.newShaderPipeline(VS, FS_TEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_texAdditiveZWrite = ctx.newShaderPipeline(VS, FS_TEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_texAdditiveZWrite = ctx.newShaderPipeline(VS, FS_TEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_texAdditiveNoZWrite = ctx.newShaderPipeline(VS, FS_TEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_texAdditiveNoZWrite = ctx.newShaderPipeline(VS, FS_TEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
|
|
||||||
m_noTexZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_noTexZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_noTexNoZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_noTexNoZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_noTexAdditiveZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_noTexAdditiveZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
m_noTexAdditiveNoZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, m_vtxFormat, CGraphics::g_ViewportSamples,
|
m_noTexAdditiveNoZWrite = ctx.newShaderPipeline(VS, FS_NOTEX, nullptr, nullptr,
|
||||||
|
m_vtxFormat, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
|
@ -134,4 +142,20 @@ TShader<CParticleSwooshShaders>::IDataBindingFactory* CParticleSwooshShaders::In
|
||||||
return new struct MetalParticleSwooshDataBindingFactory;
|
return new struct MetalParticleSwooshDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CParticleSwooshShaders::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
m_texZWrite.reset();
|
||||||
|
m_texNoZWrite.reset();
|
||||||
|
m_texAdditiveZWrite.reset();
|
||||||
|
m_texAdditiveNoZWrite.reset();
|
||||||
|
|
||||||
|
m_noTexZWrite.reset();
|
||||||
|
m_noTexNoZWrite.reset();
|
||||||
|
m_noTexAdditiveZWrite.reset();
|
||||||
|
m_noTexAdditiveNoZWrite.reset();
|
||||||
|
|
||||||
|
m_vtxFormat.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,7 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
|
||||||
if (!m_dataBind || indTex != m_indTex)
|
if (!m_dataBind || indTex != m_indTex)
|
||||||
{
|
{
|
||||||
m_indTex = indTex;
|
m_indTex = indTex;
|
||||||
m_gfxTok = CGraphics::CommitResources(
|
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
[this](boo::IGraphicsDataFactory::Context& ctx)
|
|
||||||
{
|
{
|
||||||
m_uniBufBlurX = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CVector4f), 1);
|
m_uniBufBlurX = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CVector4f), 1);
|
||||||
m_uniBufBlurY = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CVector4f), 1);
|
m_uniBufBlurY = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CVector4f), 1);
|
||||||
|
@ -89,8 +88,6 @@ void CPhazonSuitFilter::draw(const zeus::CColor& color,
|
||||||
CGraphics::DrawArray(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhazonSuitFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CPhazonSuitFilter)
|
URDE_SPECIALIZE_SHADER(CPhazonSuitFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,15 @@ class CPhazonSuitFilter
|
||||||
friend struct CPhazonSuitFilterMetalDataBindingFactory;
|
friend struct CPhazonSuitFilterMetalDataBindingFactory;
|
||||||
friend struct CPhazonSuitFilterD3DDataBindingFactory;
|
friend struct CPhazonSuitFilterD3DDataBindingFactory;
|
||||||
|
|
||||||
boo::GraphicsDataToken m_gfxTok;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBufBlurX;
|
||||||
boo::IGraphicsBufferD* m_uniBufBlurX;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBufBlurY;
|
||||||
boo::IGraphicsBufferD* m_uniBufBlurY;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IGraphicsBufferS> m_blurVbo;
|
||||||
boo::IGraphicsBufferS* m_blurVbo;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
|
||||||
const CTexture* m_indTex = nullptr;
|
const CTexture* m_indTex = nullptr;
|
||||||
boo::IShaderDataBinding* m_dataBindBlurX = nullptr;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBindBlurX;
|
||||||
boo::IShaderDataBinding* m_dataBindBlurY = nullptr;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBindBlurY;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void drawBlurPasses(float radius, const CTexture* indTex);
|
void drawBlurPasses(float radius, const CTexture* indTex);
|
||||||
|
|
|
@ -149,80 +149,80 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CPhazonSuitFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CPhazonSuitFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IVertexFormat* s_BlurVtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_BlurVtxFmt;
|
||||||
static boo::IShaderPipeline* s_IndPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_IndPipeline;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
static boo::IShaderPipeline* s_BlurPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_BlurPipeline;
|
||||||
|
|
||||||
struct CPhazonSuitFilterGLDataBindingFactory : TShader<CPhazonSuitFilter>::IDataBindingFactory
|
struct CPhazonSuitFilterGLDataBindingFactory : TShader<CPhazonSuitFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CPhazonSuitFilter& filter)
|
CPhazonSuitFilter& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor BlurVtxVmt[] =
|
const boo::VertexElementDescriptor BlurVtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_blurVbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_blurVbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_blurVbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_blurVbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* blurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
|
boo::ObjToken<boo::IVertexFormat> blurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBufBlurX};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBufBlurX.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[4];
|
boo::ObjToken<boo::ITexture> texs[4];
|
||||||
int texBindIdxs[4];
|
int texBindIdxs[4];
|
||||||
|
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 1;
|
texBindIdxs[0] = 1;
|
||||||
filter.m_dataBindBlurX = cctx.newShaderDataBinding(s_BlurPipeline,
|
filter.m_dataBindBlurX = cctx.newShaderDataBinding(s_BlurPipeline,
|
||||||
blurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
|
blurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
||||||
|
|
||||||
bufs[0] = filter.m_uniBufBlurY;
|
bufs[0] = filter.m_uniBufBlurY.get();
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 2;
|
texBindIdxs[0] = 2;
|
||||||
filter.m_dataBindBlurY = cctx.newShaderDataBinding(s_BlurPipeline,
|
filter.m_dataBindBlurY = cctx.newShaderDataBinding(s_BlurPipeline,
|
||||||
blurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
|
blurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 0},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 0},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 1},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 1},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 2}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 2}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(4, VtxVmt);
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = ctx.newVertexFormat(4, VtxVmt);
|
||||||
|
|
||||||
bufs[0] = filter.m_uniBuf;
|
bufs[0] = filter.m_uniBuf.get();
|
||||||
size_t texCount;
|
size_t texCount;
|
||||||
if (filter.m_indTex)
|
if (filter.m_indTex)
|
||||||
{
|
{
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 0;
|
texBindIdxs[0] = 0;
|
||||||
texs[1] = filter.m_indTex->GetBooTexture();
|
texs[1] = filter.m_indTex->GetBooTexture();
|
||||||
texBindIdxs[1] = 0;
|
texBindIdxs[1] = 0;
|
||||||
texs[2] = CGraphics::g_SpareTexture;
|
texs[2] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[2] = 1;
|
texBindIdxs[2] = 1;
|
||||||
texs[3] = CGraphics::g_SpareTexture;
|
texs[3] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[3] = 2;
|
texBindIdxs[3] = 2;
|
||||||
texCount = 4;
|
texCount = 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 0;
|
texBindIdxs[0] = 0;
|
||||||
texs[1] = CGraphics::g_SpareTexture;
|
texs[1] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[1] = 1;
|
texBindIdxs[1] = 1;
|
||||||
texs[2] = CGraphics::g_SpareTexture;
|
texs[2] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[2] = 2;
|
texBindIdxs[2] = 2;
|
||||||
texCount = 3;
|
texCount = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cctx.newShaderDataBinding(filter.m_indTex ? s_IndPipeline : s_Pipeline,
|
return cctx.newShaderDataBinding(filter.m_indTex ? s_IndPipeline : s_Pipeline,
|
||||||
vtxFmt, filter.m_vbo, nullptr, nullptr,
|
vtxFmt, filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
|
1, bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -306,6 +306,14 @@ CPhazonSuitFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CPhazonSuitFilterGLDataBindingFactory;
|
return new CPhazonSuitFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CPhazonSuitFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_IndPipeline.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
s_BlurPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CPhazonSuitFilter>::IDataBindingFactory*
|
TShader<CPhazonSuitFilter>::IDataBindingFactory*
|
||||||
CPhazonSuitFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CPhazonSuitFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -158,64 +158,64 @@ static const char* BlurFS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CPhazonSuitFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CPhazonSuitFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IVertexFormat* s_BlurVtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_BlurVtxFmt;
|
||||||
static boo::IShaderPipeline* s_IndPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_IndPipeline;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
static boo::IShaderPipeline* s_BlurPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_BlurPipeline;
|
||||||
|
|
||||||
struct CPhazonSuitFilterMetalDataBindingFactory : TShader<CPhazonSuitFilter>::IDataBindingFactory
|
struct CPhazonSuitFilterMetalDataBindingFactory : TShader<CPhazonSuitFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CPhazonSuitFilter& filter)
|
CPhazonSuitFilter& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBufBlurX};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBufBlurX.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[4];
|
boo::ObjToken<boo::ITexture> texs[4];
|
||||||
int texBindIdxs[4];
|
int texBindIdxs[4];
|
||||||
|
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 1;
|
texBindIdxs[0] = 1;
|
||||||
filter.m_dataBindBlurX = cctx.newShaderDataBinding(s_BlurPipeline,
|
filter.m_dataBindBlurX = cctx.newShaderDataBinding(s_BlurPipeline,
|
||||||
s_BlurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
|
s_BlurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
||||||
|
|
||||||
bufs[0] = filter.m_uniBufBlurY;
|
bufs[0] = filter.m_uniBufBlurY.get();
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 2;
|
texBindIdxs[0] = 2;
|
||||||
filter.m_dataBindBlurY = cctx.newShaderDataBinding(s_BlurPipeline,
|
filter.m_dataBindBlurY = cctx.newShaderDataBinding(s_BlurPipeline,
|
||||||
s_BlurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
|
s_BlurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
|
||||||
|
|
||||||
bufs[0] = filter.m_uniBuf;
|
bufs[0] = filter.m_uniBuf.get();
|
||||||
size_t texCount;
|
size_t texCount;
|
||||||
if (filter.m_indTex)
|
if (filter.m_indTex)
|
||||||
{
|
{
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 0;
|
texBindIdxs[0] = 0;
|
||||||
texs[1] = filter.m_indTex->GetBooTexture();
|
texs[1] = filter.m_indTex->GetBooTexture();
|
||||||
texBindIdxs[1] = 0;
|
texBindIdxs[1] = 0;
|
||||||
texs[2] = CGraphics::g_SpareTexture;
|
texs[2] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[2] = 1;
|
texBindIdxs[2] = 1;
|
||||||
texs[3] = CGraphics::g_SpareTexture;
|
texs[3] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[3] = 2;
|
texBindIdxs[3] = 2;
|
||||||
texCount = 4;
|
texCount = 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texs[0] = CGraphics::g_SpareTexture;
|
texs[0] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[0] = 0;
|
texBindIdxs[0] = 0;
|
||||||
texs[1] = CGraphics::g_SpareTexture;
|
texs[1] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[1] = 1;
|
texBindIdxs[1] = 1;
|
||||||
texs[2] = CGraphics::g_SpareTexture;
|
texs[2] = CGraphics::g_SpareTexture.get();
|
||||||
texBindIdxs[2] = 2;
|
texBindIdxs[2] = 2;
|
||||||
texCount = 3;
|
texCount = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cctx.newShaderDataBinding(filter.m_indTex ? s_IndPipeline : s_Pipeline,
|
return cctx.newShaderDataBinding(filter.m_indTex ? s_IndPipeline : s_Pipeline,
|
||||||
s_VtxFmt, filter.m_vbo, nullptr, nullptr,
|
s_VtxFmt, filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
|
1, bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -237,19 +237,29 @@ CPhazonSuitFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_BlurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
|
s_BlurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
|
||||||
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, s_VtxFmt,
|
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, nullptr, nullptr, s_VtxFmt,
|
||||||
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, s_VtxFmt,
|
||||||
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_BlurPipeline = ctx.newShaderPipeline(BlurVS, BlurFS, s_BlurVtxFmt,
|
s_BlurPipeline = ctx.newShaderPipeline(BlurVS, BlurFS, nullptr, nullptr, s_BlurVtxFmt,
|
||||||
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, false, true, boo::CullMode::None);
|
boo::ZTest::None, false, false, true, boo::CullMode::None);
|
||||||
return new CPhazonSuitFilterMetalDataBindingFactory;
|
return new CPhazonSuitFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CPhazonSuitFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_BlurVtxFmt.reset();
|
||||||
|
s_IndPipeline.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
s_BlurPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CText
|
||||||
{
|
{
|
||||||
m_maxInsts = instances.size();
|
m_maxInsts = instances.size();
|
||||||
m_tex = tex;
|
m_tex = tex;
|
||||||
m_token = CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Instance), m_maxInsts);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Instance), m_maxInsts);
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);
|
||||||
|
@ -35,6 +35,4 @@ void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CText
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CRadarPaintShader)
|
URDE_SPECIALIZE_SHADER(CRadarPaintShader)
|
||||||
|
|
||||||
void CRadarPaintShader::Shutdown() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind;
|
|
||||||
const CTexture* m_tex = nullptr;
|
const CTexture* m_tex = nullptr;
|
||||||
size_t m_maxInsts = 0;
|
size_t m_maxInsts = 0;
|
||||||
|
|
||||||
|
|
|
@ -50,34 +50,34 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CRadarPaintShader)
|
URDE_DECL_SPECIALIZE_SHADER(CRadarPaintShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CRadarPaintShaderGLDataBindingFactory : TShader<CRadarPaintShader>::IDataBindingFactory
|
struct CRadarPaintShaderGLDataBindingFactory : TShader<CRadarPaintShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CRadarPaintShader& filter)
|
CRadarPaintShader& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4, 0},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4, 0},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4, 1},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4, 1},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4, 2},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4, 2},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4, 3},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4, 3},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 0},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 0},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 1},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 1},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 2},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 2},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4, 3},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4, 3},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Color}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Color}
|
||||||
};
|
};
|
||||||
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(9, VtxVmt);
|
boo::ObjToken<boo::IVertexFormat> vtxFmt = ctx.newVertexFormat(9, VtxVmt);
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline,
|
return cctx.newShaderDataBinding(s_Pipeline,
|
||||||
vtxFmt, nullptr, filter.m_vbo, nullptr,
|
vtxFmt, nullptr, filter.m_vbo.get(), nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -110,6 +110,12 @@ CRadarPaintShader::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CRadarPaintShaderGLDataBindingFactory;
|
return new CRadarPaintShaderGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CRadarPaintShader::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CRadarPaintShader>::IDataBindingFactory*
|
TShader<CRadarPaintShader>::IDataBindingFactory*
|
||||||
CRadarPaintShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CRadarPaintShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -58,20 +58,20 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CRadarPaintShader)
|
URDE_DECL_SPECIALIZE_SHADER(CRadarPaintShader)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CRadarPaintShaderMetalDataBindingFactory : TShader<CRadarPaintShader>::IDataBindingFactory
|
struct CRadarPaintShaderMetalDataBindingFactory : TShader<CRadarPaintShader>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CRadarPaintShader& filter)
|
CRadarPaintShader& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
nullptr, filter.m_vbo, nullptr, 1, bufs,
|
nullptr, filter.m_vbo.get(), nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -92,11 +92,19 @@ CRadarPaintShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Color}
|
{nullptr, nullptr, boo::VertexSemantic::Color}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(9, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(9, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha,
|
boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
return new CRadarPaintShaderMetalDataBindingFactory;
|
return new CRadarPaintShaderMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CRadarPaintShader::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace urde
|
||||||
CRandomStaticFilter::CRandomStaticFilter(EFilterType type, bool cookieCutter)
|
CRandomStaticFilter::CRandomStaticFilter(EFilterType type, bool cookieCutter)
|
||||||
: m_cookieCutter(cookieCutter)
|
: m_cookieCutter(cookieCutter)
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
struct Vert
|
struct Vert
|
||||||
{
|
{
|
||||||
|
@ -41,8 +41,6 @@ void CRandomStaticFilter::draw(const zeus::CColor& color, float t)
|
||||||
CGraphics::DrawArray(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRandomStaticFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
|
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,9 @@ class CRandomStaticFilter
|
||||||
float randOff;
|
float randOff;
|
||||||
float discardThres;
|
float discardThres;
|
||||||
};
|
};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
bool m_cookieCutter;
|
bool m_cookieCutter;
|
||||||
|
|
||||||
|
|
|
@ -106,13 +106,13 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
static boo::IShaderPipeline* s_CookieCutterPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_CookieCutterPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -123,28 +123,27 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CRandomStaticFilterGLDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
|
struct CRandomStaticFilterGLDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CRandomStaticFilter& filter)
|
||||||
CRandomStaticFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
|
boo::ObjToken<boo::ITexture> texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
|
||||||
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
|
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
|
||||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -187,6 +186,15 @@ CRandomStaticFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CRandomStaticFilterGLDataBindingFactory;
|
return new CRandomStaticFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CRandomStaticFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
s_CookieCutterPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory*
|
TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory*
|
||||||
CRandomStaticFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CRandomStaticFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -112,13 +112,13 @@ static const char* FSCookieCutter =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
static boo::IShaderPipeline* s_CookieCutterPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_CookieCutterPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -129,22 +129,21 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CRandomStaticFilterMetalDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
|
struct CRandomStaticFilterMetalDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CRandomStaticFilter& filter)
|
||||||
CRandomStaticFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::ITexture* texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
|
boo::ObjToken<boo::ITexture> texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
|
||||||
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
|
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
|
||||||
s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs,
|
s_VtxFmt, filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -158,23 +157,37 @@ CRandomStaticFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha,
|
boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_AddPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha,
|
boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_MultPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcColor,
|
boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_CookieCutterPipeline = ctx.newShaderPipeline(VS, FSCookieCutter, s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_CookieCutterPipeline = ctx.newShaderPipeline(VS, FSCookieCutter, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcColor,
|
boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, true, false, false, boo::CullMode::None);
|
boo::ZTest::LEqual, true, false, false, boo::CullMode::None);
|
||||||
return new CRandomStaticFilterMetalDataBindingFactory;
|
return new CRandomStaticFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CRandomStaticFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
s_CookieCutterPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace urde
|
||||||
CScanLinesFilter::CScanLinesFilter(EFilterType type, bool even)
|
CScanLinesFilter::CScanLinesFilter(EFilterType type, bool even)
|
||||||
: m_even(even)
|
: m_even(even)
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
m_dataBind = TMultiBlendShader<CScanLinesFilter>::BuildShaderDataBinding(ctx, type, *this);
|
m_dataBind = TMultiBlendShader<CScanLinesFilter>::BuildShaderDataBinding(ctx, type, *this);
|
||||||
|
@ -23,8 +23,6 @@ void CScanLinesFilter::draw(const zeus::CColor& color)
|
||||||
CGraphics::DrawArray(0, 670);
|
CGraphics::DrawArray(0, 670);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScanLinesFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
|
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,8 @@ class CScanLinesFilter
|
||||||
{
|
{
|
||||||
zeus::CColor color;
|
zeus::CColor color;
|
||||||
};
|
};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
bool m_even;
|
bool m_even;
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,12 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -61,25 +61,24 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CScanLinesFilterGLDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
|
struct CScanLinesFilterGLDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CScanLinesFilter& filter)
|
||||||
CScanLinesFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* vbo = filter.m_even ?
|
boo::ObjToken<boo::IGraphicsBuffer> vbo = filter.m_even ?
|
||||||
g_Renderer->GetScanLinesEvenVBO() : g_Renderer->GetScanLinesOddVBO();
|
g_Renderer->GetScanLinesEvenVBO().get() : g_Renderer->GetScanLinesOddVBO().get();
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{vbo, nullptr, boo::VertexSemantic::Position4}
|
{vbo, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type),
|
return cctx.newShaderDataBinding(SelectPipeline(type),
|
||||||
ctx.newVertexFormat(1, VtxVmt), vbo, nullptr, nullptr,
|
ctx.newVertexFormat(1, VtxVmt), vbo, nullptr, nullptr,
|
||||||
|
@ -122,6 +121,14 @@ CScanLinesFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CScanLinesFilterGLDataBindingFactory;
|
return new CScanLinesFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CScanLinesFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory*
|
TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory*
|
||||||
CScanLinesFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CScanLinesFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -49,12 +49,12 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -65,21 +65,20 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CScanLinesFilterMetalDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
|
struct CScanLinesFilterMetalDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CScanLinesFilter& filter)
|
||||||
CScanLinesFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* vbo = filter.m_even ?
|
boo::ObjToken<boo::IGraphicsBuffer> vbo = filter.m_even ?
|
||||||
g_Renderer->GetScanLinesEvenVBO() : g_Renderer->GetScanLinesOddVBO();
|
g_Renderer->GetScanLinesEvenVBO().get() : g_Renderer->GetScanLinesOddVBO().get();
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
||||||
vbo, nullptr, nullptr, 1, bufs,
|
vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
|
||||||
|
@ -94,16 +93,28 @@ CScanLinesFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AddPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
s_MultPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
return new CScanLinesFilterMetalDataBindingFactory;
|
return new CScanLinesFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CScanLinesFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,12 @@ void CSpaceWarpFilter::GenerateWarpRampTex(boo::IGraphicsDataFactory::Context& c
|
||||||
}
|
}
|
||||||
m_warpTex = ctx.newStaticTexture(WARP_RAMP_RES+1, WARP_RAMP_RES+1, 1,
|
m_warpTex = ctx.newStaticTexture(WARP_RAMP_RES+1, WARP_RAMP_RES+1, 1,
|
||||||
boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||||
data[0], (WARP_RAMP_RES+1) * (WARP_RAMP_RES+1) * 4);
|
data[0], (WARP_RAMP_RES+1) * (WARP_RAMP_RES+1) * 4).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSpaceWarpFilter::CSpaceWarpFilter()
|
CSpaceWarpFilter::CSpaceWarpFilter()
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
GenerateWarpRampTex(ctx);
|
GenerateWarpRampTex(ctx);
|
||||||
struct Vert
|
struct Vert
|
||||||
|
@ -148,12 +148,10 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt)
|
||||||
m_uniform.m_strength.y = m_uniform.m_matrix[1][1] * m_strength * 0.5f;
|
m_uniform.m_strength.y = m_uniform.m_matrix[1][1] * m_strength * 0.5f;
|
||||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||||
|
|
||||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
CGraphics::SetShaderDataBinding(m_dataBind);
|
||||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpaceWarpFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
URDE_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,10 @@ class CSpaceWarpFilter
|
||||||
zeus::CVector3f m_strength;
|
zeus::CVector3f m_strength;
|
||||||
};
|
};
|
||||||
u8 m_shiftTexture[4][8][4] = {};
|
u8 m_shiftTexture[4][8][4] = {};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::ITexture> m_warpTex;
|
||||||
boo::ITexture* m_warpTex;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
float m_strength = 1.f;
|
float m_strength = 1.f;
|
||||||
|
|
||||||
|
|
|
@ -53,26 +53,26 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CSpaceWarpFilterGLDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
struct CSpaceWarpFilterGLDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CSpaceWarpFilter& filter)
|
CSpaceWarpFilter& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
|
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_warpTex.get()};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline,
|
return cctx.newShaderDataBinding(s_Pipeline,
|
||||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -104,6 +104,12 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
|
||||||
return new CSpaceWarpFilterGLDataBindingFactory;
|
return new CSpaceWarpFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CSpaceWarpFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,20 +57,20 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CSpaceWarpFilterMetalDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
struct CSpaceWarpFilterMetalDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CSpaceWarpFilter& filter)
|
CSpaceWarpFilter& filter)
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
|
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_warpTex};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -83,10 +83,18 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||||
return new CSpaceWarpFilterMetalDataBindingFactory;
|
return new CSpaceWarpFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CSpaceWarpFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_VtxFmt.reset();
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
boo::IVertexFormat* CTextSupportShader::s_TextVtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CTextSupportShader::s_TextVtxFmt;
|
||||||
boo::IShaderPipeline* CTextSupportShader::s_TextAlphaPipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_TextAlphaPipeline;
|
||||||
boo::IShaderPipeline* CTextSupportShader::s_TextAddPipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_TextAddPipeline;
|
||||||
|
|
||||||
boo::IVertexFormat* CTextSupportShader::s_ImageVtxFmt = nullptr;
|
boo::ObjToken<boo::IVertexFormat> CTextSupportShader::s_ImageVtxFmt;
|
||||||
boo::IShaderPipeline* CTextSupportShader::s_ImageAlphaPipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_ImageAlphaPipeline;
|
||||||
boo::IShaderPipeline* CTextSupportShader::s_ImageAddPipeline = nullptr;
|
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_ImageAddPipeline;
|
||||||
|
|
||||||
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance> CTextSupportShader::s_CharInsts;
|
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance> CTextSupportShader::s_CharInsts;
|
||||||
hecl::VertexBufferPool<CTextSupportShader::ImageInstance> CTextSupportShader::s_ImgInsts;
|
hecl::VertexBufferPool<CTextSupportShader::ImageInstance> CTextSupportShader::s_ImgInsts;
|
||||||
|
@ -61,6 +61,13 @@ void CTextSupportShader::ImageInstance::SetMetrics(const CFontImageDef& imgDef,
|
||||||
|
|
||||||
void CTextSupportShader::Shutdown()
|
void CTextSupportShader::Shutdown()
|
||||||
{
|
{
|
||||||
|
s_TextVtxFmt.reset();
|
||||||
|
s_TextAlphaPipeline.reset();
|
||||||
|
s_TextAddPipeline.reset();
|
||||||
|
s_ImageVtxFmt.reset();
|
||||||
|
s_ImageAlphaPipeline.reset();
|
||||||
|
s_ImageAddPipeline.reset();
|
||||||
|
|
||||||
s_CharInsts.doDestroy();
|
s_CharInsts.doDestroy();
|
||||||
s_ImgInsts.doDestroy();
|
s_ImgInsts.doDestroy();
|
||||||
s_Uniforms.doDestroy();
|
s_Uniforms.doDestroy();
|
||||||
|
|
|
@ -20,13 +20,13 @@ class CTextSupportShader
|
||||||
friend struct CTextSupportShaderD3DDataBindingFactory;
|
friend struct CTextSupportShaderD3DDataBindingFactory;
|
||||||
friend class CTextRenderBuffer;
|
friend class CTextRenderBuffer;
|
||||||
|
|
||||||
static boo::IVertexFormat* s_TextVtxFmt;
|
static boo::ObjToken<boo::IVertexFormat> s_TextVtxFmt;
|
||||||
static boo::IShaderPipeline* s_TextAlphaPipeline;
|
static boo::ObjToken<boo::IShaderPipeline> s_TextAlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_TextAddPipeline;
|
static boo::ObjToken<boo::IShaderPipeline> s_TextAddPipeline;
|
||||||
|
|
||||||
static boo::IVertexFormat* s_ImageVtxFmt;
|
static boo::ObjToken<boo::IVertexFormat> s_ImageVtxFmt;
|
||||||
static boo::IShaderPipeline* s_ImageAlphaPipeline;
|
static boo::ObjToken<boo::IShaderPipeline> s_ImageAlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_ImageAddPipeline;
|
static boo::ObjToken<boo::IShaderPipeline> s_ImageAddPipeline;
|
||||||
|
|
||||||
struct Uniform
|
struct Uniform
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
using _CLS = CTextSupportShader;
|
using _CLS = CTextSupportShader;
|
||||||
#include "TMultiBlendShaderDecl.hpp"
|
#include "TMultiBlendShaderDecl.hpp"
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectTextPipeline(CGuiWidget::EGuiModelDrawFlags df)
|
static boo::ObjToken<boo::IShaderPipeline> SelectTextPipeline(CGuiWidget::EGuiModelDrawFlags df)
|
||||||
{
|
{
|
||||||
switch (df)
|
switch (df)
|
||||||
{
|
{
|
||||||
|
@ -72,11 +72,11 @@ public:
|
||||||
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||||
return s_TextAddPipeline;
|
return s_TextAddPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectImagePipeline(CGuiWidget::EGuiModelDrawFlags df)
|
static boo::ObjToken<boo::IShaderPipeline> SelectImagePipeline(CGuiWidget::EGuiModelDrawFlags df)
|
||||||
{
|
{
|
||||||
switch (df)
|
switch (df)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||||
return s_ImageAddPipeline;
|
return s_ImageAddPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +98,8 @@ public:
|
||||||
s_ImgInsts.updateBuffers();
|
s_ImgInsts.updateBuffers();
|
||||||
s_Uniforms.updateBuffers();
|
s_Uniforms.updateBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,15 @@ CTextSupportShader::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CTextSupportShader::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_TextAlphaPipeline.reset();
|
||||||
|
s_TextAddPipeline.reset();
|
||||||
|
s_ImageAlphaPipeline.reset();
|
||||||
|
s_ImageAddPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TMultiBlendShader<CTextSupportShader>::IDataBindingFactory*
|
TMultiBlendShader<CTextSupportShader>::IDataBindingFactory*
|
||||||
CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -138,10 +138,12 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 2},
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 2},
|
||||||
};
|
};
|
||||||
s_TextVtxFmt = ctx.newVertexFormat(11, TextVtxVmt);
|
s_TextVtxFmt = ctx.newVertexFormat(11, TextVtxVmt);
|
||||||
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, nullptr, nullptr,
|
||||||
|
s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, nullptr, nullptr,
|
||||||
|
s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
|
@ -158,14 +160,27 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
|
||||||
};
|
};
|
||||||
s_ImageVtxFmt = ctx.newVertexFormat(9, ImageVtxVmt);
|
s_ImageVtxFmt = ctx.newVertexFormat(9, ImageVtxVmt);
|
||||||
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, nullptr, nullptr,
|
||||||
|
s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, nullptr, nullptr,
|
||||||
|
s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CTextSupportShader::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_TextVtxFmt.reset();
|
||||||
|
s_TextAlphaPipeline.reset();
|
||||||
|
s_TextAddPipeline.reset();
|
||||||
|
s_ImageVtxFmt.reset();
|
||||||
|
s_ImageAlphaPipeline.reset();
|
||||||
|
s_ImageAddPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CTexturedQuadFilter::CTexturedQuadFilter(boo::ITexture* tex)
|
CTexturedQuadFilter::CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex)
|
||||||
: m_booTex(tex)
|
: m_booTex(tex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, boo::ITexture* tex, bool gequal)
|
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const boo::ObjToken<boo::ITexture>& tex, bool gequal)
|
||||||
: m_booTex(tex), m_gequal(gequal)
|
: m_booTex(tex), m_gequal(gequal)
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 16);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 16);
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
|
@ -138,14 +138,12 @@ void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& col
|
||||||
|
|
||||||
const zeus::CRectangle CTexturedQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
const zeus::CRectangle CTexturedQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
||||||
|
|
||||||
void CTexturedQuadFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||||
|
|
||||||
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, boo::ITexture* tex)
|
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, const boo::ObjToken<boo::ITexture>& tex)
|
||||||
: CTexturedQuadFilter(tex)
|
: CTexturedQuadFilter(tex)
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
|
@ -161,8 +159,6 @@ CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type,
|
||||||
m_tex = tex;
|
m_tex = tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTexturedQuadFilterAlpha::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
|
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,13 @@ namespace urde
|
||||||
class CTexturedQuadFilter
|
class CTexturedQuadFilter
|
||||||
{
|
{
|
||||||
friend struct CTexturedQuadFilterGLDataBindingFactory;
|
friend struct CTexturedQuadFilterGLDataBindingFactory;
|
||||||
|
friend struct CTexturedQuadFilterAlphaGLDataBindingFactory;
|
||||||
friend struct CTexturedQuadFilterVulkanDataBindingFactory;
|
friend struct CTexturedQuadFilterVulkanDataBindingFactory;
|
||||||
|
friend struct CTexturedQuadFilterAlphaVulkanDataBindingFactory;
|
||||||
friend struct CTexturedQuadFilterMetalDataBindingFactory;
|
friend struct CTexturedQuadFilterMetalDataBindingFactory;
|
||||||
|
friend struct CTexturedQuadFilterAlphaMetalDataBindingFactory;
|
||||||
friend struct CTexturedQuadFilterD3DDataBindingFactory;
|
friend struct CTexturedQuadFilterD3DDataBindingFactory;
|
||||||
|
friend struct CTexturedQuadFilterAlphaD3DDataBindingFactory;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct Uniform
|
struct Uniform
|
||||||
|
@ -26,15 +30,14 @@ protected:
|
||||||
float m_lod = 0.f;
|
float m_lod = 0.f;
|
||||||
};
|
};
|
||||||
TLockedToken<CTexture> m_tex;
|
TLockedToken<CTexture> m_tex;
|
||||||
boo::ITexture* m_booTex;
|
boo::ObjToken<boo::ITexture> m_booTex;
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||||
boo::IGraphicsBufferD* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
bool m_gequal;
|
bool m_gequal;
|
||||||
|
|
||||||
CTexturedQuadFilter(boo::ITexture* tex);
|
CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Vert
|
struct Vert
|
||||||
|
@ -45,7 +48,7 @@ public:
|
||||||
|
|
||||||
static const zeus::CRectangle DefaultRect;
|
static const zeus::CRectangle DefaultRect;
|
||||||
CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex);
|
CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex);
|
||||||
CTexturedQuadFilter(EFilterType type, boo::ITexture* tex, bool gequal = false);
|
CTexturedQuadFilter(EFilterType type, const boo::ObjToken<boo::ITexture>& tex, bool gequal = false);
|
||||||
CTexturedQuadFilter(const CTexturedQuadFilter&) = delete;
|
CTexturedQuadFilter(const CTexturedQuadFilter&) = delete;
|
||||||
CTexturedQuadFilter& operator=(const CTexturedQuadFilter&) = delete;
|
CTexturedQuadFilter& operator=(const CTexturedQuadFilter&) = delete;
|
||||||
CTexturedQuadFilter(CTexturedQuadFilter&&) = default;
|
CTexturedQuadFilter(CTexturedQuadFilter&&) = default;
|
||||||
|
@ -69,7 +72,7 @@ class CTexturedQuadFilterAlpha : public CTexturedQuadFilter
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex);
|
CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex);
|
||||||
CTexturedQuadFilterAlpha(EFilterType type, boo::ITexture* tex);
|
CTexturedQuadFilterAlpha(EFilterType type, const boo::ObjToken<boo::ITexture>& tex);
|
||||||
using _CLS = CTexturedQuadFilterAlpha;
|
using _CLS = CTexturedQuadFilterAlpha;
|
||||||
#include "TMultiBlendShaderDecl.hpp"
|
#include "TMultiBlendShaderDecl.hpp"
|
||||||
};
|
};
|
||||||
|
|
|
@ -103,13 +103,13 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AlphaGEqualPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type, bool gequal)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type, bool gequal)
|
||||||
{
|
{
|
||||||
if (gequal)
|
if (gequal)
|
||||||
return s_AlphaGEqualPipeline;
|
return s_AlphaGEqualPipeline;
|
||||||
|
@ -122,16 +122,16 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type, bool gequal)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static boo::IVertexFormat* s_AVtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_AVtxFmt;
|
||||||
static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AAlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AAddPipeline;
|
||||||
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AMultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
|
static boo::ObjToken<boo::IShaderPipeline> SelectAlphaPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -142,28 +142,27 @@ static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_AMultPipeline;
|
return s_AMultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CTexturedQuadFilter& filter)
|
||||||
CTexturedQuadFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal),
|
return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal),
|
||||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -206,6 +205,15 @@ CTexturedQuadFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CTexturedQuadFilterGLDataBindingFactory;
|
return new CTexturedQuadFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CTexturedQuadFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AlphaGEqualPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory*
|
TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory*
|
||||||
CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
@ -236,22 +244,21 @@ URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
|
||||||
|
|
||||||
struct CTexturedQuadFilterAlphaGLDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
struct CTexturedQuadFilterAlphaGLDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CTexturedQuadFilterAlpha& filter)
|
||||||
CTexturedQuadFilterAlpha& filter)
|
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
|
||||||
return cctx.newShaderDataBinding(SelectAlphaPipeline(type),
|
return cctx.newShaderDataBinding(SelectAlphaPipeline(type),
|
||||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -291,6 +298,14 @@ CTexturedQuadFilterAlpha::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
return new CTexturedQuadFilterAlphaGLDataBindingFactory;
|
return new CTexturedQuadFilterAlphaGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CTexturedQuadFilterAlpha::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_AAlphaPipeline.reset();
|
||||||
|
s_AAddPipeline.reset();
|
||||||
|
s_AMultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory*
|
TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory*
|
||||||
CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx)
|
CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
|
|
|
@ -111,13 +111,13 @@ static const char* FSAlpha =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
|
||||||
static boo::IShaderPipeline* s_AlphaGEqualPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualPipeline;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectPipeline(EFilterType type, bool gequal)
|
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type, bool gequal)
|
||||||
{
|
{
|
||||||
if (gequal)
|
if (gequal)
|
||||||
return s_AlphaGEqualPipeline;
|
return s_AlphaGEqualPipeline;
|
||||||
|
@ -130,22 +130,21 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type, bool gequal)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_MultPipeline;
|
return s_MultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CTexturedQuadFilter& filter)
|
||||||
CTexturedQuadFilter& filter)
|
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal), s_VtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal), s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -159,27 +158,41 @@ CTexturedQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
s_AlphaGEqualPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AlphaGEqualPipeline = ctx.newShaderPipeline(VSNoFlip, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::GEqual, true,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::GEqual, true,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
boo::BlendFactor::One, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, nullptr, nullptr,
|
||||||
|
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||||
true, false, boo::CullMode::None);
|
true, false, boo::CullMode::None);
|
||||||
return new CTexturedQuadFilterMetalDataBindingFactory;
|
return new CTexturedQuadFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boo::IVertexFormat* s_AVtxFmt = nullptr;
|
template <>
|
||||||
static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
|
void CTexturedQuadFilter::Shutdown<boo::MetalDataFactory>()
|
||||||
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
|
{
|
||||||
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
|
s_VtxFmt.reset();
|
||||||
|
s_AlphaPipeline.reset();
|
||||||
|
s_AlphaGEqualPipeline.reset();
|
||||||
|
s_AddPipeline.reset();
|
||||||
|
s_MultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
|
static boo::ObjToken<boo::IVertexFormat> s_AVtxFmt;
|
||||||
|
static boo::ObjToken<boo::IShaderPipeline> s_AAlphaPipeline;
|
||||||
|
static boo::ObjToken<boo::IShaderPipeline> s_AAddPipeline;
|
||||||
|
static boo::ObjToken<boo::IShaderPipeline> s_AMultPipeline;
|
||||||
|
|
||||||
|
static boo::ObjToken<boo::IShaderPipeline> SelectAlphaPipeline(EFilterType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -190,22 +203,21 @@ static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
|
||||||
case EFilterType::Multiply:
|
case EFilterType::Multiply:
|
||||||
return s_AMultPipeline;
|
return s_AMultPipeline;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CTexturedQuadFilterAlphaMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
struct CTexturedQuadFilterAlphaMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
EFilterType type,
|
EFilterType type, CTexturedQuadFilterAlpha& filter)
|
||||||
CTexturedQuadFilterAlpha& filter)
|
|
||||||
{
|
{
|
||||||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
|
||||||
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
|
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -219,16 +231,28 @@ CTexturedQuadFilterAlpha::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
s_AVtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
s_AVtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, nullptr, nullptr,
|
||||||
|
s_AVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, nullptr, nullptr,
|
||||||
|
s_AVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, nullptr, nullptr,
|
||||||
|
s_AVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||||
return new CTexturedQuadFilterAlphaMetalDataBindingFactory;
|
return new CTexturedQuadFilterAlphaMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CTexturedQuadFilterAlpha::Shutdown<boo::MetalDataFactory>()
|
||||||
|
{
|
||||||
|
s_AVtxFmt.reset();
|
||||||
|
s_AAlphaPipeline.reset();
|
||||||
|
s_AAddPipeline.reset();
|
||||||
|
s_AMultPipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace urde
|
||||||
|
|
||||||
CThermalColdFilter::CThermalColdFilter()
|
CThermalColdFilter::CThermalColdFilter()
|
||||||
{
|
{
|
||||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
m_shiftTex = ctx.newDynamicTexture(8, 4, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat);
|
m_shiftTex = ctx.newDynamicTexture(8, 4, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat);
|
||||||
|
|
||||||
|
@ -62,12 +62,10 @@ void CThermalColdFilter::draw()
|
||||||
m_uniform.m_shiftTexScale[1] = 1.f / m_uniform.m_shiftTexMtx[1][1];
|
m_uniform.m_shiftTexScale[1] = 1.f / m_uniform.m_shiftTexMtx[1][1];
|
||||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||||
|
|
||||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
CGraphics::SetShaderDataBinding(m_dataBind);
|
||||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
CGraphics::DrawArray(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CThermalColdFilter::Shutdown() {}
|
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CThermalColdFilter)
|
URDE_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,10 @@ class CThermalColdFilter
|
||||||
zeus::CColor m_colorRegs[3];
|
zeus::CColor m_colorRegs[3];
|
||||||
};
|
};
|
||||||
u8 m_shiftTexture[4][8][4] = {};
|
u8 m_shiftTexture[4][8][4] = {};
|
||||||
boo::GraphicsDataToken m_token;
|
boo::ObjToken<boo::ITextureD> m_shiftTex;
|
||||||
boo::ITextureD* m_shiftTex = nullptr;
|
boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||||
boo::IGraphicsBufferS* m_vbo;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||||
boo::IGraphicsBufferD* m_uniBuf;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
|
||||||
Uniform m_uniform;
|
Uniform m_uniform;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -75,26 +75,26 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||||
|
|
||||||
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
CThermalColdFilter& filter)
|
CThermalColdFilter& filter)
|
||||||
{
|
{
|
||||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::Position4},
|
||||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
{filter.m_vbo.get(), nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
|
||||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_shiftTex.get()};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline,
|
return cctx.newShaderDataBinding(s_Pipeline,
|
||||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr,
|
||||||
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
|
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -126,6 +126,12 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
|
||||||
return new CThermalColdFilterGLDataBindingFactory;
|
return new CThermalColdFilterGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void CThermalColdFilter::Shutdown<boo::GLDataFactory>()
|
||||||
|
{
|
||||||
|
s_Pipeline.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue