Refactors to support fog volume rendering

This commit is contained in:
Jack Andersen 2017-03-13 21:03:58 -10:00
parent 22989ff47c
commit 1629882113
47 changed files with 1362 additions and 332 deletions

View File

@ -91,49 +91,51 @@ void ViewManager::TestGameView::resized(const boo::SWindowRect& root, const boo:
void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue *gfxQ)
{
gfxQ->clearTarget(false, true);
gfxQ->clearTarget(true, true);
//g_GameState->GetWorldTransitionManager()->Update(1.f / 60.f);
//g_GameState->GetWorldTransitionManager()->Draw();
if (m_vm.m_modelTest.IsLoaded())
{
#if 0
#if 1
CModelFlags flags;
flags.m_extendedShaderIdx = 0;
flags.m_extendedShader = EExtendedShader::Flat;
//flags.m_extendedShaderIdx = 2;
//if (std::fmod(m_theta, M_PIF) < M_PIF / 2.f)
// flags.m_extendedShaderIdx = 1;
m_theta += 0.01f;
CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta));
g_Renderer->SetWorldViewpoint(zeus::lookAt(zeus::CVector3f{0.f, -10.f, 7.f},
g_Renderer->SetWorldViewpoint(zeus::lookAt(zeus::CVector3f{0.f, -20.f, 7.f},
{0.f, 0.f, 3.f}));
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
float aspect = windowRect.size[0] / float(windowRect.size[1]);
CGraphics::SetPerspective(55.0, aspect, 0.1f, 1000.f);
CGraphics::SetPerspective(55.0, aspect, 0.2f, 750.f);
//CGraphics::SetFog(ERglFogMode::PerspExp, 7.f, 15.f, zeus::CColor::skRed);
//CGraphics::SetFog(ERglFogMode::PerspExp, 10.f + std::sin(m_theta) * 5.f, 15.f + std::sin(m_theta) * 5.f, zeus::CColor::skRed);
zeus::CFrustum frustum;
frustum.updatePlanes(CGraphics::g_GXModelView, zeus::SProjPersp(55.0, aspect, 0.1f, 1000.f));
frustum.updatePlanes(CGraphics::g_GXModelView, zeus::SProjPersp(55.0, aspect, 0.2f, 750.f));
g_Renderer->SetClippingPlanes(frustum);
std::vector<CLight> lights = {CLight::BuildLocalAmbient({}, {0.05f, 0.05f, 0.05f, 1.f}),
CLight::BuildCustom({5.f, -20.f, 10.f}, {0.f, 1.f, 0.f},
{200.f, 200.f, 200.f}, 0.f, 0.f, 1.f, 1.f, 0.f, 0.f)};
//lights = {CLight::BuildLocalAmbient({}, {1.0f, 0.0f, 0.0f, 1.f})};
lights = {CLight::BuildLocalAmbient({}, {0.5f, 0.5f, 0.5f, 1.f})};
m_vm.m_modelTest->GetInstance().ActivateLights(lights);
//g_Renderer->SetThermal(true, 1.f, zeus::CColor::skWhite);
//g_Renderer->SetThermalColdScale(std::sin(m_theta) * 0.5f + 0.5f);
//g_Renderer->DoThermalBlendCold();
//flags.m_extendedShaderIdx = 2;
flags.m_extendedShaderIdx = 1;
m_widescreen.draw(zeus::CColor::skBlack, std::sin(m_theta * 3.f) / 2.f + 0.5f);
//flags.m_extendedShader = EExtendedShader::Lighting;
//m_widescreen.draw(zeus::CColor::skBlack, std::sin(m_theta * 3.f) / 2.f + 0.5f);
m_vm.m_modelTest->Draw(flags);
g_Renderer->ReallyRenderFogVolume(zeus::CColor::skRed, m_vm.m_modelTest->GetAABB(),
nullptr, nullptr);
//m_xrayBlur.draw(25.f);
m_camBlur.draw((std::sin(m_theta * 3.f) / 2.f + 0.5f) * 3.f);
//m_camBlur.draw((std::sin(m_theta * 3.f) / 2.f + 0.5f) * 3.f);
//g_Renderer->DoThermalBlendHot();
//m_spaceWarpFilter.setStrength(std::sin(m_theta * 5.f) * 0.5f + 0.5f);
//m_spaceWarpFilter.draw(zeus::CVector2f{0.f, 0.f});
@ -176,7 +178,7 @@ void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue *gfxQ)
m_vm.m_moviePlayer->DrawFrame();
}
m_vm.m_projManager.mainDraw();
//m_vm.m_projManager.mainDraw();
++m_frame;
}
@ -404,10 +406,13 @@ bool ViewManager::proc()
if (m_rootSpaceView && m_editorFrames <= 30)
m_rootSpaceView->setMultiplyColor(zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, m_editorFrames / 30.0));
m_projManager.mainUpdate();
//m_projManager.mainUpdate();
if (g_Renderer)
g_Renderer->BeginScene();
m_rootView->draw(gfxQ);
CGraphics::EndScene();
if (g_Renderer)
g_Renderer->EndScene();
gfxQ->execute();
m_projManager.asyncIdle();
m_mainWindow->waitForRetrace(m_voiceEngine.get());

View File

@ -30,7 +30,7 @@ private:
UParmValue x0_value;
EParmType x4_type;
public:
CPASAnimParm(UParmValue val, EParmType tp) : x4_type(tp), x0_value(val) {}
CPASAnimParm(UParmValue val, EParmType tp) : x0_value(val), x4_type(tp) {}
EParmType GetParameterType() const { return x4_type; }
s32 GetEnumValue() const {return x0_value.m_int;}

View File

