SH-2242 Physics shape display works again, added asserts to flush out areas where state being consumed by a shader does not match state being provided by vertex buffers.
parent
bf0d36bf88
commit
7821ff23ba
|
|
@ -1583,15 +1583,11 @@ void LLRender::color3fv(const GLfloat* c)
|
|||
void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
S32 loc = -1;
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
loc = shader->getUniformLocation("color");
|
||||
}
|
||||
|
||||
if (loc >= 0)
|
||||
{
|
||||
shader->uniform4f(loc, r,g,b,1.f);
|
||||
shader->uniform4f("color", r,g,b,1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1602,15 +1598,11 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
|
|||
void LLRender::diffuseColor3fv(const F32* c)
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
S32 loc = -1;
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
loc = shader->getUniformLocation("color");
|
||||
}
|
||||
|
||||
if (loc >= 0)
|
||||
{
|
||||
shader->uniform4f(loc, c[0], c[1], c[2], 1.f);
|
||||
shader->uniform4f("color", c[0], c[1], c[2], 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1621,35 +1613,26 @@ void LLRender::diffuseColor3fv(const F32* c)
|
|||
void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a)
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
S32 loc = -1;
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
loc = shader->getUniformLocation("color");
|
||||
}
|
||||
|
||||
if (loc >= 0)
|
||||
{
|
||||
shader->uniform4f(loc, r,g,b,a);
|
||||
shader->uniform4f("color", r,g,b,a);
|
||||
}
|
||||
else
|
||||
{
|
||||
glColor4f(r,g,b,a);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LLRender::diffuseColor4fv(const F32* c)
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
S32 loc = -1;
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
loc = shader->getUniformLocation("color");
|
||||
}
|
||||
|
||||
if (loc >= 0)
|
||||
{
|
||||
shader->uniform4fv(loc, 1, c);
|
||||
shader->uniform4fv("color", 1, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1660,15 +1643,11 @@ void LLRender::diffuseColor4fv(const F32* c)
|
|||
void LLRender::diffuseColor4ubv(const U8* c)
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
S32 loc = -1;
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
loc = shader->getUniformLocation("color");
|
||||
}
|
||||
|
||||
if (loc >= 0)
|
||||
{
|
||||
shader->uniform4f(loc, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f);
|
||||
shader->uniform4f("color", c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1676,9 +1655,6 @@ void LLRender::diffuseColor4ubv(const U8* c)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LLRender::debugTexUnits(void)
|
||||
{
|
||||
LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -364,8 +364,26 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, con
|
|||
|
||||
setupClientArrays(MAP_VERTEX | MAP_NORMAL);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 0, pos[0].mV);
|
||||
glNormalPointer(GL_FLOAT, 0, norm[0].mV);
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
if (shader)
|
||||
{
|
||||
S32 loc = shader->getAttribLocation(LLVertexBuffer::TYPE_VERTEX);
|
||||
if (loc > -1)
|
||||
{
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV);
|
||||
}
|
||||
loc = shader->getAttribLocation(LLVertexBuffer::TYPE_NORMAL);
|
||||
if (loc > -1)
|
||||
{
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glVertexPointer(3, GL_FLOAT, 0, pos[0].mV);
|
||||
glNormalPointer(GL_FLOAT, 0, norm[0].mV);
|
||||
}
|
||||
|
||||
glDrawArrays(sGLMode[mode], 0, count);
|
||||
}
|
||||
|
|
@ -1730,6 +1748,34 @@ void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)
|
|||
//set up pointers if the data mask is different ...
|
||||
BOOL setup = (sLastMask != data_mask);
|
||||
|
||||
if (gDebugGL && data_mask != 0)
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
if (shader)
|
||||
{
|
||||
U32 required_mask = 0;
|
||||
for (U32 i = 0; i < LLVertexBuffer::TYPE_MAX; ++i)
|
||||
{
|
||||
if (shader->getAttribLocation(i) > -1)
|
||||
{
|
||||
U32 required = 1 << i;
|
||||
if ((data_mask & required) == 0)
|
||||
{
|
||||
llwarns << "Missing attribute: " << i << llendl;
|
||||
}
|
||||
|
||||
required_mask |= required;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ((data_mask & required_mask) != required_mask)
|
||||
{
|
||||
llerrs << "Shader consumption mismatches data provision." << llendl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (useVBOs())
|
||||
{
|
||||
if (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ attribute vec3 position;
|
|||
attribute vec4 diffuse_color;
|
||||
attribute vec3 normal;
|
||||
attribute vec2 texcoord0;
|
||||
attribute vec2 texcoord2;
|
||||
attribute vec3 binormal;
|
||||
|
||||
varying vec3 vary_mat0;
|
||||
varying vec3 vary_mat1;
|
||||
|
|
@ -40,7 +40,7 @@ void main()
|
|||
gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
|
||||
|
||||
vec3 n = normalize(gl_NormalMatrix * normal);
|
||||
vec3 b = normalize(gl_NormalMatrix * vec4(texcoord2,0,1).xyz);
|
||||
vec3 b = normalize(gl_NormalMatrix * binormal);
|
||||
vec3 t = cross(b, n);
|
||||
|
||||
vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
*/
|
||||
|
||||
|
||||
uniform vec4 highlight_color;
|
||||
uniform vec4 color;
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = highlight_color*texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
gl_FragColor = color*texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
|
||||
attribute vec3 position;
|
||||
attribute vec4 diffuse_color;
|
||||
attribute vec2 texcoord0;
|
||||
attribute vec2 texcoord1;
|
||||
|
||||
|
|
@ -35,5 +34,4 @@ void main()
|
|||
gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
|
||||
gl_TexCoord[1] = gl_TextureMatrix[1] * vec4(texcoord1,0,1);
|
||||
gl_FrontColor = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,13 +322,12 @@ void LLDrawPoolAlpha::render(S32 pass)
|
|||
if(shaders)
|
||||
{
|
||||
gHighlightProgram.bind();
|
||||
gHighlightProgram.uniform4f("highlight_color", 1,0,0,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gGL.diffuseColor4f(1,0,0,1);
|
||||
}
|
||||
gGL.diffuseColor4f(1,0,0,1);
|
||||
|
||||
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
|
||||
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
|
|||
{
|
||||
if (gPipeline.canUseVertexShaders())
|
||||
{
|
||||
gUIProgram.bind();
|
||||
gHighlightProgram.bind();
|
||||
}
|
||||
// *NOTE: even though we already bound this texture above for the
|
||||
// stars register combiners, we bind again here for defensive reasons,
|
||||
|
|
@ -289,7 +289,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
|
|||
|
||||
if (gPipeline.canUseVertexShaders())
|
||||
{
|
||||
gUIProgram.unbind();
|
||||
gHighlightProgram.unbind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5637,7 +5637,7 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
|
|||
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
|
||||
if (shader)
|
||||
{
|
||||
gHighlightProgram.uniform4f("highlight_color", color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
|
||||
gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
|
||||
pushWireframe(drawable);
|
||||
}
|
||||
else
|
||||
|
|
@ -5661,14 +5661,8 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
|
|||
gGL.flush();
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
gHighlightProgram.uniform4f("highlight_color", color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
|
||||
}
|
||||
gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
|
||||
|
||||
LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
|
||||
glPolygonOffset(3.f, 3.f);
|
||||
glLineWidth(3.f);
|
||||
|
|
|
|||
|
|
@ -2944,7 +2944,7 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
|
|||
else
|
||||
{
|
||||
gMeshRepo.buildPhysicsMesh(*decomp);
|
||||
gGL.color3f(0,1,1);
|
||||
gGL.diffuseColor4f(0,1,1,1);
|
||||
drawBoxOutline(center, size);
|
||||
}
|
||||
|
||||
|
|
@ -3078,7 +3078,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||
{
|
||||
renderMeshBaseHull(volume, data_mask, color, line_color);
|
||||
}
|
||||
#if LL_WINDOWS
|
||||
else
|
||||
{
|
||||
LLVolumeParams volume_params = volume->getVolume()->getParams();
|
||||
|
|
@ -3190,13 +3189,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||
}
|
||||
else
|
||||
{
|
||||
gGL.color3f(1,0,1);
|
||||
gGL.diffuseColor4f(1,0,1,1);
|
||||
drawBoxOutline(center, size);
|
||||
}
|
||||
|
||||
LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
|
||||
}
|
||||
#endif //LL_WINDOWS
|
||||
}
|
||||
else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX)
|
||||
{
|
||||
|
|
@ -3210,7 +3208,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||
}
|
||||
else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE)
|
||||
{
|
||||
LLVolumeParams volume_params;
|
||||
/*LLVolumeParams volume_params;
|
||||
volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
|
||||
volume_params.setBeginAndEndS( 0.f, 1.f );
|
||||
volume_params.setBeginAndEndT( 0.f, 1.f );
|
||||
|
|
@ -3220,7 +3218,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||
|
||||
gGL.diffuseColor4fv(color.mV);
|
||||
pushVerts(sphere);
|
||||
LLPrimitive::sVolumeManager->unrefVolume(sphere);
|
||||
LLPrimitive::sVolumeManager->unrefVolume(sphere);*/
|
||||
}
|
||||
else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER)
|
||||
{
|
||||
|
|
@ -3290,15 +3288,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||
}
|
||||
|
||||
gGL.popMatrix();
|
||||
|
||||
/*{ //analytical shape, just push visual rep.
|
||||
gGL.diffuseColor3fv(color.mV);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
pushVerts(drawable, data_mask);
|
||||
gGL.diffuseColor4fv(color.mV);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
pushVerts(drawable, data_mask);
|
||||
}*/
|
||||
}
|
||||
|
||||
void renderPhysicsShapes(LLSpatialGroup* group)
|
||||
|
|
|
|||
|
|
@ -719,6 +719,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery");
|
||||
gPipeline.generateWaterReflection(*LLViewerCamera::getInstance());
|
||||
gPipeline.generateHighlight(*LLViewerCamera::getInstance());
|
||||
gPipeline.renderPhysicsDisplay();
|
||||
}
|
||||
|
||||
LLGLState::checkStates();
|
||||
|
|
@ -1454,6 +1455,11 @@ void render_ui_2d()
|
|||
|
||||
void render_disconnected_background()
|
||||
{
|
||||
if (LLGLSLShader::sNoFixedFunction)
|
||||
{
|
||||
gUIProgram.bind();
|
||||
}
|
||||
|
||||
gGL.color4f(1,1,1,1);
|
||||
if (!gDisconnectedImagep && gDisconnected)
|
||||
{
|
||||
|
|
@ -1523,6 +1529,12 @@ void render_disconnected_background()
|
|||
glPopMatrix();
|
||||
}
|
||||
gGL.flush();
|
||||
|
||||
if (LLGLSLShader::sNoFixedFunction)
|
||||
{
|
||||
gUIProgram.unbind();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void display_cleanup()
|
||||
|
|
|
|||
|
|
@ -4480,8 +4480,6 @@ void LLPipeline::renderDebug()
|
|||
{
|
||||
gUIProgram.unbind();
|
||||
}
|
||||
|
||||
gPipeline.renderPhysicsDisplay();
|
||||
}
|
||||
|
||||
void LLPipeline::rebuildPools()
|
||||
|
|
|
|||
Loading…
Reference in New Issue