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 #2973

Merged
merged 7 commits into from
Nov 23, 2023
Merged

Devel #2973

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
5 changes: 5 additions & 0 deletions Components/RTShaderSystem/src/OgreShaderGLSLProgramWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ void GLSLProgramWriter::writeInputParameters(std::ostream& os, Function* functio
pParam->_rename("gl_PointCoord");
continue;
}
else if(paramContent == Parameter::SPC_POINTSPRITE_SIZE)
{
// injected by matchVStoPSInterface, but only available in VS
continue;
}
else if(paramSemantic == Parameter::SPS_POSITION)
{
pParam->_rename("gl_FragCoord");
Expand Down
2 changes: 1 addition & 1 deletion Components/RTShaderSystem/src/OgreShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ static Technique* findSourceTechnique(const Material& mat, const String& srcTech
// Find the source technique
for (auto *t : mat.getTechniques())
{
if (t->getSchemeName() == srcTechniqueSchemeName &&
if (t->getSchemeName() == srcTechniqueSchemeName && t->isSupported() &&
(hasFixedFunctionPass(t) || overProgrammable))
{
return t;
Expand Down
8 changes: 4 additions & 4 deletions OgreMain/include/OgreRenderSystemCapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ namespace Ogre
RSC_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21),
/// Supports basic point sprite rendering
RSC_POINT_SPRITES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22),
/// Supports extra point parameters (minsize, maxsize, attenuation)
RSC_POINT_EXTENDED_PARAMETERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23),
/// @deprecated same as RSC_POINT_SPRITES
RSC_POINT_EXTENDED_PARAMETERS = RSC_POINT_SPRITES,
/// Supports rendering to vertex buffers
RSC_HWRENDER_TO_VERTEX_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23),
/// Supports vertex texture fetch
RSC_VERTEX_TEXTURE_FETCH = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24),
/// Supports mipmap LOD biasing
RSC_MIPMAP_LOD_BIAS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25),
/// Supports hardware geometry programs
RSC_GEOMETRY_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26),
/// Supports rendering to vertex buffers
RSC_HWRENDER_TO_VERTEX_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27),