@ -11,6 +11,7 @@
#include "Collision/CAreaOctTree.hpp"
#include "zeus/CUnitVector.hpp"
#include "Graphics/CSkinnedModel.hpp"
#include "zeus/CVector3d.hpp"
#define FOGVOL_RAMP_RES 256
#define FOGVOL_FAR 750.0
@ -295,45 +296,163 @@ static const struct FogVolumeControl
} s_FogVolumeCtrl = {};
void CBooRenderer::DrawFogSlices(const zeus::CPlane* planes, int numPlanes,
int iteration, const zeus::CVector3f& center, float delta)
static const int OrthogonalAxis[3][2] =
{
{1, 2},
{0, 2},
{0, 1}
};
static float GetPlaneInterpolant(const zeus::CPlane& plane,
const zeus::CVector3f& vert1,
const zeus::CVector3f& vert2)
{
return zeus::clamp(0.f, -plane.pointToPlaneDist(vert1) / (vert2 - vert1).dot(plane.normal()), 1.f);
}
void CBooRenderer::CalcDrawFogFan(const zeus::CPlane* planes, int numPlanes, const zeus::CVector3f* verts,
int numVerts, int iteration, int level, CFogVolumePlaneShader& fogVol)
{
if (level == iteration)
{
CalcDrawFogFan(planes, numPlanes, verts, numVerts, iteration, level + 1, fogVol);
return;
}
if (level == numPlanes)
{
fogVol.addFan(verts, numVerts);
return;
}
const zeus::CPlane& plane = planes[level];
u32 insidePlaneCount = 0;
bool outsidePlane[4];
for (int i=0 ; i<numVerts ; ++i)
outsidePlane[insidePlaneCount++] = plane.normal().dot(verts[i]) < plane.d;
u32 numUseVerts = 0;
zeus::CVector3f useVerts[4];
for (int i=0 ; i<numVerts ; ++i)
{
int nextIdx = (i + 1) % numVerts;
int insidePair = outsidePlane[i] | (outsidePlane[nextIdx] << 1);
if (!(insidePair & 0x1))
useVerts[numUseVerts++] = verts[i];
if (insidePair == 1 || insidePair == 2)
{
/* Inside/outside transition; clip verts to other plane boundary */
const zeus::CVector3f vert1 = verts[i];
const zeus::CVector3f vert2 = verts[nextIdx];
float interp = GetPlaneInterpolant(plane, vert1, vert2);
if (interp > 0.f || interp < 1.f)
useVerts[numUseVerts++] = (vert1 * (1.f - interp)) + (vert2 * interp);
}
}
if (numUseVerts >= 3)
CalcDrawFogFan(planes, numPlanes, useVerts, numUseVerts, iteration, level + 1, fogVol);
}
void CBooRenderer::DrawFogSlices(const zeus::CPlane* planes, int numPlanes,
int iteration, const zeus::CVector3f& center, float longestAxis,
CFogVolumePlaneShader& fogVol)
{
u32 vertCount = 0;
zeus::CVector3d verts[4];
u32 vert2Count = 0;
zeus::CVector3f verts2[4];
const zeus::CPlane& plane = planes[iteration];
int longestNormAxis = std::fabs(plane[1]) > std::fabs(plane[0]);
if (std::fabs(plane[2]) > std::fabs(plane[longestNormAxis]))
longestNormAxis = 2;
zeus::CVector3d pointOnPlane = center - (plane.pointToPlaneDist(center) * plane.normal());
float deltaSign = plane[longestNormAxis] >= 0.f ? -1.f : 1.f;
if (longestNormAxis == 1)
deltaSign = -deltaSign;
zeus::CVector3d vec1;
zeus::CVector3d vec2;
vec1[OrthogonalAxis[longestNormAxis][0]] = longestAxis;
vec2[OrthogonalAxis[longestNormAxis][1]] = deltaSign * longestAxis;
verts[vertCount++] = pointOnPlane - vec1 - vec2;
verts[vertCount++] = pointOnPlane + vec1 - vec2;
verts[vertCount++] = pointOnPlane + vec1 + vec2;
verts[vertCount++] = pointOnPlane - vec1 + vec2;
zeus::CVector3d planeNormal = plane.normal();
for (const zeus::CVector3d& vert : verts)
verts2[vert2Count++] = vert - (planeNormal * (planeNormal.dot(vert) - plane.d));
CalcDrawFogFan(planes, numPlanes, verts2, vert2Count, iteration, 0, fogVol);
}
void CBooRenderer::RenderFogVolumeModel(const zeus::CAABox& aabb, const CModel* model,
const zeus::CTransform& modelMtx, const zeus::CTransform& viewMtx,
const CSkinnedModel* sModel)
const CSkinnedModel* sModel, int pass, CFogVolumePlaneShader* fvs)
{
if (!model && !sModel)
{
zeus::CAABox xfAABB = aabb.getTransformedAABox(modelMtx);
zeus::CUnitVector3f viewNormal(viewMtx.basis[1]);
zeus::CPlane planes[7] =
if (pass == 0)
{
{zeus::CVector3f::skRight, xfAABB.min.x},
{zeus::CVector3f::skLeft, -xfAABB.max.x},
{zeus::CVector3f::skForward, xfAABB.min.y},
{zeus::CVector3f::skBack, -xfAABB.max.y},
{zeus::CVector3f::skUp, xfAABB.min.z},
{zeus::CVector3f::skDown, -xfAABB.max.z},
{viewNormal, viewNormal.dot(viewMtx.origin) + 0.2f + 0.1f}
};
zeus::CAABox xfAABB = aabb.getTransformedAABox(modelMtx);
zeus::CUnitVector3f viewNormal(viewMtx.basis[1]);
zeus::CPlane planes[7] =
{
{zeus::CVector3f::skRight, xfAABB.min.x},
{zeus::CVector3f::skLeft, -xfAABB.max.x},
{zeus::CVector3f::skForward, xfAABB.min.y},
{zeus::CVector3f::skBack, -xfAABB.max.y},
{zeus::CVector3f::skUp, xfAABB.min.z},
{zeus::CVector3f::skDown, -xfAABB.max.z},
{viewNormal, viewNormal.dot(viewMtx.origin) + 0.2f + 0.1f}
};
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
float delta = std::max(std::max(
xfAABB.max.x - xfAABB.min.x,
xfAABB.max.y - xfAABB.min.y),
xfAABB.max.z - xfAABB.min.z) * 2.f;
float longestAxis = std::max(std::max(
xfAABB.max.x - xfAABB.min.x,
xfAABB.max.y - xfAABB.min.y),
xfAABB.max.z - xfAABB.min.z) * 2.f;
for (int i=0 ; i<7 ; ++i)
DrawFogSlices(planes, 7, i, xfAABB.center(), delta);
fvs->reset(7 * 6);
for (int i=0 ; i<7 ; ++i)
DrawFogSlices(planes, 7, i, xfAABB.center(), longestAxis, *fvs);
fvs->draw(0);
}
else
{
fvs->draw(pass);
}
}
else
{
CModelFlags flags;
flags.m_extendedShader = EExtendedShader::SolidColor;
switch (pass)
{
case 0:
default:
flags.m_extendedShader = EExtendedShader::SolidColorFrontfaceCullLEqualAlphaOnly;
flags.color = zeus::CColor(1.f, 1.f, 1.f, 1.f);
break;
case 1:
flags.m_extendedShader = EExtendedShader::SolidColorFrontfaceCullAlwaysAlphaOnly;
flags.color = zeus::CColor(1.f, 1.f, 1.f, 1.f);
break;
case 2:
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
flags.color = zeus::CColor(1.f, 1.f, 1.f, 0.f);
break;
case 3:
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullGreaterAlphaOnly;
flags.color = zeus::CColor(1.f, 1.f, 1.f, 0.f);
break;
}
if (sModel)
{
sModel->Draw(flags);
@ -341,7 +460,7 @@ void CBooRenderer::RenderFogVolumeModel(const zeus::CAABox& aabb, const CModel*
else
{
model->UpdateLastFrame();
model->GetInstance().Draw(flags, nullptr, nullptr);
model->Draw(flags);
}
}
}
@ -349,15 +468,12 @@ void CBooRenderer::RenderFogVolumeModel(const zeus::CAABox& aabb, const CModel*
void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb,
const CModel* model, const CSkinnedModel* sModel)
{
zeus::CTransform backupModel = CGraphics::g_GXModelMatrix;
zeus::CTransform backupView = CGraphics::g_ViewMatrix;
zeus::CMatrix4f proj = CGraphics::GetPerspectiveProjectionMatrix(false);
zeus::CVector4f points[8];
for (int i=0 ; i<8 ; ++i)
{
zeus::CVector3f pt = backupModel * aabb.getPoint(i);
zeus::CVector3f xfPt = backupView.transposeRotate(pt - backupView.origin);
zeus::CVector3f xfPt = CGraphics::g_GXModelView * aabb.getPoint(i);
points[i] = proj * zeus::CVector4f(xfPt);
}
@ -392,8 +508,8 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
overW = (pt1_3 + interp * (pt2_3 - pt1_3)) * wRecip;
}
if (overW.z > 1.001f)
continue;
//if (overW.z > 1.001f)
// continue;
int vpX = zeus::clamp(0, int(g_Viewport.x8_width * overW.x * 0.5f + (g_Viewport.x8_width / 2)), int(g_Viewport.x8_width));
int vpY = zeus::clamp(0, int(g_Viewport.xc_height * overW.y * 0.5f + (g_Viewport.xc_height / 2)), int(g_Viewport.xc_height));
@ -404,28 +520,52 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
b1 = false;
}
zeus::CVector2i vpSize = {320, 228};
if (!b1)
{
vpSize.x = std::min(320, vpMax.x - vpMin.x);
vpSize.y = std::min(320, vpMax.y - vpMin.y);
}
zeus::CVector2i vpSize = {vpMax.x - vpMin.x, vpMax.y - vpMin.y};
if (vpSize.x <= 0 || vpSize.y <= 0)
return;
//vpMin.y + g_Viewport.x4_top;
SClipScreenRect rect = {};
rect.x4_left = vpMin.x;
rect.x8_top = vpMin.y;
rect.xc_width = vpSize.x;
rect.x10_height = vpSize.y;
zeus::CAABox box((backupModel * aabb.min) - 1.f, (backupModel * aabb.max) + 1.f);
if (box.pointInside(CGraphics::g_ViewPoint) && (model || sModel))
rect.x4_left = 0;
rect.x8_top = 0;
rect.xc_width = g_Viewport.x8_width;
rect.x10_height = g_Viewport.xc_height;
//CGraphics::SetScissor(vpMin.x, vpMin.y, vpSize.x, vpSize.y);
CFogVolumePlaneShader* fvs;
if (!model && !sModel)
{
fvs = &*((m_nextFogVolumePlaneShader == m_fogVolumePlaneShaders.end()) ?
m_fogVolumePlaneShaders.insert(m_fogVolumePlaneShaders.end(), CFogVolumePlaneShader()) :
m_nextFogVolumePlaneShader++);
}
else
{
fvs = nullptr;
}
RenderFogVolumeModel(aabb, model, CGraphics::g_GXModelMatrix, CGraphics::g_ViewMatrix, sModel, 0, fvs);
RenderFogVolumeModel(aabb, model, CGraphics::g_GXModelMatrix, CGraphics::g_ViewMatrix, sModel, 1, fvs);
CGraphics::ResolveSpareDepth(rect, 0);
RenderFogVolumeModel(aabb, model, CGraphics::g_GXModelMatrix, CGraphics::g_ViewMatrix, sModel, 2, fvs);
RenderFogVolumeModel(aabb, model, CGraphics::g_GXModelMatrix, CGraphics::g_ViewMatrix, sModel, 3, fvs);
CGraphics::ResolveSpareDepth(rect, 1);
auto fvf = (m_nextFogVolumeFilter == m_fogVolumeFilters.end()) ?
m_fogVolumeFilters.insert(m_fogVolumeFilters.end(), CFogVolumeFilter()) :
m_nextFogVolumeFilter++;
fvf->draw2WayPass(color);
fvf->draw1WayPass(color);
//CGraphics::SetScissor(g_Viewport.x0_left, g_Viewport.x4_top, g_Viewport.x8_width, g_Viewport.xc_height);
}
void CBooRenderer::GenerateFogVolumeRampTex(boo::IGraphicsDataFactory::Context& ctx)
@ -498,6 +638,9 @@ CBooRenderer::CBooRenderer(IObjectStore& store, IFactory& resFac)
m_thermHotFilter.emplace();
Buckets::Init();
m_nextFogVolumePlaneShader = m_fogVolumePlaneShaders.end();
m_nextFogVolumeFilter = m_fogVolumeFilters.end();
}
void CBooRenderer::AddWorldSurfaces(CBooModel& model)
@ -828,6 +971,8 @@ void CBooRenderer::BeginScene()
x318_26_requestRGBA6 = false;
//GXSetPixelFmt(x318_27_currentRGBA6);
CGraphics::BeginScene();
m_nextFogVolumePlaneShader = m_fogVolumePlaneShaders.begin();
m_nextFogVolumeFilter = m_fogVolumeFilters.begin();
}
void CBooRenderer::EndScene()

