Skip to content

Commit

Permalink
RTSS: slightly refactor ProgramProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Oct 19, 2023
1 parent 029de78 commit aa2c53d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 107 deletions.
27 changes: 0 additions & 27 deletions Components/RTShaderSystem/src/OgreShaderGLSLProgramProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,6 @@ THE SOFTWARE.
namespace Ogre {
namespace RTShader {

//-----------------------------------------------------------------------------
GLSLProgramProcessor::GLSLProgramProcessor()
{
}

//-----------------------------------------------------------------------------
GLSLProgramProcessor::~GLSLProgramProcessor()
{
}

//-----------------------------------------------------------------------------
bool GLSLProgramProcessor::preCreateGpuPrograms(ProgramSet* programSet)
{
Program* vsProgram = programSet->getCpuProgram(GPT_VERTEX_PROGRAM);
Program* fsProgram = programSet->getCpuProgram(GPT_FRAGMENT_PROGRAM);
Function* vsMain = vsProgram->getEntryPointFunction();
Function* fsMain = fsProgram->getEntryPointFunction();
bool success;

// Compact vertex shader outputs.
success = ProgramProcessor::compactVsOutputs(vsMain, fsMain);
if (success == false)
return false;

return true;
}

//-----------------------------------------------------------------------------
bool GLSLProgramProcessor::postCreateGpuPrograms(ProgramSet* programSet)
{
Expand Down
23 changes: 0 additions & 23 deletions Components/RTShaderSystem/src/OgreShaderGLSLProgramProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,7 @@ namespace RTShader {
*/
class GLSLProgramProcessor : public ProgramProcessor
{

// Interface.
public:

/** Class constructor.
*/
GLSLProgramProcessor();

/** Class destructor */
virtual ~GLSLProgramProcessor();

/**
@see ProgramProcessor::preCreateGpuPrograms
*/
bool preCreateGpuPrograms(ProgramSet* programSet) override;

/**
@see ProgramProcessor::postCreateGpuPrograms
*/
bool postCreateGpuPrograms(ProgramSet* programSet) override;


private:

/** Bind texture samplers. */
void bindTextureSamplers(Program* pCpuProgram, GpuProgramPtr pGpuProgram);
};
Expand Down
32 changes: 0 additions & 32 deletions Components/RTShaderSystem/src/OgreShaderHLSLProgramProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,6 @@ THE SOFTWARE.

namespace Ogre {
namespace RTShader {

String HLSLProgramProcessor::TargetLanguage = "hlsl";

//-----------------------------------------------------------------------------
HLSLProgramProcessor::HLSLProgramProcessor()
{

}

//-----------------------------------------------------------------------------
HLSLProgramProcessor::~HLSLProgramProcessor()
{

}

//-----------------------------------------------------------------------------
bool HLSLProgramProcessor::preCreateGpuPrograms( ProgramSet* programSet )
{
Program* vsProgram = programSet->getCpuProgram(GPT_VERTEX_PROGRAM);
Program* psProgram = programSet->getCpuProgram(GPT_FRAGMENT_PROGRAM);
Function* vsMain = vsProgram->getEntryPointFunction();
Function* fsMain = psProgram->getEntryPointFunction();
bool success;

// Compact vertex shader outputs.
success = ProgramProcessor::compactVsOutputs(vsMain, fsMain);
if (success == false)
return false;

return true;
}

//-----------------------------------------------------------------------------
bool HLSLProgramProcessor::postCreateGpuPrograms( ProgramSet* programSet )
{
Expand Down
24 changes: 0 additions & 24 deletions Components/RTShaderSystem/src/OgreShaderHLSLProgramProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,7 @@ namespace RTShader {
*/
class HLSLProgramProcessor : public ProgramProcessor
{

// Interface.
public:

/** Class constructor.
*/
HLSLProgramProcessor();

/** Class destructor */
virtual ~HLSLProgramProcessor();

/** Return the target language of this processor. */
virtual const String& getTargetLanguage() const { return TargetLanguage; }

/**
@see ProgramProcessor::preCreateGpuPrograms
*/
bool preCreateGpuPrograms(ProgramSet* programSet) override;
/**
@see ProgramProcessor::postCreateGpuPrograms
*/
bool postCreateGpuPrograms(ProgramSet* programSet) override;

static String TargetLanguage;

};


Expand Down
13 changes: 13 additions & 0 deletions Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ ProgramProcessor::~ProgramProcessor()

}

//-----------------------------------------------------------------------------
bool ProgramProcessor::preCreateGpuPrograms(ProgramSet* programSet)
{
Program* vsProgram = programSet->getCpuProgram(GPT_VERTEX_PROGRAM);
Program* fsProgram = programSet->getCpuProgram(GPT_FRAGMENT_PROGRAM);
Function* vsMain = vsProgram->getEntryPointFunction();
Function* fsMain = fsProgram->getEntryPointFunction();

// Compact vertex shader outputs.
return compactVsOutputs(vsMain, fsMain);
}


//-----------------------------------------------------------------------------
void ProgramProcessor::bindAutoParameters(Program* pCpuProgram, GpuProgramPtr pGpuProgram)
{
Expand Down
2 changes: 1 addition & 1 deletion Components/RTShaderSystem/src/OgreShaderProgramProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ProgramProcessor : public RTShaderSystemAlloc
@param programSet The program set container.
Return true on success.
*/
virtual bool preCreateGpuPrograms(ProgramSet* programSet) = 0;
virtual bool preCreateGpuPrograms(ProgramSet* programSet);

/** Called after creation of the GPU programs.
@param programSet The program set container.
Expand Down

0 comments on commit aa2c53d

Please sign in to comment.