diff options
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 88 |
1 files changed, 72 insertions, 16 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bbff6c889f..7b379da2a9 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -523,7 +523,7 @@ void LLPipeline::init() if (mCubeVB.isNull()) { - mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB); + mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW); } mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); @@ -719,7 +719,7 @@ void LLPipeline::destroyGL() if (mMeshDirtyQueryObject) { - glDeleteQueriesARB(1, &mMeshDirtyQueryObject); + glDeleteQueries(1, &mMeshDirtyQueryObject); mMeshDirtyQueryObject = 0; } } @@ -895,15 +895,19 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (!mOcclusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; if (!addDeferredAttachments(mDeferredScreen)) return false; +#if GL_VERSION_1_1 GLuint screenFormat = GL_RGBA16; if (gGLManager.mIsAMD) { screenFormat = GL_RGBA12; } +#else + GLuint screenFormat = GL_RGBA16F; +#endif if (gGLManager.mGLVersion < 4.f && gGLManager.mIsNVIDIA) { - screenFormat = GL_RGBA16F_ARB; + screenFormat = GL_RGBA16F; } if (!mScreen.allocate(resX, resY, screenFormat, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; @@ -1282,7 +1286,7 @@ void LLPipeline::createGLBuffers() LLImageGL::generateTextures(1, &mNoiseMap); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); - LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false); + LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } @@ -1297,7 +1301,7 @@ void LLPipeline::createGLBuffers() LLImageGL::generateTextures(1, &mTrueNoiseMap); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap); - LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false); + LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } @@ -2382,7 +2386,9 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, LLPlane* pla gGL.loadMatrix(gGLLastModelView); LLGLDisable blend(GL_BLEND); +#if GL_VERSION_1_1 LLGLDisable test(GL_ALPHA_TEST); +#endif gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2399,7 +2405,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, LLPlane* pla { if (mCubeVB.isNull()) { //cube VB will be used for issuing occlusion queries - mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB); + mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW); } mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); } @@ -2633,7 +2639,9 @@ void LLPipeline::doOcclusion(LLCamera& camera) gGL.setColorMask(false, false); } LLGLDisable blend(GL_BLEND); +#if GL_VERSION_1_1 LLGLDisable test(GL_ALPHA_TEST); +#endif gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2655,7 +2663,7 @@ void LLPipeline::doOcclusion(LLCamera& camera) if (mCubeVB.isNull()) { //cube VB will be used for issuing occlusion queries - mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB); + mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW); } mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -4000,7 +4008,9 @@ void render_hud_elements() LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); gPipeline.disableLights(); +#if GL_VERSION_1_1 LLGLDisable fog(GL_FOG); +#endif LLGLSUIDefault gls_ui; LLGLEnable stencil(GL_STENCIL_TEST); @@ -4054,14 +4064,18 @@ void LLPipeline::renderHighlights() // Render highlighted faces. LLGLSPipelineAlpha gls_pipeline_alpha; LLColor4 color(1.f, 1.f, 1.f, 0.5f); +#if GL_VERSION_1_1 LLGLEnable color_mat(GL_COLOR_MATERIAL); +#endif disableLights(); if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD) && !mHighlightSet.empty()) { //draw blurry highlight image over screen LLGLEnable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); +#if GL_VERSION_1_1 LLGLDisable test(GL_ALPHA_TEST); +#endif LLGLEnable stencil(GL_STENCIL_TEST); gGL.flush(); @@ -4325,14 +4339,18 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate) LLGLSPipeline gls_pipeline; LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); +#if GL_VERSION_1_1 LLGLState gls_color_material(GL_COLOR_MATERIAL, mLightingDetail < 2); +#endif // Toggle backface culling for debugging LLGLEnable cull_face(mBackfaceCull ? GL_CULL_FACE : 0); // Set fog bool use_fog = hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG); +#if GL_VERSION_1_1 LLGLEnable fog_enable(use_fog && !gPipeline.canUseWindLightShadersOnObjects() ? GL_FOG : 0); +#endif gSky.updateFog(camera.getFar()); if (!use_fog) { @@ -4922,7 +4940,9 @@ void LLPipeline::renderDebug() glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); gGL.setColorMask(true, false); +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +#endif } //NavMesh @@ -4952,7 +4972,9 @@ void LLPipeline::renderDebug() gPathfindingProgram.bind(); gGL.flush(); +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +#endif glLineWidth(1.0f); gGL.flush(); } @@ -5009,7 +5031,9 @@ void LLPipeline::renderDebug() LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0); gGL.flush(); +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +#endif //get rid of some z-fighting LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); @@ -5034,8 +5058,10 @@ void LLPipeline::renderDebug() gGL.flush(); } +#if GL_VERSION_1_1 LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); +#endif F32 offset = gSavedSettings.getF32("PathfindingLineOffset"); @@ -5055,10 +5081,14 @@ void LLPipeline::renderDebug() } else { +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +#endif gPathfindingProgram.uniform1f(sAmbiance, ambiance); llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); +#if GL_VERSION_1_1 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +#endif } } @@ -5075,7 +5105,9 @@ void LLPipeline::renderDebug() glLineWidth(1.f); } +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +#endif } } } @@ -5086,7 +5118,9 @@ void LLPipeline::renderDebug() { //render navmesh xray F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance"); +#if GL_VERSION_1_1 LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); +#endif LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); F32 offset = gSavedSettings.getF32("PathfindingLineOffset"); @@ -5103,10 +5137,14 @@ void LLPipeline::renderDebug() if (gSavedSettings.getBOOL("PathfindingXRayWireframe")) { //draw hidden wireframe as darker and less opaque +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); +#endif gPathfindingProgram.uniform1f(sAmbiance, 1.f); llPathingLibInstance->renderNavMesh(); +#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +#endif } else { @@ -5147,7 +5185,9 @@ void LLPipeline::renderDebug() gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true); +#if GL_VERSION_1_1 glPointSize(8.f); +#endif LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); gGL.begin(LLRender::POINTS); @@ -5172,7 +5212,9 @@ void LLPipeline::renderDebug() } gGL.end(); gGL.flush(); +#if GL_VERSION_1_1 glPointSize(1.f); +#endif } @@ -5335,7 +5377,9 @@ void LLPipeline::renderDebug() { //render visible point cloud gGL.flush(); +#if GL_VERSION_1_1 glPointSize(8.f); +#endif gGL.begin(LLRender::POINTS); F32* c = col+i*4; @@ -5349,7 +5393,9 @@ void LLPipeline::renderDebug() gGL.end(); gGL.flush(); +#if GL_VERSION_1_1 glPointSize(1.f); +#endif LLVector3* ext = mShadowExtents[i]; LLVector3 pos = (ext[0]+ext[1])*0.5f; @@ -7440,7 +7486,7 @@ void apply_cube_face_rotation(U32 face) void validate_framebuffer_object() { GLenum status; - status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); switch(status) { case GL_FRAMEBUFFER_COMPLETE: @@ -7481,7 +7527,9 @@ void LLPipeline::renderFinalize() if (gUseWireframe) { +#if GL_VERSION_1_1 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +#endif } LLVector2 tc1(0, 0); @@ -7502,7 +7550,9 @@ void LLPipeline::renderFinalize() gGL.pushMatrix(); gGL.loadIdentity(); +#if GL_VERSION_1_1 LLGLDisable test(GL_ALPHA_TEST); +#endif gGL.setColorMask(true, true); glClearColor(0, 0, 0, 0); @@ -7529,7 +7579,9 @@ void LLPipeline::renderFinalize() { LLGLEnable blend_on(GL_BLEND); +#if GL_VERSION_1_1 LLGLEnable test(GL_ALPHA_TEST); +#endif gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); @@ -8167,8 +8219,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); stop_glerror(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); stop_glerror(); } } @@ -8189,8 +8241,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); stop_glerror(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); stop_glerror(); } } @@ -8541,7 +8593,9 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target) { LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); +#if GL_VERSION_1_1 LLGLDisable test(GL_ALPHA_TEST); +#endif // full screen blit gGL.pushMatrix(); @@ -8602,7 +8656,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target) if (mCubeVB.isNull()) { - mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB); + mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW); } mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -9104,7 +9158,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) { if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); } } @@ -9112,7 +9166,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) { if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); } } @@ -9961,7 +10015,9 @@ void LLPipeline::generateHighlight(LLCamera& camera) { F32 transition = gFrameIntervalSeconds.value()/RenderHighlightFadeTime; +#if GL_VERSION_1_1 LLGLDisable test(GL_ALPHA_TEST); +#endif LLGLDepthTest depth(GL_FALSE); mHighlight.bindTarget(); disableLights(); @@ -11131,7 +11187,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) { GLuint buff = GL_COLOR_ATTACHMENT0; LL_PROFILER_GPU_ZONEC( "gl.DrawBuffersARB", 0x8000FF ); - glDrawBuffersARB(1, &buff); + glDrawBuffers(1, &buff); } LLGLDisable blend(GL_BLEND); |