diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llcubemaparray.cpp | 32 | ||||
-rw-r--r-- | indra/llrender/llcubemaparray.h | 2 | ||||
-rw-r--r-- | indra/llrender/llfontfreetype.cpp | 37 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 46 | ||||
-rw-r--r-- | indra/llrender/llgl.h | 13 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 33 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 90 |
8 files changed, 144 insertions, 111 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index 9c3069e848..fb35e002df 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -105,6 +105,36 @@ LLCubeMapArray::LLCubeMapArray() } +LLCubeMapArray::LLCubeMapArray(LLCubeMapArray& lhs, U32 width, U32 count) : mTextureStage(0) +{ + mWidth = width; + mCount = count; + + // Allocate a new cubemap array with the same criteria as the incoming cubemap array + allocate(mWidth, lhs.mImage->getComponents(), count, lhs.mImage->getUseMipMaps(), lhs.mHDR); + + // Copy each cubemap from the incoming array to the new array + U32 min_count = std::min(count, lhs.mCount); + for (U32 i = 0; i < min_count * 6; ++i) + { + U32 src_resolution = lhs.mWidth; + U32 dst_resolution = mWidth; + { + GLint components = GL_RGB; + if (mImage->getComponents() == 4) + components = GL_RGBA; + GLint format = GL_RGB; + + // Handle different resolutions by scaling the image + LLPointer<LLImageRaw> src_image = new LLImageRaw(lhs.mWidth, lhs.mWidth, lhs.mImage->getComponents()); + glGetTexImage(GL_TEXTURE_CUBE_MAP_ARRAY, 0, components, GL_UNSIGNED_BYTE, src_image->getData()); + + LLPointer<LLImageRaw> scaled_image = src_image->scaled(mWidth, mWidth); + glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, i, mWidth, mWidth, 1, components, GL_UNSIGNED_BYTE, scaled_image->getData()); + } + } +} + LLCubeMapArray::~LLCubeMapArray() { } @@ -115,6 +145,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us mWidth = resolution; mCount = count; + mHDR = hdr; + LLImageGL::generateTextures(1, &texname); mImage = new LLImageGL(resolution, resolution, components, use_mips); diff --git a/indra/llrender/llcubemaparray.h b/indra/llrender/llcubemaparray.h index bfc72a321d..6b4288cb23 100644 --- a/indra/llrender/llcubemaparray.h +++ b/indra/llrender/llcubemaparray.h @@ -36,6 +36,7 @@ class LLCubeMapArray : public LLRefCount { public: LLCubeMapArray(); + LLCubeMapArray(LLCubeMapArray& lhs, U32 width, U32 count); static GLenum sTargets[6]; @@ -73,4 +74,5 @@ protected: U32 mWidth = 0; U32 mCount = 0; S32 mTextureStage; + bool mHDR; }; diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 723f0d5062..e93c98970b 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -32,7 +32,7 @@ // Freetype stuff #include <ft2build.h> #ifdef LL_WINDOWS -#include <freetype2\freetype\ftsystem.h> +#include <freetype/ftsystem.h> #endif #include "llfontfreetypesvg.h" @@ -656,7 +656,14 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_glyph_type, bitmap_num); LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_glyph_type, bitmap_num); - image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); + if (image_gl && image_raw) + { + image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); + } + else + { + llassert(false); //images were just inserted by nextOpenPos, they shouldn't be missing + } return gi; } @@ -727,11 +734,11 @@ void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index, ll || FT_Err_Invalid_Composite == error || (FT_Err_Ok != error && LLStringOps::isEmoji(wch))) { - glyph_index = FT_Get_Char_Index(mFTFace, '?'); - // if '?' is not present, potentially can use last index, that's supposed to be null glyph - if (glyph_index > 0) + // value~0 always corresponds to the 'missing glyph' + error = FT_Load_Glyph(mFTFace, 0, FT_LOAD_FORCE_AUTOHINT); + if (FT_Err_Ok != error) { - error = FT_Load_Glyph(mFTFace, glyph_index, load_flags ^ FT_LOAD_COLOR); + LL_ERRS() << "Loading fallback for char '" << (U32)wch << "', glyph " << glyph_index << " failed with error : " << (S32)error << LL_ENDL; } } llassert_always_msg(FT_Err_Ok == error, message.c_str()); @@ -840,7 +847,12 @@ bool LLFontFreetype::setSubImageBGRA(U32 x, U32 y, U32 bitmap_num, U16 width, U1 { LLImageRaw* image_raw = mFontBitmapCachep->getImageRaw(EFontGlyphType::Color, bitmap_num); llassert(!mIsFallback); - llassert(image_raw && (image_raw->getComponents() == 4)); + if (!image_raw) + { + llassert(false); + return false; + } + llassert(image_raw->getComponents() == 4); // NOTE: inspired by LLImageRaw::setSubImage() U32* image_data = (U32*)image_raw->getData(); @@ -868,10 +880,17 @@ bool LLFontFreetype::setSubImageBGRA(U32 x, U32 y, U32 bitmap_num, U16 width, U1 void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 width, U32 height, U8 *data, S32 stride) const { LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(EFontGlyphType::Grayscale, bitmap_num); - LLImageDataLock lock(image_raw); llassert(!mIsFallback); - llassert(image_raw && (image_raw->getComponents() == 2)); + if (!image_raw) + { + llassert(false); + return; + } + + LLImageDataLock lock(image_raw); + + llassert(image_raw->getComponents() == 2); U8 *target = image_raw->getData(); llassert(target); diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 17fa8f14a9..ac66faaf5a 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -238,8 +238,6 @@ PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC wglBlitContextFramebufferAMD = n PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr; PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr; -/* - // GL_VERSION_1_2 //PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = nullptr; //PFNGLTEXIMAGE3DPROC glTexImage3D = nullptr; @@ -984,7 +982,6 @@ PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC glMultiDrawArraysIndirectCount = nullpt PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC glMultiDrawElementsIndirectCount = nullptr; PFNGLPOLYGONOFFSETCLAMPPROC glPolygonOffsetClamp = nullptr; -*/ #endif LLGLManager gGLManager; @@ -1233,28 +1230,9 @@ bool LLGLManager::initGL() } #endif -#if LL_WINDOWS - if (mVRAM < 256) - { - // Something likely went wrong using the above extensions - // try WMI first and fall back to old method (from dxdiag) if all else fails - // Function will check all GPUs WMI knows of and will pick up the one with most - // memory. We need to check all GPUs because system can switch active GPU to - // weaker one, to preserve power when not under load. - U32 mem = LLDXHardware::getMBVideoMemoryViaWMI(); - if (mem != 0) - { - mVRAM = mem; - LL_WARNS("RenderInit") << "VRAM Detected (WMI):" << mVRAM<< LL_ENDL; - } - } -#endif - if (mVRAM < 256 && old_vram > 0) { // fall back to old method - // Note: on Windows value will be from LLDXHardware. - // Either received via dxdiag or via WMI by id from dxdiag. mVRAM = old_vram; } @@ -1273,7 +1251,7 @@ bool LLGLManager::initGL() // there's some implementation that reports a crazy value mMaxUniformBlockSize = llmin(mMaxUniformBlockSize, 65536); - if (mGLVersion >= 4.59f) + if (mHasAnisotropic) { glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &mMaxAnisotropy); } @@ -1440,6 +1418,11 @@ void LLGLManager::initExtensions() mHasCubeMapArray = mGLVersion >= 3.99f; mHasTransformFeedback = mGLVersion >= 3.99f; mHasDebugOutput = mGLVersion >= 4.29f; + mHasAnisotropic = mGLVersion >= 4.59f; + if(!mHasAnisotropic && gGLHExts.mSysExts) + { + mHasAnisotropic = ExtensionExists("GL_EXT_texture_filter_anisotropic", gGLHExts.mSysExts); + } // Misc glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); @@ -1448,7 +1431,6 @@ void LLGLManager::initExtensions() mInited = true; -/* #if LL_WINDOWS LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; @@ -2286,7 +2268,6 @@ void LLGLManager::initExtensions() glPolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC)GLH_EXT_GET_PROC_ADDRESS("glPolygonOffsetClamp"); #endif -*/ } void rotate_quat(LLQuaternion& rotation) @@ -2475,12 +2456,15 @@ void LLGLState::checkStates(GLboolean writeAlpha) return; } - GLint src; - GLint dst; - glGetIntegerv(GL_BLEND_SRC, &src); - glGetIntegerv(GL_BLEND_DST, &dst); - llassert_always(src == GL_SRC_ALPHA); - llassert_always(dst == GL_ONE_MINUS_SRC_ALPHA); + GLint srcRGB, dstRGB, srcAlpha, dstAlpha; + glGetIntegerv(GL_BLEND_SRC_RGB, &srcRGB); + glGetIntegerv(GL_BLEND_DST_RGB, &dstRGB); + glGetIntegerv(GL_BLEND_SRC_ALPHA, &srcAlpha); + glGetIntegerv(GL_BLEND_DST_ALPHA, &dstAlpha); + llassert_always(srcRGB == GL_SRC_ALPHA); + llassert_always(srcAlpha == GL_SRC_ALPHA); + llassert_always(dstRGB == GL_ONE_MINUS_SRC_ALPHA); + llassert_always(dstAlpha == GL_ONE_MINUS_SRC_ALPHA); // disable for now until usage is consistent //GLboolean colorMask[4]; diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 24ba4d6deb..bf8368a7b3 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -160,18 +160,17 @@ void assert_glerror(); void clear_glerror(); +#if !LL_RELEASE_FOR_DOWNLOAD # define stop_glerror() assert_glerror() # define llglassertok() assert_glerror() - -// stop_glerror is still needed on OS X but has performance implications -// use macro below to conditionally add stop_glerror to non-release builds -// on OS X -#if LL_DARWIN && !LL_RELEASE_FOR_DOWNLOAD -#define STOP_GLERROR stop_glerror() +# define STOP_GLERROR stop_glerror() #else -#define STOP_GLERROR +# define stop_glerror() +# define llglassertok() +# define STOP_GLERROR #endif + #define llglassertok_always() assert_glerror() //////////////////////// diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 3d7bf500f1..aac5e3abc8 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1114,8 +1114,8 @@ void LLGLSLShader::bind() void LLGLSLShader::bind(U8 variant) { - llassert(mGLTFVariants.size() == LLGLSLShader::NUM_GLTF_VARIANTS); - llassert(variant < LLGLSLShader::NUM_GLTF_VARIANTS); + llassert_always(mGLTFVariants.size() == LLGLSLShader::NUM_GLTF_VARIANTS); + llassert_always(variant < LLGLSLShader::NUM_GLTF_VARIANTS); mGLTFVariants[variant].bind(); } @@ -1123,7 +1123,7 @@ void LLGLSLShader::bind(bool rigged) { if (rigged) { - llassert(mRiggedVariant); + llassert_always(mRiggedVariant); mRiggedVariant->bind(); } else @@ -1285,23 +1285,40 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode) llassert(false); return -1; } + S32 index = mTexture[uniform]; - if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE) + if (index < 0) + { + // Invalid texture index - nothing to disable + return index; + } + + LLTexUnit* tex_unit = gGL.getTexUnit(index); + if (!tex_unit) { - if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode) + // Invalid texture unit + LL_WARNS_ONCE("Shader") << "Invalid texture unit at index: " << index << LL_ENDL; + return index; + } + + LLTexUnit::eTextureType curr_type = tex_unit->getCurrType(); + if (curr_type != LLTexUnit::TT_NONE) + { + if (gDebugGL && curr_type != mode) { if (gDebugSession) { - gFailLog << "Texture channel " << index << " texture type corrupted." << std::endl; + gFailLog << "Texture channel " << index << " texture type corrupted. Expected: " << mode << ", Found: " << curr_type << std::endl; ll_fail("LLGLSLShader::disableTexture failed"); } else { - LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL; + LL_ERRS() << "Texture channel " << index << " texture type corrupted. Expected: " << mode << ", Found: " << curr_type << LL_ENDL; } } - gGL.getTexUnit(index)->disable(); + tex_unit->disable(); } + return index; } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 9f3f42d6d5..cbb178b6f8 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -517,7 +517,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio } } - if (gGLManager.mGLVersion >= 4.59f) + if (gGLManager.mHasAnisotropic) { if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC) { diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 96569a33e9..ac6db0b34f 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -945,8 +945,7 @@ void LLVertexBuffer::initClass(LLWindow* window) { llassert(sVBOPool == nullptr); - //if (gGLManager.mIsApple) - if(0) + if (gGLManager.mIsApple) { LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL; sVBOPool = new LLAppleVBOPool(); @@ -1289,8 +1288,7 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde count = mNumVerts - index; } - //if (!gGLManager.mIsApple) - if (1) + if (!gGLManager.mIsApple) { U32 start = mOffsets[type] + sTypeSize[type] * index; U32 end = start + sTypeSize[type] * count-1; @@ -1327,8 +1325,7 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) count = mNumIndices-index; } - //if (!gGLManager.mIsApple) - if(1) + if (!gGLManager.mIsApple) { U32 start = sizeof(U16) * index; U32 end = start + sizeof(U16) * count-1; @@ -1365,20 +1362,6 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 { if (gGLManager.mIsApple) { - U32 MapBits = GL_MAP_WRITE_BIT; - U32 buffer_size = end-start+1; - - U8 * mptr = NULL; - mptr = (U8*) glMapBufferRange( target, start, end-start+1, MapBits); - - if (mptr) - { - std::memcpy(mptr, (U8*) data, buffer_size); - if(!glUnmapBuffer(target)) LL_WARNS() << "glUnmapBuffer() failed" << LL_ENDL; - } - else LL_WARNS() << "glMapBufferRange() returned NULL" << LL_ENDL; - - /* // on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call // _mapBuffer to tag the buffer for flushing to GL _mapBuffer(); @@ -1386,7 +1369,6 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 STOP_GLERROR; // copy into mapped buffer memcpy(dst+start, data, end-start+1); - */ } else { @@ -1444,8 +1426,7 @@ void LLVertexBuffer::_unmapBuffer() } }; - //if (gGLManager.mIsApple) - if (0) + if (gGLManager.mIsApple) { STOP_GLERROR; if (mMappedData) @@ -1726,55 +1707,58 @@ void LLVertexBuffer::setupVertexBuffer() STOP_GLERROR; U8* base = nullptr; + AttributeType loc; + void* ptr = nullptr; + U32 data_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask; if (data_mask & MAP_NORMAL) { - AttributeType loc = TYPE_NORMAL; - void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]); + loc = TYPE_NORMAL; + ptr = (void*)(base + mOffsets[TYPE_NORMAL]); glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); } if (data_mask & MAP_TEXCOORD3) { - AttributeType loc = TYPE_TEXCOORD3; - void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]); + loc = TYPE_TEXCOORD3; + ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]); glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); } if (data_mask & MAP_TEXCOORD2) { - AttributeType loc = TYPE_TEXCOORD2; - void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]); + loc = TYPE_TEXCOORD2; + ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]); glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); } if (data_mask & MAP_TEXCOORD1) { - AttributeType loc = TYPE_TEXCOORD1; - void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]); + loc = TYPE_TEXCOORD1; + ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]); glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); } if (data_mask & MAP_TANGENT) { - AttributeType loc = TYPE_TANGENT; - void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]); + loc = TYPE_TANGENT; + ptr = (void*)(base + mOffsets[TYPE_TANGENT]); glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); } if (data_mask & MAP_TEXCOORD0) { - AttributeType loc = TYPE_TEXCOORD0; - void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]); + loc = TYPE_TEXCOORD0; + ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]); glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); } if (data_mask & MAP_COLOR) { - AttributeType loc = TYPE_COLOR; + loc = TYPE_COLOR; //bind emissive instead of color pointer if emissive is present - void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]); + ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]); glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); } if (data_mask & MAP_EMISSIVE) { - AttributeType loc = TYPE_EMISSIVE; - void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]); + loc = TYPE_EMISSIVE; + ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]); glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); if (!(data_mask & MAP_COLOR)) @@ -1785,38 +1769,38 @@ void LLVertexBuffer::setupVertexBuffer() } if (data_mask & MAP_WEIGHT) { - AttributeType loc = TYPE_WEIGHT; - void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); + loc = TYPE_WEIGHT; + ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); } if (data_mask & MAP_WEIGHT4) { - AttributeType loc = TYPE_WEIGHT4; - void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]); + loc = TYPE_WEIGHT4; + ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]); glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); } if (data_mask & MAP_JOINT) { - AttributeType loc = TYPE_JOINT; - void* ptr = (void*)(base + mOffsets[TYPE_JOINT]); + loc = TYPE_JOINT; + ptr = (void*)(base + mOffsets[TYPE_JOINT]); glVertexAttribIPointer(loc, 4, GL_UNSIGNED_SHORT, LLVertexBuffer::sTypeSize[TYPE_JOINT], ptr); } if (data_mask & MAP_CLOTHWEIGHT) { - AttributeType loc = TYPE_CLOTHWEIGHT; - void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); + loc = TYPE_CLOTHWEIGHT; + ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); } if (data_mask & MAP_TEXTURE_INDEX) { - AttributeType loc = TYPE_TEXTURE_INDEX; - void* ptr = (void*)(base + mOffsets[TYPE_VERTEX] + 12); + loc = TYPE_TEXTURE_INDEX; + ptr = (void*)(base + mOffsets[TYPE_VERTEX] + 12); glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } if (data_mask & MAP_VERTEX) { - AttributeType loc = TYPE_VERTEX; - void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); + loc = TYPE_VERTEX; + ptr = (void*)(base + mOffsets[TYPE_VERTEX]); glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } STOP_GLERROR; @@ -1933,7 +1917,3 @@ void LLVertexBuffer::setIndexData(const U32* data, U32 offset, U32 count) } flush_vbo(GL_ELEMENT_ARRAY_BUFFER, offset * sizeof(U32), (offset + count) * sizeof(U32) - 1, (U8*)data, mMappedIndexData); } - - - - |