/// Supports compressed textures
RSC_TEXTURE_COMPRESSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 0),
Expand Down
3 changes: 1 addition & 2 deletions OgreMain/src/OgreRenderSystemCapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace Ogre {
, mStencilBufferBitDepth(8)
, mConstantFloatCount{}
, mNumMultiRenderTargets(1)
, mMaxPointSize(1)
, mNonPOW2TexturesLimited(false)
, mMaxSupportedAnisotropy(0)
, mGeometryProgramNumOutputVertices(0)
Expand Down Expand Up @@ -219,8 +220,6 @@ namespace Ogre {
pLog->logMessage(" * Point Sprites: " + StringConverter::toString(hasCapability(RSC_POINT_SPRITES), true));
if (hasCapability(RSC_POINT_SPRITES))
{
pLog->logMessage(" - Extended parameters: " +
StringConverter::toString(hasCapability(RSC_POINT_EXTENDED_PARAMETERS), true));
pLog->logMessage(" - Max Size: " + StringConverter::toString(mMaxPointSize));
}
pLog->logMessage(
Expand Down
1 change: 0 additions & 1 deletion OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ namespace Ogre
addCapabilitiesMapping("texture_1d", RSC_TEXTURE_1D);
addCapabilitiesMapping("point_sprites", RSC_POINT_SPRITES);
addCapabilitiesMapping("wide_lines", RSC_WIDE_LINES);
addCapabilitiesMapping("point_extended_parameters", RSC_POINT_EXTENDED_PARAMETERS);
addCapabilitiesMapping("vertex_texture_fetch", RSC_VERTEX_TEXTURE_FETCH);
addCapabilitiesMapping("mipmap_lod_bias", RSC_MIPMAP_LOD_BIAS);
addCapabilitiesMapping("atomic_counters", RSC_READ_WRITE_BUFFERS);
Expand Down
48 changes: 27 additions & 21 deletions OgreMain/src/OgreTechnique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,33 @@ namespace Ogre {
// Adjust pass index
currPass->_notifyIndex(passNum);

if(currPass->getPointSpritesEnabled() && !caps->hasCapability(RSC_POINT_SPRITES))
{
compileErrors << "Pass " << passNum << ": Point sprites not supported by RenderSystem";
return false;
}

// Check a few fixed-function options in texture layers
size_t texUnit = 0;
for(const TextureUnitState* tex : currPass->getTextureUnitStates())
{
const char* err = 0;
if ((tex->getTextureType() == TEX_TYPE_3D) && !caps->hasCapability(RSC_TEXTURE_3D))
err = "Volume";

if ((tex->getTextureType() == TEX_TYPE_2D_ARRAY) && !caps->hasCapability(RSC_TEXTURE_2D_ARRAY))
err = "Array";

if (err)
{
// Fail
compileErrors << "Pass " << passNum << " Tex " << texUnit << ": " << err
<< " textures not supported by RenderSystem";
return false;
}
++texUnit;
}

// Check texture unit requirements
size_t numTexUnitsRequested = currPass->getNumTextureUnitStates();
// Don't trust getNumTextureUnits for programmable
Expand Down Expand Up @@ -128,27 +155,6 @@ namespace Ogre {
}
}

// Check a few fixed-function options in texture layers
size_t texUnit = 0;
for(const TextureUnitState* tex : currPass->getTextureUnitStates())
{
const char* err = 0;
if ((tex->getTextureType() == TEX_TYPE_3D) && !caps->hasCapability(RSC_TEXTURE_3D))
err = "Volume";

if ((tex->getTextureType() == TEX_TYPE_2D_ARRAY) && !caps->hasCapability(RSC_TEXTURE_2D_ARRAY))
err = "Array";

if (err)
{
// Fail
compileErrors << "Pass " << passNum << " Tex " << texUnit << ": " << err
<< " textures not supported by RenderSystem";
return false;
}
++texUnit;
}

// We're ok on operations, now we need to check # texture units

// Keep splitting this pass so long as units requested > gpu units
Expand Down
3 changes: 0 additions & 3 deletions RenderSystems/Direct3D11/src/OgreD3D11RenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,6 @@ namespace Ogre
#endif

rsc->setNumMultiRenderTargets(std::min(numMultiRenderTargets, (int)OGRE_MAX_MULTIPLE_RENDER_TARGETS));

rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);
rsc->setMaxPointSize(256); // TODO: guess!

rsc->setCapability(RSC_VERTEX_TEXTURE_FETCH);
rsc->setNumVertexTextureUnits(4);
Expand Down
5 changes: 1 addition & 4 deletions RenderSystems/Direct3D9/src/OgreD3D9RenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,7 @@ namespace Ogre
rsc->setCapability(RSC_NON_POWER_OF_2_TEXTURES);
rsc->setNonPOW2TexturesLimited(false);
rsc->setNumMultiRenderTargets(OGRE_MAX_MULTIPLE_RENDER_TARGETS);
rsc->setCapability(RSC_POINT_SPRITES);
rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);
rsc->setCapability(RSC_POINT_SPRITES);
rsc->setMaxPointSize(2.19902e+012f);
rsc->setCapability(RSC_MIPMAP_LOD_BIAS);
rsc->setCapability(RSC_PERSTAGECONSTANT);
Expand Down Expand Up @@ -970,8 +969,6 @@ namespace Ogre
if (rkCurCaps.MaxPointSize <= 1.0f)
{
rsc->unsetCapability(RSC_POINT_SPRITES);
// sprites and extended parameters go together in D3D
rsc->unsetCapability(RSC_POINT_EXTENDED_PARAMETERS);
}

// Take the minimum point size.
Expand Down
3 changes: 0 additions & 3 deletions RenderSystems/GL/src/OgreGLRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,6 @@ namespace Ogre {
glPointParameterfv = glPointParameterfvEXT;
}

rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);