View File

@ -8,6 +8,8 @@
#include "Shaders/CThermalColdFilter.hpp"
#include "Shaders/CThermalHotFilter.hpp"
#include "Shaders/CSpaceWarpFilter.hpp"
#include "Shaders/CFogVolumePlaneShader.hpp"
#include "Shaders/CFogVolumeFilter.hpp"
#include "CRandom16.hpp"
#include "CPVSVisSet.hpp"
#include "zeus/CRectangle.hpp"
@ -127,6 +129,10 @@ class CBooRenderer : public IRenderer
CRandom16 x2a8_thermalRand;
std::list<CFogVolumeListItem> x2ac_fogVolumes;
std::list<CFogVolumePlaneShader> m_fogVolumePlaneShaders;
std::list<CFogVolumePlaneShader>::iterator m_nextFogVolumePlaneShader;
std::list<CFogVolumeFilter> m_fogVolumeFilters;
std::list<CFogVolumeFilter>::iterator m_nextFogVolumeFilter;
std::list<std::pair<zeus::CVector3f, float>> x2c4_spaceWarps;
zeus::CColor x2e0_ = zeus::CColor::skWhite;
zeus::CVector3f x2e4_ = {0.f, 1.f, 0.f};
@ -166,12 +172,13 @@ class CBooRenderer : public IRenderer
void ActivateLightsForModel(CAreaListItem* item, CBooModel& model);
void RenderBucketItems(CAreaListItem* item);
void HandleUnsortedModel(CAreaListItem* item, CBooModel& model);
static void CalcDrawFogFan(const zeus::CPlane* planes, int numPlanes, const zeus::CVector3f* verts,
int numVerts, int iteration, int level, CFogVolumePlaneShader& fogVol);
static void DrawFogSlices(const zeus::CPlane* planes, int numPlanes, int iteration,
const zeus::CVector3f& center, float delta);
const zeus::CVector3f& center, float delta, CFogVolumePlaneShader& fogVol);
static void RenderFogVolumeModel(const zeus::CAABox& aabb, const CModel* model, const zeus::CTransform& modelMtx,
const zeus::CTransform& viewMtx, const CSkinnedModel* sModel);
void ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb,
const CModel* model, const CSkinnedModel* sModel);
const zeus::CTransform& viewMtx, const CSkinnedModel* sModel, int pass,
CFogVolumePlaneShader* fvs);
public:
CBooRenderer(IObjectStore& store, IFactory& resFac);
@ -239,7 +246,11 @@ public:
void PrepareDynamicLights(const std::vector<CLight>& lights);
void SetWorldLightFadeLevel(float level);
void ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb,
const CModel* model, const CSkinnedModel* sModel);
boo::ITexture* GetThermoPalette() {return x288_thermoPalette;}
boo::ITextureS* GetFogRampTex() {return x1b8_fogVolumeRamp;}
void BindMainDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(CGraphics::g_SpareTexture);}
void BindReflectionDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(x14c_reflectionTex);}
@ -254,7 +265,7 @@ public:
boo::SWindowRect(0, 0,
m_ballShadowIdW,
m_ballShadowIdH),
false, true, false);
false, 0, true, false);
}
void FindOverlappingWorldModels(std::vector<u32>& modelBits, const zeus::CAABox& aabb) const;

View File

@ -317,10 +317,15 @@ public:
{
g_BooMainCommandQueue->setShaderDataBinding(binding);
}
static void ResolveSpareTexture(const SClipScreenRect& rect)
static void ResolveSpareTexture(const SClipScreenRect& rect, int bindIdx=0)
{
boo::SWindowRect wrect = {rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height};
g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, true, false);
g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, bindIdx, true, false);
}
static void ResolveSpareDepth(const SClipScreenRect& rect, int bindIdx=0)
{
boo::SWindowRect wrect = {rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height};
g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, bindIdx, false, true);
}
static void DrawInstances(size_t start, size_t count, size_t instCount)
{

View File

@ -9,7 +9,9 @@ if(WIN32)
Shaders/CSpaceWarpFilterHLSL.cpp
Shaders/CCameraBlurFilterHLSL.cpp
Shaders/CXRayBlurFilterHLSL.cpp
Shaders/CTextSupportShaderHLSL.cpp)
Shaders/CTextSupportShaderHLSL.cpp
Shaders/CFogVolumePlaneShaderHLSL.cpp
Shaders/CFogVolumeFilterHLSL.cpp)
elseif(BOO_HAS_METAL)
set(PLAT_SRCS
Shaders/CLineRendererShadersMetal.cpp
@ -21,7 +23,9 @@ elseif(BOO_HAS_METAL)
Shaders/CSpaceWarpFilterMetal.cpp
Shaders/CCameraBlurFilterMetal.cpp
Shaders/CXRayBlurFilterMetal.cpp
Shaders/CTextSupportShaderMetal.cpp)
Shaders/CTextSupportShaderMetal.cpp
Shaders/CFogVolumePlaneShaderMetal.cpp
Shaders/CFogVolumeFilterMetal.cpp)
endif()
set(GRAPHICS_SOURCES
@ -55,6 +59,8 @@ set(GRAPHICS_SOURCES
Shaders/CCameraBlurFilter.hpp Shaders/CCameraBlurFilter.cpp Shaders/CCameraBlurFilterGLSL.cpp
Shaders/CXRayBlurFilter.hpp Shaders/CXRayBlurFilter.cpp Shaders/CXRayBlurFilterGLSL.cpp
Shaders/CTextSupportShader.hpp Shaders/CTextSupportShader.cpp Shaders/CTextSupportShaderGLSL.cpp
Shaders/CFogVolumePlaneShader.hpp Shaders/CFogVolumePlaneShader.cpp Shaders/CFogVolumePlaneShaderGLSL.cpp
Shaders/CFogVolumeFilter.hpp Shaders/CFogVolumeFilter.cpp Shaders/CFogVolumeFilterGLSL.cpp
${PLAT_SRCS})
runtime_add_list(Graphics GRAPHICS_SOURCES)

View File

@ -224,12 +224,12 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
{
size_t texCount;
boo::ITexture** ltexs;
if (idx == 2)
if (idx == EExtendedShader::Thermal)
{
texCount = 8;
ltexs = texs.data();
}
else if (idx == 6)
else if (idx == EExtendedShader::MorphBallShadow)
{
texCount = 3;
ltexs = mbShadowTexs;
@ -242,7 +242,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
extendeds.push_back(
ctx.newShaderDataBinding(pipeline, m_vtxFmt,
x8_vbo, nullptr, xc_ibo, 3, bufs, stages,
thisOffs, thisSizes, texCount, ltexs));
thisOffs, thisSizes, texCount, ltexs, nullptr, nullptr));
++idx;
}
}
@ -681,7 +681,8 @@ void CBooModel::UpdateUniformData(const CModelFlags& flags,
thermalOut.mulColor = flags.color;
thermalOut.addColor = flags.addColor;
}
else if (flags.m_extendedShader == EExtendedShader::SolidColor) /* Solid color render */
else if (flags.m_extendedShader >= EExtendedShader::SolidColor &&
flags.m_extendedShader <= EExtendedShader::SolidColorBackfaceCullGreaterAlphaOnly) /* Solid color render */
{
CModelShaders::SolidUniform& solidOut = *reinterpret_cast<CModelShaders::SolidUniform*>(dataCur);
solidOut.solidColor = flags.color;

View File

@ -217,7 +217,7 @@ void CMoviePlayer::Initialize()
YUVShaderPipeline = static_cast<boo::GLDataFactory::Context&>(ctx).newShaderPipeline
(VS_GLSL_YUV, FS_GLSL_YUV, 3, TexNames, 1, BlockNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
break;
#if _WIN32
case boo::IGraphicsDataFactory::Platform::D3D11:
@ -225,7 +225,7 @@ void CMoviePlayer::Initialize()
YUVShaderPipeline = static_cast<boo::ID3DDataFactory::Context&>(ctx).newShaderPipeline
(VS_HLSL_YUV, FS_HLSL_YUV, nullptr, nullptr, nullptr, YUVVTXFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
break;
#endif
#if BOO_HAS_METAL
@ -233,7 +233,7 @@ void CMoviePlayer::Initialize()
YUVShaderPipeline = static_cast<boo::MetalDataFactory::Context&>(ctx).newShaderPipeline
(VS_METAL_YUV, FS_METAL_YUV, YUVVTXFmt, 1,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
break;
#endif
#if BOO_HAS_VULKAN
@ -241,7 +241,7 @@ void CMoviePlayer::Initialize()
YUVShaderPipeline = static_cast<boo::VulkanDataFactory::Context&>(ctx).newShaderPipeline
(VS_GLSL_YUV, FS_GLSL_YUV, YUVVTXFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
break;
#endif
default: break;
@ -467,7 +467,8 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
{
boo::ITexture* texs[] = {set.Y[j], set.U, set.V};
set.binding[j] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf,
nullptr, nullptr, 1, bufs, nullptr, 3, texs);
nullptr, nullptr, 1, bufs, nullptr,
3, texs, nullptr, nullptr);
}
}
else
@ -486,7 +487,8 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
boo::IGraphicsBuffer* bufs[] = {m_blockBuf};
boo::ITexture* texs[] = {set.Y[0], set.U, set.V};
set.binding[0] = ctx.newShaderDataBinding(YUVShaderPipeline, vtxFmt, m_vertBuf,
nullptr, nullptr, 1, bufs, nullptr, 3, texs);
nullptr, nullptr, 1, bufs, nullptr,
3, texs, nullptr, nullptr);
}
if (xf4_25_hasAudio)
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);

