mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-20 01:00:24 +01:00
Get rid of MATERIAL_MAX_TEXTURES_USED
Another configurable knob of questionable usefulness, especially since this inhibits certain optimizations by making loop length dependent on a global variable.
This commit is contained in:
parent
6779cb7254
commit
d322b73e4c
@ -282,23 +282,6 @@ namespace video
|
||||
*/
|
||||
const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_;
|
||||
|
||||
//! By default this is identical to MATERIAL_MAX_TEXTURES
|
||||
/** Users can modify this value if they are certain they don't need all
|
||||
available textures per material in their application. For example if you
|
||||
never need more than 2 textures per material you can set this to 2.
|
||||
|
||||
We (mostly) avoid dynamic memory in SMaterial, so the extra memory
|
||||
will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the
|
||||
material comparisons and assignments can be faster. Also several other
|
||||
places in the engine can be faster when reducing this value to the limit
|
||||
you need.
|
||||
|
||||
NOTE: This should only be changed once and before any call to createDevice.
|
||||
NOTE: Do not set it below 1 or above the value of _IRR_MATERIAL_MAX_TEXTURES_.
|
||||
NOTE: Going below 4 is usually not worth it.
|
||||
*/
|
||||
IRRLICHT_API extern u32 MATERIAL_MAX_TEXTURES_USED;
|
||||
|
||||
//! Struct for holding parameters for a material renderer
|
||||
// Note for implementors: Serialization is in CNullDriver
|
||||
class SMaterial
|
||||
@ -323,7 +306,7 @@ namespace video
|
||||
SMaterial(const SMaterial& other)
|
||||
{
|
||||
// These pointers are checked during assignment
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].TextureMatrix = 0;
|
||||
*this = other;
|
||||
}
|
||||
@ -565,23 +548,23 @@ namespace video
|
||||
FrontfaceCulling = value; break;
|
||||
case EMF_BILINEAR_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].BilinearFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_TRILINEAR_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].TrilinearFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_ANISOTROPIC_FILTER:
|
||||
{
|
||||
if (value)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = 0xFF;
|
||||
else
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = 0;
|
||||
}
|
||||
break;
|
||||
@ -591,7 +574,7 @@ namespace video
|
||||
NormalizeNormals = value; break;
|
||||
case EMF_TEXTURE_WRAP:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value;
|
||||
TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;
|
||||
@ -713,7 +696,7 @@ namespace video
|
||||
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
|
||||
UseMipMaps != b.UseMipMaps
|
||||
;
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
|
||||
{
|
||||
different |= (TextureLayer[i] != b.TextureLayer[i]);
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ namespace video
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES_USED));
|
||||
Feature.ColorAttachment = 1;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,6 @@ namespace video
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES_USED));
|
||||
Feature.ColorAttachment = 1;
|
||||
|
||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
||||
|
@ -756,7 +756,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
||||
else
|
||||
#endif
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES_USED));
|
||||
|
||||
#ifdef GL_ARB_occlusion_query
|
||||
if (FeatureAvailable[IRR_ARB_occlusion_query])
|
||||
|
@ -1097,7 +1097,6 @@ void CWebGL1Driver::initWebGLExtensions()
|
||||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES_USED));
|
||||
|
||||
Feature.ColorAttachment = 1;
|
||||
}
|
||||
|
@ -132,7 +132,6 @@ namespace core
|
||||
namespace video
|
||||
{
|
||||
SMaterial IdentityMaterial;
|
||||
u32 MATERIAL_MAX_TEXTURES_USED = MATERIAL_MAX_TEXTURES;
|
||||
}
|
||||
|
||||
} // end namespace irr
|
||||
|
Loading…
Reference in New Issue
Block a user