Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #3002

Merged
merged 2 commits into from
Jan 7, 2024
Merged

Devel #3002

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Components/Overlay/src/OgreOverlayProfileSessionListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ namespace Ogre
OverlayContainer* container = dynamic_cast<OverlayContainer*>(mProfileGui);
if (container)
{
for (const auto& p : container->getChildren())
while (!container->getChildren().empty())
{
OverlayElement* element = p.second;
OverlayContainer* parent = element->getParent();
if (parent) parent->removeChild(element->getName());
OverlayElement* element = container->getChildren().cbegin()->second;
container->removeChild(element->getName());
OverlayManager::getSingleton().destroyOverlayElement(element);
}
}
Expand Down
4 changes: 3 additions & 1 deletion OgreMain/include/OgreGpuProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ namespace Ogre {
GPT_COMPUTE_PROGRAM
};
enum {
GPT_COUNT = GPT_COMPUTE_PROGRAM + 1
GPT_COUNT = GPT_COMPUTE_PROGRAM + 1,
/// max programs that can be active in a pipeline (e.g compute is separate)
GPT_PIPELINE_COUNT = GPT_HULL_PROGRAM + 1
};

/** Defines a program which runs on the GPU such as a vertex or fragment program.
Expand Down
3 changes: 1 addition & 2 deletions OgreMain/include/OgrePass.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ namespace Ogre {
typedef std::vector<unsigned short> ContentTypeLookup;
mutable ContentTypeLookup mShadowContentTypeLookup;

/// Vertex program details
std::unique_ptr<GpuProgramUsage> mProgramUsage[GPT_COUNT];
std::unique_ptr<GpuProgramUsage> mProgramUsage[GPT_PIPELINE_COUNT];
/// Number of pass iterations to perform
size_t mPassIterationCount;
/// Point size, applies when not using per-vertex point size
Expand Down
11 changes: 6 additions & 5 deletions OgreMain/src/OgrePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace Ogre {
mIlluminationStage = oth.mIlluminationStage;
mLightMask = oth.mLightMask;

for(int i = 0; i < GPT_COUNT; i++)
for(int i = 0; i < GPT_PIPELINE_COUNT; i++)
{
auto& programUsage = mProgramUsage[i];
auto& othUsage = oth.mProgramUsage[i];
Expand Down Expand Up @@ -882,12 +882,12 @@ namespace Ogre {
}

std::unique_ptr<GpuProgramUsage>& Pass::getProgramUsage(GpuProgramType programType) {
return mProgramUsage[programType];
return mProgramUsage[programType % GPT_PIPELINE_COUNT];
}

const std::unique_ptr<GpuProgramUsage>& Pass::getProgramUsage(GpuProgramType programType) const
{
return mProgramUsage[programType];
return mProgramUsage[programType % GPT_PIPELINE_COUNT];
}

bool Pass::hasGpuProgram(GpuProgramType programType) const {
Expand All @@ -896,8 +896,9 @@ namespace Ogre {
const GpuProgramPtr& Pass::getGpuProgram(GpuProgramType programType) const
{
OGRE_LOCK_MUTEX(mGpuProgramChangeMutex);
OgreAssert(mProgramUsage[programType], "check whether program is available using hasGpuProgram()");
return mProgramUsage[programType]->getProgram();
auto programType_ = programType % GPT_PIPELINE_COUNT;
OgreAssert(mProgramUsage[programType_], "check whether program is available using hasGpuProgram()");
return mProgramUsage[programType_]->getProgram();
}
//-----------------------------------------------------------------------
const String& Pass::getGpuProgramName(GpuProgramType type) const
Expand Down