View File

@ -100,7 +100,7 @@ struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IData
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
return cctx.newShaderDataBinding(s_Pipeline,
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs);
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -116,7 +116,7 @@ struct CCameraBlurFilterVulkanDataBindingFactory : TShader<CCameraBlurFilter>::I
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs);
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
#endif
@ -126,8 +126,8 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
const char* texNames[] = {"sceneTex"};
const char* uniNames[] = {"CameraBlurUniform"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CCameraBlurFilterGLDataBindingFactory;
}
@ -141,8 +141,8 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, boo::CullMode::None);
return new CCameraBlurFilterVulkanDataBindingFactory;
}
#endif

View File

@ -105,7 +105,7 @@ struct CCameraBlurFilterMetalDataBindingFactory : TShader<CCameraBlurFilter>::ID
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs);
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -118,8 +118,8 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CCameraBlurFilterMetalDataBindingFactory;
}

View File

@ -81,7 +81,7 @@ struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFi
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
return cctx.newShaderDataBinding(SelectPipeline(type),
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 0, nullptr);
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
@ -97,7 +97,7 @@ struct CColoredQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CColoredQu
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr);
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
#endif
@ -107,14 +107,14 @@ CColoredQuadFilter::Initialize(boo::GLDataFactory::Context& ctx)
{
const char* uniNames[] = {"ColoredQuadUniform"};
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CColoredQuadFilterGLDataBindingFactory;
}
@ -128,14 +128,14 @@ CColoredQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CColoredQuadFilterVulkanDataBindingFactory;
}
#endif

View File

@ -80,7 +80,7 @@ struct CColoredQuadFilterMetalDataBindingFactory : TMultiBlendShader<CColoredQua
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr);
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
@ -93,14 +93,14 @@ CColoredQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CColoredQuadFilterMetalDataBindingFactory;
}

View File

@ -0,0 +1,46 @@
#include "CFogVolumeFilter.hpp"
namespace urde
{
CFogVolumeFilter::CFogVolumeFilter()
{
m_token = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
struct Vert
{
zeus::CVector2f m_pos;
zeus::CVector2f m_uv;
} verts[4] =
{
{{-1.0, -1.0}, {0.0, 0.0}},
{{-1.0, 1.0}, {0.0, 1.0}},
{{ 1.0, -1.0}, {1.0, 0.0}},
{{ 1.0, 1.0}, {1.0, 1.0}},
};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, sizeof(Vert), 4);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CColor), 1);
TShader<CFogVolumeFilter>::BuildShaderDataBinding(ctx, *this);
return true;
});
}
void CFogVolumeFilter::draw2WayPass(const zeus::CColor& color)
{
m_uniBuf->load(&color, sizeof(zeus::CColor));
CGraphics::SetShaderDataBinding(m_dataBind2Way);
CGraphics::DrawArray(0, 4);
}
void CFogVolumeFilter::draw1WayPass(const zeus::CColor& color)
{
m_uniBuf->load(&color, sizeof(zeus::CColor));
CGraphics::SetShaderDataBinding(m_dataBind1Way);
CGraphics::DrawArray(0, 4);
}
void CFogVolumeFilter::Shutdown() {}
URDE_SPECIALIZE_SHADER(CFogVolumeFilter)
}

View File

@ -0,0 +1,36 @@
#ifndef __URDE_CFOGVOLUMEFILTER_HPP__
#define __URDE_CFOGVOLUMEFILTER_HPP__
#include "TShader.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CRectangle.hpp"
namespace urde
{
class CFogVolumeFilter
{
friend struct CFogVolumeFilterGLDataBindingFactory;
friend struct CFogVolumeFilterVulkanDataBindingFactory;
friend struct CFogVolumeFilterMetalDataBindingFactory;
friend struct CFogVolumeFilterD3DDataBindingFactory;
boo::GraphicsDataToken m_token;
boo::IGraphicsBufferS* m_vbo;
boo::IGraphicsBufferD* m_uniBuf;
boo::IShaderDataBinding* m_dataBind1Way;
boo::IShaderDataBinding* m_dataBind2Way;
public:
CFogVolumeFilter();
void draw2WayPass(const zeus::CColor& color);
void draw1WayPass(const zeus::CColor& color);
using _CLS = CFogVolumeFilter;
#include "TShaderDecl.hpp"
};
}
#endif // __URDE_CFOGVOLUMEFILTER_HPP__

View File

