Merge branch 'master' of git://github.com/Shyotl/SingularityViewer

This commit is contained in:
Latif Khalifa
2013-12-25 18:08:42 +01:00
10 changed files with 254 additions and 251 deletions

View File

@@ -399,7 +399,7 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
//Setup our VBO.
{
mVBO = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1,3);
mVBO = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1,GL_STREAM_DRAW_ARB);
mVBO->allocateBuffer(4,0,TRUE);
LLStrider<LLVector3> v;

View File

@@ -1179,7 +1179,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("shadow_target_width");
mReservedUniforms.push_back("downsampled_depth_scale");
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH+1);
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_DOWNSAMPLED_DEPTH_SCALE+1);
mReservedUniforms.push_back("tc_scale");
mReservedUniforms.push_back("rcp_screen_res");

View File

@@ -187,7 +187,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)
{
glBufferDataARB(mType, size, 0, mUsage);
ret = (U8*) ll_aligned_malloc_16(size);
ret = (U8*) ll_aligned_malloc(size, 64);
}
else
{ //always use a true hint of static draw when allocating non-client-backed buffers
@@ -240,7 +240,7 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)
llassert(vbo_block_size(size) == size);
deleteBuffer(name);
ll_aligned_free_16((U8*) buffer);
ll_aligned_free((U8*) buffer);
if (mType == GL_ARRAY_BUFFER_ARB)
{
@@ -294,7 +294,7 @@ void LLVBOPool::cleanup()
if (r.mClientData)
{
ll_aligned_free_16((void*) r.mClientData);
ll_aligned_free((void*) r.mClientData);
}
l.pop_front();
@@ -356,6 +356,13 @@ static std::string vb_type_name[] =
"TYPE_INDEX",
};
// static
const std::string& LLVertexBuffer::getTypeName(U8 i)
{
llassert_always(i < (U8)(sizeof(vb_type_name) / sizeof(std::string)));
return vb_type_name[i];
}
U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] =
{
GL_TRIANGLES,
@@ -582,16 +589,8 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, con
if (shader)
{
S32 loc = LLVertexBuffer::TYPE_VERTEX;
if (loc > -1)
{
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV);
}
loc = LLVertexBuffer::TYPE_NORMAL;
if (loc > -1)
{
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV);
}
glVertexAttribPointerARB(TYPE_VERTEX, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV);
glVertexAttribPointerARB(TYPE_NORMAL, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV);
}
else
{
@@ -621,19 +620,19 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto
if (LLGLSLShader::sNoFixedFunction)
{
S32 loc = LLVertexBuffer::TYPE_VERTEX;
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 16, pos);
glVertexAttribPointerARB(TYPE_VERTEX, 3, GL_FLOAT, GL_FALSE, 16, pos);
if (tc)
{
loc = LLVertexBuffer::TYPE_TEXCOORD0;
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, 0, tc);
glVertexAttribPointerARB(TYPE_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, 0, tc);
}
}
else
{
glTexCoordPointer(2, GL_FLOAT, 0, tc);
glVertexPointer(3, GL_FLOAT, 16, pos);
if (tc)
{
glTexCoordPointer(2, GL_FLOAT, 0, tc);
}
}
glDrawElements(sGLMode[mode], num_indices, GL_UNSIGNED_SHORT, indicesp);

View File

@@ -119,6 +119,8 @@ public:
return *this;
}
static const std::string& getTypeName(U8 i);
static LLVBOPool sStreamVBOPool;
static LLVBOPool sDynamicVBOPool;
static LLVBOPool sStreamIBOPool;