Skip to content

Commit

Permalink
Remove most references to GLES and GLSLES
Browse files Browse the repository at this point in the history
Eugene is not going to be pursuing this endeavour (he is the one who
created the GLES/GLSLES split) anymore.

Furthermore it is likely that the Hlms should reuse GLSL code and use a
few extra property to mark the GLSLES differences.

It also doesn't make sense to have fully separate files just to write

precision highp float;

When all of our GLSL shaders now start with "#version ogre_glsl_ver_330"
to patch this from C++.
  • Loading branch information
darksylinc committed Jul 20, 2024
1 parent 81dbdc2 commit b7af63f
Show file tree
Hide file tree
Showing 32 changed files with 24 additions and 3,302 deletions.
1 change: 0 additions & 1 deletion CMake/Templates/resources2.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ FileSystem=@OGRE_MEDIA_TEXTURES_DIR@/textures/Cubemaps
FileSystem=@OGRE_MEDIA_DIR_REL@/2.0/scripts/materials/Common
FileSystem=@OGRE_MEDIA_DIR_REL@/2.0/scripts/materials/Common/Any
FileSystem=@OGRE_MEDIA_DIR_REL@/2.0/scripts/materials/Common/GLSL
FileSystem=@OGRE_MEDIA_DIR_REL@/2.0/scripts/materials/Common/GLSLES
FileSystem=@OGRE_MEDIA_DIR_REL@/2.0/scripts/materials/Common/HLSL
FileSystem=@OGRE_MEDIA_DIR_REL@/2.0/scripts/materials/Common/Metal
FileSystem=@OGRE_MEDIA_DIR_REL@/Hlms/Common/Any
Expand Down
4 changes: 1 addition & 3 deletions Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3863,9 +3863,7 @@ namespace Ogre
// name of the compatible shading language is part of the path
Ogre::RenderSystem *renderSystem = Ogre::Root::getSingleton().getRenderSystem();
Ogre::String shaderSyntax = "GLSL";
if( renderSystem->getName() == "OpenGL ES 2.x Rendering Subsystem" )
shaderSyntax = "GLSLES";
else if( renderSystem->getName() == "Direct3D11 Rendering Subsystem" )
if( renderSystem->getName() == "Direct3D11 Rendering Subsystem" )
shaderSyntax = "HLSL";
else if( renderSystem->getName() == "Metal Rendering Subsystem" )
shaderSyntax = "Metal";
Expand Down
4 changes: 1 addition & 3 deletions Components/Hlms/Unlit/src/OgreHlmsUnlit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,9 +1205,7 @@ namespace Ogre
// name of the compatible shading language is part of the path
RenderSystem *renderSystem = Root::getSingleton().getRenderSystem();
String shaderSyntax = "GLSL";
if( renderSystem->getName() == "OpenGL ES 2.x Rendering Subsystem" )
shaderSyntax = "GLSLES";
else if( renderSystem->getName() == "Direct3D11 Rendering Subsystem" )
if( renderSystem->getName() == "Direct3D11 Rendering Subsystem" )
shaderSyntax = "HLSL";
else if( renderSystem->getName() == "Metal Rendering Subsystem" )
shaderSyntax = "Metal";
Expand Down
29 changes: 20 additions & 9 deletions OgreMain/include/OgreHlms.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,29 @@ namespace Ogre

HlmsDatablockMap mDatablocks;

String mShaderProfile; ///< "glsl", "glsles", "hlsl"
/// This is what we tell the RenderSystem to compile as.
///
/// For example if we set at the same time:
/// - mShaderProfile = "metal"
/// - mShaderSyntax = "hlsl"
/// - mShaderFileExt = ".glsl"
///
/// Then we will:
/// - Look for *.hlsl files.
/// - Tell the Hlms parser that it is glsl, i.e. `@property( syntax == glsl )`.
/// - Tell the RenderSystem to compile it as Metal.
String mShaderProfile; //< "glsl", "glslvk", "hlsl", "metal"
/// This is what we tell the Hlms parser what the syntax is.
IdString mShaderSyntax;
IdStringVec mRsSpecificExtensions;
String const *mShaderTargets[NumShaderTypes]; ///[0] = "vs_4_0", etc. Only used by D3D
String mShaderFileExt; ///< Either glsl or hlsl
String mOutputPath;
bool mDebugOutput;
bool mDebugOutputProperties;
uint8 mPrecisionMode; ///< See PrecisionMode
bool mFastShaderBuildHack;
/// This is the extension we look for. e.g. .glsl, .hlsl, etc.
String mShaderFileExt;
String mOutputPath;
bool mDebugOutput;
bool mDebugOutputProperties;
uint8 mPrecisionMode; ///< See PrecisionMode
bool mFastShaderBuildHack;

