diff options
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 133 |
1 files changed, 63 insertions, 70 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d22206ca98..6c9c4751d7 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -117,7 +117,7 @@ #include "llenvironment.h" #include "llsettingsvo.h" -extern BOOL gSnapshot; +extern bool gSnapshot; bool gShiftFrame = false; //cached settings @@ -213,11 +213,11 @@ const F32 DEFERRED_LIGHT_FALLOFF = 0.5f; const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; extern S32 gBoxFrame; -//extern BOOL gHideSelectedObjects; -extern BOOL gDisplaySwapBuffers; -extern BOOL gDebugGL; -extern BOOL gCubeSnapshot; -extern BOOL gSnapshotNoPost; +//extern bool gHideSelectedObjects; +extern bool gDisplaySwapBuffers; +extern bool gDebugGL; +extern bool gCubeSnapshot; +extern bool gSnapshotNoPost; bool gAvatarBacklight = false; @@ -439,8 +439,8 @@ void LLPipeline::init() // disables non-object rendering (UI, sky, water, etc) if (gSavedSettings.getBOOL("RenderPerformanceTest")) { - gSavedSettings.setBOOL("RenderPerformanceTest", FALSE); - gSavedSettings.setBOOL("RenderPerformanceTest", TRUE); + gSavedSettings.setBOOL("RenderPerformanceTest", false); + gSavedSettings.setBOOL("RenderPerformanceTest", true); } mOldRenderDebugMask = mRenderDebugMask; @@ -671,12 +671,12 @@ void LLPipeline::destroyGL() void LLPipeline::requestResizeScreenTexture() { - gResizeScreenTexture = TRUE; + gResizeScreenTexture = true; } void LLPipeline::requestResizeShadowTexture() { - gResizeShadowTexture = TRUE; + gResizeShadowTexture = true; } void LLPipeline::resizeShadowTexture() @@ -684,7 +684,7 @@ void LLPipeline::resizeShadowTexture() releaseSunShadowTargets(); releaseSpotShadowTargets(); allocateShadowBuffer(mRT->width, mRT->height); - gResizeShadowTexture = FALSE; + gResizeShadowTexture = false; } void LLPipeline::resizeScreenTexture() @@ -700,7 +700,7 @@ void LLPipeline::resizeScreenTexture() releaseSunShadowTargets(); releaseSpotShadowTargets(); allocateScreenBuffer(resX,resY); - gResizeScreenTexture = FALSE; + gResizeScreenTexture = false; } } } @@ -776,14 +776,9 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; if (mRT == &mMainRT) { // hacky -- allocate auxillary buffer - - gCubeSnapshot = TRUE; - mReflectionMapManager.initReflectionMaps(); - mHeroProbeManager.initReflectionMaps(); - if (sReflectionProbesEnabled) { - gCubeSnapshot = TRUE; + gCubeSnapshot = true; mReflectionMapManager.initReflectionMaps(); } @@ -800,7 +795,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) } mRT = &mMainRT; - gCubeSnapshot = FALSE; + gCubeSnapshot = false; } // remember these dimensions @@ -943,7 +938,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) LLRenderTarget* shadow_target = getSunShadowTarget(i); if (shadow_target) { - gGL.getTexUnit(0)->bind(getSunShadowTarget(i), TRUE); + gGL.getTexUnit(0)->bind(getSunShadowTarget(i), true); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_ANISOTROPIC); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); @@ -960,7 +955,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) LLRenderTarget* shadow_target = getSpotShadowTarget(i); if (shadow_target) { - gGL.getTexUnit(0)->bind(shadow_target, TRUE); + gGL.getTexUnit(0)->bind(shadow_target, true); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_ANISOTROPIC); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); @@ -994,8 +989,8 @@ void LLPipeline::refreshCachedSettings() && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && gSavedSettings.getBOOL("UseOcclusion")) ? 2 : 0; - WindLightUseAtmosShaders = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); - RenderDeferred = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); + WindLightUseAtmosShaders = true; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); + RenderDeferred = true; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0; RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); @@ -1071,7 +1066,7 @@ void LLPipeline::refreshCachedSettings() RenderScreenSpaceReflectionAdaptiveStepMultiplier = gSavedSettings.getF32("RenderScreenSpaceReflectionAdaptiveStepMultiplier"); RenderScreenSpaceReflectionGlossySamples = gSavedSettings.getS32("RenderScreenSpaceReflectionGlossySamples"); RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization"); - if (gSavedSettings.getBOOL("RenderMirrors") != (BOOL)RenderMirrors) + if (gSavedSettings.getBOOL("RenderMirrors") != RenderMirrors) { RenderMirrors = gSavedSettings.getBOOL("RenderMirrors"); LLViewerShaderMgr::instance()->clearShaderCache(); @@ -1641,7 +1636,7 @@ void LLPipeline::allocDrawable(LLViewerObject *vobj) { drawable->setState(LLDrawable::FORCE_INVISIBLE); } - drawable->updateXform(TRUE); + drawable->updateXform(true); } @@ -1792,7 +1787,7 @@ void LLPipeline::createObject(LLViewerObject* vobj) if (drawablep->getVOVolume() && RenderAnimateRes) { // fun animated res - drawablep->updateXform(TRUE); + drawablep->updateXform(true); drawablep->clearState(LLDrawable::MOVE_UNDAMPED); drawablep->setScale(LLVector3(0,0,0)); drawablep->makeActive(); @@ -1886,6 +1881,11 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list) { LLDrawable::drawable_vector_t::iterator curiter = iter++; LLDrawable *drawablep = *curiter; + if (!drawablep) + { + iter = moved_list.erase(curiter); + continue; + } bool done = true; if (!drawablep->isDead() && (!drawablep->isState(LLDrawable::EARLY_MOVE))) { @@ -2436,6 +2436,7 @@ void LLPipeline::doOcclusion(LLCamera& camera) mCubeVB->setBuffer(); mReflectionMapManager.doOcclusion(); + mHeroProbeManager.doOcclusion(); gOcclusionCubeProgram.unbind(); gGL.setColorMask(true, true); @@ -2525,7 +2526,7 @@ void LLPipeline::updateGL() { LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); glu->updateGL(); - glu->mInQ = FALSE; + glu->mInQ = false; LLGLUpdate::sGLQ.pop_front(); } } @@ -2842,7 +2843,7 @@ void LLPipeline::markGLRebuild(LLGLUpdate* glu) if (glu && !glu->mInQ) { LLGLUpdate::sGLQ.push_back(glu); - glu->mInQ = TRUE; + glu->mInQ = true; } } @@ -2961,7 +2962,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot) { LLSpatialGroup* last_group = NULL; - BOOL fov_changed = LLViewerCamera::getInstance()->isDefaultFOVChanged(); + bool fov_changed = LLViewerCamera::getInstance()->isDefaultFOVChanged(); for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) { LLCullResult::bridge_iterator cur_iter = i; @@ -3050,7 +3051,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) } } -void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed) +void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, bool fov_changed) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; if (bridge->getSpatialGroup()->changeLOD() || fov_changed) @@ -3108,7 +3109,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) { if (!drawablep->isState(LLDrawable::INVISIBLE|LLDrawable::FORCE_INVISIBLE)) { - drawablep->setVisible(camera, NULL, FALSE); + drawablep->setVisible(camera, NULL, false); } } @@ -3603,7 +3604,7 @@ void LLPipeline::postSort(LLCamera &camera) } } - // LLSpatialGroup::sNoDelete = FALSE; + // LLSpatialGroup::sNoDelete = false; LL_PUSH_CALLSTACKS(); } @@ -3626,7 +3627,7 @@ void render_hud_elements() if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d() + gViewerWindow->renderSelections(false, false, false); // For HUD version in render_ui_3d() // Draw the tracking overlays LLTracker::render3D(); @@ -3678,10 +3679,8 @@ void LLPipeline::renderHighlights() // Make sure the selection image gets downloaded and decoded mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3697,10 +3696,8 @@ void LLPipeline::renderHighlights() // Paint 'em red! color.setVec(1.f, 0.f, 0.f, 0.5f); - int count = mHighlightFaces.size(); - for (S32 i = 0; i < count; i++) + for (auto facep : mHighlightFaces) { - LLFace* facep = mHighlightFaces[i]; facep->renderSelected(LLViewerTexture::sNullImagep, color); } } @@ -3726,10 +3723,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3756,10 +3751,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -4624,7 +4617,7 @@ void LLPipeline::renderDebug() LLVertexBuffer::unbind(); LLGLEnable blend(GL_BLEND); - LLGLDepthTest depth(TRUE, FALSE); + LLGLDepthTest depth(true, false); LLGLDisable cull(GL_CULL_FACE); gGL.color4f(1,1,1,1); @@ -4800,7 +4793,7 @@ void LLPipeline::rebuildPools() assertInitialized(); - S32 max_count = mPools.size(); + auto max_count = mPools.size(); pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool); while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS) { @@ -5759,7 +5752,7 @@ void LLPipeline::enableLightsDynamic() void LLPipeline::enableLightsAvatar() { U32 mask = 0xff; // All lights - setupAvatarLights(FALSE); + setupAvatarLights(false); enableLights(mask); } @@ -5823,7 +5816,7 @@ void LLPipeline::enableLightsPreview() void LLPipeline::enableLightsAvatarEdit(const LLColor4& color) { U32 mask = 0x2002; // Avatar backlight only, set ambient - setupAvatarLights(TRUE); + setupAvatarLights(true); enableLights(mask); gGL.setAmbientLightColor(color); @@ -6279,7 +6272,7 @@ LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start, LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_PARTICLE); if (part && hasRenderType(part->mDrawableType)) { - LLDrawable* hit = part->lineSegmentIntersect(start, local_end, TRUE, FALSE, TRUE, FALSE, face_hit, &position, NULL, NULL, NULL); + LLDrawable* hit = part->lineSegmentIntersect(start, local_end, true, false, true, false, face_hit, &position, NULL, NULL, NULL); if (hit) { drawable = hit; @@ -6508,7 +6501,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, c LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_HUD); if (part) { - LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, FALSE, TRUE, FALSE, face_hit, intersection, tex_coord, normal, tangent); + LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, false, true, false, face_hit, intersection, tex_coord, normal, tangent); if (hit) { drawable = hit; @@ -6821,7 +6814,7 @@ void LLPipeline::generateLuminance(LLRenderTarget* src, LLRenderTarget* dst) mGlow[1].bindTexture(0, channel); } - channel = gLuminanceProgram.enableTexture(LLShaderMgr::DEFERRED_NORMAL); + channel = gLuminanceProgram.enableTexture(LLShaderMgr::NORMAL_MAP); if (channel > -1) { // bind the normal map to get the environment mask @@ -7286,7 +7279,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) LLVector4a result; result.clear(); - gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, TRUE, nullptr, nullptr, nullptr, &result); + gViewerWindow->cursorIntersect(-1, -1, 512.f, nullptr, -1, false, false, true, true, nullptr, nullptr, nullptr, &result); focus_point.set(result.getF32ptr()); } @@ -7571,7 +7564,7 @@ void LLPipeline::bindShadowMaps(LLGLSLShader& shader) S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0 + i, LLTexUnit::TT_TEXTURE); if (channel > -1) { - gGL.getTexUnit(channel)->bind(getSunShadowTarget(i), TRUE); + gGL.getTexUnit(channel)->bind(getSunShadowTarget(i), true); } } } @@ -7584,7 +7577,7 @@ void LLPipeline::bindShadowMaps(LLGLSLShader& shader) LLRenderTarget* shadow_target = getSpotShadowTarget(i - 4); if (shadow_target) { - gGL.getTexUnit(channel)->bind(shadow_target, TRUE); + gGL.getTexUnit(channel)->bind(shadow_target, true); } } } @@ -7628,7 +7621,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } - channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage()); + channel = shader.enableTexture(LLShaderMgr::NORMAL_MAP, deferred_target->getUsage()); if (channel > -1) { deferred_target->bindTexture(2, channel, LLTexUnit::TFO_POINT); // frag_data[2] @@ -7647,11 +7640,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { if (depth_target) { - gGL.getTexUnit(channel)->bind(depth_target, TRUE); + gGL.getTexUnit(channel)->bind(depth_target, true); } else { - gGL.getTexUnit(channel)->bind(deferred_target, TRUE); + gGL.getTexUnit(channel)->bind(deferred_target, true); } stop_glerror(); } @@ -7672,7 +7665,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ if (sReflectionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX)) { - shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, FALSE, mReflectionModelView.m); + shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, false, mReflectionModelView.m); } channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); @@ -7717,7 +7710,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ mat[i+80] = mSunShadowMatrix[5].m[i]; } - shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat); + shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, false, mat); stop_glerror(); @@ -7739,7 +7732,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ m[4], m[5], m[6], m[8], m[9], m[10] }; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, true, mat); } } @@ -7828,7 +7821,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) { glh::matrix4f norm_mat = get_current_modelview().inverse().transpose(); - shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); + shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, false, norm_mat.m); } // auto adjust legacy sun color if needed @@ -8573,7 +8566,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) F32 proj_range = far_clip - near_clip; glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip); screen_to_light = trans * light_proj * screen_to_light; - shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, FALSE, screen_to_light.m); + shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, false, screen_to_light.m); shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip); shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v); shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v); @@ -8663,7 +8656,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) LLRenderTarget* deferred_light_target = &mRT->deferredLight; stop_glerror(); - shader.disableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage()); + shader.disableTexture(LLShaderMgr::NORMAL_MAP, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_EMISSIVE, deferred_target->getUsage()); @@ -8721,7 +8714,7 @@ void LLPipeline::setEnvMat(LLGLSLShader& shader) m[4], m[5], m[6], m[8], m[9], m[10] }; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, true, mat); } void LLPipeline::bindReflectionProbes(LLGLSLShader& shader) @@ -9588,7 +9581,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) shadow_cam = camera; shadow_cam.setFar(16.f); - LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(shadow_cam, false, false, true); LLVector3* frust = shadow_cam.mAgentFrustum; @@ -9895,7 +9888,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) set_current_modelview(view[j]); set_current_projection(proj[j]); - LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(shadow_cam, false, false, true); //shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR); shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip); @@ -10069,7 +10062,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) shadow_cam.setFar(far_clip); shadow_cam.setOrigin(origin); - LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(shadow_cam, false, false, true); // @@ -10237,7 +10230,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool result.clear(); grabReferences(result); - if (!avatar || !avatar->mDrawable) + if (!avatar || avatar->isDead() || !avatar->mDrawable) { LL_WARNS_ONCE("AvatarRenderPipeline") << "Avatar is " << (avatar ? "not drawable" : "null") << LL_ENDL; return; @@ -10584,7 +10577,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool if (!preview_avatar && !for_profile) { - avatar->mNeedsImpostorUpdate = FALSE; + avatar->mNeedsImpostorUpdate = false; avatar->cacheImpostorValues(); avatar->mLastImpostorUpdateFrameTime = gFrameTimeSeconds; } |