From 14f6bbadef2c39e58a3b54c0c6212949acf50e45 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 8 Aug 2011 15:29:23 -0500 Subject: SH-2242 Work in progress migrating to glVertexAttrib everywhere --- indra/newview/pipeline.cpp | 56 +++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7c2eaecf8b..8620894229 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -138,7 +138,7 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f; const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10; const U32 REFLECTION_MAP_RES = 128; - +const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; // Max number of occluders to search for. JC const S32 MAX_OCCLUDER_COUNT = 2; @@ -457,6 +457,8 @@ void LLPipeline::init() mSpotLightFade[i] = 1.f; } + mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); + mDeferredVB->allocateBuffer(3, 0, true); setLightingDetail(-1); } @@ -535,6 +537,8 @@ void LLPipeline::cleanup() mMovedBridge.clear(); mInitialized = FALSE; + + mDeferredVB = NULL; } //============================================================================ @@ -6983,6 +6987,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen shader.uniform1f("lum_scale", gSavedSettings.getF32("RenderLuminanceScale")); shader.uniform1f("sun_lum_scale", gSavedSettings.getF32("RenderSunLuminanceScale")); shader.uniform1f("sun_lum_offset", gSavedSettings.getF32("RenderSunLuminanceOffset")); + shader.uniform3fv("sun_dir", 1, mTransformedSunDir.mV); shader.uniform1f("lum_lod", gSavedSettings.getF32("RenderLuminanceDetail")); shader.uniform1f("gi_range", gSavedSettings.getF32("RenderGIRange")); shader.uniform1f("gi_brightness", gSavedSettings.getF32("RenderGIBrightness")); @@ -7057,21 +7062,23 @@ void LLPipeline::renderDeferredLighting() glh::matrix4f mat = glh_copy_matrix(gGLModelView); - F32 vert[] = - { - -1,1, - -1,-3, - 3,1, - }; - glVertexPointer(2, GL_FLOAT, 0, vert); - glColor3f(1,1,1); + LLStrider vert; + mDeferredVB->getVertexStrider(vert); + LLStrider tc0; + LLStrider tc1; + mDeferredVB->getTexCoord0Strider(tc0); + mDeferredVB->getTexCoord1Strider(tc1); + vert[0].set(-1,1,0); + vert[1].set(-1,-3,0); + vert[2].set(3,1,0); + { setupHWLights(NULL); //to set mSunDir; LLVector4 dir(mSunDir, 0.f); glh::vec4f tc(dir.mV); mat.mult_matrix_vec(tc); - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0); + mTransformedSunDir.set(dir.mV); } glPushMatrix(); @@ -7335,10 +7342,10 @@ void LLPipeline::renderDeferredLighting() glPushMatrix(); glLoadIdentity(); - glVertexPointer(2, GL_FLOAT, 0, vert); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); @@ -7347,7 +7354,7 @@ void LLPipeline::renderDeferredLighting() unbindDeferredShader(gDeferredSoftenProgram); } - { //render sky + { //render non-deferred geometry (fullbright, alpha, etc) LLGLDisable blend(GL_BLEND); LLGLDisable stencil(GL_STENCIL_TEST); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -7476,7 +7483,7 @@ void LLPipeline::renderDeferredLighting() LLFastTimer ftm(FTM_LOCAL_LIGHTS); glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); stop_glerror(); @@ -7542,7 +7549,7 @@ void LLPipeline::renderDeferredLighting() v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); } @@ -7553,6 +7560,8 @@ void LLPipeline::renderDeferredLighting() { bindDeferredShader(gDeferredMultiLightProgram); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + LLGLDepthTest depth(GL_FALSE); //full screen blit @@ -7568,7 +7577,7 @@ void LLPipeline::renderDeferredLighting() LLVector4 light[max_count]; LLVector4 col[max_count]; - glVertexPointer(2, GL_FLOAT, 0, vert); +// glVertexPointer(2, GL_FLOAT, 0, vert); F32 far_z = 0.f; @@ -7591,7 +7600,8 @@ void LLPipeline::renderDeferredLighting() gDeferredMultiLightProgram.uniform1f("far_z", far_z); far_z = 0.f; count = 0; - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } } @@ -7623,7 +7633,7 @@ void LLPipeline::renderDeferredLighting() col *= volume->getLightIntensity(); glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); } @@ -7660,8 +7670,8 @@ void LLPipeline::renderDeferredLighting() LLVertexBuffer::unbind(); - glVertexPointer(2, GL_FLOAT, 0, vert); - glColor3f(1,1,1); +// glVertexPointer(2, GL_FLOAT, 0, vert); + gGL.diffuseColor3f(1,1,1); glPushMatrix(); glLoadIdentity(); @@ -8297,7 +8307,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); stop_glerror(); @@ -8341,7 +8351,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); } -- cgit v1.2.3 From 2ee815478043c4d5845f094f744a055707dba0e0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Aug 2011 13:01:14 -0500 Subject: SH-2238, SH-2223, SH-SH-2242 glVertexAttrib throughout main render pipeline complete, preview renders and debug displays still pending. Also fixed a render glitch and a crash (JIRAs listed). --- indra/newview/pipeline.cpp | 126 ++++++++++++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 46 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d296081612..f6d021fda8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -458,7 +458,7 @@ void LLPipeline::init() } mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); - mDeferredVB->allocateBuffer(3, 0, true); + mDeferredVB->allocateBuffer(8, 0, true); setLightingDetail(-1); } @@ -3494,7 +3494,7 @@ void LLPipeline::renderHighlights() if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { gHighlightProgram.bind(); - gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,1,1,0.5f); + gHighlightProgram.uniform4f("highlight_color",1,1,1,0.5f); } if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) @@ -3526,7 +3526,7 @@ void LLPipeline::renderHighlights() color.setVec(1.f, 0.f, 0.f, 0.5f); if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { - gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,0,0,0.5f); + gHighlightProgram.uniform4f("highlight_color",1,0,0,0.5f); } int count = mHighlightFaces.size(); for (S32 i = 0; i < count; i++) @@ -7021,7 +7021,7 @@ void LLPipeline::renderDeferredLighting() LLVector4 dir(mSunDir, 0.f); glh::vec4f tc(dir.mV); mat.mult_matrix_vec(tc); - mTransformedSunDir.set(dir.mV); + mTransformedSunDir.set(tc.v); } glPushMatrix(); @@ -7036,7 +7036,7 @@ void LLPipeline::renderDeferredLighting() { //paint shadow/SSAO light map (direct lighting lightmap) LLFastTimer ftm(FTM_SUN_SHADOW); bindDeferredShader(gDeferredSunProgram, 0); - + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); glClearColor(1,1,1,1); mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT); glClearColor(0,0,0,0); @@ -7067,7 +7067,7 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } @@ -7091,7 +7091,8 @@ void LLPipeline::renderDeferredLighting() gDeferredEdgeProgram.bind(); mEdgeMap.bindTarget(); bindDeferredShader(gDeferredEdgeProgram); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); unbindDeferredShader(gDeferredEdgeProgram); mEdgeMap.flush(); } @@ -7113,7 +7114,8 @@ void LLPipeline::renderDeferredLighting() gLuminanceGatherProgram.uniform2f("screen_res", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight()); mLuminanceMap.bindTarget(); bindDeferredShader(gLuminanceGatherProgram); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); unbindDeferredShader(gLuminanceGatherProgram); mLuminanceMap.flush(); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true); @@ -7131,7 +7133,8 @@ void LLPipeline::renderDeferredLighting() mGIMapPost[0].bindTarget(); bindDeferredShader(gDeferredGIProgram, 0, &mGIMap, 0, mTrueNoiseMap); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); unbindDeferredShader(gDeferredGIProgram); mGIMapPost[0].flush(); } @@ -7156,7 +7159,8 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_FALSE); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } @@ -7171,7 +7175,8 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_FALSE); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } mGIMapPost[0].flush(); @@ -7185,13 +7190,12 @@ void LLPipeline::renderDeferredLighting() LLFastTimer ftm(FTM_SOFTEN_SHADOW); //blur lightmap mDeferredLight[1].bindTarget(); - glClearColor(1,1,1,1); mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT); glClearColor(0,0,0,0); bindDeferredShader(gDeferredBlurLightProgram); - + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian"); const U32 kern_length = 4; F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize"); @@ -7219,7 +7223,7 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } @@ -7227,6 +7231,7 @@ void LLPipeline::renderDeferredLighting() unbindDeferredShader(gDeferredBlurLightProgram); bindDeferredShader(gDeferredBlurLightProgram, 1); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); mDeferredLight[0].bindTarget(); gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f); @@ -7235,7 +7240,7 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } mDeferredLight[0].flush(); @@ -7338,12 +7343,12 @@ void LLPipeline::renderDeferredLighting() std::list light_colors; LLVertexBuffer::unbind(); + LLVector4a* v = (LLVector4a*) vert.get(); - F32 v[24]; - glVertexPointer(3, GL_FLOAT, 0, v); - { bindDeferredShader(gDeferredLightProgram); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + LLGLDepthTest depth(GL_TRUE, GL_FALSE); for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter) { @@ -7398,15 +7403,15 @@ void LLPipeline::renderDeferredLighting() //correspond to their axis facing, with bit position 3,2,1 matching //axis facing x,y,z, bit set meaning positive facing, bit clear //meaning negative facing - v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000 - v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001 - v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010 - v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011 + v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000 + v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001 + v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010 + v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011 - v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100 - v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101 - v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110 - v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 + v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100 + v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101 + v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110 + v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111 if (camera->getOrigin().mV[0] > c[0] + s + 0.2f || camera->getOrigin().mV[0] < c[0] - s - 0.2f || @@ -7425,8 +7430,12 @@ void LLPipeline::renderDeferredLighting() } LLFastTimer ftm(FTM_LOCAL_LIGHTS); - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + //glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); + gDeferredLightProgram.uniform3fv("center", 1, tc.v); + gDeferredLightProgram.uniform1f("size", s*s); + gDeferredLightProgram.uniform3fv("color", 1, col.mV); + gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); stop_glerror(); @@ -7453,6 +7462,8 @@ void LLPipeline::renderDeferredLighting() LLGLDepthTest depth(GL_TRUE, GL_FALSE); bindDeferredShader(gDeferredSpotLightProgram); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) @@ -7481,18 +7492,20 @@ void LLPipeline::renderDeferredLighting() //correspond to their axis facing, with bit position 3,2,1 matching //axis facing x,y,z, bit set meaning positive facing, bit clear //meaning negative facing - v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000 - v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001 - v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010 - v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011 + v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000 + v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001 + v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010 + v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011 - v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100 - v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101 - v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110 - v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 - - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100 + v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101 + v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110 + v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111 + + gDeferredSpotLightProgram.uniform3fv("center", 1, tc.v); + gDeferredSpotLightProgram.uniform1f("size", s*s); + gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV); + gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); } @@ -7500,6 +7513,11 @@ void LLPipeline::renderDeferredLighting() unbindDeferredShader(gDeferredSpotLightProgram); } + //reset mDeferredVB to fullscreen triangle + vert[0].set(-1,1,0); + vert[1].set(-1,-3,0); + vert[2].set(3,1,0); + { bindDeferredShader(gDeferredMultiLightProgram); @@ -7554,6 +7572,8 @@ void LLPipeline::renderDeferredLighting() gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter) { LLFastTimer ftm(FTM_PROJECTORS); @@ -7575,9 +7595,11 @@ void LLPipeline::renderDeferredLighting() LLColor3 col = volume->getLightColor(); col *= volume->getLightIntensity(); - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + gDeferredMultiSpotLightProgram.uniform3fv("center", 1, tc.v); + gDeferredMultiSpotLightProgram.uniform1f("size", s*s); + gDeferredMultiSpotLightProgram.uniform3fv("color", 1, col.mV); + gDeferredMultiSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); @@ -7610,7 +7632,7 @@ void LLPipeline::renderDeferredLighting() bindDeferredShader(gDeferredPostProgram, 0, &mGIMapPost[0]); gDeferredPostProgram.bind(); - + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); LLVertexBuffer::unbind(); // glVertexPointer(2, GL_FLOAT, 0, vert); @@ -7622,8 +7644,8 @@ void LLPipeline::renderDeferredLighting() glPushMatrix(); glLoadIdentity(); - glDrawArrays(GL_TRIANGLES, 0, 3); - + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); @@ -8294,12 +8316,14 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); - gGL.diffuseColor4f(1,1,1,1); + gDeferredTreeShadowProgram.bind(); + gDeferredTreeShadowProgram.setAlphaRange(0.6f, 1.f); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); } //glCullFace(GL_BACK); + gDeferredShadowProgram.bind(); gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); doOcclusion(shadow_cam); @@ -9676,6 +9700,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) static const F32 clip_plane = 0.99999f; + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gGL.color4ub(64,64,64,255); gGL.begin(LLRender::QUADS); gGL.vertex3f(-1, -1, clip_plane); @@ -9685,6 +9714,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) gGL.end(); gGL.flush(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } + glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); -- cgit v1.2.3