From 300c48e191a15d49380f93fd3c1483c9d5d4ad8b Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 9 Feb 2011 16:03:44 +0100 Subject: [PATCH] Changed: #878 Fix typos in comments/code --- .../src/3d/driver/opengl/driver_opengl.cpp | 6 +- .../driver/opengl/driver_opengl_extension.cpp | 2 - .../3d/driver/opengl/driver_opengl_states.cpp | 53 ++++-- .../3d/driver/opengl/driver_opengl_vertex.cpp | 154 +++++++++--------- .../opengl/driver_opengl_vertex_program.cpp | 2 +- 5 files changed, 121 insertions(+), 96 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 4cc85b7bf..02ba70993 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -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; } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 027a5234a..a56f3670b 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -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) { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index 4eac76125..fb4f14dc2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -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::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;stageGPURenderingAfterFence= 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; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index 9ce7f5b45..4c255e1d9 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -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; }