Proper interleaved rendering of indirect-textured particle instances

This commit is contained in:
Jack Andersen 2018-11-04 21:25:28 -10:00
parent d6051f8808
commit 3ef7386978
4 changed files with 10 additions and 6 deletions

View File

@ -356,9 +356,9 @@ public:
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)
static void DrawInstances(size_t start, size_t count, size_t instCount, size_t startInst = 0)
{
g_BooMainCommandQueue->drawInstances(start, count, instCount);
g_BooMainCommandQueue->drawInstances(start, count, instCount, startInst);
}
static void DrawArray(size_t start, size_t count)
{

View File

@ -27,7 +27,7 @@ void CEnvFxShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& c
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {uBufInfo.first.get(),
fxMgr.m_fogUniformBuf.get()};
size_t ubufOffsets[] = {uBufInfo.second, 0};
size_t ubufSizes[] = {256, 256};
size_t ubufSizes[] = {sizeof(CEnvFxShaders::Uniform), sizeof(CGraphics::g_Fog)};
boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment};
boo::ObjToken<boo::ITexture> textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
fxMgr.x40_txtrEnvGradient->GetBooTexture()};

View File

@ -1876,6 +1876,9 @@ void CElementGen::RenderParticlesIndirectTexture()
g_instIndTexData.clear();
g_instIndTexData.reserve(x30_particles.size());
if (!x30_particles.empty())
CGraphics::SetShaderDataBinding(m_normalDataBind);
for (int i=0 ; i<x30_particles.size() ; ++i)
{
int partIdx = desc->x44_28_x30_28_SORT ? sortItems[i].x0_partIdx : i;
@ -1945,13 +1948,14 @@ void CElementGen::RenderParticlesIndirectTexture()
inst.sceneUVs = zeus::CVector4f{clipRect.x18_uvXMin, 1.f - clipRect.x24_uvYMax, clipRect.x1c_uvXMax, 1.f - clipRect.x20_uvYMin};
break;
}
CGraphics::DrawInstances(0, 4, 1, g_instIndTexData.size() - 1);
}
if (g_instIndTexData.size())
{
m_instBuf->load(g_instIndTexData.data(), g_instIndTexData.size() * sizeof(SParticleInstanceIndTex));
CGraphics::SetShaderDataBinding(m_normalDataBind);
CGraphics::DrawInstances(0, 4, g_instIndTexData.size());
//CGraphics::SetShaderDataBinding(m_normalDataBind);
//CGraphics::DrawInstances(0, 4, g_instIndTexData.size());
}
}

2
hecl

@ -1 +1 @@
Subproject commit 26541cd2b460592049b75b9612562fa6b7d01cc5
Subproject commit 75e7dc2e871e4ca41d9691737259455fb337dc15