@ -0,0 +1,189 @@
#include "CFogVolumeFilter.hpp"
#include "TShader.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
namespace urde
{
static const char* VS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n"
"layout(location=1) in vec2 uvIn;\n"
"\n"
"UBINDING0 uniform FogVolumeFilterUniform\n"
"{\n"
" vec4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
" vec2 uv;\n"
"};\n"
"\n"
"SBINDING(0) out VertToFrag vtf;\n"
"void main()\n"
"{\n"
" gl_Position = FLIPFROMGL(vec4(posIn.xy, 0.0, 1.0));\n"
" vtf.color = color;\n"
" vtf.uv = uvIn;\n"
"}\n";
static const char* FS1Way =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"\n"
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
" vec2 uv;\n"
"};\n"
"\n"
"SBINDING(0) in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n"
"TBINDING0 uniform sampler2D zFrontfaceTex;\n"
"TBINDING1 uniform sampler2D zBackfaceTex;\n"
"TBINDING2 uniform sampler2D zLinearizer;\n"
"void main()\n"
"{\n"
" float y;\n"
" const float linScale = 65535.0 / 65536.0 * 256.0;\n"
"#ifdef VULKAN\n"
" float x = modf((1.0 - texture(zFrontfaceTex, vtf.uv).r) * linScale, y);\n"
"#else\n"
" float x = modf(texture(zFrontfaceTex, vtf.uv).r * linScale, y);\n"
"#endif\n"
" const float uvBias = 0.5 / 256.0;\n"
" float alpha = texture(zLinearizer, vec2(x * 255.0 / 256.0 + uvBias, y / 256.0 + uvBias)).r * 10.0;\n"
" colorOut = vtf.color * alpha;\n"
"}\n";
static const char* FS2Way =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"\n"
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
" vec2 uv;\n"
"};\n"
"\n"
"SBINDING(0) in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n"
"TBINDING0 uniform sampler2D zFrontfaceTex;\n"
"TBINDING1 uniform sampler2D zBackfaceTex;\n"
"TBINDING2 uniform sampler2D zLinearizer;\n"
"void main()\n"
"{\n"
" float frontY;\n"
" float backY;\n"
" const float linScale = 65535.0 / 65536.0 * 256.0;\n"
"#ifdef VULKAN\n"
" float frontX = modf((1.0 - texture(zFrontfaceTex, vtf.uv).r) * linScale, frontY);\n"
" float backX = modf((1.0 - texture(zBackfaceTex, vtf.uv).r) * linScale, backY);\n"
"#else\n"
" float frontX = modf(texture(zFrontfaceTex, vtf.uv).r * linScale, frontY);\n"
" float backX = modf(texture(zBackfaceTex, vtf.uv).r * linScale, backY);\n"
"#endif\n"
" const float uvBias = 0.5 / 256.0;\n"
" float frontLin = texture(zLinearizer, vec2(frontX * 255.0 / 256.0 + uvBias, frontY / 256.0 + uvBias)).r;\n"
" float backLin = texture(zLinearizer, vec2(backX * 255.0 / 256.0 + uvBias, backY / 256.0 + uvBias)).r;\n"
" colorOut = vec4(vtf.color.rgb, (frontLin - backLin) * 10.0);\n"
"}\n";
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_1WayPipeline = nullptr;
static boo::IShaderPipeline* s_2WayPipeline = nullptr;
struct CFogVolumeFilterGLDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
const boo::VertexElementDescriptor VtxVmt[] =
{
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
};
boo::IVertexFormat* VtxVmtObj = cctx.newVertexFormat(2, VtxVmt);
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
g_Renderer->GetFogRampTex() };
int bindIdxs[] = {0, 1, 0};
bool bindDepth[] = {true, true, false};
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, VtxVmtObj,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, VtxVmtObj,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
return filter.m_dataBind1Way;
}
};
#if BOO_HAS_VULKAN
struct CFogVolumeFilterVulkanDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
g_Renderer->GetFogRampTex() };
int bindIdxs[] = {0, 1, 0};
bool bindDepth[] = {true, true, false};
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
return filter.m_dataBind1Way;
}
};
#endif
TShader<CFogVolumeFilter>::IDataBindingFactory*
CFogVolumeFilter::Initialize(boo::GLDataFactory::Context& ctx)
{
const char* texNames[] = {"zFrontfaceTex", "zBackfaceTex", "zLinearizer"};
const char* uniNames[] = {"FogVolumeFilterUniform"};
s_1WayPipeline = ctx.newShaderPipeline(VS, FS1Way, 3, texNames, 1, uniNames, boo::BlendFactor::DstAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_2WayPipeline = ctx.newShaderPipeline(VS, FS2Way, 3, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CFogVolumeFilterGLDataBindingFactory;
}
#if BOO_HAS_VULKAN
TShader<CFogVolumeFilter>::IDataBindingFactory*
CFogVolumeFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::UV4}
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_1WayPipeline = ctx.newShaderPipeline(VS, FS1Way, s_VtxFmt, boo::BlendFactor::DstAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_2WayPipeline = ctx.newShaderPipeline(VS, FS2Way, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CFogVolumeFilterVulkanDataBindingFactory;
}
#endif
}

View File

@ -0,0 +1,137 @@
#include "CFogVolumeFilter.hpp"
#include "TShader.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
namespace urde
{
static const char* VS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertData\n"
"{\n"
" float4 posIn [[ attribute(0) ]];\n"
" float2 uvIn [[ attribute(1) ]];\n"
"};\n"
"\n"
"struct FogVolumeFilterUniform\n"
"{\n"
" float4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 pos [[ position ]];\n"
" float4 color;\n"
" float2 uv;\n"
"};\n"
"\n"
"vertex VertToFrag vmain(VertData v [[ stage_in ]],\n"
" constant FogVolumeFilterUniform& fu [[ buffer(2) ]])\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.pos = float4(v.posIn.x, -v.posIn.y, 0.0, 1.0);\n"
" vtf.color = fu.color;\n"
" vtf.uv = v.uvIn;\n"
" return vtf;\n"
"}\n";
static const char* FS1Way =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat, filter::linear);\n"
"struct VertToFrag\n"
"{\n"
" float4 pos [[ position ]];\n"
" float4 color;\n"
" float2 uv;\n"
"};\n"
"\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
" texture2d<float> zFrontfaceTex [[ texture(0) ]],\n"
" texture2d<float> zBackfaceTex [[ texture(1) ]],\n"
" texture2d<float> zLinearizer [[ texture(2) ]])\n"
"{\n"
" float y;\n"
" const float linScale = 65535.0 / 65536.0 * 256.0;\n"
" float x = modf((1.0 - zFrontfaceTex.sample(samp, vtf.uv).r) * linScale, y);\n"
" const float uvBias = 0.5 / 256.0;\n"
" float alpha = zLinearizer.sample(samp, float2(x * 255.0 / 256.0 + uvBias, y / 256.0 + uvBias)).r * 10.0;\n"
" return vtf.color * alpha;\n"
"}\n";
static const char* FS2Way =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat, filter::linear);\n"
"struct VertToFrag\n"
"{\n"
" float4 pos [[ position ]];\n"
" float4 color;\n"
" float2 uv;\n"
"};\n"
"\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
" texture2d<float> zFrontfaceTex [[ texture(0) ]],\n"
" texture2d<float> zBackfaceTex [[ texture(1) ]],\n"
" texture2d<float> zLinearizer [[ texture(2) ]])\n"
"{\n"
" float frontY;\n"
" float backY;\n"
" const float linScale = 65535.0 / 65536.0 * 256.0;\n"
" float frontX = modf((1.0 - zFrontfaceTex.sample(samp, vtf.uv).r) * linScale, frontY);\n"
" float backX = modf((1.0 - zBackfaceTex.sample(samp, vtf.uv).r) * linScale, backY);\n"
" const float uvBias = 0.5 / 256.0;\n"
" float frontLin = zLinearizer.sample(samp, float2(frontX * 255.0 / 256.0 + uvBias, frontY / 256.0 + uvBias)).r;\n"
" float backLin = zLinearizer.sample(samp, float2(backX * 255.0 / 256.0 + uvBias, backY / 256.0 + uvBias)).r;\n"
" return float4(vtf.color.rgb, (frontLin - backLin) * 10.0);\n"
"}\n";
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_1WayPipeline = nullptr;
static boo::IShaderPipeline* s_2WayPipeline = nullptr;
struct CFogVolumeFilterMetalDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
g_Renderer->GetFogRampTex() };
int bindIdxs[] = {0, 1, 0};
bool bindDepth[] = {true, true, false};
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
return filter.m_dataBind1Way;
}
};
TShader<CFogVolumeFilter>::IDataBindingFactory*
CFogVolumeFilter::Initialize(boo::MetalDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::UV4}
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_1WayPipeline = ctx.newShaderPipeline(VS, FS1Way, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::DstAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_2WayPipeline = ctx.newShaderPipeline(VS, FS2Way, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CFogVolumeFilterMetalDataBindingFactory;
}
}

View File

