Skip to content

Commit 4c22255

Browse files
committed
Main: Pass - alias compute shader to vertex shader storage
as both cannot be active at the same time anyway
1 parent ee5fd3b commit 4c22255

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

OgreMain/include/OgreGpuProgram.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ namespace Ogre {
5555
GPT_COMPUTE_PROGRAM
5656
};
5757
enum {
58-
GPT_COUNT = GPT_COMPUTE_PROGRAM + 1
58+
GPT_COUNT = GPT_COMPUTE_PROGRAM + 1,
59+
/// max programs that can be active in a pipeline (e.g compute is separate)
60+
GPT_PIPELINE_COUNT = GPT_HULL_PROGRAM + 1
5961
};
6062

6163
/** Defines a program which runs on the GPU such as a vertex or fragment program.

OgreMain/include/OgrePass.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ namespace Ogre {
220220
typedef std::vector<unsigned short> ContentTypeLookup;
221221
mutable ContentTypeLookup mShadowContentTypeLookup;
222222

223-
/// Vertex program details
224-
std::unique_ptr<GpuProgramUsage> mProgramUsage[GPT_COUNT];
223+
std::unique_ptr<GpuProgramUsage> mProgramUsage[GPT_PIPELINE_COUNT];
225224
/// Number of pass iterations to perform
226225
size_t mPassIterationCount;
227226
/// Point size, applies when not using per-vertex point size

OgreMain/src/OgrePass.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ namespace Ogre {
249249
mIlluminationStage = oth.mIlluminationStage;
250250
mLightMask = oth.mLightMask;
251251

252-
for(int i = 0; i < GPT_COUNT; i++)
252+
for(int i = 0; i < GPT_PIPELINE_COUNT; i++)
253253
{
254254
auto& programUsage = mProgramUsage[i];
255255
auto& othUsage = oth.mProgramUsage[i];
@@ -882,12 +882,12 @@ namespace Ogre {
882882
}
883883

884884
std::unique_ptr<GpuProgramUsage>& Pass::getProgramUsage(GpuProgramType programType) {
885-
return mProgramUsage[programType];
885+
return mProgramUsage[programType % GPT_PIPELINE_COUNT];
886886
}
887887

888888
const std::unique_ptr<GpuProgramUsage>& Pass::getProgramUsage(GpuProgramType programType) const
889889
{
890-
return mProgramUsage[programType];
890+
return mProgramUsage[programType % GPT_PIPELINE_COUNT];
891891
}
892892

893893
bool Pass::hasGpuProgram(GpuProgramType programType) const {
@@ -896,8 +896,9 @@ namespace Ogre {
896896
const GpuProgramPtr& Pass::getGpuProgram(GpuProgramType programType) const
897897
{
898898
OGRE_LOCK_MUTEX(mGpuProgramChangeMutex);
899-
OgreAssert(mProgramUsage[programType], "check whether program is available using hasGpuProgram()");
900-
return mProgramUsage[programType]->getProgram();
899+
auto programType_ = programType % GPT_PIPELINE_COUNT;
900+
OgreAssert(mProgramUsage[programType_], "check whether program is available using hasGpuProgram()");
901+
return mProgramUsage[programType_]->getProgram();
901902
}
902903
//-----------------------------------------------------------------------
903904
const String& Pass::getGpuProgramName(GpuProgramType type) const

0 commit comments

Comments
 (0)