// Check for hardware stencil support and set bit depth
GLint stencil;
glGetIntegerv(GL_STENCIL_BITS,&stencil);
Expand Down
12 changes: 3 additions & 9 deletions RenderSystems/GL/src/OgreGLStateCacheManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,7 @@ namespace Ogre {
#endif
{
mPointSizeMin = minSize;
const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
glPointParameterf(GL_POINT_SIZE_MIN, mPointSizeMin);
glPointParameterf(GL_POINT_SIZE_MIN, mPointSizeMin);
}

if(maxSize > -1)
Expand All @@ -595,9 +593,7 @@ namespace Ogre {
#endif
{
mPointSizeMax = maxSize;
const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
glPointParameterf(GL_POINT_SIZE_MAX, mPointSizeMax);
glPointParameterf(GL_POINT_SIZE_MAX, mPointSizeMax);
}

if(attenuation)
Expand All @@ -608,9 +604,7 @@ namespace Ogre {
mPointAttenuation[0] = attenuation[0];
mPointAttenuation[1] = attenuation[1];
mPointAttenuation[2] = attenuation[2];
const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
}
}

Expand Down
1 change: 0 additions & 1 deletion RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ namespace Ogre {

// Point sprites
rsc->setCapability(RSC_POINT_SPRITES);
rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);

// Check for hardware stencil support and set bit depth
rsc->setCapability(RSC_HWSTENCIL);
Expand Down
1 change: 0 additions & 1 deletion RenderSystems/GLES2/src/OgreGLES2RenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ namespace Ogre {

// Point sprites
rsc->setCapability(RSC_POINT_SPRITES);
rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);

// GLSL ES is always supported in GL ES 2
rsc->addShaderProfile("glsles");
Expand Down
1 change: 0 additions & 1 deletion RenderSystems/Metal/src/OgreMetalRenderSystem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ of this software and associated documentation files (the "Software"), to deal
rsc->setCapability(RSC_HWRENDER_TO_TEXTURE);
rsc->setCapability(RSC_TEXTURE_FLOAT);
rsc->setCapability(RSC_POINT_SPRITES);
rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);
rsc->setCapability(RSC_TEXTURE_1D);
rsc->setCapability(RSC_TEXTURE_3D);
// rsc->setCapability(RSC_TEXTURE_SIGNED_INT);
Expand Down
8 changes: 5 additions & 3 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,16 @@ namespace Ogre
rsc->setNonPOW2TexturesLimited( false );
rsc->setCapability( RSC_HWRENDER_TO_TEXTURE );
rsc->setCapability( RSC_TEXTURE_FLOAT );
rsc->setCapability( RSC_POINT_SPRITES );
rsc->setCapability( RSC_POINT_EXTENDED_PARAMETERS );
if( mActiveDevice->mDeviceFeatures.largePoints )
{
rsc->setCapability( RSC_POINT_SPRITES );
}
rsc->setCapability( RSC_TEXTURE_2D_ARRAY );
rsc->setCapability( RSC_ALPHA_TO_COVERAGE );
rsc->setCapability( RSC_HW_GAMMA );
rsc->setCapability( RSC_VERTEX_BUFFER_INSTANCE_DATA );
rsc->setCapability(RSC_VERTEX_FORMAT_INT_10_10_10_2);
rsc->setMaxPointSize( 256 );
rsc->setMaxPointSize( deviceLimits.pointSizeRange[1] );

//rsc->setMaximumResolutions( 16384, 4096, 16384 );
auto maxFloatVectors = deviceLimits.maxUniformBufferRange / (4 * sizeof(float));
Expand Down
6 changes: 0 additions & 6 deletions Tests/OgreMain/src/RenderSystemCapabilitiesTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ TEST_F(RenderSystemCapabilitiesTests,WriteAllFalseCapabilities)
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tnon_power_of_2_textures false") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\ttexture_3d false") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tpoint_sprites false") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tpoint_extended_parameters false") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tvertex_texture_fetch false") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tmipmap_lod_bias false") != lines.end());

