Changed: #878 Fix typos in comments/code

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

View file

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

View file

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

View file

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

View file

@ -288,7 +288,6 @@ bool CDriverGL::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
// end multipass. // end multipass.
endMultiPass(); endMultiPass();
// Profiling. // Profiling.
_PrimitiveProfileIn.NLines+= nlines; _PrimitiveProfileIn.NLines+= nlines;
_PrimitiveProfileOut.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. // We have render some prims. inform the VBHard.
if(_CurrentVertexBufferHard) if(_CurrentVertexBufferHard)
_CurrentVertexBufferHard->GPURenderingAfterFence= true; _CurrentVertexBufferHard->GPURenderingAfterFence= true;
return 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) 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 // update matrix and Light in OpenGL if needed
refreshRenderSetup(); refreshRenderSetup();
// setup material // setup material
if ( !setupMaterial(mat) || _LastIB._Values == NULL ) if ( !setupMaterial(mat) || _LastIB._Values == NULL )
return false; return false;
@ -357,20 +359,20 @@ bool CDriverGL::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)
bool CDriverGL::renderSimpleTriangles(uint32 firstTri, uint32 ntris) bool CDriverGL::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
{ {
H_AUTO_OGL(CDriverGL_renderSimpleTriangles) H_AUTO_OGL(CDriverGL_renderSimpleTriangles);
nlassert(ntris>0); nlassert(ntris>0);
// update matrix and Light in OpenGL if needed // update matrix and Light in OpenGL if needed
refreshRenderSetup(); refreshRenderSetup();
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true; if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
// Don't setup any material here. // Don't setup any material here.
// render primitives. // render primitives.
//============================== //==============================
// NO MULTIPASS HERE!! // NO MULTIPASS HERE!!
// draw the primitives. (nb: ntrsi>0). // draw the primitives. (nb: ntris>0).
if (_LastIB._Format == CIndexBuffer::Indices16) if (_LastIB._Format == CIndexBuffer::Indices16)
{ {
@ -389,6 +391,7 @@ bool CDriverGL::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
// We have render some prims. inform the VBHard. // We have render some prims. inform the VBHard.
if(_CurrentVertexBufferHard) if(_CurrentVertexBufferHard)
_CurrentVertexBufferHard->GPURenderingAfterFence= true; _CurrentVertexBufferHard->GPURenderingAfterFence= true;
return true; return true;
} }
@ -757,7 +760,7 @@ IVertexBufferHardGL *CDriverGL::createVertexBufferHard(uint size, uint numVertic
break; break;
default: default:
break; break;
}; }
// If this one at least created (an extension support it). // If this one at least created (an extension support it).
if( !vertexArrayRange ) if( !vertexArrayRange )
@ -769,7 +772,7 @@ IVertexBufferHardGL *CDriverGL::createVertexBufferHard(uint size, uint numVertic
return NULL; return NULL;
// Create a CVertexBufferHardGL // Create a CVertexBufferHardGL
IVertexBufferHardGL *vbHard; IVertexBufferHardGL *vbHard = NULL;
// let the VAR create the vbhard. // let the VAR create the vbhard.
vbHard= vertexArrayRange->createVBHardGL(size, vb); vbHard= vertexArrayRange->createVBHardGL(size, vb);
// if fails // if fails
@ -889,6 +892,7 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
nlassert (numVertexCoord >= 2); nlassert (numVertexCoord >= 2);
_DriverGLStates.enableVertexArray(true); _DriverGLStates.enableVertexArray(true);
glVertexPointer(numVertexCoord, GL_FLOAT, vb.VertexSize, vb.ValuePtr[CVertexBuffer::Position]); glVertexPointer(numVertexCoord, GL_FLOAT, vb.VertexSize, vb.ValuePtr[CVertexBuffer::Position]);
// setup normal ptr. // setup normal ptr.
//----------- //-----------
// Check for normal param in vertex buffer // Check for normal param in vertex buffer
@ -904,6 +908,7 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
{ {
_DriverGLStates.enableNormalArray(false); _DriverGLStates.enableNormalArray(false);
} }
// Setup Color // Setup Color
//----------- //-----------
// Check for color param in vertex buffer // Check for color param in vertex buffer
@ -916,8 +921,10 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
glColorPointer(4,GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[CVertexBuffer::PrimaryColor]); glColorPointer(4,GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[CVertexBuffer::PrimaryColor]);
} }
else else
{
_DriverGLStates.enableColorArray(false); _DriverGLStates.enableColorArray(false);
} }
}
break; break;
case CVertexBufferInfo::HwATI: case CVertexBufferInfo::HwATI:
{ {
@ -972,8 +979,6 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
// normal behavior: each texture has its own UV. // normal behavior: each texture has its own UV.
setupUVPtr(i, vb, vb.UVRouting[i]); setupUVPtr(i, vb, vb.UVRouting[i]);
} }
} }
@ -1732,7 +1737,8 @@ uint32 CDriverGL::getAvailableVertexVRAMMemory ()
// *************************************************************************** // ***************************************************************************
void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard) 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 old is not a VBHard, or if not a NVidia VBHard, no-op.
if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB) if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB)
return; return;

View file

@ -1888,7 +1888,7 @@ void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided)
bool CDriverGL::supportVertexProgramDoubleSidedColor() const bool CDriverGL::supportVertexProgramDoubleSidedColor() const
{ {
H_AUTO_OGL(CDriverGL_supportVertexProgramDoubleSidedColor) 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; return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram;
} }