@ -0,0 +1,67 @@
#include "CFogVolumePlaneShader.hpp"
namespace urde
{
void CFogVolumePlaneShader::CommitResources(size_t capacity)
{
m_vertCapacity = capacity;
m_token = CGraphics::CommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector4f), capacity);
TShader<CFogVolumePlaneShader>::BuildShaderDataBinding(ctx, *this);
return true;
});
}
void CFogVolumePlaneShader::addFan(const zeus::CVector3f* verts, int numVerts)
{
if (numVerts == 3)
{
zeus::CMatrix4f proj = CGraphics::GetPerspectiveProjectionMatrix(true);
zeus::CVector4f vert0 = proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[0]);
if (m_verts.size())
{
m_verts.push_back(m_verts.back());
m_verts.push_back(vert0);
}
m_verts.push_back(vert0);
m_verts.push_back(proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[1]));
m_verts.push_back(proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[2]));
m_verts.push_back(m_verts.back());
}
else if (numVerts == 4)
{
zeus::CMatrix4f proj = CGraphics::GetPerspectiveProjectionMatrix(true);
zeus::CVector4f vert0 = proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[0]);
if (m_verts.size())
{
m_verts.push_back(m_verts.back());
m_verts.push_back(vert0);
}
m_verts.push_back(vert0);
m_verts.push_back(proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[1]));
m_verts.push_back(proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[3]));
m_verts.push_back(proj * zeus::CVector4f(CGraphics::g_GXModelView * verts[2]));
}
}
void CFogVolumePlaneShader::draw(int pass)
{
if (m_verts.empty())
return;
if (pass == 0)
{
if (m_vertCapacity < m_verts.size())
CommitResources(m_verts.size());
m_vbo->load(m_verts.data(), m_verts.size() * sizeof(zeus::CVector4f));
}
CGraphics::SetShaderDataBinding(m_dataBinds[pass]);
CGraphics::DrawArray(0, m_verts.size());
}
void CFogVolumePlaneShader::Shutdown() {}
URDE_SPECIALIZE_SHADER(CFogVolumePlaneShader)
}

View File

@ -0,0 +1,40 @@
#ifndef __URDE_CFOGVOLUMEPLANESHADER_HPP__
#define __URDE_CFOGVOLUMEPLANESHADER_HPP__
#include "TShader.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CRectangle.hpp"
#include "zeus/CVector4f.hpp"
namespace urde
{
class CFogVolumePlaneShader
{
friend struct CFogVolumePlaneShaderGLDataBindingFactory;
friend struct CFogVolumePlaneShaderVulkanDataBindingFactory;
friend struct CFogVolumePlaneShaderMetalDataBindingFactory;
friend struct CFogVolumePlaneShaderD3DDataBindingFactory;
boo::GraphicsDataToken m_token;
boo::IGraphicsBufferD* m_vbo;
boo::IShaderDataBinding* m_dataBinds[4];
std::vector<zeus::CVector4f> m_verts;
size_t m_vertCapacity = 0;
void CommitResources(size_t capacity);
public:
static const zeus::CRectangle DefaultRect;
void reset(int numVerts) { m_verts.clear(); m_verts.reserve(numVerts); }
void addFan(const zeus::CVector3f* verts, int numVerts);
void draw(int pass);
using _CLS = CFogVolumePlaneShader;
#include "TShaderDecl.hpp"
};
}
#endif // __URDE_CFOGVOLUMEPLANESHADER_HPP__

View File

@ -0,0 +1,112 @@
#include "CFogVolumePlaneShader.hpp"
#include "TShader.hpp"
namespace urde
{
static const char* VS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = posIn;\n"
"}\n";
static const char* FS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"\n"
"layout(location=0) out vec4 colorOut;\n"
"void main()\n"
"{\n"
" colorOut = vec4(1.0);\n"
"}\n";
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipelines[4] = {};
struct CFogVolumePlaneShaderGLDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
const boo::VertexElementDescriptor VtxVmt[] =
{
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4}
};
boo::IVertexFormat* VtxVmtObj = cctx.newVertexFormat(1, VtxVmt);
for (int i=0 ; i<4 ; ++i)
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], VtxVmtObj,
filter.m_vbo, nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBinds[0];
}
};
#if BOO_HAS_VULKAN
struct CFogVolumePlaneShaderVulkanDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
for (int i=0 ; i<4 ; ++i)
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBinds[0];
}
};
#endif
TShader<CFogVolumePlaneShader>::IDataBindingFactory*
CFogVolumePlaneShader::Initialize(boo::GLDataFactory::Context& ctx)
{
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, 0, nullptr, 0, nullptr, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Frontface);
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, 0, nullptr, 0, nullptr, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, false, false, boo::CullMode::Frontface);
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, 0, nullptr, 0, nullptr, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Backface);
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, 0, nullptr, 0, nullptr, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
return new CFogVolumePlaneShaderGLDataBindingFactory;
}
#if BOO_HAS_VULKAN
TShader<CFogVolumePlaneShader>::IDataBindingFactory*
CFogVolumePlaneShader::Initialize(boo::VulkanDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Frontface);
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, false, false, boo::CullMode::Frontface);
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Backface);
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
return new CFogVolumePlaneShaderVulkanDataBindingFactory;
}
#endif
}

View File

@ -0,0 +1,83 @@
#include "CFogVolumePlaneShader.hpp"
#include "TShader.hpp"
namespace urde
{
static const char* VS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertData\n"
"{\n"
" float4 posIn [[ attribute(0) ]];\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
"};\n"
"\n"
"vertex VertToFrag vmain(VertData v [[ stage_in ]])\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.position = v.posIn;\n"
" return vtf;\n"
"}\n";
static const char* FS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
"};\n"
"\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]])\n"
"{\n"
" return float4(1.0, 1.0, 1.0, 1.0);\n"
"}\n";
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipelines[4] = {};
struct CFogVolumePlaneShaderMetalDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
for (int i=0 ; i<4 ; ++i)
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBinds[0];
}
};
TShader<CFogVolumePlaneShader>::IDataBindingFactory*
CFogVolumePlaneShader::Initialize(boo::MetalDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Frontface);
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, false, false, boo::CullMode::Frontface);
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Backface);
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
return new CFogVolumePlaneShaderMetalDataBindingFactory;
}
}

View File

@ -120,7 +120,7 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, vtxFmt, renderer.m_vertBuf,
nullptr, nullptr, 1, uniforms, nullptr,
texCount, textures);
texCount, textures, nullptr, nullptr);
}
};
@ -130,17 +130,17 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
static const char* TexNames[] = {"tex"};
m_texAlpha = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
m_texAdditive = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
m_noTexAlpha = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 1, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
m_noTexAdditive = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 1, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
return new struct OGLLineDataBindingFactory;
}

View File

@ -119,7 +119,7 @@ struct MetalLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, renderer.m_vertBuf,
nullptr, nullptr, 1, uniforms, nullptr,
texCount, textures);
texCount, textures, nullptr, nullptr);
}
};
@ -141,21 +141,21 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
m_noTexVtxFmt = ctx.newVertexFormat(2, VtxFmtNoTex);
m_texAlpha = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_texVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
m_texAdditive = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_texVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
m_noTexAlpha = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_noTexVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
m_noTexAdditive = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, m_noTexVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
return new struct MetalLineDataBindingFactory;
}

View File

@ -49,4 +49,9 @@ void CModelShaders::Initialize(const hecl::Runtime::FileStoreManager& storeMgr,
g_ModelShaders.emplace(storeMgr, gfxFactory);
}
void CModelShaders::Shutdown()
{
g_ModelShaders = std::experimental::nullopt;
}
}

View File

@ -20,6 +20,10 @@ enum EExtendedShader : uint8_t
ForcedAlpha,
ForcedAdditive,
SolidColor,
SolidColorFrontfaceCullLEqualAlphaOnly,
SolidColorFrontfaceCullAlwaysAlphaOnly, // No Z-write or test
SolidColorBackfaceCullLEqualAlphaOnly,
SolidColorBackfaceCullGreaterAlphaOnly, // No Z-write
MorphBallShadow
};
@ -72,6 +76,7 @@ public:
static void Initialize(const hecl::Runtime::FileStoreManager& storeMgr,
boo::IGraphicsDataFactory* gfxFactory);
static void Shutdown();
CModelShaders(const hecl::Runtime::FileStoreManager& storeMgr,
boo::IGraphicsDataFactory* gfxFactory);

View File

