Merging r5678 from trunk to ogl-es branch
- Add global variable MATERIAL_MAX_TEXTURES_USED for texture limit - COpenGLCoreFeature::TextureUnit renamed to COpenGLCoreFeature::MaxTextureUnits Drivers for ES1, ES2 and WebGL also adapted. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5685 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
dad0695522
commit
ac376727d0
|
@ -259,8 +259,28 @@ namespace video
|
|||
|
||||
|
||||
//! Maximum number of texture an SMaterial can have.
|
||||
/** SMaterial might ignore some textures in most function, like assignment and comparison,
|
||||
when SIrrlichtCreationParameters::MaxTextureUnits is set to a lower number.
|
||||
*/
|
||||
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
|
||||
class SMaterial
|
||||
{
|
||||
|
@ -284,7 +304,7 @@ namespace video
|
|||
SMaterial(const SMaterial& other)
|
||||
{
|
||||
// These pointers are checked during assignment
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].TextureMatrix = 0;
|
||||
*this = other;
|
||||
}
|
||||
|
@ -307,7 +327,7 @@ namespace video
|
|||
MaterialTypeParam = other.MaterialTypeParam;
|
||||
MaterialTypeParam2 = other.MaterialTypeParam2;
|
||||
Thickness = other.Thickness;
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
{
|
||||
TextureLayer[i] = other.TextureLayer[i];
|
||||
}
|
||||
|
@ -493,7 +513,7 @@ namespace video
|
|||
E_ZWRITE_FINE_CONTROL ZWriteFineControl;
|
||||
|
||||
//! Gets the texture transformation matrix for level i
|
||||
/** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES.
|
||||
/** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES
|
||||
\return Texture matrix for texture level i. */
|
||||
core::matrix4& getTextureMatrix(u32 i)
|
||||
{
|
||||
|
@ -565,23 +585,23 @@ namespace video
|
|||
FrontfaceCulling = value; break;
|
||||
case EMF_BILINEAR_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].BilinearFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_TRILINEAR_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].TrilinearFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_ANISOTROPIC_FILTER:
|
||||
{
|
||||
if (value)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = 0xFF;
|
||||
else
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -591,7 +611,7 @@ namespace video
|
|||
NormalizeNormals = value; break;
|
||||
case EMF_TEXTURE_WRAP:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
{
|
||||
TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value;
|
||||
TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;
|
||||
|
@ -711,7 +731,7 @@ namespace video
|
|||
UseMipMaps != b.UseMipMaps ||
|
||||
ZWriteFineControl != b.ZWriteFineControl;
|
||||
;
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
|
||||
{
|
||||
different |= (TextureLayer[i] != b.TextureLayer[i]);
|
||||
}
|
||||
|
@ -752,12 +772,10 @@ namespace video
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//! global const identity Material
|
||||
IRRLICHT_API extern SMaterial IdentityMaterial;
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -427,12 +427,14 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
createMaterialRenderers();
|
||||
|
||||
MaxFixedPipelineTextureUnits = (u32)Caps.MaxSimultaneousTextures;
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)MaxFixedPipelineTextureUnits);
|
||||
|
||||
u32 maxTextureSamplers = (Caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) ? 16 : (Caps.PixelShaderVersion >= D3DPS_VERSION(1, 4)) ?
|
||||
6 : (Caps.PixelShaderVersion >= D3DPS_VERSION(1, 0)) ? 4 : 0;
|
||||
|
||||
MaxTextureUnits = core::max_(MaxFixedPipelineTextureUnits, maxTextureSamplers);
|
||||
MaxTextureUnits = core::min_(MaxTextureUnits, MATERIAL_MAX_TEXTURES);
|
||||
MaxTextureUnits = core::min_(MaxTextureUnits, MATERIAL_MAX_TEXTURES_USED);
|
||||
|
||||
MaxUserClipPlanes = (u32)Caps.MaxUserClipPlanes;
|
||||
OcclusionQuerySupport=(pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, NULL) == S_OK);
|
||||
|
@ -450,7 +452,6 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
#endif
|
||||
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxLights", (s32)Caps.MaxActiveLights);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", (s32)Caps.MaxAnisotropy);
|
||||
DriverAttributes->setAttribute("MaxUserClipPlanes", (s32)Caps.MaxUserClipPlanes);
|
||||
|
@ -672,7 +673,8 @@ void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4
|
|||
{
|
||||
const s32 stage = state - ETS_TEXTURE_0;
|
||||
|
||||
if (stage < MATERIAL_MAX_TEXTURES && stage < static_cast<s32>(MaxFixedPipelineTextureUnits))
|
||||
if ( stage < static_cast<s32>(MaxTextureUnits)
|
||||
&& stage < static_cast<s32>(MaxFixedPipelineTextureUnits)) // texture transforms for shader pipeline have to be passed by user
|
||||
{
|
||||
if (mat.isIdentity())
|
||||
pID3DDevice->SetTextureStageState(stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
|
|
|
@ -122,8 +122,8 @@ COGLES2Driver::~COGLES2Driver()
|
|||
|
||||
StencilBuffer = stencilBuffer;
|
||||
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
|
||||
// DriverAttributes->setAttribute("MaxLights", MaxLights);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
|
||||
// DriverAttributes->setAttribute("MaxUserClipPlanes", MaxUserClipPlanes);
|
||||
|
@ -1580,7 +1580,7 @@ COGLES2Driver::~COGLES2Driver()
|
|||
Material = material;
|
||||
OverrideMaterial.apply(Material);
|
||||
|
||||
for (u32 i = 0; i < Feature.TextureUnit; ++i)
|
||||
for (u32 i = 0; i < Feature.MaxTextureUnits; ++i)
|
||||
{
|
||||
CacheHandler->getTextureCache().set(i, material.getTexture(i));
|
||||
setTransform((E_TRANSFORMATION_STATE)(ETS_TEXTURE_0 + i), material.getTextureMatrix(i));
|
||||
|
@ -1863,7 +1863,7 @@ COGLES2Driver::~COGLES2Driver()
|
|||
|
||||
// Set textures to TU/TIU and apply filters to them
|
||||
|
||||
for (s32 i = Feature.TextureUnit - 1; i >= 0; --i)
|
||||
for (s32 i = Feature.MaxTextureUnits - 1; i >= 0; --i)
|
||||
{
|
||||
const COGLES2Texture* tmpTexture = CacheHandler->getTextureCache()[i];
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace video
|
|||
|
||||
GLint val=0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &val);
|
||||
Feature.TextureUnit = static_cast<u8>(val);
|
||||
Feature.MaxTextureUnits = static_cast<u8>(val);
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_filter_anisotropic])
|
||||
|
@ -46,7 +46,8 @@ namespace video
|
|||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
|
||||
Feature.TextureUnit = core::min_(Feature.TextureUnit, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||
|
||||
StencilBuffer = stencilBuffer;
|
||||
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
|
||||
DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
|
||||
DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
|
||||
|
@ -669,7 +669,7 @@ void COGLES1Driver::drawVertexPrimitiveList2d3d(const void* vertices, u32 vertex
|
|||
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), 0);
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0 && CacheHandler->getTextureCache().get(1))
|
||||
if (Feature.MaxTextureUnits > 0 && CacheHandler->getTextureCache().get(1))
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -695,7 +695,7 @@ void COGLES1Driver::drawVertexPrimitiveList2d3d(const void* vertices, u32 vertex
|
|||
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), buffer_offset(0));
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -721,7 +721,7 @@ void COGLES1Driver::drawVertexPrimitiveList2d3d(const void* vertices, u32 vertex
|
|||
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(0));
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -824,7 +824,7 @@ void COGLES1Driver::drawVertexPrimitiveList2d3d(const void* vertices, u32 vertex
|
|||
break;
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
if (vType == EVT_TANGENTS)
|
||||
{
|
||||
|
@ -1431,7 +1431,7 @@ void COGLES1Driver::setMaterial(const SMaterial& material)
|
|||
Material = material;
|
||||
OverrideMaterial.apply(Material);
|
||||
|
||||
for (u32 i = 0; i < Feature.TextureUnit; ++i)
|
||||
for (u32 i = 0; i < Feature.MaxTextureUnits; ++i)
|
||||
setTransform((E_TRANSFORMATION_STATE)(ETS_TEXTURE_0 + i), material.getTextureMatrix(i));
|
||||
}
|
||||
|
||||
|
@ -1879,7 +1879,7 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
|
|||
{
|
||||
// Set textures to TU/TIU and apply filters to them
|
||||
|
||||
for (s32 i = Feature.TextureUnit - 1; i >= 0; --i)
|
||||
for (s32 i = Feature.MaxTextureUnits - 1; i >= 0; --i)
|
||||
{
|
||||
CacheHandler->getTextureCache().set(i, material.TextureLayer[i].Texture);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace video
|
|||
MaxLights = static_cast<u8>(val);
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &val);
|
||||
Feature.TextureUnit = static_cast<u8>(val);
|
||||
Feature.MaxTextureUnits = static_cast<u8>(val);
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_filter_anisotropic])
|
||||
|
@ -81,7 +81,8 @@ namespace video
|
|||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
|
||||
Feature.TextureUnit = core::min_(Feature.TextureUnit, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
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_)
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
#pragma warning(push)
|
||||
#pragma warning(disable: 4355) // Warning: "'this' : used in base member initializer list. ". It's OK, we don't use the reference in STextureCache constructor.
|
||||
#endif
|
||||
TextureCache(STextureCache(*this, driver->getDriverType(), driver->getFeature().TextureUnit)),
|
||||
TextureCache(STextureCache(*this, driver->getDriverType(), driver->getFeature().MaxTextureUnits)),
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace video
|
|||
class COpenGLCoreFeature
|
||||
{
|
||||
public:
|
||||
COpenGLCoreFeature() : BlendOperation(false), ColorAttachment(0), MultipleRenderTarget(0), TextureUnit(1)
|
||||
COpenGLCoreFeature() : BlendOperation(false), ColorAttachment(0), MultipleRenderTarget(0), MaxTextureUnits(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
u8 ColorAttachment;
|
||||
u8 MultipleRenderTarget;
|
||||
u8 TextureUnit;
|
||||
u8 MaxTextureUnits;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -152,8 +152,8 @@ bool COpenGLDriver::genericDriverInit()
|
|||
}
|
||||
else
|
||||
os::Printer::log("GLSL not available.", ELL_INFORMATION);
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxLights", MaxLights);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
|
||||
DriverAttributes->setAttribute("MaxUserClipPlanes", MaxUserClipPlanes);
|
||||
|
@ -888,7 +888,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
|
|||
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), 0);
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0 && CacheHandler->getTextureCache()[1])
|
||||
if (Feature.MaxTextureUnits > 0 && CacheHandler->getTextureCache()[1])
|
||||
{
|
||||
CacheHandler->setClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -914,7 +914,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
|
|||
}
|
||||
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
CacheHandler->setClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -939,7 +939,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
|
|||
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(0));
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
CacheHandler->setClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -960,7 +960,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
|
|||
|
||||
renderArray(indexList, primitiveCount, pType, iType);
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
if (vType==EVT_TANGENTS)
|
||||
{
|
||||
|
@ -1213,7 +1213,7 @@ void COpenGLDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCo
|
|||
glVertexPointer(2, GL_FLOAT, sizeof(S3DVertex), 0);
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0 && CacheHandler->getTextureCache()[1])
|
||||
if (Feature.MaxTextureUnits > 0 && CacheHandler->getTextureCache()[1])
|
||||
{
|
||||
CacheHandler->setClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -1236,7 +1236,7 @@ void COpenGLDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCo
|
|||
glVertexPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), buffer_offset(0));
|
||||
}
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
CacheHandler->setClientActiveTexture(GL_TEXTURE0 + 1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -1264,7 +1264,7 @@ void COpenGLDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCo
|
|||
|
||||
renderArray(indexList, primitiveCount, pType, iType);
|
||||
|
||||
if (Feature.TextureUnit > 0)
|
||||
if (Feature.MaxTextureUnits > 0)
|
||||
{
|
||||
if ((vType!=EVT_STANDARD) || CacheHandler->getTextureCache()[1])
|
||||
{
|
||||
|
@ -1968,7 +1968,7 @@ void COpenGLDriver::drawPixel(u32 x, u32 y, const SColor &color)
|
|||
bool COpenGLDriver::disableTextures(u32 fromStage)
|
||||
{
|
||||
bool result=true;
|
||||
for (u32 i=fromStage; i<Feature.TextureUnit; ++i)
|
||||
for (u32 i=fromStage; i<Feature.MaxTextureUnits; ++i)
|
||||
{
|
||||
result &= CacheHandler->getTextureCache().set(i, 0, EST_ACTIVE_ON_CHANGE);
|
||||
}
|
||||
|
@ -2043,7 +2043,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material)
|
|||
Material = material;
|
||||
OverrideMaterial.apply(Material);
|
||||
|
||||
for (u32 i = 0; i < Feature.TextureUnit; ++i)
|
||||
for (u32 i = 0; i < Feature.MaxTextureUnits; ++i)
|
||||
{
|
||||
const ITexture* texture = Material.getTexture(i);
|
||||
CacheHandler->getTextureCache().set(i, texture, EST_ACTIVE_ON_CHANGE);
|
||||
|
@ -2698,7 +2698,7 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
|
|||
{
|
||||
// Set textures to TU/TIU and apply filters to them
|
||||
|
||||
for (s32 i = Feature.TextureUnit - 1; i >= 0; --i)
|
||||
for (s32 i = Feature.MaxTextureUnits - 1; i >= 0; --i)
|
||||
{
|
||||
bool fixedPipeline = false;
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
#elif defined(GL_MAX_TEXTURE_UNITS_ARB)
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num);
|
||||
#endif
|
||||
Feature.TextureUnit=static_cast<u8>(num); // MULTITEXTURING (fixed function pipeline texture units)
|
||||
Feature.MaxTextureUnits=static_cast<u8>(num); // MULTITEXTURING (fixed function pipeline texture units)
|
||||
}
|
||||
#endif
|
||||
#if defined(GL_ARB_vertex_shader) || defined(GL_VERSION_2_0)
|
||||
|
@ -594,7 +594,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
#elif defined(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB)
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &num);
|
||||
#endif
|
||||
Feature.TextureUnit =core::max_(Feature.TextureUnit,static_cast<u8>(num));
|
||||
Feature.MaxTextureUnits =core::max_(Feature.MaxTextureUnits,static_cast<u8>(num));
|
||||
}
|
||||
#endif
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &num);
|
||||
|
@ -694,12 +694,13 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
if (!pGlActiveTextureARB || !pGlClientActiveTextureARB)
|
||||
{
|
||||
Feature.TextureUnit = 1;
|
||||
Feature.MaxTextureUnits = 1;
|
||||
os::Printer::log("Failed to load OpenGL's multitexture extension, proceeding without.", ELL_WARNING);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
Feature.TextureUnit = core::min_(Feature.TextureUnit, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
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])
|
||||
|
@ -768,7 +769,7 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
|||
case EVDF_HARDWARE_TL:
|
||||
return true; // we cannot tell other things
|
||||
case EVDF_MULTITEXTURE:
|
||||
return Feature.TextureUnit > 1;
|
||||
return Feature.MaxTextureUnits > 1;
|
||||
case EVDF_BILINEAR_FILTER:
|
||||
return true;
|
||||
case EVDF_MIP_MAP:
|
||||
|
|
|
@ -1015,8 +1015,8 @@ bool CWebGL1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||
|
||||
StencilBuffer = stencilBuffer;
|
||||
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.TextureUnit);
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
|
||||
DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
|
||||
DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
|
||||
|
@ -1070,7 +1070,7 @@ void CWebGL1Driver::initWebGLExtensions()
|
|||
// TODO: basically copied ES2 implementation, so not certain if 100% correct for WebGL
|
||||
GLint val=0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &val);
|
||||
Feature.TextureUnit = static_cast<u8>(val);
|
||||
Feature.MaxTextureUnits = static_cast<u8>(val);
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_EXT_texture_filter_anisotropic) )
|
||||
|
@ -1096,7 +1096,8 @@ void CWebGL1Driver::initWebGLExtensions()
|
|||
|
||||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
Feature.TextureUnit = core::min_(Feature.TextureUnit, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ namespace core
|
|||
namespace video
|
||||
{
|
||||
SMaterial IdentityMaterial;
|
||||
u32 MATERIAL_MAX_TEXTURES_USED = MATERIAL_MAX_TEXTURES;
|
||||
}
|
||||
|
||||
} // end namespace irr
|
||||
|
|
Loading…
Reference in New Issue