Skip to content

Commit

Permalink
Main: SceneManager - dont bind compute programs. They are dispatched …
Browse files Browse the repository at this point in the history
…differently

and simplify binding in general
  • Loading branch information
paroj committed Jan 4, 2024
1 parent f28cfd0 commit 33edefb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 48 deletions.
1 change: 1 addition & 0 deletions OgreMain/src/OgreCompositorInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class RSComputeOperation : public CompositorInstance::RenderSystemOperation
rs->bindGpuProgramParameters(GPT_COMPUTE_PROGRAM, params, GPV_GLOBAL);
rs->_dispatchCompute(thread_groups);
}
rs->unbindGpuProgram(GPT_COMPUTE_PROGRAM);
}
};

Expand Down
58 changes: 10 additions & 48 deletions OgreMain/src/OgreSceneManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,58 +689,20 @@ const Pass* SceneManager::_setPass(const Pass* pass, bool shadowDerivation)
// Set fixed-function vertex parameters
}

if (pass->hasGeometryProgram())
for(auto gptype : {GPT_DOMAIN_PROGRAM, GPT_HULL_PROGRAM, GPT_GEOMETRY_PROGRAM})
{
bindGpuProgram(pass->getGeometryProgram()->_getBindingDelegate());
// bind parameters later
}
else
{
// Unbind program?
if (mDestRenderSystem->isGpuProgramBound(GPT_GEOMETRY_PROGRAM))
{
mDestRenderSystem->unbindGpuProgram(GPT_GEOMETRY_PROGRAM);
}
}
if (pass->hasTessellationHullProgram())
{
bindGpuProgram(pass->getTessellationHullProgram()->_getBindingDelegate());
// bind parameters later
}
else
{
// Unbind program?
if (mDestRenderSystem->isGpuProgramBound(GPT_HULL_PROGRAM))
if (pass->hasGpuProgram(gptype))
{
mDestRenderSystem->unbindGpuProgram(GPT_HULL_PROGRAM);
bindGpuProgram(pass->getGpuProgram(gptype)->_getBindingDelegate());
// bind parameters later
}
}

if (pass->hasTessellationDomainProgram())
{
bindGpuProgram(pass->getTessellationDomainProgram()->_getBindingDelegate());
// bind parameters later
}
else
{
// Unbind program?
if (mDestRenderSystem->isGpuProgramBound(GPT_DOMAIN_PROGRAM))
{
mDestRenderSystem->unbindGpuProgram(GPT_DOMAIN_PROGRAM);
}
}

if (pass->hasComputeProgram())
{
bindGpuProgram(pass->getComputeProgram()->_getBindingDelegate());
// bind parameters later
}
else
{
// Unbind program?
if (mDestRenderSystem->isGpuProgramBound(GPT_COMPUTE_PROGRAM))
else
{
mDestRenderSystem->unbindGpuProgram(GPT_COMPUTE_PROGRAM);
// Unbind program?
if (mDestRenderSystem->isGpuProgramBound(gptype))
{
mDestRenderSystem->unbindGpuProgram(gptype);
}
}
}

Expand Down

0 comments on commit 33edefb

Please sign in to comment.