@ -125,33 +125,64 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
/* Normal lit shading */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original,
hecl::Backend::BlendFactor::Original);
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Thermal Visor shading */
ext.registerExtensionSlot({}, {ThermalPostGLSL, "ThermalPostFunc"}, 3, ThermalBlockNames,
1, ThermalTextures, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::One);
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Forced alpha shading */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha);
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Forced additive shading */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::One);
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Solid shading */
/* Solid color */
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::Zero);
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
false, false, false, false);
/* Alpha-only Solid color frontface cull, LEqual */
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
true, false, true, false);
/* Alpha-only Solid color frontface cull, Always, No Z-write */
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None,
true, true, true, false);
/* Alpha-only Solid color backface cull, LEqual */
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
false, false, true, false);
/* Alpha-only Solid color backface cull, Greater, No Z-write */
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater,
false, true, true, false);
/* MorphBall shadow shading */
ext.registerExtensionSlot({}, {MBShadowPostGLSL, "MBShadowPostFunc"},
3, MBShadowBlockNames, 3, BallFadeTextures,
hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha);
hecl::Backend::BlendFactor::InvSrcAlpha,
hecl::Backend::ZTest::Equal,
false, false, false, true);
return ext;
}

View File

@ -125,16 +125,37 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::One);
/* Solid shading */
/* Solid color */
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::Zero);
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual, false, false);
/* Alpha-only Solid color backface cull, LEqual */
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual, false, false);
/* Alpha-only Solid color backface cull, Always, No Z-write */
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None, false, true);
/* Alpha-only Solid color frontface cull, LEqual */
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual, true, false);
/* Alpha-only Solid color frontface cull, Greater, No Z-write */
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater, true, true);
/* MorphBall shadow shading */
ext.registerExtensionSlot({}, {MBShadowPostHLSL, "MBShadowPostFunc"},
0, nullptr, 3, BallFadeTextures,
hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha);
hecl::Backend::BlendFactor::InvSrcAlpha,
hecl::Backend::ZTest::Equal);
return ext;
}

View File

@ -114,33 +114,64 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
/* Normal lit shading */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original,
hecl::Backend::BlendFactor::Original);
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Thermal Visor shading */
ext.registerExtensionSlot({}, {ThermalPostMetal, "ThermalPostFunc"}, 1, ThermalBlockNames,
1, ThermalTextures, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::One);
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Forced alpha shading */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha);
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Forced additive shading */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::One);
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
false, false, false, true);
/* Solid shading */
/* Solid color */
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::Zero);
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
false, false, false, false);
/* Alpha-only Solid color frontface cull, LEqual */
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
true, false, true, false);
/* Alpha-only Solid color frontface cull, Always, No Z-write */
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None,
true, true, true, false);
/* Alpha-only Solid color backface cull, LEqual */
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
false, false, true, false);
/* Alpha-only Solid color backface cull, Greater, No Z-write */
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater,
false, true, true, false);
/* MorphBall shadow shading */
ext.registerExtensionSlot({}, {MBShadowPostMetal, "MBShadowPostFunc"},
1, MBShadowBlockNames, 3, BallFadeTextures,
hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha);
hecl::Backend::BlendFactor::InvSrcAlpha,
hecl::Backend::ZTest::Equal,
false, false, false, true);
return ext;
}

View File

@ -73,7 +73,7 @@ struct CSpaceWarpFilterGLDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBi
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
return cctx.newShaderDataBinding(s_Pipeline,
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 2, texs);
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -89,7 +89,7 @@ struct CSpaceWarpFilterVulkanDataBindingFactory : TShader<CSpaceWarpFilter>::IDa
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
#endif
@ -99,8 +99,8 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
const char* texNames[] = {"sceneTex", "indTex"};
const char* uniNames[] = {"SpaceWarpUniform"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CSpaceWarpFilterGLDataBindingFactory;
}
@ -114,8 +114,8 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CSpaceWarpFilterVulkanDataBindingFactory;
}
#endif

View File

@ -71,7 +71,7 @@ struct CSpaceWarpFilterMetalDataBindingFactory : TShader<CSpaceWarpFilter>::IDat
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -84,8 +84,8 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CSpaceWarpFilterMetalDataBindingFactory;
}

View File

@ -111,18 +111,18 @@ CTextSupportShader::Initialize(boo::GLDataFactory::Context& ctx)
const char* uniNames[] = {"TextSupportUniform"};
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
return nullptr;
}
@ -147,11 +147,11 @@ CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
};
s_TextVtxFmt = ctx.newVertexFormat(11, TextVtxVmt);
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
boo::VertexElementDescriptor ImageVtxVmt[] =
{
@ -167,11 +167,11 @@ CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
};
s_ImageVtxFmt = ctx.newVertexFormat(9, ImageVtxVmt);
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
return nullptr;
}

View File

@ -138,10 +138,12 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 2},
};
s_TextVtxFmt = ctx.newVertexFormat(11, TextVtxVmt);
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
boo::VertexElementDescriptor ImageVtxVmt[] =
{
@ -156,10 +158,12 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
};
s_ImageVtxFmt = ctx.newVertexFormat(9, ImageVtxVmt);
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, true, false, boo::CullMode::None);
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
return nullptr;
}

View File

@ -155,7 +155,7 @@ struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuad
boo::ITexture* texs[] = {filter.m_booTex};
return cctx.newShaderDataBinding(SelectPipeline(type),
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs);
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -172,7 +172,7 @@ struct CTexturedQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CTextured
boo::ITexture* texs[] = {filter.m_booTex};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs);
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
#endif
@ -183,14 +183,14 @@ CTexturedQuadFilter::Initialize(boo::GLDataFactory::Context& ctx)
const char* texNames[] = {"tex"};
const char* uniNames[] = {"TexuredQuadUniform"};
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CTexturedQuadFilterGLDataBindingFactory;
}
@ -205,14 +205,14 @@ CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, boo::CullMode::None);
return new CTexturedQuadFilterVulkanDataBindingFactory;
}
#endif
@ -237,7 +237,7 @@ struct CTexturedQuadFilterAlphaGLDataBindingFactory : TMultiBlendShader<CTexture
boo::ITexture* texs[] = {filter.m_booTex};
return cctx.newShaderDataBinding(SelectAlphaPipeline(type),
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs);
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -254,7 +254,7 @@ struct CTexturedQuadFilterAlphaVulkanDataBindingFactory : TMultiBlendShader<CTex
boo::ITexture* texs[] = {filter.m_booTex};
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs);
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
#endif
@ -265,14 +265,14 @@ CTexturedQuadFilterAlpha::Initialize(boo::GLDataFactory::Context& ctx)
const char* texNames[] = {"tex"};
const char* uniNames[] = {"TexuredQuadUniform"};
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CTexturedQuadFilterAlphaGLDataBindingFactory;
}
@ -287,14 +287,14 @@ CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx)
};
s_AVtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CTexturedQuadFilterAlphaVulkanDataBindingFactory;
}
#endif

View File

@ -135,7 +135,7 @@ struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQ
boo::ITexture* texs[] = {filter.m_booTex};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs);
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -149,14 +149,14 @@ CTexturedQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::None, false,
true, true, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips, boo::ZTest::None, false,
true, true, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, boo::ZTest::None, false,
true, true, boo::CullMode::None);
return new CTexturedQuadFilterMetalDataBindingFactory;
}
@ -172,7 +172,7 @@ struct CTexturedQuadFilterAlphaMetalDataBindingFactory : TMultiBlendShader<CText
boo::ITexture* texs[] = {filter.m_booTex};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs);
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -186,14 +186,14 @@ CTexturedQuadFilterAlpha::Initialize(boo::MetalDataFactory::Context& ctx)
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CTexturedQuadFilterAlphaMetalDataBindingFactory;
}

View File

@ -95,7 +95,7 @@ struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDa
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
return cctx.newShaderDataBinding(s_Pipeline,
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 2, texs);
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -111,7 +111,7 @@ struct CThermalColdFilterVulkanDataBindingFactory : TShader<CThermalColdFilter>:
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
#endif
@ -121,8 +121,8 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
const char* texNames[] = {"sceneTex", "shiftTex"};
const char* uniNames[] = {"ThermalColdUniform"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CThermalColdFilterGLDataBindingFactory;
}
@ -136,8 +136,8 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CThermalColdFilterVulkanDataBindingFactory;
}
#endif

View File

@ -99,7 +99,7 @@ struct CThermalColdFilterMetalDataBindingFactory : TShader<CThermalColdFilter>::
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -112,8 +112,8 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CThermalColdFilterMetalDataBindingFactory;
}

View File

