Changed: #878 Fix typos in comments/code

This commit is contained in:
kervala 2011-02-09 16:03:44 +01:00
parent a617da4566
commit 300c48e191
5 changed files with 121 additions and 96 deletions

View file

@ -2552,14 +2552,16 @@ bool CDriverGL::supportTextureRectangle() const
// ***************************************************************************
bool CDriverGL::supportPackedDepthStencil() const
{
H_AUTO_OGL(CDriverGL_supportPackedDepthStencil)
H_AUTO_OGL(CDriverGL_supportPackedDepthStencil);
return _Extensions.PackedDepthStencil;
}
// ***************************************************************************
bool CDriverGL::supportFrameBufferObject() const
{
H_AUTO_OGL(CDriverGL_supportFrameBufferObject)
H_AUTO_OGL(CDriverGL_supportFrameBufferObject);
return _Extensions.FrameBufferObject;
}

View file

@ -604,7 +604,6 @@ static bool setupNVVertexArrayRange(const char *glext)
CHECK_ADDRESS(NEL_PFNGLFINISHFENCENVPROC, glFinishFenceNV);
CHECK_ADDRESS(NEL_PFNGLSETFENCENVPROC, glSetFenceNV);
return true;
}
@ -952,7 +951,6 @@ static bool setupEXTBlendColor(const char *glext)
return true;
}
// *********************************
static bool setupNVVertexArrayRange2(const char *glext)
{

View file

@ -94,8 +94,6 @@ void CDriverGLStates::forceDefaults(uint nbStages)
glDisable(GL_LIGHTING);
glDepthMask(GL_TRUE);
// Func.
_CurBlendSrc= GL_SRC_ALPHA;
_CurBlendDst= GL_ONE_MINUS_SRC_ALPHA;
@ -108,6 +106,7 @@ void CDriverGLStates::forceDefaults(uint nbStages)
_CurStencilOpZPass = GL_KEEP;
_CurStencilWriteMask = std::numeric_limits<GLuint>::max();
_CurAlphaTestThreshold= 0.5f;
// setup GLStates.
glBlendFunc(_CurBlendSrc, _CurBlendDst);
glDepthFunc(_CurDepthFunc);
@ -140,9 +139,6 @@ void CDriverGLStates::forceDefaults(uint nbStages)
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, zero);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, _CurShininess);
// TexModes
uint stage;
for(stage=0;stage<nbStages; stage++)
@ -328,15 +324,15 @@ void CDriverGLStates::enableZWrite(uint enable)
// ***************************************************************************
void CDriverGLStates::enableStencilTest(bool enable)
{
H_AUTO_OGL(CDriverGLStates_enableStencilTest)
H_AUTO_OGL(CDriverGLStates_enableStencilTest);
// If different from current setup, update.
bool enabled= (enable!=0);
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if( enabled != _CurStencilTest )
if( enable != _CurStencilTest )
#endif
{
// new state.
_CurStencilTest= enabled;
_CurStencilTest= enable;
// Setup GLState.
if(_CurStencilTest)
glEnable(GL_STENCIL_TEST);
@ -599,7 +595,8 @@ void CDriverGLStates::setDepthRange(float znear, float zfar)
// ***************************************************************************
void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
{
H_AUTO_OGL(CDriverGLStates_setTexGenMode )
H_AUTO_OGL(CDriverGLStates_setTexGenMode);
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (mode != _TexGenMode[stage])
#endif
@ -643,12 +640,13 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
// ***************************************************************************
void CDriverGLStates::resetTextureMode()
{
H_AUTO_OGL(CDriverGLStates_resetTextureMode)
H_AUTO_OGL(CDriverGLStates_resetTextureMode);
glDisable(GL_TEXTURE_2D);
if (_TextureCubeMapSupported)
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
@ -657,6 +655,7 @@ void CDriverGLStates::resetTextureMode()
{
glDisable(GL_TEXTURE_RECTANGLE_NV);
}
_TextureMode[_CurrentActiveTextureARB]= TextureDisabled;
}
@ -669,39 +668,59 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
if(oldTexMode != texMode)
{
// Disable first old mode.
if(oldTexMode == Texture2D)
if (oldTexMode == Texture2D)
{
glDisable(GL_TEXTURE_2D);
}
else if(oldTexMode == TextureRect)
{
if(_TextureRectangleSupported)
{
glDisable(GL_TEXTURE_RECTANGLE_NV);
}
else
{
glDisable(GL_TEXTURE_2D);
}
}
else if(oldTexMode == TextureCubeMap)
{
if(_TextureCubeMapSupported)
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
}
else
{
glDisable(GL_TEXTURE_2D);
}
}
// Enable new mode.
if(texMode == Texture2D)
{
glEnable(GL_TEXTURE_2D);
}
else if(texMode == TextureRect)
{
if(_TextureRectangleSupported)
{
glEnable(GL_TEXTURE_RECTANGLE_NV);
}
else
{
glDisable(GL_TEXTURE_2D);
}
}
else if(texMode == TextureCubeMap)
{
if(_TextureCubeMapSupported)
{
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
}
else
{
glDisable(GL_TEXTURE_2D);
}
}
// new mode.
@ -713,7 +732,8 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
// ***************************************************************************
void CDriverGLStates::activeTextureARB(uint stage)
{
H_AUTO_OGL(CDriverGLStates_activeTextureARB)
H_AUTO_OGL(CDriverGLStates_activeTextureARB);
if( _CurrentActiveTextureARB != stage )
{
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
@ -726,7 +746,8 @@ void CDriverGLStates::activeTextureARB(uint stage)
// ***************************************************************************
void CDriverGLStates::forceActiveTextureARB(uint stage)
{
H_AUTO_OGL(CDriverGLStates_forceActiveTextureARB)
H_AUTO_OGL(CDriverGLStates_forceActiveTextureARB);
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
_CurrentActiveTextureARB= stage;
@ -960,8 +981,6 @@ void CDriverGLStates::enableFog(uint enable)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
}
}

View file

@ -288,7 +288,6 @@ bool CDriverGL::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
// end multipass.
endMultiPass();
// Profiling.
_PrimitiveProfileIn.NLines+= nlines;
_PrimitiveProfileOut.NLines+= nlines;
@ -296,6 +295,7 @@ bool CDriverGL::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
// We have render some prims. inform the VBHard.
if(_CurrentVertexBufferHard)
_CurrentVertexBufferHard->GPURenderingAfterFence= true;
return true;
}
@ -303,9 +303,11 @@ bool CDriverGL::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
bool CDriverGL::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)
{
H_AUTO_OGL(CDriverGL_renderTriangles)
H_AUTO_OGL(CDriverGL_renderTriangles);
// update matrix and Light in OpenGL if needed
refreshRenderSetup();
// setup material
if ( !setupMaterial(mat) || _LastIB._Values == NULL )
return false;
@ -357,20 +359,20 @@ bool CDriverGL::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)
bool CDriverGL::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
{
H_AUTO_OGL(CDriverGL_renderSimpleTriangles)
H_AUTO_OGL(CDriverGL_renderSimpleTriangles);
nlassert(ntris>0);
// update matrix and Light in OpenGL if needed
refreshRenderSetup();
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
// Don't setup any material here.
// render primitives.
//==============================
// NO MULTIPASS HERE!!
// draw the primitives. (nb: ntrsi>0).
// draw the primitives. (nb: ntris>0).
if (_LastIB._Format == CIndexBuffer::Indices16)
{
@ -389,6 +391,7 @@ bool CDriverGL::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
// We have render some prims. inform the VBHard.
if(_CurrentVertexBufferHard)
_CurrentVertexBufferHard->GPURenderingAfterFence= true;
return true;
}
@ -757,7 +760,7 @@ IVertexBufferHardGL *CDriverGL::createVertexBufferHard(uint size, uint numVertic
break;
default:
break;
};
}
// If this one at least created (an extension support it).
if( !vertexArrayRange )
@ -769,7 +772,7 @@ IVertexBufferHardGL *CDriverGL::createVertexBufferHard(uint size, uint numVertic
return NULL;
// Create a CVertexBufferHardGL
IVertexBufferHardGL *vbHard;
IVertexBufferHardGL *vbHard = NULL;
// let the VAR create the vbhard.
vbHard= vertexArrayRange->createVBHardGL(size, vb);
// if fails
@ -889,6 +892,7 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
nlassert (numVertexCoord >= 2);
_DriverGLStates.enableVertexArray(true);
glVertexPointer(numVertexCoord, GL_FLOAT, vb.VertexSize, vb.ValuePtr[CVertexBuffer::Position]);
// setup normal ptr.
//-----------
// Check for normal param in vertex buffer
@ -904,6 +908,7 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
{
_DriverGLStates.enableNormalArray(false);
}
// Setup Color
//-----------
// Check for color param in vertex buffer
@ -916,7 +921,9 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
glColorPointer(4,GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[CVertexBuffer::PrimaryColor]);
}
else
{
_DriverGLStates.enableColorArray(false);
}
}
break;
case CVertexBufferInfo::HwATI:
@ -972,8 +979,6 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
// normal behavior: each texture has its own UV.
setupUVPtr(i, vb, vb.UVRouting[i]);
}
}
@ -1435,70 +1440,70 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
{
switch(value)
{
case CVertexBuffer::Position: // position
{
nlassert(NumCoordinatesType[type] >= 2);
glVertexPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Weight: // skin weight
{
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Normal: // normal
{
nlassert(NumCoordinatesType[type] == 3); // must have 3 components for normals
glNormalPointer(GLType[type], vb.VertexSize, vb.ValuePtr[CVertexBuffer::Normal]);
}
break;
case CVertexBuffer::PrimaryColor: // color
{
nlassert(NumCoordinatesType[type] >= 3); // must have 3 or 4 components for primary color
glColorPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::SecondaryColor: // secondary color
{
// implemented using a variant, as not available with EXTVertexShader
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Fog: // fog coordinate
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::PaletteSkin: // palette skin
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Empty: // empty
nlstop;
break;
case CVertexBuffer::TexCoord0:
case CVertexBuffer::TexCoord1:
case CVertexBuffer::TexCoord2:
case CVertexBuffer::TexCoord3:
case CVertexBuffer::TexCoord4:
case CVertexBuffer::TexCoord5:
case CVertexBuffer::TexCoord6:
case CVertexBuffer::TexCoord7:
{
_DriverGLStates.clientActiveTextureARB(value - CVertexBuffer::TexCoord0);
glTexCoordPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
default:
nlstop; // invalid value
break;
case CVertexBuffer::Position: // position
{
nlassert(NumCoordinatesType[type] >= 2);
glVertexPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Weight: // skin weight
{
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Normal: // normal
{
nlassert(NumCoordinatesType[type] == 3); // must have 3 components for normals
glNormalPointer(GLType[type], vb.VertexSize, vb.ValuePtr[CVertexBuffer::Normal]);
}
break;
case CVertexBuffer::PrimaryColor: // color
{
nlassert(NumCoordinatesType[type] >= 3); // must have 3 or 4 components for primary color
glColorPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::SecondaryColor: // secondary color
{
// implemented using a variant, as not available with EXTVertexShader
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Fog: // fog coordinate
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::PaletteSkin: // palette skin
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Empty: // empty
nlstop;
break;
case CVertexBuffer::TexCoord0:
case CVertexBuffer::TexCoord1:
case CVertexBuffer::TexCoord2:
case CVertexBuffer::TexCoord3:
case CVertexBuffer::TexCoord4:
case CVertexBuffer::TexCoord5:
case CVertexBuffer::TexCoord6:
case CVertexBuffer::TexCoord7:
{
_DriverGLStates.clientActiveTextureARB(value - CVertexBuffer::TexCoord0);
glTexCoordPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
default:
nlstop; // invalid value
break;
}
}
}
@ -1732,7 +1737,8 @@ uint32 CDriverGL::getAvailableVertexVRAMMemory ()
// ***************************************************************************
void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard)
{
H_AUTO_OGL(CDriverGL_fenceOnCurVBHardIfNeeded)
H_AUTO_OGL(CDriverGL_fenceOnCurVBHardIfNeeded);
// If old is not a VBHard, or if not a NVidia VBHard, no-op.
if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB)
return;

View file

@ -1888,7 +1888,7 @@ void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided)
bool CDriverGL::supportVertexProgramDoubleSidedColor() const
{
H_AUTO_OGL(CDriverGL_supportVertexProgramDoubleSidedColor)
// currenlty only supported by NV_VERTEX_PROGRAM && ARB_VERTEX_PROGRAM
// currently only supported by NV_VERTEX_PROGRAM && ARB_VERTEX_PROGRAM
return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram;
}