diff options
Diffstat (limited to 'indra/newview')
69 files changed, 289 insertions, 318 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f1e4b39d7d..588d22a45b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5334,6 +5334,28 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderDebugGL</key> + <map> + <key>Comment</key> + <string>Enable strict GL debugging.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>RenderDebugPipeline</key> + <map> + <key>Comment</key> + <string>Enable strict pipeline debugging.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderDebugTextureBind</key> <map> <key>Comment</key> @@ -5826,17 +5848,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>RenderUseCleverUI</key> - <map> - <key>Comment</key> - <string>Turns on the \"clever\" UI rendering optimization. It's a known performace gain on apple.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>1</integer> - </map> <key>RenderUseFarClip</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 45fbb5e65f..1ad37f239c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -222,6 +222,7 @@ extern OSStatus DisplayReleaseNotes(void); extern BOOL gRandomizeFramerate; extern BOOL gPeriodicSlowFrame; +extern BOOL gDebugGL; //////////////////////////////////////////////////////////// // All from the last globals push... @@ -421,7 +422,8 @@ static void settings_modify() LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //sqaure lod factor to get exponential range of [1,4] - gGL.setClever(gSavedSettings.getBOOL("RenderUseCleverUI")); + gDebugGL = gSavedSettings.getBOOL("RenderDebugGL"); + gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); #if LL_VECTORIZE if (gSysCPU.hasAltivec()) @@ -2977,7 +2979,7 @@ void LLAppViewer::loadNameCache() // Try to load from the legacy format. This should go away after a // while. Phoenix 2008-01-30 - FILE* name_cache_fp = LLFile::fopen(name_cache.c_str(), "r"); // Flawfinder: ignore + LLFILE* name_cache_fp = LLFile::fopen(name_cache.c_str(), "r"); // Flawfinder: ignore if (name_cache_fp) { gCacheName->importFile(name_cache_fp); diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 3ea8c737c9..753ea1bc6c 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -131,7 +131,7 @@ static inline BOOL do_basic_glibc_backtrace() std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; - FILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); + LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); if (!StraceFile) { llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; @@ -162,7 +162,7 @@ static inline BOOL do_basic_glibc_backtrace() std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; - FILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore + LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore if (!StraceFile) { llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; @@ -200,7 +200,7 @@ static inline BOOL do_elfio_glibc_backtrace() std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; - FILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore + LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore if (!StraceFile) { llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; diff --git a/indra/newview/llbox.cpp b/indra/newview/llbox.cpp index d0505b6b06..1a3cf36ce6 100644 --- a/indra/newview/llbox.cpp +++ b/indra/newview/llbox.cpp @@ -81,7 +81,7 @@ void LLBox::renderface(S32 which_face) {7, 4, 0, 3} }; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); //gGL.normal3fv(&normals[which_face][0]); gGL.texCoord2f(1,0); gGL.vertex3fv(&mVertex[ faces[which_face][0] ][0]); diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 619b393d0b..8e5e8c8ea3 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -386,7 +386,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, asset_id.toString(uuid_str); snprintf(filename, sizeof(filename), "%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */ - FILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ + LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (fp) { const S32 buf_size = 65536; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 1c430b3a14..95e3bc2205 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -508,7 +508,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) LLVector3 pos = avatarp->getPositionAgent(); gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); @@ -520,7 +520,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) pos = avatarp->mDrawable->getPositionAgent(); gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); @@ -532,7 +532,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) pos = avatarp->mRoot.getWorldPosition(); gGL.color4f(1.0f, 1.0f, 1.0f, 0.8f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); @@ -544,7 +544,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) pos = avatarp->mPelvisp->getWorldPosition(); gGL.color4f(0.0f, 0.0f, 1.0f, 0.8f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index e5c9200cad..3f52021711 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -100,7 +100,7 @@ void LLStandardBumpmap::restoreGL() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS std::string file_name = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "std_bump.ini" ); - FILE* file = LLFile::fopen( file_name.c_str(), "rt" ); /*Flawfinder: ignore*/ + LLFILE* file = LLFile::fopen( file_name.c_str(), "rt" ); /*Flawfinder: ignore*/ if( !file ) { llwarns << "Could not open std_bump <" << file_name << ">" << llendl; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index cdb7531341..7b88349ef4 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -223,17 +223,18 @@ BOOL LLDynamicTexture::updateAllInstances() glClear(GL_DEPTH_BUFFER_BIT); gDisplaySwapBuffers = FALSE; + + gGL.color4f(1,1,1,1); dynamicTexture->preRender(); // Must be called outside of startRender() - LLVertexBuffer::startRender(); - if (dynamicTexture->render()) { result = TRUE; sNumRenders++; } - LLVertexBuffer::stopRender(); - + gGL.flush(); + LLVertexBuffer::unbind(); + dynamicTexture->postRender(result); } } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 3ced3541d2..723477a833 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -493,7 +493,7 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count) glPolygonOffset(factor, bias); if (sSafeRenderSelect) { - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); if (count) { for (S32 i = offset; i < offset + count; i++) diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index fd9d790f27..8133c20bf7 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -978,7 +978,7 @@ void LLFastTimerView::draw() gGL.color4f(0.5f,0.5f,0.5f,1); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex2i((S32)bar, graph_rect.mBottom); gGL.vertex2i((S32)bar, graph_rect.mTop); gGL.end(); @@ -1014,7 +1014,7 @@ void LLFastTimerView::draw() } gGL.color4f(col[0], col[1], col[2], alpha); - gGL.begin(GL_LINE_STRIP); + gGL.begin(LLVertexBuffer::LINE_STRIP); for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++) { U64 ticks = ticks_sum[j+1][idx]; diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 927f4ada45..ffa8420697 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -76,7 +76,7 @@ public: void setFeatureAvailable(const char *name, const BOOL available); void setRecommendedLevel(const char *name, const F32 level); - BOOL loadFeatureList(FILE *fp); + BOOL loadFeatureList(LLFILE *fp); BOOL maskList(LLFeatureList &mask); diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index c2495e4037..d9411b58d8 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -382,7 +382,7 @@ void LLFloaterAnimPreview::draw() gGL.color3f(1.f, 1.f, 1.f); mAnimPreview->bindTexture(); - gGL.begin( GL_QUADS ); + gGL.begin( LLVertexBuffer::QUADS ); { gGL.texCoord2f(0.f, 1.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); @@ -1068,8 +1068,6 @@ BOOL LLPreviewAnimation::render() { mNeedsUpdate = FALSE; LLVOAvatar* avatarp = mDummyAvatar; - - gGL.start(); glMatrixMode(GL_PROJECTION); gGL.pushMatrix(); @@ -1092,7 +1090,7 @@ BOOL LLPreviewAnimation::render() glMatrixMode(GL_MODELVIEW); gGL.popMatrix(); - gGL.stop(); + gGL.flush(); LLVector3 target_pos = avatarp->mRoot.getWorldPosition(); @@ -1124,9 +1122,9 @@ BOOL LLPreviewAnimation::render() avatarp->updateMotion(); } - LLVertexBuffer::stopRender(); + LLVertexBuffer::unbind(); avatarp->updateLOD(); - LLVertexBuffer::startRender(); + avatarp->mRoot.updateWorldMatrixChildren(); @@ -1140,6 +1138,7 @@ BOOL LLPreviewAnimation::render() avatarPoolp->renderAvatars(avatarp); // renders only one avatar } + gGL.color4f(1,1,1,1); return TRUE; } diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 751de2be20..5f6bf1cd28 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -545,7 +545,7 @@ void LLFloaterColorPicker::draw() { LLGLSNoTexture no_texture; LLGLEnable(GL_CULL_FACE); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 67f9ebe6b4..790af61264 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -260,7 +260,7 @@ void LLFloaterImagePreview::draw() } gGL.color3f(1.f, 1.f, 1.f); - gGL.begin( GL_QUADS ); + gGL.begin( LLVertexBuffer::QUADS ); { gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); @@ -288,7 +288,7 @@ void LLFloaterImagePreview::draw() else mAvatarPreview->bindTexture(); - gGL.begin( GL_QUADS ); + gGL.begin( LLVertexBuffer::QUADS ); { gGL.texCoord2f(0.f, 1.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); @@ -667,8 +667,6 @@ void LLImagePreviewAvatar::setPreviewTarget(const char* joint_name, const char* //----------------------------------------------------------------------------- BOOL LLImagePreviewAvatar::render() { - gGL.start(); - mNeedsUpdate = FALSE; LLVOAvatar* avatarp = mDummyAvatar; @@ -692,7 +690,7 @@ BOOL LLImagePreviewAvatar::render() glMatrixMode(GL_MODELVIEW); gGL.popMatrix(); - gGL.stop(); + gGL.flush(); LLVector3 target_pos = mTargetJoint->getWorldPosition(); LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) * @@ -710,9 +708,9 @@ BOOL LLImagePreviewAvatar::render() LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); - LLVertexBuffer::stopRender(); + LLVertexBuffer::unbind(); avatarp->updateLOD(); - LLVertexBuffer::startRender(); + if (avatarp->mDrawable.notNull()) { @@ -725,6 +723,7 @@ BOOL LLImagePreviewAvatar::render() avatarPoolp->renderAvatars(avatarp); // renders only one avatar } + gGL.color4f(1,1,1,1); return TRUE; } @@ -823,8 +822,6 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) //----------------------------------------------------------------------------- BOOL LLImagePreviewSculpted::render() { - gGL.start(); - mNeedsUpdate = FALSE; LLGLSUIDefault def; @@ -919,8 +916,6 @@ BOOL LLImagePreviewSculpted::render() delete [] normals; } - gGL.stop(); - return TRUE; } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e5b9eef72a..7950b127f0 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -415,7 +415,7 @@ void LLSnapshotLivePreview::draw() glPushMatrix(); { glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.texCoord2f(uv_width, uv_height); gGL.vertex2i(rect.getWidth(), rect.getHeight() ); @@ -478,7 +478,7 @@ void LLSnapshotLivePreview::draw() S32 y2 = gViewerWindow->getWindowHeight(); LLGLSNoTexture no_texture; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.color4f(1.f, 1.f, 1.f, 0.f); gGL.vertex2i(x1, y1); @@ -509,7 +509,7 @@ void LLSnapshotLivePreview::draw() LLGLSNoTexture no_texture; gGL.color4f(1.f, 1.f, 1.f, 1.f); LLRect outline_rect = mImageRect[mCurImageIndex]; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); @@ -555,7 +555,7 @@ void LLSnapshotLivePreview::draw() LLRect& rect = mImageRect[old_image_index]; glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.texCoord2f(uv_width, uv_height); gGL.vertex2i(rect.getWidth(), rect.getHeight() ); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index f6d9ee9761..21b98d6038 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -358,7 +358,7 @@ void LLCompass::draw() mBkgndTexture->bind(); gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(1.f, 1.f); gGL.vertex2i(width, height); @@ -384,7 +384,7 @@ void LLCompass::draw() mTexture->bind(); gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(1.f, 1.f); gGL.vertex2i(width, height); @@ -428,7 +428,7 @@ void LLHorizontalCompass::draw() mTexture->bind(); gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f ); - gGL.begin( GL_QUADS ); + gGL.begin( LLVertexBuffer::QUADS ); gGL.texCoord2f(right, 1.f); gGL.vertex2i(width, height); @@ -479,11 +479,11 @@ void LLWind::renderVectors() gGL.pushMatrix(); gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0); gGL.color3f(0,1,0); - gGL.begin(GL_POINTS); + gGL.begin(LLVertexBuffer::POINTS); gGL.vertex3f(0,0,0); gGL.end(); gGL.color3f(1,0,0); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex3f(x * 0.1f, y * 0.1f ,0.f); gGL.vertex3f(x, y, 0.f); gGL.end(); @@ -532,7 +532,7 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, gGL.color4f(1.f, 1.f, 0.f, 1.f); // Cheat and give this the same pick-name as land - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -549,7 +549,7 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, gGL.end(); gGL.color4f(1.f, 1.f, 0.f, 0.2f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -616,7 +616,7 @@ void LLViewerParcelMgr::renderParcel(LLParcel* parcel ) gGL.color4f(0.f, 1.f, 1.f, 1.f); // Cheat and give this the same pick-name as land - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -633,7 +633,7 @@ void LLViewerParcelMgr::renderParcel(LLParcel* parcel ) gGL.end(); gGL.color4f(0.f, 1.f, 1.f, 0.2f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -786,7 +786,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi if (!has_segments) { has_segments = true; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); } renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, SOUTH_MASK, regionp); } @@ -802,7 +802,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi if (!has_segments) { has_segments = true; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); } renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, WEST_MASK, regionp); } @@ -857,7 +857,7 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLV LLViewerImage::bindTexture(mBlockedImage); } - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); for (y = 0; y < STRIDE; y++) { @@ -1014,7 +1014,7 @@ void LLViewerObjectList::renderObjectBeacons() LLGLSNoTexture gls_ui_no_texture; S32 last_line_width = -1; - // gGL.begin(GL_LINES); // Always happens in (line_width != last_line_width) + // gGL.begin(LLVertexBuffer::LINES); // Always happens in (line_width != last_line_width) for (S32 i = 0; i < mDebugBeacons.count(); i++) { @@ -1031,7 +1031,7 @@ void LLViewerObjectList::renderObjectBeacons() } glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; @@ -1053,7 +1053,7 @@ void LLViewerObjectList::renderObjectBeacons() LLGLDepthTest gls_depth(GL_TRUE); S32 last_line_width = -1; - // gGL.begin(GL_LINES); // Always happens in (line_width != last_line_width) + // gGL.begin(LLVertexBuffer::LINES); // Always happens in (line_width != last_line_width) for (S32 i = 0; i < mDebugBeacons.count(); i++) { @@ -1069,7 +1069,7 @@ void LLViewerObjectList::renderObjectBeacons() } glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 046eac73fe..7dd20debd9 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -504,7 +504,7 @@ void LLHUDEffectLookAt::render() glPushMatrix(); glTranslatef(target.mV[VX], target.mV[VY], target.mV[VZ]); glScalef(0.3f, 0.3f, 0.3f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { LLColor3 color = (*mAttentions)[mTargetType].mColor; gGL.color3f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE]); diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 4c352bab72..72fe1b2e08 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -334,7 +334,7 @@ void LLHUDEffectPointAt::render() glPushMatrix(); glTranslatef(target.mV[VX], target.mV[VY], target.mV[VZ]); glScalef(0.3f, 0.3f, 0.3f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.color3f(1.f, 0.f, 0.f); gGL.vertex3f(-1.f, 0.f, 0.f); diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index 248caf07a9..cbb9fb8619 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -166,7 +166,7 @@ void LLHUDIcon::renderIcon(BOOL for_select) LLViewerImage::bindTexture(mImagep); } - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.texCoord2f(0.f, 1.f); gGL.vertex3fv(upper_left.mV); diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index d6bafa9b58..07b0379f7a 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -281,6 +281,9 @@ void LLHUDObject::renderAll() hud_objp->render(); } } + + // cleanup any leftover client state, etc + LLVertexBuffer::unbind(); } // static diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 47e23f1c6a..2529010857 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -317,7 +317,7 @@ void LLHUDText::renderText(BOOL for_select) LLUI::translate(box_center_offset.mV[VX], box_center_offset.mV[VY], box_center_offset.mV[VZ]); gGL.color4fv(bg_color.mV); LLUI::setLineWidth(2.0); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { if (outside_width) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 32a9fc95b4..8cbc55892f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1810,7 +1810,7 @@ bool LLInventoryModel::loadSkeleton( const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; std::string gzip_filename(inventory_filename); gzip_filename.append(".gz"); - FILE* fp = LLFile::fopen(gzip_filename.c_str(), "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(gzip_filename.c_str(), "rb"); /*Flawfinder: ignore*/ bool remove_inventory_file = false; if(fp) { @@ -2344,7 +2344,7 @@ bool LLInventoryModel::loadFromFile( return false; } llinfos << "LLInventoryModel::loadFromFile(" << filename << ")" << llendl; - FILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ + LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if(!file) { llinfos << "unable to load inventory from: " << filename << llendl; @@ -2417,7 +2417,7 @@ bool LLInventoryModel::saveToFile( return false; } llinfos << "LLInventoryModel::saveToFile(" << filename << ")" << llendl; - FILE* file = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ + LLFILE* file = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if(!file) { llwarns << "unable to save inventory to: " << filename << llendl; @@ -3692,7 +3692,7 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename) BOOL rv = FALSE; gzFile src = NULL; U8* buffer = NULL; - FILE* dst = NULL; + LLFILE* dst = NULL; S32 bytes = 0; const S32 DECOMPRESS_BUFFER_SIZE = 32000; diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 21dc28784b..e9d5bfddd2 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -655,7 +655,7 @@ void LLJoystickCameraRotate::drawRotatedImage( const LLImageGL* image, S32 rotat gGL.color4fv(UI_VERTEX_COLOR.mV); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.texCoord2fv( uv[ (rotations + 0) % 4]); gGL.vertex2i(width, height ); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 6aa209b787..91e6ef1e05 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -76,7 +76,7 @@ void LLLogChat::saveHistory(LLString filename, LLString line) return; } - FILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(filename).c_str(), "a"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(filename).c_str(), "a"); /*Flawfinder: ignore*/ if (!fp) { llinfos << "Couldn't open chat history log!" << llendl; @@ -96,7 +96,7 @@ void LLLogChat::loadHistory(LLString filename , void (*callback)(ELogLineType,LL llerrs << "Filename is Empty!" << llendl; } - FILE* fptr = LLFile::fopen(makeLogFileName(filename).c_str(), "r"); /*Flawfinder: ignore*/ + LLFILE* fptr = LLFile::fopen(makeLogFileName(filename).c_str(), "r"); /*Flawfinder: ignore*/ if (!fptr) { //LLUIString message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 887db4cf95..c6c417d8f2 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -391,7 +391,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) if (draw_x) { gGL.color4f(1.f, 0.f, 0.f, LINE_ALPHA); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex3f( -region_size, 0.f, 0.f ); gGL.vertex3f( region_size, 0.f, 0.f ); gGL.end(); @@ -400,7 +400,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) if (draw_y) { gGL.color4f(0.f, 1.f, 0.f, LINE_ALPHA); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex3f( 0.f, -region_size, 0.f ); gGL.vertex3f( 0.f, region_size, 0.f ); gGL.end(); @@ -409,7 +409,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) if (draw_z) { gGL.color4f(0.f, 0.f, 1.f, LINE_ALPHA); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex3f( 0.f, 0.f, -region_size ); gGL.vertex3f( 0.f, 0.f, region_size ); gGL.end(); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index d98de5cb80..8bb5b18e8f 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -868,7 +868,7 @@ void LLManipRotate::renderSnapGuides() LLVector3 outer_point; LLVector3 text_point; LLQuaternion rot(deg * DEG_TO_RAD, constraint_axis); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { inner_point = (projected_snap_axis * mRadiusMeters * SNAP_GUIDE_INNER_RADIUS * rot) + center; F32 tick_length = 0.f; @@ -1046,7 +1046,7 @@ void LLManipRotate::renderSnapGuides() object_axis = object_axis * SNAP_GUIDE_INNER_RADIUS * mRadiusMeters + center; LLVector3 line_start = center; - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.vertex3fv(line_start.mV); gGL.vertex3fv(object_axis.mV); @@ -1054,7 +1054,7 @@ void LLManipRotate::renderSnapGuides() gGL.end(); // draw snap guide arrow - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { LLVector3 arrow_dir; LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis(); @@ -1074,7 +1074,7 @@ void LLManipRotate::renderSnapGuides() { LLGLDepthTest gls_depth(GL_TRUE); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.vertex3fv(line_start.mV); gGL.vertex3fv(object_axis.mV); @@ -1082,7 +1082,7 @@ void LLManipRotate::renderSnapGuides() gGL.end(); // draw snap guide arrow - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { LLVector3 arrow_dir; LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis(); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index a2d6909b28..d857ca7510 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -600,7 +600,7 @@ void LLManipScale::renderFaces( const LLBBox& bbox ) { gGL.color4fv( default_normal_color.mV ); LLGLDepthTest gls_depth(GL_FALSE); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { // Face 0 gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]); @@ -1534,7 +1534,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) { LLColor4 tick_color = setupSnapGuideRenderPass(pass); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); LLVector3 line_mid = mScaleCenter + (mScaleSnapValue * mScaleDir) + (mSnapGuideDir1 * mSnapRegimeOffset); LLVector3 line_start = line_mid - (mScaleDir * (llmin(mScaleSnapValue, mSnapGuideLength * 0.5f))); LLVector3 line_end = line_mid + (mScaleDir * llmin(max_point_on_scale_line - mScaleSnapValue, mSnapGuideLength * 0.5f)); @@ -1585,7 +1585,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) if (mInSnapRegime) { // draw snap guide line - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); LLVector3 snap_line_center = mScaleCenter + (mScaleSnapValue * mScaleDir); LLVector3 snap_line_start = snap_line_center + (mSnapGuideDir1 * mSnapRegimeOffset); @@ -1599,7 +1599,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) gGL.end(); // draw snap guide arrow - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { //gGLSNoCullFaces.set(); gGL.color4f(1.f, 1.f, 1.f, grid_alpha); @@ -1634,7 +1634,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1)); stop_tick = llmin(max_ticks1, num_ticks_per_side1); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); // draw first row of ticks for (S32 i = start_tick; i <= stop_tick; i++) { diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index c55f9f806a..1659cc71ce 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1253,7 +1253,7 @@ void LLManipTranslate::renderSnapGuides() { LLColor4 line_color = setupSnapGuideRenderPass(pass); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { LLVector3 line_start = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) + (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit)); LLVector3 line_end = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) - (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit)); @@ -1329,7 +1329,7 @@ void LLManipTranslate::renderSnapGuides() LLVector3 line_start = selection_center - mSnapOffsetAxis * mSnapOffsetMeters; LLVector3 line_end = selection_center + mSnapOffsetAxis * mSnapOffsetMeters; - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); @@ -1339,7 +1339,7 @@ void LLManipTranslate::renderSnapGuides() gGL.end(); // draw snap guide arrow - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); @@ -1594,7 +1594,7 @@ void LLManipTranslate::renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F for (F32 xx = -size-d; xx < size+d; xx += d) { - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); for (F32 yy = -size-d; yy < size+d; yy += d) { float dx, dy, da; @@ -1640,7 +1640,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, GLuint stencil_mask = 0xFFFFFFFF; //stencil in volumes - gGL.stop(); + gGL.flush(); { glStencilMask(stencil_mask); glClearStencil(1); @@ -1702,7 +1702,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); } - gGL.start(); + gGL.color4f(1,1,1,1); gGL.pushMatrix(); @@ -1907,7 +1907,7 @@ void LLManipTranslate::renderTranslationHandles() color1.setVec(0.f, 1.f, 0.f, 0.6f); color2.setVec(0.f, 0.f, 1.f, 0.6f); } - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { gGL.color4fv(color1.mV); gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f)); @@ -1922,7 +1922,7 @@ void LLManipTranslate::renderTranslationHandles() gGL.end(); LLUI::setLineWidth(3.0f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.color4f(0.f, 0.f, 0.f, 0.3f); gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f); @@ -1962,7 +1962,7 @@ void LLManipTranslate::renderTranslationHandles() color2.setVec(1.f, 0.f, 0.f, 0.6f); } - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { gGL.color4fv(color1.mV); gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f)); @@ -1977,7 +1977,7 @@ void LLManipTranslate::renderTranslationHandles() gGL.end(); LLUI::setLineWidth(3.0f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.color4f(0.f, 0.f, 0.f, 0.3f); gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f); @@ -2041,7 +2041,7 @@ void LLManipTranslate::renderTranslationHandles() color2.setVec(0.f, 0.8f, 0.f, 0.6f); } - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { gGL.color4fv(color1.mV); gGL.vertex3fv(v0.mV); @@ -2056,7 +2056,7 @@ void LLManipTranslate::renderTranslationHandles() gGL.end(); LLUI::setLineWidth(3.0f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { gGL.color4f(0.f, 0.f, 0.f, 0.3f); LLVector3 v12 = (v1 + v2) * .5f; @@ -2190,7 +2190,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ { LLUI::setLineWidth(2.0f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); vec.mV[index] = box_size; gGL.vertex3f(vec.mV[0], vec.mV[1], vec.mV[2]); diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index e124af1427..ccaed78727 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -58,7 +58,7 @@ mDelay(120) #ifdef MEM_DUMP_DATA // clear out file. - FILE *dump = fopen("memusagedump.txt", "w"); + LLFILE *dump = LLFile::fopen("memusagedump.txt", "w"); fclose(dump); #endif } @@ -262,7 +262,7 @@ void LLMemoryView::dumpData() // reset timer mDumpTimer.reset(); // append dump info to text file - FILE *dump = fopen("memusagedump.txt", "a"); + LLFILE *dump = LLFile::fopen("memusagedump.txt", "a"); if (dump) { diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 6edd9d0b7d..71c93c3542 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -550,7 +550,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) return FALSE; } - FILE* fp = LLFile::fopen(filename.c_str(), "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(filename.c_str(), "rb"); /*Flawfinder: ignore*/ if (!fp) { llwarns << "Couldn't open mute list " << filename << llendl; @@ -600,7 +600,7 @@ BOOL LLMuteList::saveToFile(const LLString& filename) return FALSE; } - FILE* fp = LLFile::fopen(filename.c_str(), "wb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(filename.c_str(), "wb"); /*Flawfinder: ignore*/ if (!fp) { llwarns << "Couldn't open mute list " << filename << llendl; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 1b2474728f..6e10bfef58 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -287,7 +287,7 @@ void LLNetMap::draw() // Draw using texture. LLViewerImage::bindTexture(regionp->getLand().getSTexture()); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(left, top); gGL.texCoord2f(0.f, 0.f); @@ -304,7 +304,7 @@ void LLNetMap::draw() if (regionp->getLand().getWaterTexture()) { LLViewerImage::bindTexture(regionp->getLand().getWaterTexture()); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(left, top); gGL.texCoord2f(0.f, 0.f); @@ -354,7 +354,7 @@ void LLNetMap::draw() F32 image_half_width = 0.5f*mObjectMapPixels; F32 image_half_height = 0.5f*mObjectMapPixels; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]); gGL.texCoord2f(0.f, 0.f); @@ -463,7 +463,7 @@ void LLNetMap::draw() { gGL.color4fv(gFrustumMapColor.mV); - gGL.begin( GL_TRIANGLES ); + gGL.begin( LLVertexBuffer::TRIANGLES ); gGL.vertex2f( ctr_x, ctr_y ); gGL.vertex2f( ctr_x - half_width_pixels, ctr_y + far_clip_pixels ); gGL.vertex2f( ctr_x + half_width_pixels, ctr_y + far_clip_pixels ); @@ -477,7 +477,7 @@ void LLNetMap::draw() gGL.pushMatrix(); gGL.translatef( ctr_x, ctr_y, 0 ); glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); - gGL.begin( GL_TRIANGLES ); + gGL.begin( LLVertexBuffer::TRIANGLES ); gGL.vertex2f( 0, 0 ); gGL.vertex2f( -half_width_pixels, far_clip_pixels ); gGL.vertex2f( half_width_pixels, far_clip_pixels ); diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 85d5def673..f4cbbe28c8 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -271,7 +271,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName ) llerrs << "Filename is Empty!" << llendl; return FALSE; } - FILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/ if (!fp) { llerrs << "can't open: " << fileName << llendl; diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index 5574ec67c7..572a495f70 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -83,7 +83,7 @@ LLPolyMorphData::~LLPolyMorphData() //----------------------------------------------------------------------------- // loadBinary() //----------------------------------------------------------------------------- -BOOL LLPolyMorphData::loadBinary(FILE *fp, LLPolyMeshSharedData *mesh) +BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) { S32 numVertices; S32 numRead; diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h index 088963584e..8b4493ce86 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/newview/llpolymorph.h @@ -51,7 +51,7 @@ public: LLPolyMorphData(char *morph_name); ~LLPolyMorphData(); - BOOL loadBinary(FILE* fp, LLPolyMeshSharedData *mesh); + BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh); char* loadASCII(char* text, LLPolyMeshSharedData *mesh); char* getName() { return mName; } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index e55d2b2225..2d87cae69b 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1262,7 +1262,7 @@ void LLPreviewLSL::saveIfNeeded() std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString()); std::string filename = llformat("%s.lsl", filepath.c_str()); - FILE* fp = LLFile::fopen(filename.c_str(), "wb"); + LLFILE* fp = LLFile::fopen(filename.c_str(), "wb"); if(!fp) { llwarns << "Unable to write to " << filename << llendl; @@ -1336,7 +1336,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, //system(command); // load the error file into the error scrolllist - FILE* fp = LLFile::fopen(err_filename.c_str(), "r"); + LLFILE* fp = LLFile::fopen(err_filename.c_str(), "r"); if(fp) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ @@ -1851,7 +1851,7 @@ void LLLiveLSLEditor::loadScriptText(const char* filename) llerrs << "Filename is Empty!" << llendl; return; } - FILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ + LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if(file) { // read in the whole file @@ -2063,7 +2063,7 @@ void LLLiveLSLEditor::saveIfNeeded() mItem->setTransactionID(tid); // write out the data, and store it in the asset database - FILE* fp = LLFile::fopen(filename.c_str(), "wb"); + LLFILE* fp = LLFile::fopen(filename.c_str(), "wb"); if(!fp) { llwarns << "Unable to write to " << filename << llendl; @@ -2136,7 +2136,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, std::string dst_filename = llformat("%s.lso", filepath.c_str()); std::string err_filename = llformat("%s.out", filepath.c_str()); - FILE *fp; + LLFILE *fp; if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5eacb25ded..179b1469ed 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5280,7 +5280,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); glAlphaFunc(GL_GREATER, 0.01f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { S32 i = 0; for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++) @@ -5301,7 +5301,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) gGL.flush(); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); { S32 i = 0; for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b7cdf04de7..ff53dfea2f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1646,7 +1646,7 @@ public: void drawBox(const LLVector3& c, const LLVector3& r) { - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); //left front gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV); @@ -1665,7 +1665,7 @@ void drawBox(const LLVector3& c, const LLVector3& r) gGL.end(); //bottom - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,-1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,-1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV); @@ -1673,7 +1673,7 @@ void drawBox(const LLVector3& c, const LLVector3& r) gGL.end(); //top - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,1))).mV); @@ -1688,7 +1688,7 @@ void drawBoxOutline(const LLVector3& pos, const LLVector3& size) LLVector3 v3 = size.scaledVec(LLVector3(-1,-1,1)); LLVector3 v4 = size.scaledVec(LLVector3( 1,-1,1)); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); //top gGL.vertex3fv((pos+v1).mV); @@ -2032,7 +2032,7 @@ void renderOctree(LLSpatialGroup* group) drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); gGL.flush(); glLineWidth(1.f); - gGL.stop(); + gGL.flush(); for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) { LLDrawable* drawable = *i; @@ -2074,7 +2074,7 @@ void renderOctree(LLSpatialGroup* group) } } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - gGL.start(); + gGL.color4f(1,1,1,1); } } else @@ -2313,7 +2313,7 @@ void renderPoints(LLDrawable* drawablep) LLGLDepthTest depth(GL_FALSE, GL_FALSE); if (drawablep->getNumFaces()) { - gGL.begin(GL_POINTS); + gGL.begin(LLVertexBuffer::POINTS); gGL.color3f(1,1,1); LLVector3 center(drawablep->getPositionGroup()); for (S32 i = 0; i < drawablep->getNumFaces(); i++) @@ -2405,14 +2405,14 @@ public: if (group->mSpatialPartition->mRenderByGroup && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION)) { - gGL.stop(); + gGL.flush(); glPushMatrix(); gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); renderVisibility(group, mCamera); gGLLastMatrix = NULL; glPopMatrix(); - gGL.start(); + gGL.color4f(1,1,1,1); } } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7d9bab59df..ec15ffecee 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -438,7 +438,7 @@ BOOL idle_startup() std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg"); - FILE* found_template = NULL; + LLFILE* found_template = NULL; found_template = LLFile::fopen(message_template_path.c_str(), "r"); /* Flawfinder: ignore */ if (found_template) { @@ -2439,7 +2439,7 @@ LLString load_password_from_disk() std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat"); - FILE* fp = LLFile::fopen(filepath.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filepath.c_str(), "rb"); /* Flawfinder: ignore */ if (!fp) { return hashed_password; @@ -2486,7 +2486,7 @@ void save_password_to_disk(const char* hashed_password) } else { - FILE* fp = LLFile::fopen(filepath.c_str(), "wb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filepath.c_str(), "wb"); /* Flawfinder: ignore */ if (!fp) { return; diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index f8931cb18b..7a2d232de6 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -244,8 +244,6 @@ BOOL LLTexLayerSetBuffer::render() BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); BOOL success = TRUE; - gGL.start(); - // Composite bump if( mBumpTexName ) { @@ -297,8 +295,6 @@ BOOL LLTexLayerSetBuffer::render() glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - gGL.stop(); - // we have valid texture data now mInitialized = TRUE; mNeedsUpdate = FALSE; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a654dbc2cd..6625e10982 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -484,7 +484,7 @@ void LLFloaterTexturePicker::draw() { LLGLSNoTexture no_texture; LLGLEnable(GL_CULL_FACE); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index a15b01ca04..0224e1c925 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -482,7 +482,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region S32 j = (S32) pos_region.mV[VY]; S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]); - gGL.begin(GL_POINTS); + gGL.begin(LLVertexBuffer::POINTS); for(S32 di = -half_edge; di <= half_edge; di++) { if((i+di) < 0 || (i+di) >= (S32)land.mGridsPerEdge) continue; diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 85ea204645..ad11f5ad43 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -163,8 +163,6 @@ void LLVisualParamHint::preRender(BOOL clear_depth) //----------------------------------------------------------------------------- BOOL LLVisualParamHint::render() { - gGL.start(); - LLVisualParamReset::sDirty = TRUE; LLVOAvatar* avatarp = gAgent.getAvatarObject(); @@ -224,7 +222,7 @@ BOOL LLVisualParamHint::render() mVisualParam->getCameraElevation() ); LLVector3 camera_pos = target_joint_pos + (camera_snapshot_offset * avatar_rotation); - gGL.stop(); + gGL.flush(); LLViewerCamera::getInstance()->setAspect((F32)mWidth / (F32)mHeight); LLViewerCamera::getInstance()->setOriginAndLookAt( @@ -241,7 +239,7 @@ BOOL LLVisualParamHint::render() avatarPoolp->renderAvatars(avatarp); // renders only one avatar } avatarp->setVisualParamWeight(mVisualParam, mLastParamWeight); - + gGL.color4f(1,1,1,1); return TRUE; } @@ -258,7 +256,7 @@ void LLVisualParamHint::draw() gGL.color4f(1.f, 1.f, 1.f, 1.f); LLGLSUIDefault gls_ui; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.texCoord2i(0, 1); gGL.vertex2i(0, mHeight); diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 40ae4e49a6..874608d066 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -444,7 +444,7 @@ void draw_shockwave(F32 center_z, F32 t, S32 steps, LLColor4 color) F32 y = 0.f; LLColor4 ccol = LLColor4(1,1,1,(1.f-t)*0.25f); - gGL.begin(GL_TRIANGLE_FAN); + gGL.begin(LLVertexBuffer::TRIANGLE_FAN); gGL.color4fv(ccol.mV); gGL.vertex3f(0.f, 0.f, center_z); // make sure circle is complete @@ -534,7 +534,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global, an *= 2.f; an += 1.0f+dr; - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.color4fv(col_edge.mV); gGL.vertex3f(-x*a, -y*a, z); gGL.color4fv(col_edge_next.mV); diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index c015004a71..39e0bd8555 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -202,7 +202,7 @@ if(!filename) llinfos << "ASSET_ID: " << asset_id << llendl; S32 size = 0; - FILE* fp = LLFile::fopen(filename, "rb"); + LLFILE* fp = LLFile::fopen(filename, "rb"); if (fp) { fseek(fp, 0, SEEK_END); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index b834eb7e2e..9ba25902af 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -86,6 +86,7 @@ LLString gLastRunVersion; LLString gCurrentVersion; extern BOOL gResizeScreenTexture; +extern BOOL gDebugGL; //////////////////////////////////////////////////////////////////////////// // Listeners @@ -357,9 +358,15 @@ static bool handleRenderUseImpostorsChanged(const LLSD& newvalue) return true; } -static bool handleRenderUseCleverUIChanged(const LLSD& newvalue) +static bool handleRenderDebugGLChanged(const LLSD& newvalue) { - gGL.setClever(newvalue.asBoolean()); + gDebugGL = newvalue.asBoolean(); + return true; +} + +static bool handleRenderDebugPipelineChanged(const LLSD& newvalue) +{ + gDebugPipeline = newvalue.asBoolean(); return true; } @@ -464,7 +471,8 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _1)); gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1)); - gSavedSettings.getControl("RenderUseCleverUI")->getSignal()->connect(boost::bind(&handleRenderUseCleverUIChanged, _1)); + gSavedSettings.getControl("RenderDebugGL")->getSignal()->connect(boost::bind(&handleRenderDebugGLChanged, _1)); + gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _1)); gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _1)); gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("AvatarCompositeLimit")->getSignal()->connect(boost::bind(&handleCompositeLimitChanged, _1)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 152c614c08..a24f4b36de 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -125,20 +125,17 @@ void display_startup() // Required for HTML update in login screen static S32 frame_count = 0; -#ifndef LL_RELEASE_FOR_DOWNLOAD + LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif if (frame_count++ > 1) // make sure we have rendered a frame first { LLDynamicTexture::updateAllInstances(); } -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); LLGLSUIDefault gls_ui; @@ -147,14 +144,14 @@ void display_startup() gViewerWindow->setup2DRender(); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - gGL.start(); + gGL.color4f(1,1,1,1); gViewerWindow->draw(); - gGL.stop(); + gGL.flush(); + + LLVertexBuffer::unbind(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif gViewerWindow->mWindow->swapBuffers(); glClear(GL_DEPTH_BUFFER_BIT); @@ -199,16 +196,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLSDefault gls_default; LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE, GL_LEQUAL); - - // No clue where this is getting unset, but safe enough to reset it here. - //this causes frame stalls, try real hard not to uncomment this line - DaveP - //LLGLState::resetTextureStates(); - -#ifndef LL_RELEASE_FOR_DOWNLOAD + LLVertexBuffer::unbind(); + LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif gPipeline.disableLights(); @@ -233,10 +225,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gViewerWindow->performPick(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif ////////////////////////////////////////////////////////// // @@ -676,7 +666,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); // gGL.color4fv(LLColor4::white.mV); - // gGL.begin(GL_QUADS); + // gGL.begin(LLVertexBuffer::QUADS); // { // gGL.vertex3f(floater_3d_rect.mLeft, floater_3d_rect.mBottom, 0.f); // gGL.vertex3f(floater_3d_rect.mLeft, floater_3d_rect.mTop, 0.f); @@ -881,9 +871,7 @@ BOOL setup_hud_matrices(BOOL for_select) void render_ui_and_swap() { -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); -#endif glPushMatrix(); glLoadMatrixd(gGLLastModelView); @@ -910,8 +898,8 @@ void render_ui_and_swap() } { - LLVertexBuffer::startRender(); - gGL.start(); + + gGL.color4f(1,1,1,1); if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { LLFastTimer t(LLFastTimer::FTM_RENDER_UI); @@ -919,17 +907,13 @@ void render_ui_and_swap() if (!gDisconnected) { render_ui_3d(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); -#endif } render_ui_2d(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); -#endif } - gGL.stop(); + gGL.flush(); { gViewerWindow->setup2DRender(); @@ -937,7 +921,7 @@ void render_ui_and_swap() gViewerWindow->drawDebugText(); } - LLVertexBuffer::stopRender(); + LLVertexBuffer::unbind(); } glh_set_current_modelview(saved_view); @@ -960,7 +944,7 @@ void render_ui_and_swap_if_needed() void renderCoordinateAxes() { LLGLSNoTexture gls_no_texture; - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red gGL.vertex3f(0.0f, 0.0f, 0.0f); gGL.vertex3f(2.0f, 0.0f, 0.0f); @@ -1013,7 +997,7 @@ void draw_axes() LLGLSNoTexture gls_no_texture; // A vertical white line at origin LLVector3 v = gAgent.getPositionAgent(); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.color3f(1.0f, 1.0f, 1.0f); gGL.vertex3f(0.0f, 0.0f, 0.0f); gGL.vertex3f(0.0f, 0.0f, 40.0f); @@ -1119,7 +1103,7 @@ void render_ui_2d() void render_disconnected_background() { - gGL.start(); + gGL.color4f(1,1,1,1); if (!gDisconnectedImagep && gDisconnected) { llinfos << "Loading last bitmap..." << llendl; @@ -1192,7 +1176,7 @@ void render_disconnected_background() } glPopMatrix(); } - gGL.stop(); + gGL.flush(); } void display_cleanup() diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index aeffcd6c56..097b3b1a9d 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -254,7 +254,7 @@ void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const msg->addU32Fast(_PREHASH_CRC, crc); } // virtual -BOOL LLViewerInventoryItem::importFile(FILE* fp) +BOOL LLViewerInventoryItem::importFile(LLFILE* fp) { BOOL rv = LLInventoryItem::importFile(fp); mIsComplete = TRUE; @@ -269,7 +269,7 @@ BOOL LLViewerInventoryItem::importLegacyStream(std::istream& input_stream) return rv; } -bool LLViewerInventoryItem::importFileLocal(FILE* fp) +bool LLViewerInventoryItem::importFileLocal(LLFILE* fp) { // TODO: convert all functions that return BOOL to return bool bool rv = (LLInventoryItem::importFile(fp) ? true : false); @@ -277,7 +277,7 @@ bool LLViewerInventoryItem::importFileLocal(FILE* fp) return rv; } -bool LLViewerInventoryItem::exportFileLocal(FILE* fp) const +bool LLViewerInventoryItem::exportFileLocal(LLFILE* fp) const { char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ fprintf(fp, "\tinv_item\t0\n\t{\n"); @@ -469,7 +469,7 @@ bool LLViewerInventoryCategory::fetchDescendents() return false; } -bool LLViewerInventoryCategory::importFileLocal(FILE* fp) +bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp) { // *NOTE: This buffer size is hard coded into scanf() below. char buffer[MAX_STRING]; /* Flawfinder: ignore */ @@ -538,7 +538,7 @@ bool LLViewerInventoryCategory::importFileLocal(FILE* fp) return true; } -bool LLViewerInventoryCategory::exportFileLocal(FILE* fp) const +bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const { char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ fprintf(fp, "\tinv_category\t0\n\t{\n"); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 24c33bf292..30e5afdad1 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -100,13 +100,13 @@ public: //virtual void packMessage(LLMessageSystem* msg) const; virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); virtual BOOL unpackMessage(LLSD item); - virtual BOOL importFile(FILE* fp); + virtual BOOL importFile(LLFILE* fp); virtual BOOL importLegacyStream(std::istream& input_stream); // file handling on the viewer. These are not meant for anything // other than cacheing. - bool exportFileLocal(FILE* fp) const; - bool importFileLocal(FILE* fp); + bool exportFileLocal(LLFILE* fp) const; + bool importFileLocal(LLFILE* fp); // new methods BOOL isComplete() const { return mIsComplete; } @@ -182,8 +182,8 @@ public: // file handling on the viewer. These are not meant for anything // other than cacheing. - bool exportFileLocal(FILE* fp) const; - bool importFileLocal(FILE* fp); + bool exportFileLocal(LLFILE* fp) const; + bool importFileLocal(LLFILE* fp); protected: LLUUID mOwnerID; diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index b1cad86a61..9bf392249e 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -148,7 +148,7 @@ void LLViewerJoint::renderSkeleton(BOOL recursive) //---------------------------------------------------------------- if (mComponents & SC_AXES) { - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.color3f( 1.0f, 0.0f, 0.0f ); gGL.vertex3f( 0.0f, 0.0f, 0.0f ); gGL.vertex3f( 0.1f, 0.0f, 0.0f ); @@ -170,7 +170,7 @@ void LLViewerJoint::renderSkeleton(BOOL recursive) { gGL.color3f( 1.0f, 1.0f, 0.0f ); - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); // joint top half glNormal3f(nc, nc, nc); @@ -360,7 +360,7 @@ void LLViewerJoint::drawBone() // render the bone gGL.color3f( 0.5f, 0.5f, 0.0f ); - gGL.begin(GL_TRIANGLES); + gGL.begin(LLVertexBuffer::TRIANGLES); gGL.vertex3f( length, 0.0f, 0.0f); gGL.vertex3f( 0.0f, boneSize, 0.0f); diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index 7ec60a31d1..9e5c207f7d 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -92,7 +92,7 @@ U32 LLViewerJointAttachment::drawShape( F32 pixelArea, BOOL first_pass ) LLGLDisable cull_face(GL_CULL_FACE); gGL.color4f(1.f, 1.f, 1.f, 1.f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); { gGL.vertex3f(-0.1f, 0.1f, 0.f); gGL.vertex3f(-0.1f, -0.1f, 0.f); diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index e21c14637b..00473439a3 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -738,7 +738,7 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c S32 LLViewerKeyboard::loadBindings(const char *filename) { - FILE *fp; + LLFILE *fp; const S32 BUFFER_SIZE = 2048; char buffer[BUFFER_SIZE]; /* Flawfinder: ignore */ // *NOTE: This buffer size is hard coded into scanf() below. diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0a7a14dbfa..ab796f184f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1429,6 +1429,12 @@ void init_debug_rendering_menu(LLMenuGL* menu) item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); menu->append(item); + + item = new LLMenuItemCheckGL("Debug GL", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugGL"); + menu->append(item); + + item = new LLMenuItemCheckGL("Debug Pipeline", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugPipeline"); + menu->append(item); item = new LLMenuItemCheckGL("Fast Alpha", menu_toggle_control, NULL, menu_check_control, (void*)"RenderFastAlpha"); menu->append(item); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 6a0b5280ab..864c1dd570 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -591,7 +591,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, { // This is a generic .lin resource file asset_type = LLAssetType::AT_OBJECT; - FILE* in = LLFile::fopen(src_filename.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* in = LLFile::fopen(src_filename.c_str(), "rb"); /* Flawfinder: ignore */ if (in) { // read in the file header @@ -676,7 +676,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, } // copy the file's data segment into another file for uploading - FILE* out = LLFile::fopen(filename.c_str(), "wb"); /* Flawfinder: ignore */ + LLFILE* out = LLFile::fopen(filename.c_str(), "wb"); /* Flawfinder: ignore */ if (out) { while((read = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */ diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5b16b81639..e09af2ea45 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -345,7 +345,7 @@ void export_complete() gExporterRequestID.setNull(); gExportDirectory = ""; - FILE* fXML = LLFile::fopen(gExportedFile.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* fXML = LLFile::fopen(gExportedFile.c_str(), "rb"); /* Flawfinder: ignore */ fseek(fXML, 0, SEEK_END); long length = ftell(fXML); fseek(fXML, 0, SEEK_SET); @@ -390,7 +390,7 @@ void export_complete() } } - FILE* fXMLOut = LLFile::fopen(gExportedFile.c_str(), "wb"); /* Flawfinder: ignore */ + LLFILE* fXMLOut = LLFile::fopen(gExportedFile.c_str(), "wb"); /* Flawfinder: ignore */ if (fwrite(buffer, 1, length, fXMLOut) != length) { llwarns << "Short write" << llendl; @@ -446,7 +446,7 @@ void exported_j2c_complete(const LLTSCode status, void *user_data) } else { - FILE* fIn = LLFile::fopen(filename.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* fIn = LLFile::fopen(filename.c_str(), "rb"); /* Flawfinder: ignore */ if (fIn) { LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; @@ -481,7 +481,7 @@ void exported_j2c_complete(const LLTSCode status, void *user_data) delete [] file_path; //S32 name_len = output_file.length(); //strcpy(&output_file[name_len-3], "tga"); - FILE* fOut = LLFile::fopen(output_file.c_str(), "wb"); /* Flawfinder: ignore */ + LLFILE* fOut = LLFile::fopen(output_file.c_str(), "wb"); /* Flawfinder: ignore */ char md5_hash_string[33]; /* Flawfinder: ignore */ strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ if (fOut) diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 499476e065..8398c3c9d7 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1206,12 +1206,12 @@ U32 LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, BOOL pick_parce // // Render pass for selected objects // - gGL.start(); + gGL.color4f(1,1,1,1); gViewerWindow->renderSelections( TRUE, pick_parcel_wall, FALSE ); // render pickable ui elements, like names, etc. LLHUDObject::renderAllForSelect(); - gGL.stop(); + gGL.flush(); gRenderForSelect = FALSE; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index b105267723..d190d2f12c 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -824,7 +824,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () continue; } - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); for (j = 0; j < vertex_per_edge; j++) { @@ -844,7 +844,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () colorp = mColorArray + BYTES_PER_COLOR * i; vertexp = mVertexArray + FLOATS_PER_VERTEX * i; - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); for (j = 0; j < vertex_per_edge; j++) { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4b7c849171..5d7bac7ab3 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -214,7 +214,7 @@ void LLViewerRegion::loadCache() U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS ); - FILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ if (!fp) { // might not have a file, which is normal @@ -303,7 +303,7 @@ void LLViewerRegion::saveCache() U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS ); - FILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (!fp) { llwarns << "Unable to write cache file " << filename << llendl; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index e403df7f45..0e39c9d5d4 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2243,7 +2243,7 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) void LLViewerWindow::drawDebugText() { - gGL.start(); + gGL.color4f(1,1,1,1); gGL.pushMatrix(); { // scale view by UI global scale factor and aspect ratio correction factor @@ -2251,7 +2251,7 @@ void LLViewerWindow::drawDebugText() mDebugText->draw(); } gGL.popMatrix(); - gGL.stop(); + gGL.flush(); } void LLViewerWindow::draw() @@ -5019,20 +5019,16 @@ BOOL LLViewerWindow::checkSettings() return FALSE; } -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif changeDisplaySettings(TRUE, LLCoordScreen(gSavedSettings.getS32("FullScreenWidth"), gSavedSettings.getS32("FullScreenHeight")), gSavedSettings.getBOOL("DisableVerticalSync"), mShowFullscreenProgress); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif return TRUE; } return FALSE; @@ -5213,7 +5209,7 @@ void LLViewerWindow::drawPickBuffer() const { if (mPickBuffer) { - gGL.start(); + gGL.color4f(1,1,1,1); gGL.pushMatrix(); LLGLDisable no_blend(GL_BLEND); LLGLDisable no_alpha_test(GL_ALPHA_TEST); @@ -5249,7 +5245,7 @@ void LLViewerWindow::drawPickBuffer() const llround((F32)mPickPoint.mY * mDisplayScale.mV[VY] + (F32)(PICK_HALF_WIDTH + mPickOffset.mY) * 10.f), FALSE); gGL.popMatrix(); - gGL.stop(); + gGL.flush(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index afe5f5f9fb..292fa83918 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4056,7 +4056,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) LLVector3 collide_point = slaved_pos; collide_point.mV[VZ] -= foot_plane_normal.mV[VZ] * (dist_from_plane + COLLISION_TOLERANCE - FOOT_COLLIDE_FUDGE); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); { F32 SQUARE_SIZE = 0.2f; gGL.color4f(1.f, 0.f, 0.f, 1.f); @@ -4229,10 +4229,10 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) LLGLEnable test(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.f); - gGL.start(); + gGL.color4f(1,1,1,1); gGL.color4ubv(color.mV); mImpostor.bindTexture(); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0,0); gGL.vertex3fv((pos+left-up).mV); gGL.texCoord2f(1,0); @@ -4242,7 +4242,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) gGL.texCoord2f(0,1); gGL.vertex3fv((pos+left+up).mV); gGL.end(); - gGL.stop(); + gGL.flush(); return 6; } diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 79c7594a0f..a0a4cc4b64 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -63,7 +63,7 @@ LLVOCacheEntry::LLVOCacheEntry() } -static inline void checkedRead(FILE *fp, void *data, size_t nbytes) +static inline void checkedRead(LLFILE *fp, void *data, size_t nbytes) { if (fread(data, 1, nbytes, fp) != nbytes) { @@ -72,7 +72,7 @@ static inline void checkedRead(FILE *fp, void *data, size_t nbytes) } } -LLVOCacheEntry::LLVOCacheEntry(FILE *fp) +LLVOCacheEntry::LLVOCacheEntry(LLFILE *fp) { S32 size; checkedRead(fp, &mLocalID, sizeof(U32)); @@ -153,7 +153,7 @@ void LLVOCacheEntry::dump() const << llendl; } -static inline void checkedWrite(FILE *fp, const void *data, size_t nbytes) +static inline void checkedWrite(LLFILE *fp, const void *data, size_t nbytes) { if (fwrite(data, 1, nbytes, fp) != nbytes) { @@ -161,7 +161,7 @@ static inline void checkedWrite(FILE *fp, const void *data, size_t nbytes) } } -void LLVOCacheEntry::writeToFile(FILE *fp) const +void LLVOCacheEntry::writeToFile(LLFILE *fp) const { checkedWrite(fp, &mLocalID, sizeof(U32)); checkedWrite(fp, &mCRC, sizeof(U32)); diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 809b82a6d9..d2b8f5681c 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -45,7 +45,7 @@ class LLVOCacheEntry : public LLDLinked<LLVOCacheEntry> { public: LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp); - LLVOCacheEntry(FILE *fp); + LLVOCacheEntry(LLFILE *fp); LLVOCacheEntry(); ~LLVOCacheEntry(); @@ -55,7 +55,7 @@ public: S32 getCRCChangeCount() const { return mCRCChangeCount; } void dump() const; - void writeToFile(FILE *fp) const; + void writeToFile(LLFILE *fp) const; void assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp); LLDataPackerBinaryBuffer *getDP(U32 crc); void recordHit(); diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h index a1dab634be..1a14241409 100644 --- a/indra/newview/llvograss.h +++ b/indra/newview/llvograss.h @@ -56,8 +56,8 @@ public: U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp); - static void import(FILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos); - /*virtual*/ void exportFile(FILE *file, const LLVector3 &position); + static void import(LLFILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos); + /*virtual*/ void exportFile(LLFILE *file, const LLVector3 &position); void updateDrawable(BOOL force_damped); diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 87f0ffdbee..a0286d3e4b 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -393,13 +393,13 @@ void LLVoiceVisualizer::render() //------------------------------------------------------------- gGL.color4fv( LLColor4( 1.0f, 1.0f, 1.0f, DOT_OPACITY ).mV ); - gGL.begin( GL_TRIANGLE_STRIP ); + gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); gGL.end(); - gGL.begin( GL_TRIANGLE_STRIP ); + gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); @@ -516,13 +516,13 @@ void LLVoiceVisualizer::render() //--------------------------------------------------- // now, render the mofo //--------------------------------------------------- - gGL.begin( GL_TRIANGLE_STRIP ); + gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); gGL.end(); - gGL.begin( GL_TRIANGLE_STRIP ); + gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index b63543a327..af554e5160 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -185,7 +185,7 @@ const char* terse_F32_to_string( F32 f, char s[MAX_STRING] ) /* Flawfinder: ign return r; } -BOOL LLWearable::exportFile( FILE* file ) +BOOL LLWearable::exportFile( LLFILE* file ) { // header and version if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 ) @@ -266,7 +266,7 @@ BOOL LLWearable::exportFile( FILE* file ) -BOOL LLWearable::importFile( FILE* file ) +BOOL LLWearable::importFile( LLFILE* file ) { // *NOTE: changing the type or size of this buffer will require // changes in the fscanf() code below. You would be better off @@ -852,7 +852,7 @@ void LLWearable::saveNewAsset() mAssetID.toString(new_asset_id_string); char filename[LL_MAX_PATH]; /* Flawfinder: ignore */ snprintf(filename, LL_MAX_PATH, "%s.wbl", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string).c_str()); /* Flawfinder: ignore */ - FILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ BOOL successful_save = FALSE; if(fp && exportFile(fp)) { diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 1b0fb3d7aa..fb66663fc2 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -78,8 +78,8 @@ public: void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); } static void removeFromAvatar( EWearableType type, BOOL set_by_user ); - BOOL exportFile(FILE* file); - BOOL importFile(FILE* file); + BOOL exportFile(LLFILE* file); + BOOL importFile(LLFILE* file); EWearableType getType() const { return mType; } void setType( EWearableType type ) { mType = type; } diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 29021aa54c..3ec5737acf 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -110,7 +110,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID if( status >= 0 ) { // read the file - FILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if( !fp ) { llinfos << "Bad Wearable Asset: unable to open file: '" << filename << "'" << llendl; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 124e865637..dd1d266490 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -381,7 +381,7 @@ void LLWorldMapView::draw() glColorMask(TRUE, TRUE, TRUE, FALSE); gGL.color4f(1.f, 1.f, 1.f, layer_alpha); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.0f, 1.0f); gGL.vertex3f(left, top, -1.0f); gGL.texCoord2f(0.0f, 0.0f); @@ -397,7 +397,7 @@ void LLWorldMapView::draw() glColorMask(FALSE, FALSE, FALSE, TRUE); gGL.color4f(1.f, 1.f, 1.f, 1.f); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.0f, 1.0f); gGL.vertex2f(left, top); gGL.texCoord2f(0.0f, 0.0f); @@ -538,7 +538,7 @@ void LLWorldMapView::draw() F32 alpha = sim_alpha * info->mAlpha; gGL.color4f(1.f, 1.0f, 1.0f, alpha); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex3f(left, top, 0.f); gGL.texCoord2f(0.f, 0.f); @@ -553,7 +553,7 @@ void LLWorldMapView::draw() { LLViewerImage::bindTexture(overlayimage); gGL.color4f(1.f, 1.f, 1.f, alpha); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex3f(left, top, -0.5f); gGL.texCoord2f(0.f, 0.f); @@ -574,7 +574,7 @@ void LLWorldMapView::draw() gGL.color4f(1.f, 1.f, 1.f, 1.f); LLGLSNoTexture gls_no_texture; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.vertex2f(left, top); gGL.vertex2f(left, bottom); gGL.vertex2f(right, bottom); @@ -593,7 +593,7 @@ void LLWorldMapView::draw() gGL.color4f(0.2f, 0.0f, 0.0f, 0.4f); LLGLSNoTexture gls_no_texture; - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.vertex2f(left, top); gGL.vertex2f(left, bottom); gGL.vertex2f(right, bottom); @@ -610,7 +610,7 @@ void LLWorldMapView::draw() LLGLSNoTexture gls_no_texture; gGL.color3f(1.f, 0.f, 0.f); - gGL.begin(GL_LINES); + gGL.begin(LLVertexBuffer::LINES); gGL.vertex2f(left, top); gGL.vertex2f(right, bottom); gGL.vertex2f(left, bottom); @@ -971,7 +971,7 @@ void LLWorldMapView::drawFrustum() // Draw triangle with more alpha in far pixels to make it // fade out in distance. - gGL.begin( GL_TRIANGLES ); + gGL.begin( LLVertexBuffer::TRIANGLES ); gGL.color4f(1.f, 1.f, 1.f, 0.25f); gGL.vertex2f( 0, 0 ); @@ -1181,7 +1181,7 @@ static void drawDot(F32 x_pixels, F32 y_pixels, gGL.color4fv( color.mV ); LLUI::setLineWidth(1.5f); F32 h_bar = relative_z > HEIGHT_THRESHOLD ? top : bottom; // horizontal bar Y - gGL.begin( GL_LINES ); + gGL.begin( LLVertexBuffer::LINES ); gGL.vertex2f(center, top); gGL.vertex2f(left, h_bar); gGL.vertex2f(right, h_bar); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4f71e33af5..4972ce33ea 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -125,6 +125,7 @@ extern S32 gBoxFrame; extern BOOL gRenderLightGlows; extern BOOL gHideSelectedObjects; extern BOOL gDisplaySwapBuffers; +extern BOOL gDebugGL; // hack counter for rendering a fixed number of frames after toggling // fullscreen to work around DEV-5361 @@ -134,6 +135,7 @@ BOOL gAvatarBacklight = FALSE; BOOL gRenderForSelect = FALSE; +BOOL gDebugPipeline = FALSE; LLPipeline gPipeline; const LLMatrix4* gGLLastMatrix = NULL; @@ -2129,7 +2131,7 @@ void render_hud_elements() glStencilMask(0xFFFFFFFF); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - gGL.start(); + gGL.color4f(1,1,1,1); if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d() @@ -2156,7 +2158,7 @@ void render_hud_elements() { LLHUDText::renderAllHUD(); } - gGL.stop(); + gGL.flush(); } void LLPipeline::renderHighlights() @@ -2260,11 +2262,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLVertexBuffer::unbind(); // Do verification of GL state -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif if (mRenderDebugMask & RENDER_DEBUG_VERIFY) { if (!verify()) @@ -2273,7 +2273,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } } - LLVertexBuffer::startRender(); + //by bao //fake vertex buffer updating @@ -2382,19 +2382,18 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } poolp->endRenderPass(i); LLVertexBuffer::unbind(); -#ifndef LL_RELEASE_FOR_DOWNLOAD -# if LL_DEBUG_GL - GLint depth; - glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); - if (depth > 3) + if (gDebugGL || gDebugPipeline) { - llerrs << "GL matrix stack corrupted!" << llendl; + GLint depth; + glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); + if (depth > 3) + { + llerrs << "GL matrix stack corrupted!" << llendl; + } + LLGLState::checkStates(); + LLGLState::checkTextureChannels(); + LLGLState::checkClientArrays(); } - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); -# endif -#endif } } else @@ -2415,11 +2414,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } LLVertexBuffer::unbind(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); @@ -2434,12 +2431,10 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) stop_glerror(); -#ifndef LL_RELEASE_FOR_DOWNLOAD - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); -#endif - + LLGLState::checkStates(); + LLGLState::checkTextureChannels(); + LLGLState::checkClientArrays(); + if (!sReflectionRender) { renderHighlights(); @@ -2451,17 +2446,14 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) renderDebug(); - LLVertexBuffer::stopRender(); LLVertexBuffer::unbind(); if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - gGL.start(); // Render debugging beacons. gObjectList.renderObjectBeacons(); LLHUDObject::renderAll(); gObjectList.resetObjectBeacons(); - gGL.stop(); } //HACK: preserve/restore matrices around HUD render @@ -2474,11 +2466,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } } -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif } void LLPipeline::renderGeomDeferred() @@ -2509,7 +2499,7 @@ void LLPipeline::renderDebug() assertInitialized(); - gGL.start(); + gGL.color4f(1,1,1,1); gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); @@ -2554,7 +2544,7 @@ void LLPipeline::renderDebug() if (gAgent.getRegion()) { - gGL.begin(GL_POINTS); + gGL.begin(LLVertexBuffer::POINTS); // Draw the composition layer for the region that I'm in. for (x = 0; x <= 260; x++) { @@ -2577,7 +2567,7 @@ void LLPipeline::renderDebug() gGL.end(); } } - gGL.stop(); + gGL.flush(); } void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) @@ -2594,7 +2584,7 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) LLMemType mt(LLMemType::MTYPE_PIPELINE); - LLVertexBuffer::startRender(); + glMatrixMode(GL_MODELVIEW); @@ -2603,13 +2593,14 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) LLGLDepthTest gls_depth(GL_TRUE,GL_TRUE); disableLights(); + LLVertexBuffer::unbind(); + //for each drawpool -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); U32 last_type = 0; -#endif + for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) { LLDrawPool *poolp = *iter; @@ -2621,7 +2612,6 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); -#ifndef LL_RELEASE_FOR_DOWNLOAD if (poolp->getType() != last_type) { last_type = poolp->getType(); @@ -2629,7 +2619,6 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); } -#endif } } @@ -2758,7 +2747,6 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); LLVertexBuffer::unbind(); - LLVertexBuffer::stopRender(); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } @@ -4115,11 +4103,9 @@ void apply_cube_face_rotation(U32 face) } void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam) { -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif assertInitialized(); @@ -4251,12 +4237,9 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam) LLPipeline::sSkipUpdate = FALSE; LLPipeline::sReflectionRender = FALSE; -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif - } //send cube map vertices and texture coordinates @@ -4333,11 +4316,9 @@ void validate_framebuffer_object() void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) { -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif assertInitialized(); @@ -4448,11 +4429,9 @@ void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) gViewerWindow->setupViewport(); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif } void LLPipeline::bindScreenToTexture() @@ -4468,10 +4447,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot) return; } -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif assertInitialized(); @@ -4494,7 +4471,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); LLFastTimer ftm(LLFastTimer::FTM_RENDER_BLOOM); - gGL.start(); + gGL.color4f(1,1,1,1); LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); LLGLDisable cull(GL_CULL_FACE); @@ -4524,7 +4501,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) LLGLEnable blend(GL_BLEND); gGL.blendFunc(GL_ONE, GL_ONE); tc2.setVec(1,1); - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.color4f(1,1,1,1); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4543,7 +4520,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - gGL.stop(); + gGL.flush(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); @@ -4582,7 +4559,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGL.color4f(1,1,1,1); gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4652,7 +4629,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGlowProgram.uniform2f("glowDelta", 0, delta); } - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4686,7 +4663,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); LLGLDisable blend(GL_BLEND); - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.color4f(1,1,1,1); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4721,7 +4698,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) glEnable(GL_TEXTURE_RECTANGLE_ARB); mScreen.bindTexture(); - gGL.begin(GL_TRIANGLE_STRIP); + gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); gGL.color4f(1,1,1,1); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4743,7 +4720,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); }*/ - gGL.stop(); + gGL.flush(); { LLVertexBuffer::unbind(); @@ -4829,10 +4806,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot) glMatrixMode(GL_MODELVIEW); glPopMatrix(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); -#endif } @@ -4864,11 +4839,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { LLVertexBuffer::unbind(); -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif LLCamera camera = camera_in; camera.setFar(camera.getFar()*0.87654321f); @@ -5057,11 +5030,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLViewerCamera::getInstance()->setUserClipPlane(LLPlane(-pnorm, -pd)); LLPipeline::sUseOcclusion = occlusion; -#ifndef LL_RELEASE_FOR_DOWNLOAD LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); -#endif } } @@ -5259,15 +5230,15 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLGLDepthTest depth(GL_FALSE, GL_FALSE); - gGL.start(); + gGL.color4f(1,1,1,1); gGL.color4ub(64,64,64,1); - gGL.begin(GL_QUADS); + gGL.begin(LLVertexBuffer::QUADS); gGL.vertex3fv((pos+left-up).mV); gGL.vertex3fv((pos-left-up).mV); gGL.vertex3fv((pos-left+up).mV); gGL.vertex3fv((pos+left+up).mV); gGL.end(); - gGL.stop(); + gGL.flush(); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 7e38628d87..a96fe0865d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -550,6 +550,7 @@ void render_bbox(const LLVector3 &min, const LLVector3 &max); extern LLPipeline gPipeline; extern BOOL gRenderForSelect; +extern BOOL gDebugPipeline; extern const LLMatrix4* gGLLastMatrix; #endif |