From 92eb988f2abfcffdcac1a01f8513f9926bf29ec2 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Mon, 22 Jan 2018 19:32:46 -0600 Subject: [PATCH] Pull in vertex buffer changes from alch. --- indra/llrender/llvertexbuffer.cpp | 180 ++++++++++++++------------- indra/llrender/llvertexbuffer.h | 11 +- indra/newview/llface.cpp | 148 +--------------------- indra/newview/llselectmgr.cpp | 2 +- indra/newview/llspatialpartition.cpp | 12 +- 5 files changed, 103 insertions(+), 250 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 65b3d475e..c4977e9bc 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -97,7 +97,6 @@ U32 LLVertexBuffer::sCurVAOName = 1; U32 LLVertexBuffer::sAllocatedIndexBytes = 0; U32 LLVertexBuffer::sIndexCount = 0; -LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL; U32 LLVertexBuffer::sBindCount = 0; U32 LLVertexBuffer::sSetCount = 0; S32 LLVertexBuffer::sCount = 0; @@ -117,6 +116,7 @@ bool LLVertexBuffer::sMapped = false; bool LLVertexBuffer::sUseStreamDraw = true; bool LLVertexBuffer::sUseVAO = false; bool LLVertexBuffer::sPreferStreamDraw = false; +LLVertexBuffer* LLVertexBuffer::sUtilityBuffer = nullptr; U32 LLVBOPool::genBuffer() @@ -135,7 +135,7 @@ void LLVBOPool::deleteBuffer(U32 name) LLVertexBuffer::unbind(); glBindBufferARB(mType, name); - glBufferDataARB(mType, 0, NULL, mUsage); + glBufferDataARB(mType, 0, nullptr, mUsage); glBindBufferARB(mType, 0); glDeleteBuffersARB(1, &name); @@ -154,7 +154,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) { llassert(vbo_block_size(size) == size); - volatile U8* ret = NULL; + volatile U8* ret = nullptr; U32 i = vbo_block_index(size); @@ -186,12 +186,12 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) { - glBufferDataARB(mType, size, 0, mUsage); + glBufferDataARB(mType, size, nullptr, mUsage); ret = (U8*) ll_aligned_malloc<64>(size); } else { //always use a true hint of static draw when allocating non-client-backed buffers - glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB); + glBufferDataARB(mType, size, nullptr, GL_STATIC_DRAW_ARB); } glBindBufferARB(mType, 0); @@ -449,7 +449,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) else { - GLenum array[] = + static const GLenum array[] = { GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, @@ -457,7 +457,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) GL_COLOR_ARRAY, }; - GLenum mask[] = + static const GLenum mask[] = { MAP_VERTEX, MAP_NORMAL, @@ -564,77 +564,96 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, con gGL.syncMatrices(); U32 count = pos.size(); - + llassert(norm.size() >= pos.size()); llassert(count > 0); - if( count == 0 ) + if (count == 0) { LL_WARNS() << "Called drawArrays with 0 vertices" << LL_ENDL; return; } - if( norm.size() < pos.size() ) + if (norm.size() < pos.size()) { LL_WARNS() << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << LL_ENDL; return; } - unbind(); - - setupClientArrays(MAP_VERTEX | MAP_NORMAL); - - LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - - if (shader) + if (!sUtilityBuffer) { - glVertexAttribPointerARB(TYPE_VERTEX, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV); - glVertexAttribPointerARB(TYPE_NORMAL, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV); + sUtilityBuffer = new LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0, GL_STREAM_DRAW); + sUtilityBuffer->allocateBuffer(count, count, true); } - else + if (sUtilityBuffer->getNumVerts() < (S32)count) { - glVertexPointer(3, GL_FLOAT, 0, pos[0].mV); - glNormalPointer(GL_FLOAT, 0, norm[0].mV); + sUtilityBuffer->resizeBuffer(count, count); } - glDrawArrays(sGLMode[mode], 0, count); + LLStrider vertex_strider; + LLStrider normal_strider; + sUtilityBuffer->getVertexStrider(vertex_strider); + sUtilityBuffer->getNormalStrider(normal_strider); + for (U32 i = 0; i < count; ++i) + { + *(vertex_strider++) = pos[i]; + *(normal_strider++) = norm[i]; + } + + sUtilityBuffer->setBuffer(MAP_VERTEX | MAP_NORMAL); + sUtilityBuffer->drawArrays(mode, 0, pos.size()); } //static -void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp) +void LLVertexBuffer::drawElements(U32 mode, const S32 num_vertices, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp) { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + if (num_vertices <= 0) + { + LL_WARNS() << "Called drawElements with 0 vertices" << LL_ENDL; + return; + } + + if (num_indices <= 0) + { + LL_WARNS() << "Called drawElements with 0 indices" << LL_ENDL; + return; + } + gGL.syncMatrices(); + if (!sUtilityBuffer) + { + sUtilityBuffer = new LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0, GL_STREAM_DRAW); + sUtilityBuffer->allocateBuffer(num_vertices, num_indices, true); + } + if (sUtilityBuffer->getNumVerts() < num_vertices || sUtilityBuffer->getNumIndices() < num_indices) + { + sUtilityBuffer->resizeBuffer(llmax(sUtilityBuffer->getNumVerts(), num_vertices), llmax(sUtilityBuffer->getNumIndices(), num_indices)); + } + U32 mask = LLVertexBuffer::MAP_VERTEX; + + LLStrider index_strider; + LLStrider vertex_strider; + sUtilityBuffer->getIndexStrider(index_strider); + sUtilityBuffer->getVertexStrider(vertex_strider); + const S32 index_size = ((num_indices * sizeof(U16)) + 0xF) & ~0xF; + const S32 vertex_size = ((num_vertices * 4 * sizeof(F32)) + 0xF) & ~0xF; + LLVector4a::memcpyNonAliased16((F32*)index_strider.get(), (F32*)indicesp, index_size); + LLVector4a::memcpyNonAliased16((F32*)vertex_strider.get(), (F32*)pos, vertex_size); if (tc) { mask = mask | LLVertexBuffer::MAP_TEXCOORD0; + LLStrider tc_strider; + sUtilityBuffer->getTexCoord0Strider(tc_strider); + const S32 tc_size = ((num_vertices * 2 * sizeof(F32)) + 0xF) & ~0xF; + LLVector4a::memcpyNonAliased16((F32*)tc_strider.get(), (F32*)tc, tc_size); } - unbind(); - - setupClientArrays(mask); - - if (LLGLSLShader::sNoFixedFunction) - { - glVertexAttribPointerARB(TYPE_VERTEX, 3, GL_FLOAT, GL_FALSE, 16, pos); - if (tc) - { - glVertexAttribPointerARB(TYPE_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, 0, tc); - } - } - else - { - glVertexPointer(3, GL_FLOAT, 16, pos); - if (tc) - { - glTexCoordPointer(2, GL_FLOAT, 0, tc); - } - } - - glDrawElements(sGLMode[mode], num_indices, GL_UNSIGNED_SHORT, indicesp); + sUtilityBuffer->setBuffer(mask); + sUtilityBuffer->draw(mode, num_indices, 0); } void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const @@ -822,7 +841,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const } { - LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS); + //LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS); stop_glerror(); glDrawArrays(sGLMode[mode], first, count); } @@ -834,12 +853,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping) { sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject; - sDisableVBOMapping = sEnableVBOs;// && no_vbo_mapping; //Temporary workaround for vbo mapping being straight up broken - - if (!sPrivatePoolp) - { - sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC); - } + sDisableVBOMapping = sEnableVBOs;// && no_vbo_mapping; } //static @@ -882,11 +896,8 @@ void LLVertexBuffer::cleanupClass() sStreamVBOPool.cleanup(); sDynamicVBOPool.cleanup(); - if(sPrivatePoolp) - { - LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp); - sPrivatePoolp = NULL; - } + delete sUtilityBuffer; + sUtilityBuffer = nullptr; } //---------------------------------------------------------------------------- @@ -944,8 +955,8 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : mGLBuffer(0), mGLIndices(0), mGLArray(0), - mMappedData(NULL), - mMappedIndexData(NULL), + mMappedData(nullptr), + mMappedIndexData(nullptr), mMappedDataUsingVBOs(false), mMappedIndexDataUsingVBOs(false), mVertexLocked(false), @@ -953,7 +964,7 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : mFinal(false), mEmpty(true), mMappable(false), - mFence(NULL) + mFence(nullptr) { mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping); @@ -1031,7 +1042,7 @@ LLVertexBuffer::~LLVertexBuffer() delete mFence; } - mFence = NULL; + mFence = nullptr; sVertexCount -= mNumVerts; sIndexCount -= mNumIndices; @@ -1109,7 +1120,7 @@ void LLVertexBuffer::releaseBuffer() } mGLBuffer = 0; - mMappedData = NULL; + mMappedData = nullptr; sGLCount--; } @@ -1126,7 +1137,7 @@ void LLVertexBuffer::releaseIndices() } mGLIndices = 0; - mMappedIndexData = NULL; + mMappedIndexData = nullptr; sGLCount--; } @@ -1155,7 +1166,7 @@ void LLVertexBuffer::createGLBuffer(U32 size) { static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; - mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + mMappedData = (U8*)ll_aligned_malloc_16(size); mSize = size; } } @@ -1187,7 +1198,7 @@ void LLVertexBuffer::createGLIndices(U32 size) } else { - mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + mMappedIndexData = (U8*)ll_aligned_malloc_16(size); static int gl_buffer_idx = 0; mGLIndices = ++gl_buffer_idx; mIndicesSize = size; @@ -1204,8 +1215,8 @@ void LLVertexBuffer::destroyGLBuffer() } else { - FREE_MEM(sPrivatePoolp, (void*) mMappedData); - mMappedData = NULL; + ll_aligned_free_16((void*) mMappedData); + mMappedData = nullptr; mEmpty = true; } } @@ -1224,8 +1235,8 @@ void LLVertexBuffer::destroyGLIndices() } else { - FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData); - mMappedIndexData = NULL; + ll_aligned_free_16((void*) mMappedIndexData); + mMappedIndexData = nullptr; mEmpty = true; } } @@ -1529,7 +1540,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } else { - volatile U8* src = NULL; + volatile U8* src = nullptr; waitFence(); if (gGLManager.mHasMapBufferRange) { @@ -1716,7 +1727,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } else { - volatile U8* src = NULL; + volatile U8* src = nullptr; waitFence(); if (gGLManager.mHasMapBufferRange) { @@ -1849,7 +1860,7 @@ void LLVertexBuffer::unmapBuffer() else { stop_glerror(); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), NULL, mUsage); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), nullptr, mUsage); // glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData); stop_glerror(); } @@ -1887,7 +1898,7 @@ void LLVertexBuffer::unmapBuffer() glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); stop_glerror(); - mMappedData = NULL; + mMappedData = nullptr; } mVertexLocked = false; @@ -1916,7 +1927,7 @@ void LLVertexBuffer::unmapBuffer() else { stop_glerror(); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), NULL, mUsage); + glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), nullptr, mUsage); // glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData); stop_glerror(); } @@ -1955,7 +1966,7 @@ void LLVertexBuffer::unmapBuffer() glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); stop_glerror(); - mMappedIndexData = NULL; + mMappedIndexData = nullptr; } mIndexLocked = false; @@ -1970,7 +1981,8 @@ void LLVertexBuffer::unmapBuffer() //---------------------------------------------------------------------------- -template struct VertexBufferStrider +template +struct VertexBufferStrider { typedef LLStrider strider_t; static bool get(LLVertexBuffer& vbo, @@ -1983,7 +1995,7 @@ template struct VertexBufferStrider volatile U8* ptr = vbo.mapVertexBuffer(type, index, count, map_range); - if (ptr == NULL) + if (ptr == nullptr) { LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL; return false; @@ -2011,7 +2023,7 @@ struct VertexBufferStrider { volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range); - if (ptr == NULL) + if (ptr == nullptr) { LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL; return false; @@ -2176,16 +2188,6 @@ void LLVertexBuffer::flush() } } -// bind for transform feedback (quick 'n dirty) -void LLVertexBuffer::bindForFeedback(U32 channel, U32 type, U32 index, U32 count) -{ -#ifdef GL_TRANSFORM_FEEDBACK_BUFFER - U32 offset = mOffsets[type] + sTypeSize[type]*index; - U32 size= (sTypeSize[type]*count); - glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, channel, mGLBuffer, offset, size); -#endif -} - // Set for rendering void LLVertexBuffer::setBuffer(U32 data_mask) { diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 1cebd96bd..afddf5ad2 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -93,7 +93,6 @@ public: //============================================================================ // base class -class LLPrivateMemoryPool; class LLVertexBuffer : public LLRefCount { public: @@ -142,7 +141,7 @@ public: static void cleanupClass(); static void setupClientArrays(U32 data_mask); static void drawArrays(U32 mode, const std::vector& pos, const std::vector& norm); - static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp); + static void drawElements(U32 mode, const S32 num_vertices, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp); static void unbind(); //unbind any bound vertex buffer @@ -227,8 +226,6 @@ public: volatile U8* mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range); volatile U8* mapIndexBuffer(S32 index, S32 count, bool map_range); - void bindForFeedback(U32 channel, U32 type, U32 index, U32 count); - // set for rendering virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0 void flush(); //flush pending data to GL memory @@ -327,9 +324,6 @@ protected: static S32 determineUsage(S32 usage); -private: - static LLPrivateMemoryPool* sPrivatePoolp; - public: static S32 sCount; static S32 sGLCount; @@ -353,6 +347,9 @@ public: static U32 sIndexCount; static U32 sBindCount; static U32 sSetCount; + +private: + static LLVertexBuffer* sUtilityBuffer; }; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index e1c909a5d..7ef9c5601 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -607,7 +607,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) gGL.diffuseColor4fv(color.mV); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mPositions, vol_face.mTexCoords, vol_face.mNumIndices, vol_face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mNumVertices, vol_face.mPositions, vol_face.mTexCoords, vol_face.mNumIndices, vol_face.mIndices); if(prev_shader) { @@ -1439,152 +1439,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } static LLCachedControl use_transform_feedback("RenderUseTransformFeedback", false); - -#ifdef GL_TRANSFORM_FEEDBACK_BUFFER - if (use_transform_feedback && - gTransformPositionProgram.mProgramObject && //transform shaders are loaded - mVertexBuffer->useVBOs() && //target buffer is in VRAM - !rebuild_weights && //TODO: add support for weights - !volume.isUnique()) //source volume is NOT flexi - { //use transform feedback to pack vertex buffer - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK); - LLGLEnable discard(GL_RASTERIZER_DISCARD); - LLVertexBuffer* buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); - - if (vf.mVertexBuffer.isNull() || buff->getNumVerts() != vf.mNumVertices) - { - mVObjp->getVolume()->genTangents(f); - LLFace::cacheFaceInVRAM(vf); - buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); - } - - LLGLSLShader* cur_shader = LLGLSLShader::sCurBoundShaderPtr; - - gGL.pushMatrix(); - gGL.loadMatrix(mat_vert_in); - - if (rebuild_pos) - { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_POSITION); - gTransformPositionProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_VERTEX, mGeomIndex, mGeomCount); - - U8 index = mTextureIndex < 255 ? mTextureIndex : 0; - - S32 val = 0; - U8* vp = (U8*) &val; - vp[0] = index; - vp[1] = 0; - vp[2] = 0; - vp[3] = 0; - - gTransformPositionProgram.uniform1i(sTextureIndexIn, val); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - - push_for_transform(buff, vf.mNumVertices, mGeomCount); - - glEndTransformFeedback(); - } - - if (rebuild_color) - { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_COLOR); - gTransformColorProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_COLOR, mGeomIndex, mGeomCount); - - S32 val = *((S32*) color.mV); - - gTransformColorProgram.uniform1i(sColorIn, val); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_emissive) - { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_EMISSIVE); - gTransformColorProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_EMISSIVE, mGeomIndex, mGeomCount); - - U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255); - - S32 glow32 = glow | - (glow << 8) | - (glow << 16) | - (glow << 24); - - gTransformColorProgram.uniform1i(sColorIn, glow32); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_normal) - { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_NORMAL); - gTransformNormalProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_NORMAL, mGeomIndex, mGeomCount); - - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_NORMAL); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_tangent) - { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TANGENT); - gTransformTangentProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TANGENT, mGeomIndex, mGeomCount); - - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_TANGENT); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_tcoord) - { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_TEXTURE); - gTransformTexCoordProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD0, mGeomIndex, mGeomCount); - - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_TEXCOORD0); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - - bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); - - if (do_bump) - { - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD1, mGeomIndex, mGeomCount); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_TEXCOORD0); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - } - - glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0); - gGL.popMatrix(); - - if (cur_shader) - { - cur_shader->bind(); - } - } - else -#endif { //if it's not fullbright and has no normals, bake sunlight based on face normal //bool bake_sunlight = !getTextureEntry()->getFullbright() && diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 1acfc9617..e36764d02 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6140,7 +6140,7 @@ void pushWireframe(LLDrawable* drawable) for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mNumVertices, face.mPositions, NULL, face.mNumIndices, face.mIndices); } } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b0c914b79..392a48c08 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1456,7 +1456,7 @@ void pushVerts(LLVolume* volume) for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mNumVertices, face.mPositions, NULL, face.mNumIndices, face.mIndices); } } @@ -2325,11 +2325,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); gGL.diffuseColor4fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); } else @@ -2406,11 +2406,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); gGL.diffuseColor4fv(line_color.mV); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); gGL.diffuseColor4fv(color.mV); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); } else { @@ -2824,7 +2824,7 @@ void renderRaycast(LLDrawable* drawablep) { //render face positions gGL.diffuseColor4f(0,1,1,0.5f); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mNumVertices, face.mPositions, NULL, face.mNumIndices, face.mIndices); } if (!volume->isUnique())