@ -72,7 +72,7 @@ struct CThermalHotFilterGLDataBindingFactory : TShader<CThermalHotFilter>::IData
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
return cctx.newShaderDataBinding(s_Pipeline,
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 2, texs);
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -88,7 +88,7 @@ struct CThermalHotFilterVulkanDataBindingFactory : TShader<CThermalHotFilter>::I
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
#endif
@ -98,8 +98,8 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
const char* texNames[] = {"sceneTex", "paletteTex"};
const char* uniNames[] = {"ThermalHotUniform"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::DstAlpha,
boo::BlendFactor::InvDstAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvDstAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CThermalHotFilterGLDataBindingFactory;
}
@ -113,8 +113,8 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::DstAlpha,
boo::BlendFactor::InvDstAlpha, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::InvDstAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CThermalHotFilterVulkanDataBindingFactory;
}
#endif

View File

@ -72,7 +72,7 @@ struct CThermalHotFilterMetalDataBindingFactory : TShader<CThermalHotFilter>::ID
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -86,7 +86,8 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::DstAlpha, boo::BlendFactor::InvDstAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, true, boo::CullMode::None);
return new CThermalHotFilterMetalDataBindingFactory;
}

View File

@ -84,7 +84,7 @@ struct CXRayBlurFilterGLDataBindingFactory : TShader<CXRayBlurFilter>::IDataBind
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
return cctx.newShaderDataBinding(s_Pipeline,
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 2, texs);
1, bufs, stages, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -100,7 +100,7 @@ struct CXRayBlurFilterVulkanDataBindingFactory : TShader<CXRayBlurFilter>::IData
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
#endif
@ -110,8 +110,8 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
const char* texNames[] = {"sceneTex", "paletteTex"};
const char* uniNames[] = {"XRayBlurUniform"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CXRayBlurFilterGLDataBindingFactory;
}
@ -125,8 +125,8 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CXRayBlurFilterVulkanDataBindingFactory;
}
#endif

View File

@ -87,7 +87,7 @@ struct CXRayBlurFilterMetalDataBindingFactory : TShader<CXRayBlurFilter>::IDataB
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs);
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -100,8 +100,8 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false,
boo::CullMode::None);
boo::BlendFactor::Zero, boo::Primitive::TriStrips, boo::ZTest::None, false,
true, true, boo::CullMode::None);
return new CXRayBlurFilterMetalDataBindingFactory;
}

View File

@ -93,7 +93,7 @@ void CTextRenderBuffer::CommitResources()
chs.m_dataBinding = ctx.newShaderDataBinding(CTextSupportShader::SelectTextPipeline(m_drawFlags),
vFmt, nullptr, iBufInfo.first, nullptr,
1, uniforms, unistages, unioffs,
unisizes, 1, texs, 0, iBufInfo.second);
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second);
}
for (BooImage& img : m_images)
@ -131,7 +131,7 @@ void CTextRenderBuffer::CommitResources()
img.m_dataBinding.push_back(ctx.newShaderDataBinding(CTextSupportShader::SelectImagePipeline(m_drawFlags),
vFmt, nullptr, iBufInfo.first, nullptr,
1, uniforms, unistages, unioffs,
unisizes, 1, texs, 0, iBufInfo.second));
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second));
}
}
return true;

View File

@ -21,6 +21,8 @@ URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
@ -209,6 +211,8 @@ CMain::BooSetter::BooSetter(boo::IGraphicsDataFactory* factory,
TShader<CSpaceWarpFilter>::Initialize();
TShader<CCameraBlurFilter>::Initialize();
TShader<CXRayBlurFilter>::Initialize();
TShader<CFogVolumePlaneShader>::Initialize();
TShader<CFogVolumeFilter>::Initialize();
TMultiBlendShader<CColoredQuadFilter>::Initialize();
TMultiBlendShader<CTexturedQuadFilter>::Initialize();
TMultiBlendShader<CTexturedQuadFilterAlpha>::Initialize();
@ -313,6 +317,7 @@ void CMain::ShutdownSubsystems()
CElementGen::Shutdown();
CAnimData::FreeCache();
CMemoryCardSys::Shutdown();
CModelShaders::Shutdown();
}
void CMain::Shutdown()
@ -324,6 +329,8 @@ void CMain::Shutdown()
TShader<CSpaceWarpFilter>::Shutdown();
TShader<CCameraBlurFilter>::Shutdown();
TShader<CXRayBlurFilter>::Shutdown();
TShader<CFogVolumePlaneShader>::Shutdown();
TShader<CFogVolumeFilter>::Shutdown();
TMultiBlendShader<CColoredQuadFilter>::Shutdown();
TMultiBlendShader<CTexturedQuadFilter>::Shutdown();
TMultiBlendShader<CTexturedQuadFilterAlpha>::Shutdown();

View File

@ -265,11 +265,11 @@ struct OGLElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
if (regPipeline)
gen.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, vtxFmt, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
nullptr, texCount, textures);
nullptr, texCount, textures, nullptr, nullptr);
if (redToAlphaPipeline)
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, vtxFmt, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
nullptr, texCount, textures);
nullptr, texCount, textures, nullptr, nullptr);
}
};
@ -280,71 +280,91 @@ static const char* TindTexNames[] = {"texrMap", "sceneMap", "tindMap"};
CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::GLDataFactory::Context& ctx)
{
m_texZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
true, false, boo::CullMode::None);
m_texNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true,
true, false, boo::CullMode::None);
m_texZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
true, false, boo::CullMode::None);
m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
m_texAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
true, false, boo::CullMode::None);
m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
true, false, boo::CullMode::None);
m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, 1, TexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
m_indTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, TindTexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true,
true, false, boo::CullMode::None);
m_indTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, TindTexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
m_indTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, 3, TindTexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, true,
true, false, boo::CullMode::None);
m_cindTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, TindTexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true,
true, false, boo::CullMode::None);
m_cindTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, TindTexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
m_cindTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, 3, TindTexNames, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, true,
true, false, boo::CullMode::None);
m_noTexZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, true,
true, false, boo::CullMode::None);
m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true,
true, false, boo::CullMode::None);
m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
true, false, boo::CullMode::None);
m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
true, false, boo::CullMode::None);
m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false,
true, false, boo::CullMode::None);
return new struct OGLElementDataBindingFactory;
}
@ -435,70 +455,90 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::Vul
m_texZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, true, true,
true, false, boo::CullMode::None);
m_texNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::Primitive::TriStrips, false, true,
true, false, boo::CullMode::None);
m_texZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, false, false,
true, false, boo::CullMode::None);
m_texAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, false, false,
true, false, boo::CullMode::None);
m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_texRedToAlphaNoZTest = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX_REDTOALPHA, m_vtxFormatTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, false, false,
true, false, boo::CullMode::None);
m_indTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, true, true,
true, false, boo::CullMode::None);
m_indTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_indTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_INDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, true, true,
true, false, boo::CullMode::None);
m_cindTexZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, true, true,
true, false, boo::CullMode::None);
m_cindTexNoZWrite = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_cindTexAdditive = ctx.newShaderPipeline(VS_GLSL_INDTEX, FS_GLSL_CINDTEX, m_vtxFormatIndTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, true, true,
true, false, boo::CullMode::None);
m_noTexZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, true, true,
true, false, boo::CullMode::None);
m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, true, boo::CullMode::None);
boo::Primitive::TriStrips, false, true,
true, false, boo::CullMode::None);
m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, false, false,
true, false, boo::CullMode::None);
m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, boo::CullMode::None);
boo::Primitive::TriStrips, true, false,
true, false, boo::CullMode::None);
m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_vtxFormatNoTex,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, false, false,
true, false, boo::CullMode::None);
return new struct VulkanElementDataBindingFactory;
}

View File

@ -241,11 +241,11 @@ struct MetalElementDataBindingFactory : CElementGenShaders::IDataBindingFactory
if (regPipeline)
gen.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
nullptr, texCount, textures);
nullptr, texCount, textures, nullptr, nullptr);
if (redToAlphaPipeline)
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
nullptr, texCount, textures);
nullptr, texCount, textures, nullptr, nullptr);
}
};
@ -293,89 +293,89 @@ CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::Met
m_texZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, m_vtxFormatTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
m_indTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, m_vtxFormatIndTex,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, true, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, false, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, true, false, 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,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, false, false, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
return new struct MetalElementDataBindingFactory;
}

2
hecl

@ -1 +1 @@
Subproject commit 28ee5ccf8a139755cd12df30ed6da79762f7a4b2
Subproject commit 04330e966a6b393971c13902dff31b50a1228a71

@ -1 +1 @@
Subproject commit 0a24fe47034b2e64ca6d8239d439d142cab0fb71
Subproject commit 21a4040bd296b1999c2c1b75c3b82d500611a95a