Expand Down Expand Up @@ -348,7 +347,6 @@ TEST_F(RenderSystemCapabilitiesTests,WriteAllTrueCapabilities)
caps.setCapability(RSC_NON_POWER_OF_2_TEXTURES);
caps.setCapability(RSC_TEXTURE_3D);
caps.setCapability(RSC_POINT_SPRITES);
caps.setCapability(RSC_POINT_EXTENDED_PARAMETERS);
caps.setCapability(RSC_VERTEX_TEXTURE_FETCH);
caps.setCapability(RSC_MIPMAP_LOD_BIAS);

Expand Down Expand Up @@ -406,7 +404,6 @@ TEST_F(RenderSystemCapabilitiesTests,WriteAllTrueCapabilities)
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tnon_power_of_2_textures true") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\ttexture_3d true") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tpoint_sprites true") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tpoint_extended_parameters true") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tvertex_texture_fetch true") != lines.end());
EXPECT_TRUE(find(lines.begin(), lines.end(), "\tmipmap_lod_bias true") != lines.end());

Expand Down Expand Up @@ -442,7 +439,6 @@ TEST_F(RenderSystemCapabilitiesTests,WriteAndReadComplexCapabilities)
caps.setCapability(RSC_TEXTURE_FLOAT);
caps.setCapability(RSC_NON_POWER_OF_2_TEXTURES);
caps.setCapability(RSC_TEXTURE_3D);
caps.setCapability(RSC_POINT_EXTENDED_PARAMETERS);
caps.setCapability(RSC_MIPMAP_LOD_BIAS);
caps.setCapability(RSC_TEXTURE_COMPRESSION);
caps.setCapability(RSC_TEXTURE_COMPRESSION_DXT);
Expand Down Expand Up @@ -512,7 +508,6 @@ TEST_F(RenderSystemCapabilitiesTests,WriteAndReadComplexCapabilities)
EXPECT_EQ(caps.hasCapability(RSC_NON_POWER_OF_2_TEXTURES), caps2.hasCapability(RSC_NON_POWER_OF_2_TEXTURES));
EXPECT_EQ(caps.hasCapability(RSC_TEXTURE_3D), caps2.hasCapability(RSC_TEXTURE_3D));
EXPECT_EQ(caps.hasCapability(RSC_POINT_SPRITES), caps2.hasCapability(RSC_POINT_SPRITES));
EXPECT_EQ(caps.hasCapability(RSC_POINT_EXTENDED_PARAMETERS), caps2.hasCapability(RSC_POINT_EXTENDED_PARAMETERS));
EXPECT_EQ(caps.hasCapability(RSC_VERTEX_TEXTURE_FETCH), caps2.hasCapability(RSC_VERTEX_TEXTURE_FETCH));
EXPECT_EQ(caps.hasCapability(RSC_MIPMAP_LOD_BIAS), caps2.hasCapability(RSC_MIPMAP_LOD_BIAS));

Expand Down Expand Up @@ -570,7 +565,6 @@ TEST_F(RenderSystemCapabilitiesTests, CustomCapabilities)
EXPECT_EQ(caps->hasCapability(RSC_NON_POWER_OF_2_TEXTURES), false);
EXPECT_EQ(caps->hasCapability(RSC_TEXTURE_3D), true);
EXPECT_EQ(caps->hasCapability(RSC_POINT_SPRITES), true);
EXPECT_EQ(caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS), true);
EXPECT_EQ(caps->hasCapability(RSC_VERTEX_TEXTURE_FETCH), false);
EXPECT_EQ(caps->hasCapability(RSC_MIPMAP_LOD_BIAS), true);

Expand Down