public:
struct DatablockCustomPieceFile
Expand Down Expand Up @@ -1240,12 +1253,10 @@ namespace Ogre
static const IdString Syntax;
static const IdString Hlsl;
static const IdString Glsl;
static const IdString Glsles;
static const IdString Glslvk;
static const IdString Hlslvk;
static const IdString Metal;
static const IdString GL3Plus;
static const IdString GLES;
static const IdString iOS;
static const IdString macOS;
static const IdString GLVersion;
Expand Down
19 changes: 2 additions & 17 deletions OgreMain/src/OgreHlms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,10 @@ namespace Ogre
const IdString HlmsBaseProp::Syntax = IdString( "syntax" );
const IdString HlmsBaseProp::Hlsl = IdString( "hlsl" );
const IdString HlmsBaseProp::Glsl = IdString( "glsl" );
const IdString HlmsBaseProp::Glsles = IdString( "glsles" );
const IdString HlmsBaseProp::Glslvk = IdString( "glslvk" );
const IdString HlmsBaseProp::Hlslvk = IdString( "hlslvk" );
const IdString HlmsBaseProp::Metal = IdString( "metal" );
const IdString HlmsBaseProp::GL3Plus = IdString( "GL3+" );
const IdString HlmsBaseProp::GLES = IdString( "GLES" );
const IdString HlmsBaseProp::iOS = IdString( "iOS" );
const IdString HlmsBaseProp::macOS = IdString( "macOS" );
const IdString HlmsBaseProp::PrecisionMode = IdString( "precision_mode" );
Expand Down Expand Up @@ -1661,16 +1659,10 @@ namespace Ogre
{
setProperty( tid, HlmsBaseProp::GL3Plus, mRenderSystem->getNativeShadingLanguageVersion() );
}
else if( mShaderProfile == "glsles" ) // TODO: String comparision
{
setProperty( tid, HlmsBaseProp::GLES, mRenderSystem->getNativeShadingLanguageVersion() );
}

setProperty( tid, HlmsBaseProp::Syntax, static_cast<int32>( mShaderSyntax.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Hlsl, static_cast<int32>( HlmsBaseProp::Hlsl.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Glsl, static_cast<int32>( HlmsBaseProp::Glsl.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Glsles,
static_cast<int32>( HlmsBaseProp::Glsles.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Glslvk,
static_cast<int32>( HlmsBaseProp::Glslvk.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Hlslvk,
Expand Down Expand Up @@ -2354,20 +2346,13 @@ namespace Ogre
setProperty( tid, HlmsBaseProp::GL3Plus,
mRenderSystem->getNativeShadingLanguageVersion() );
}
else if( mShaderProfile == "glsles" ) // TODO: String comparision
{
setProperty( tid, HlmsBaseProp::GLES,
mRenderSystem->getNativeShadingLanguageVersion() );
}

setProperty( tid, HlmsBaseProp::Syntax,
static_cast<int32>( mShaderSyntax.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Hlsl,
static_cast<int32>( HlmsBaseProp::Hlsl.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Glsl,
static_cast<int32>( HlmsBaseProp::Glsl.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Glsles,
static_cast<int32>( HlmsBaseProp::Glsles.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Glslvk,
static_cast<int32>( HlmsBaseProp::Glslvk.getU32Value() ) );
setProperty( tid, HlmsBaseProp::Hlslvk,
Expand Down Expand Up @@ -3897,8 +3882,8 @@ namespace Ogre
mFastShaderBuildHack = StringConverter::parseBool( itor->second.currentValue );
}

// Prefer glslvk over hlslvk over glsl, and glsl over glsles
const String shaderProfiles[6] = { "hlsl", "glsles", "glsl", "hlslvk", "glslvk", "metal" };
// Prefer glslvk over hlslvk over glsl
const String shaderProfiles[6] = { "hlsl", "glsl", "hlslvk", "glslvk", "metal" };
const RenderSystemCapabilities *capabilities = mRenderSystem->getCapabilities();

for( size_t i = 0; i < 6; ++i )
Expand Down
5 changes: 0 additions & 5 deletions OgreMain/src/OgreHlmsCompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ namespace Ogre
filename.compare( pos + 1, String::npos, "any" ) != 0 &&
filename.compare( pos + 1, String::npos, "metal" ) != 0 &&
filename.compare( pos + 1, String::npos, "glsl" ) != 0 &&
filename.compare( pos + 1, String::npos, "glsles" ) != 0 &&
filename.compare( pos + 1, String::npos, "hlsl" ) != 0 ) )
{
filename += mShaderFileExt;
Expand Down Expand Up @@ -191,8 +190,6 @@ namespace Ogre
setProperty( kNoTid, HlmsBaseProp::GL3Plus,
mRenderSystem->getNativeShadingLanguageVersion() );
}
if( mShaderProfile == "glsles" ) // TODO: String comparision
setProperty( kNoTid, HlmsBaseProp::GLES, 300 );

setProperty( kNoTid, HlmsBaseProp::Syntax, static_cast<int32>( mShaderSyntax.getU32Value() ) );
setProperty( kNoTid, HlmsBaseProp::Hlsl,
Expand All @@ -203,8 +200,6 @@ namespace Ogre
static_cast<int32>( HlmsBaseProp::Glslvk.getU32Value() ) );
setProperty( kNoTid, HlmsBaseProp::Hlslvk,
static_cast<int32>( HlmsBaseProp::Hlslvk.getU32Value() ) );
setProperty( kNoTid, HlmsBaseProp::Glsles,
static_cast<int32>( HlmsBaseProp::Glsles.getU32Value() ) );
setProperty( kNoTid, HlmsBaseProp::Metal,
static_cast<int32>( HlmsBaseProp::Metal.getU32Value() ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ namespace Demo
Ogre::RenderSystem *renderSystem = mRoot->getRenderSystem();

Ogre::String shaderSyntax = "GLSL";
if( renderSystem->getName() == "OpenGL ES 2.x Rendering Subsystem" )
shaderSyntax = "GLSLES";
if( renderSystem->getName() == "Direct3D11 Rendering Subsystem" )
shaderSyntax = "HLSL";
else if( renderSystem->getName() == "Metal Rendering Subsystem" )
Expand Down

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions Samples/Media/2.0/scripts/materials/Common/GLSLES/Quad_vs.glsles

This file was deleted.

This file was deleted.

Loading

0 comments on commit b7af63f

Please sign in to comment.