Merge branch 'DRTVWR-559' of https://bitbucket.org/lindenlab/viewer
# Conflicts: # indra/llmath/llvolume.cpp # indra/llrender/llglslshader.cpp # indra/llrender/llpostprocess.cpp # indra/llrender/llrender.cpp # indra/newview/llpanelface.cpp # indra/newview/lltexturectrl.cpp # indra/newview/llvieweroctree.cpp # indra/newview/llviewershadermgr.cpp # indra/newview/skins/default/xui/en/floater_texture_ctrl.xmlmaster
commit
1f176fdc18
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
include(Variables)
|
||||
include(Mikktspace)
|
||||
include(MESHOPTIMIZER)
|
||||
|
||||
set(LLMATH_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llmath
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@
|
|||
#include "mikktspace/mikktspace.h"
|
||||
#include "mikktspace/mikktspace.c" // insert mikktspace implementation into llvolume object file
|
||||
|
||||
#include "meshoptimizer/meshoptimizer.h"
|
||||
|
||||
#define DEBUG_SILHOUETTE_BINORMALS 0
|
||||
#define DEBUG_SILHOUETTE_NORMALS 0 // TomY: Use this to display normals using the silhouette
|
||||
#define DEBUG_SILHOUETTE_EDGE_MAP 0 // DaveP: Use this to display edge map using the silhouette
|
||||
|
|
@ -2120,7 +2122,12 @@ void LLVolume::regen()
|
|||
|
||||
void LLVolume::genTangents(S32 face, bool mikktspace)
|
||||
{
|
||||
mVolumeFaces[face].createTangents(mikktspace);
|
||||
// generate legacy tangents for the specified face
|
||||
// if mikktspace is true, only generate tangents if mikktspace tangents are not present (handles the case for non-mesh prims)
|
||||
if (!mikktspace || mVolumeFaces[face].mMikktSpaceTangents == nullptr)
|
||||
{
|
||||
mVolumeFaces[face].createTangents();
|
||||
}
|
||||
}
|
||||
|
||||
LLVolume::~LLVolume()
|
||||
|
|
@ -2464,11 +2471,10 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
|
|||
|
||||
LLSD::Binary pos = mdl[i]["Position"];
|
||||
LLSD::Binary norm = mdl[i]["Normal"];
|
||||
LLSD::Binary tangent = mdl[i]["Tangent"];
|
||||
LLSD::Binary tc = mdl[i]["TexCoord0"];
|
||||
LLSD::Binary idx = mdl[i]["TriangleList"];
|
||||
|
||||
|
||||
|
||||
//copy out indices
|
||||
S32 num_indices = idx.size() / 2;
|
||||
face.resizeIndices(num_indices);
|
||||
|
|
@ -2567,6 +2573,33 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (!tangent.empty())
|
||||
{
|
||||
face.allocateTangents(face.mNumVertices, true);
|
||||
U16* t = (U16*)&(tangent[0]);
|
||||
|
||||
// store incoming tangents in mMikktSpaceTangents
|
||||
// NOTE: tangents coming from the asset may not be mikkt space, but they should always be used by the CLTF shaders to
|
||||
// maintain compliance with the GLTF spec
|
||||
LLVector4a* t_out = face.mMikktSpaceTangents;
|
||||
|
||||
for (U32 j = 0; j < num_verts; ++j)
|
||||
{
|
||||
t_out->set((F32)t[0], (F32)t[1], (F32)t[2], (F32) t[3]);
|
||||
t_out->div(65535.f);
|
||||
t_out->mul(2.f);
|
||||
t_out->sub(1.f);
|
||||
|
||||
F32* tp = t_out->getF32ptr();
|
||||
tp[3] = tp[3] < 0.f ? -1.f : 1.f;
|
||||
|
||||
t_out++;
|
||||
t += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (!tc.empty())
|
||||
{
|
||||
|
|
@ -5442,262 +5475,198 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// data structures for tangent generation
|
||||
|
||||
struct MikktData
|
||||
{
|
||||
LLVolumeFace* face;
|
||||
std::vector<LLVector3> p;
|
||||
std::vector<LLVector3> n;
|
||||
std::vector<LLVector2> tc;
|
||||
std::vector<LLVector4> w;
|
||||
std::vector<LLVector4> t;
|
||||
|
||||
MikktData(LLVolumeFace* f)
|
||||
: face(f)
|
||||
{
|
||||
U32 count = face->mNumIndices;
|
||||
|
||||
p.resize(count);
|
||||
n.resize(count);
|
||||
tc.resize(count);
|
||||
t.resize(count);
|
||||
|
||||
if (face->mWeights)
|
||||
{
|
||||
w.resize(count);
|
||||
}
|
||||
|
||||
for (int i = 0; i < face->mNumIndices; ++i)
|
||||
{
|
||||
U32 idx = face->mIndices[i];
|
||||
|
||||
p[i].set(face->mPositions[idx].getF32ptr());
|
||||
n[i].set(face->mNormals[idx].getF32ptr());
|
||||
tc[i].set(face->mTexCoords[idx]);
|
||||
|
||||
if (face->mWeights)
|
||||
{
|
||||
w[i].set(face->mWeights[idx].getF32ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool LLVolumeFace::cacheOptimize()
|
||||
{ //optimize for vertex cache according to Forsyth method:
|
||||
// http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
|
||||
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
|
||||
llassert(!mOptimized);
|
||||
mOptimized = TRUE;
|
||||
|
||||
// <FS:ND> FIRE-23370/BUG-8801/MAIN-5060/FIRE-29492
|
||||
// cacheOptimize will destroy triangles. This is due to LLVCacheVertexData pointing to vertices in the vector vertex_data.
|
||||
// Once vertex_data is sorted (std::sort(triangle_data.begin(), triangle_data.end()) ) this will invalidate those pointers and
|
||||
// LLVCacheVertexData suddenly does point to unrelated vertices. It is an interesting fact that this is no problem for the
|
||||
// windows version.
|
||||
//
|
||||
|
||||
#ifndef LL_LINUX
|
||||
LLVCacheLRU cache;
|
||||
|
||||
if (mNumVertices < 3 || mNumIndices < 3)
|
||||
{ //nothing to do
|
||||
return true;
|
||||
}
|
||||
|
||||
//mapping of vertices to triangles and indices
|
||||
std::vector<LLVCacheVertexData> vertex_data;
|
||||
|
||||
//mapping of triangles do vertices
|
||||
std::vector<LLVCacheTriangleData> triangle_data;
|
||||
|
||||
try
|
||||
{
|
||||
triangle_data.resize(mNumIndices / 3);
|
||||
vertex_data.resize(mNumVertices);
|
||||
|
||||
for (U32 i = 0; i < mNumIndices; i++)
|
||||
{ //populate vertex data and triangle data arrays
|
||||
U16 idx = mIndices[i];
|
||||
U32 tri_idx = i / 3;
|
||||
|
||||
vertex_data[idx].mTriangles.push_back(&(triangle_data[tri_idx]));
|
||||
vertex_data[idx].mIdx = idx;
|
||||
triangle_data[tri_idx].mVertex[i % 3] = &(vertex_data[idx]);
|
||||
}
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
// resize or push_back failed
|
||||
LL_WARNS("LLVOLUME") << "Resize for " << mNumVertices << " vertices failed" << LL_ENDL;
|
||||
if (!mNormals || !mTexCoords)
|
||||
{ // can't perform this operation without normals and texture coordinates
|
||||
return false;
|
||||
}
|
||||
|
||||
/*F32 pre_acmr = 1.f;
|
||||
//measure cache misses from before rebuild
|
||||
{
|
||||
LLVCacheFIFO test_cache;
|
||||
for (U32 i = 0; i < mNumIndices; ++i)
|
||||
{
|
||||
test_cache.addVertex(&vertex_data[mIndices[i]]);
|
||||
}
|
||||
if (mMikktSpaceTangents == nullptr)
|
||||
{ // make sure to generate mikkt space tangents for cache optimizing since the index buffer may change
|
||||
allocateTangents(mNumVertices, true);
|
||||
|
||||
for (U32 i = 0; i < mNumVertices; i++)
|
||||
{
|
||||
vertex_data[i].mCacheTag = -1;
|
||||
}
|
||||
SMikkTSpaceInterface ms;
|
||||
|
||||
pre_acmr = (F32) test_cache.mMisses/(mNumIndices/3);
|
||||
}*/
|
||||
ms.m_getNumFaces = [](const SMikkTSpaceContext* pContext)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
return face->mNumIndices / 3;
|
||||
};
|
||||
|
||||
for (U32 i = 0; i < mNumVertices; i++)
|
||||
{ //initialize score values (no cache -- might try a fifo cache here)
|
||||
LLVCacheVertexData& data = vertex_data[i];
|
||||
ms.m_getNumVerticesOfFace = [](const SMikkTSpaceContext* pContext, const int iFace)
|
||||
{
|
||||
return 3;
|
||||
};
|
||||
|
||||
data.mScore = find_vertex_score(data);
|
||||
data.mActiveTriangles = data.mTriangles.size();
|
||||
ms.m_getPosition = [](const SMikkTSpaceContext* pContext, float fvPosOut[], const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 idx = face->mIndices[iFace * 3 + iVert];
|
||||
auto& vert = face->mPositions[idx];
|
||||
F32* v = vert.getF32ptr();
|
||||
fvPosOut[0] = v[0];
|
||||
fvPosOut[1] = v[1];
|
||||
fvPosOut[2] = v[2];
|
||||
};
|
||||
|
||||
for (U32 j = 0; j < data.mActiveTriangles; ++j)
|
||||
{
|
||||
data.mTriangles[j]->mScore += data.mScore;
|
||||
}
|
||||
}
|
||||
ms.m_getNormal = [](const SMikkTSpaceContext* pContext, float fvNormOut[], const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 idx = face->mIndices[iFace * 3 + iVert];
|
||||
auto& norm = face->mNormals[idx];
|
||||
F32* n = norm.getF32ptr();
|
||||
fvNormOut[0] = n[0];
|
||||
fvNormOut[1] = n[1];
|
||||
fvNormOut[2] = n[2];
|
||||
};
|
||||
|
||||
//sort triangle data by score
|
||||
std::sort(triangle_data.begin(), triangle_data.end());
|
||||
|
||||
std::vector<U16> new_indices;
|
||||
ms.m_getTexCoord = [](const SMikkTSpaceContext* pContext, float fvTexcOut[], const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 idx = face->mIndices[iFace * 3 + iVert];
|
||||
auto& tc = face->mTexCoords[idx];
|
||||
fvTexcOut[0] = tc.mV[0];
|
||||
fvTexcOut[1] = tc.mV[1];
|
||||
};
|
||||
|
||||
LLVCacheTriangleData* tri;
|
||||
ms.m_setTSpaceBasic = [](const SMikkTSpaceContext* pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 i = iFace * 3 + iVert;
|
||||
S32 idx = face->mIndices[i];
|
||||
|
||||
//prime pump by adding first triangle to cache;
|
||||
tri = &(triangle_data[0]);
|
||||
|
||||
cache.addTriangle(tri);
|
||||
new_indices.push_back(tri->mVertex[0]->mIdx);
|
||||
new_indices.push_back(tri->mVertex[1]->mIdx);
|
||||
new_indices.push_back(tri->mVertex[2]->mIdx);
|
||||
tri->complete();
|
||||
LLVector3 p(face->mPositions[idx].getF32ptr());
|
||||
LLVector3 n(face->mNormals[idx].getF32ptr());
|
||||
LLVector3 t(fvTangent);
|
||||
|
||||
U32 breaks = 0;
|
||||
for (U32 i = 1; i < mNumIndices/3; ++i)
|
||||
{
|
||||
cache.updateScores();
|
||||
tri = cache.mBestTriangle;
|
||||
if (!tri)
|
||||
{
|
||||
breaks++;
|
||||
for (U32 j = 0; j < triangle_data.size(); ++j)
|
||||
{
|
||||
if (triangle_data[j].mActive)
|
||||
{
|
||||
tri = &(triangle_data[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache.addTriangle(tri);
|
||||
new_indices.push_back(tri->mVertex[0]->mIdx);
|
||||
new_indices.push_back(tri->mVertex[1]->mIdx);
|
||||
new_indices.push_back(tri->mVertex[2]->mIdx);
|
||||
tri->complete();
|
||||
}
|
||||
// assert that this tangent hasn't already been set
|
||||
llassert(data->t[i].magVec() < 0.1f);
|
||||
|
||||
for (U32 i = 0; i < mNumIndices; ++i)
|
||||
{
|
||||
mIndices[i] = new_indices[i];
|
||||
}
|
||||
data->t[i].set(fvTangent);
|
||||
data->t[i].mV[3] = fSign;
|
||||
};
|
||||
|
||||
/*F32 post_acmr = 1.f;
|
||||
//measure cache misses from after rebuild
|
||||
{
|
||||
LLVCacheFIFO test_cache;
|
||||
for (U32 i = 0; i < mNumVertices; i++)
|
||||
{
|
||||
vertex_data[i].mCacheTag = -1;
|
||||
}
|
||||
ms.m_setTSpace = nullptr;
|
||||
|
||||
for (U32 i = 0; i < mNumIndices; ++i)
|
||||
{
|
||||
test_cache.addVertex(&vertex_data[mIndices[i]]);
|
||||
}
|
||||
|
||||
post_acmr = (F32) test_cache.mMisses/(mNumIndices/3);
|
||||
}*/
|
||||
MikktData data(this);
|
||||
|
||||
//optimize for pre-TnL cache
|
||||
|
||||
//allocate space for new buffer
|
||||
S32 num_verts = mNumVertices;
|
||||
S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF;
|
||||
LLVector4a* pos = (LLVector4a*) ll_aligned_malloc<64>(sizeof(LLVector4a)*2*num_verts+size);
|
||||
if (pos == NULL)
|
||||
{
|
||||
LL_WARNS("LLVOLUME") << "Allocation of positions vector[" << sizeof(LLVector4a) * 2 * num_verts + size << "] failed. " << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
LLVector4a* norm = pos + num_verts;
|
||||
LLVector2* tc = (LLVector2*) (norm + num_verts);
|
||||
SMikkTSpaceContext ctx = { &ms, &data };
|
||||
|
||||
LLVector4a* wght = NULL;
|
||||
if (mWeights)
|
||||
{
|
||||
wght = (LLVector4a*)ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
||||
if (wght == NULL)
|
||||
{
|
||||
ll_aligned_free<64>(pos);
|
||||
LL_WARNS("LLVOLUME") << "Allocation of weights[" << sizeof(LLVector4a) * num_verts << "] failed" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
genTangSpaceDefault(&ctx);
|
||||
|
||||
llassert(mTangents == nullptr); // cache optimize called too late, tangents already generated
|
||||
llassert(mMikktSpaceTangents == nullptr);
|
||||
//re-weld
|
||||
meshopt_Stream mos[] =
|
||||
{
|
||||
{ &data.p[0], sizeof(LLVector3), sizeof(LLVector3) },
|
||||
{ &data.n[0], sizeof(LLVector3), sizeof(LLVector3) },
|
||||
{ &data.t[0], sizeof(LLVector4), sizeof(LLVector4) },
|
||||
{ &data.tc[0], sizeof(LLVector2), sizeof(LLVector2) },
|
||||
{ data.w.empty() ? nullptr : &data.w[0], sizeof(LLVector4), sizeof(LLVector4) }
|
||||
};
|
||||
|
||||
// =====================================================================================
|
||||
// DEPRECATED -- cacheOptimize should always be called before tangents are generated
|
||||
// =====================================================================================
|
||||
LLVector4a* binorm = NULL;
|
||||
if (mTangents)
|
||||
{
|
||||
binorm = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
||||
if (binorm == NULL)
|
||||
{
|
||||
ll_aligned_free<64>(pos);
|
||||
ll_aligned_free_16(wght);
|
||||
LL_WARNS("LLVOLUME") << "Allocation of binormals[" << sizeof(LLVector4a)*num_verts << "] failed" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// =====================================================================================
|
||||
std::vector<U32> remap;
|
||||
remap.resize(data.p.size());
|
||||
|
||||
//allocate mapping of old indices to new indices
|
||||
std::vector<S32> new_idx;
|
||||
try
|
||||
{
|
||||
new_idx.resize(mNumVertices, -1);
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
ll_aligned_free<64>(pos);
|
||||
ll_aligned_free_16(wght);
|
||||
ll_aligned_free_16(binorm);
|
||||
LL_WARNS("LLVOLUME") << "Resize failed: " << mNumVertices << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
U32 stream_count = data.w.empty() ? 4 : 5;
|
||||
|
||||
S32 cur_idx = 0;
|
||||
for (U32 i = 0; i < mNumIndices; ++i)
|
||||
{
|
||||
U16 idx = mIndices[i];
|
||||
if (new_idx[idx] == -1)
|
||||
{ //this vertex hasn't been added yet
|
||||
new_idx[idx] = cur_idx;
|
||||
U32 vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count);
|
||||
|
||||
//copy vertex data
|
||||
pos[cur_idx] = mPositions[idx];
|
||||
norm[cur_idx] = mNormals[idx];
|
||||
tc[cur_idx] = mTexCoords[idx];
|
||||
if (mWeights)
|
||||
{
|
||||
wght[cur_idx] = mWeights[idx];
|
||||
}
|
||||
if (mTangents)
|
||||
{
|
||||
binorm[cur_idx] = mTangents[idx];
|
||||
}
|
||||
std::vector<U32> indices;
|
||||
indices.resize(mNumIndices);
|
||||
|
||||
cur_idx++;
|
||||
}
|
||||
}
|
||||
//copy results back into volume
|
||||
resizeVertices(vert_count);
|
||||
|
||||
for (U32 i = 0; i < mNumIndices; ++i)
|
||||
{
|
||||
mIndices[i] = new_idx[mIndices[i]];
|
||||
}
|
||||
|
||||
ll_aligned_free<64>(mPositions);
|
||||
// DO NOT free mNormals and mTexCoords as they are part of mPositions buffer
|
||||
ll_aligned_free_16(mWeights);
|
||||
ll_aligned_free_16(mTangents);
|
||||
#if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS
|
||||
ll_aligned_free_16(mJointIndices);
|
||||
ll_aligned_free_16(mJustWeights);
|
||||
mJustWeights = NULL;
|
||||
mJointIndices = NULL; // filled in later as necessary by skinning code for acceleration
|
||||
#endif
|
||||
if (!data.w.empty())
|
||||
{
|
||||
allocateWeights(vert_count);
|
||||
}
|
||||
|
||||
mPositions = pos;
|
||||
mNormals = norm;
|
||||
mTexCoords = tc;
|
||||
mWeights = wght;
|
||||
mTangents = binorm;
|
||||
allocateTangents(mNumVertices, true);
|
||||
|
||||
for (int i = 0; i < mNumIndices; ++i)
|
||||
{
|
||||
U32 src_idx = i;
|
||||
U32 dst_idx = remap[i];
|
||||
mIndices[i] = dst_idx;
|
||||
|
||||
mPositions[dst_idx].load3(data.p[src_idx].mV);
|
||||
mNormals[dst_idx].load3(data.n[src_idx].mV);
|
||||
mTexCoords[dst_idx] = data.tc[src_idx];
|
||||
|
||||
mMikktSpaceTangents[dst_idx].loadua(data.t[src_idx].mV);
|
||||
|
||||
if (mWeights)
|
||||
{
|
||||
mWeights[dst_idx].loadua(data.w[src_idx].mV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cache optimize index buffer
|
||||
|
||||
// meshopt needs scratch space, do some pointer shuffling to avoid an extra index buffer copy
|
||||
U16* src_indices = mIndices;
|
||||
mIndices = nullptr;
|
||||
resizeIndices(mNumIndices);
|
||||
|
||||
meshopt_optimizeVertexCache<U16>(mIndices, src_indices, mNumIndices, mNumVertices);
|
||||
|
||||
ll_aligned_free_16(src_indices);
|
||||
|
||||
//std::string result = llformat("ACMR pre/post: %.3f/%.3f -- %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks);
|
||||
//LL_INFOS() << result << LL_ENDL;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -6496,209 +6465,25 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
|||
void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal,
|
||||
const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent);
|
||||
|
||||
|
||||
// data structures for tangent generation
|
||||
|
||||
// key for summing tangents
|
||||
// We will blend tangents wherever a common position and normal is found
|
||||
struct MikktKey
|
||||
{
|
||||
// Position
|
||||
LLVector3 p;
|
||||
// Normal
|
||||
LLVector3 n;
|
||||
|
||||
bool operator==(const MikktKey& rhs) const { return p == rhs.p && n == rhs.n; }
|
||||
};
|
||||
|
||||
// sum of tangents and list of signs and index array indices for a given position and normal combination
|
||||
// sign must be kept separate from summed tangent because a single position and normal may have a different
|
||||
// tangent facing where UV seams exist
|
||||
struct MikktTangent
|
||||
{
|
||||
// tangent vector
|
||||
LLVector3 t;
|
||||
// signs
|
||||
std::vector<F32> s;
|
||||
// indices (in index array)
|
||||
std::vector<S32> i;
|
||||
};
|
||||
|
||||
// hash function for MikktTangent
|
||||
namespace boost
|
||||
{
|
||||
template <>
|
||||
struct hash<LLVector3>
|
||||
{
|
||||
std::size_t operator()(LLVector3 const& k) const
|
||||
{
|
||||
size_t seed = 0;
|
||||
boost::hash_combine(seed, k.mV[0]);
|
||||
boost::hash_combine(seed, k.mV[1]);
|
||||
boost::hash_combine(seed, k.mV[2]);
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<MikktKey>
|
||||
{
|
||||
std::size_t operator()(MikktKey const& k) const
|
||||
{
|
||||
size_t seed = 0;
|
||||
boost::hash_combine(seed, k.p);
|
||||
boost::hash_combine(seed, k.n);
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// boost adapter
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
struct hash<MikktKey>
|
||||
{
|
||||
std::size_t operator()(MikktKey const& k) const
|
||||
{
|
||||
return boost::hash<MikktKey>()(k);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
struct MikktData
|
||||
{
|
||||
LLVolumeFace* face;
|
||||
std::unordered_map<MikktKey, MikktTangent > tangents;
|
||||
};
|
||||
|
||||
|
||||
void LLVolumeFace::createTangents(bool mikktspace)
|
||||
void LLVolumeFace::createTangents()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
|
||||
|
||||
auto& tangents = mikktspace ? mMikktSpaceTangents : mTangents;
|
||||
|
||||
if (!tangents)
|
||||
|
||||
if (!mTangents)
|
||||
{
|
||||
allocateTangents(mNumVertices, mikktspace);
|
||||
allocateTangents(mNumVertices);
|
||||
|
||||
//generate tangents
|
||||
LLVector4a* ptr = (LLVector4a*)mTangents;
|
||||
|
||||
if (mikktspace)
|
||||
LLVector4a* end = mTangents + mNumVertices;
|
||||
while (ptr < end)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("mikktspace");
|
||||
SMikkTSpaceInterface ms;
|
||||
|
||||
ms.m_getNumFaces = [](const SMikkTSpaceContext* pContext)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
return face->mNumIndices / 3;
|
||||
};
|
||||
|
||||
ms.m_getNumVerticesOfFace = [](const SMikkTSpaceContext* pContext, const int iFace)
|
||||
{
|
||||
return 3;
|
||||
};
|
||||
|
||||
ms.m_getPosition = [](const SMikkTSpaceContext* pContext, float fvPosOut[], const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 idx = face->mIndices[iFace * 3 + iVert];
|
||||
auto& vert = face->mPositions[idx];
|
||||
F32* v = vert.getF32ptr();
|
||||
fvPosOut[0] = v[0];
|
||||
fvPosOut[1] = v[1];
|
||||
fvPosOut[2] = v[2];
|
||||
};
|
||||
|
||||
ms.m_getNormal = [](const SMikkTSpaceContext* pContext, float fvNormOut[], const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 idx = face->mIndices[iFace * 3 + iVert];
|
||||
auto& norm = face->mNormals[idx];
|
||||
F32* n = norm.getF32ptr();
|
||||
fvNormOut[0] = n[0];
|
||||
fvNormOut[1] = n[1];
|
||||
fvNormOut[2] = n[2];
|
||||
};
|
||||
|
||||
ms.m_getTexCoord = [](const SMikkTSpaceContext* pContext, float fvTexcOut[], const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 idx = face->mIndices[iFace * 3 + iVert];
|
||||
auto& tc = face->mTexCoords[idx];
|
||||
fvTexcOut[0] = tc.mV[0];
|
||||
fvTexcOut[1] = tc.mV[1];
|
||||
};
|
||||
|
||||
ms.m_setTSpaceBasic = [](const SMikkTSpaceContext* pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert)
|
||||
{
|
||||
MikktData* data = (MikktData*)pContext->m_pUserData;
|
||||
LLVolumeFace* face = data->face;
|
||||
S32 i = iFace * 3 + iVert;
|
||||
S32 idx = face->mIndices[i];
|
||||
|
||||
LLVector3 p(face->mPositions[idx].getF32ptr());
|
||||
LLVector3 n(face->mNormals[idx].getF32ptr());
|
||||
LLVector3 t(fvTangent);
|
||||
|
||||
MikktKey key = { p, n };
|
||||
|
||||
MikktTangent& mt = data->tangents[key];
|
||||
mt.t += t;
|
||||
mt.s.push_back(fSign);
|
||||
mt.i.push_back(i);
|
||||
};
|
||||
|
||||
ms.m_setTSpace = nullptr;
|
||||
|
||||
MikktData data;
|
||||
data.face = this;
|
||||
|
||||
SMikkTSpaceContext ctx = { &ms, &data };
|
||||
|
||||
genTangSpaceDefault(&ctx);
|
||||
|
||||
for (U32 i = 0; i < mNumVertices; ++i)
|
||||
{
|
||||
MikktKey key = { LLVector3(mPositions[i].getF32ptr()), LLVector3(mNormals[i].getF32ptr()) };
|
||||
MikktTangent& t = data.tangents[key];
|
||||
|
||||
//set tangent
|
||||
mMikktSpaceTangents[i].load3(t.t.mV);
|
||||
mMikktSpaceTangents[i].normalize3fast();
|
||||
|
||||
//set sign
|
||||
F32 sign = 0.f;
|
||||
for (int j = 0; j < t.i.size(); ++j)
|
||||
{
|
||||
if (mIndices[t.i[j]] == i)
|
||||
{
|
||||
sign = t.s[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
llassert(sign != 0.f);
|
||||
mMikktSpaceTangents[i].getF32ptr()[3] = sign;
|
||||
}
|
||||
(*ptr++).clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
//generate tangents
|
||||
LLVector4a* ptr = (LLVector4a*)tangents;
|
||||
|
||||
LLVector4a* end = mTangents + mNumVertices;
|
||||
while (ptr < end)
|
||||
{
|
||||
(*ptr++).clear();
|
||||
}
|
||||
|
||||
CalculateTangentArray(mNumVertices, mPositions, mNormals, mTexCoords, mNumIndices / 3, mIndices, tangents);
|
||||
}
|
||||
CalculateTangentArray(mNumVertices, mPositions, mNormals, mTexCoords, mNumIndices / 3, mIndices, mTangents);
|
||||
|
||||
//normalize normals
|
||||
for (U32 i = 0; i < mNumVertices; i++)
|
||||
|
|
@ -6707,6 +6492,7 @@ void LLVolumeFace::createTangents(bool mikktspace)
|
|||
mNormals[i].normalize3fast();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LLVolumeFace::resizeVertices(S32 num_verts)
|
||||
|
|
|
|||
|
|
@ -873,7 +873,7 @@ private:
|
|||
public:
|
||||
|
||||
BOOL create(LLVolume* volume, BOOL partial_build = FALSE);
|
||||
void createTangents(bool mikktspace = false);
|
||||
void createTangents();
|
||||
|
||||
void resizeVertices(S32 num_verts);
|
||||
void allocateTangents(S32 num_verts, bool mikktspace = false);
|
||||
|
|
|
|||
|
|
@ -2695,6 +2695,9 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
|
|||
LLVolume::face_list_t remainder;
|
||||
do
|
||||
{
|
||||
// generate tangents and cache optimize before normalizing
|
||||
ret->preprocessVolumeFaces();
|
||||
|
||||
// Insure we do this once with the whole gang and not per-model
|
||||
//
|
||||
if (!normalized && !mNoNormalize)
|
||||
|
|
@ -2705,10 +2708,11 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
|
|||
|
||||
ret->trimVolumeFacesToSize(LL_SCULPT_MESH_MAX_FACES, &remainder);
|
||||
|
||||
if (!mNoOptimize)
|
||||
{
|
||||
ret->remapVolumeFaces();
|
||||
}
|
||||
// remove unused/redundant vertices after normalizing
|
||||
//if (!mNoOptimize)
|
||||
//{
|
||||
// ret->remapVolumeFaces();
|
||||
//}
|
||||
|
||||
volume_faces = remainder.size();
|
||||
|
||||
|
|
|
|||
|
|
@ -190,6 +190,15 @@ void LLModel::trimVolumeFacesToSize(U32 new_count, LLVolume::face_list_t* remain
|
|||
}
|
||||
}
|
||||
|
||||
// generate mikkt space tangents and cache optimize
|
||||
void LLModel::preprocessVolumeFaces()
|
||||
{
|
||||
for (auto& face : mVolumeFaces)
|
||||
{
|
||||
face.cacheOptimize();
|
||||
}
|
||||
}
|
||||
|
||||
// Shrink the model to fit
|
||||
// on a 1x1x1 cube centered at the origin.
|
||||
// The positions and extents
|
||||
|
|
@ -298,6 +307,7 @@ void LLModel::normalizeVolumeFaces()
|
|||
// the positions to fit within the unit cube.
|
||||
LLVector4a* pos = (LLVector4a*) face.mPositions;
|
||||
LLVector4a* norm = (LLVector4a*) face.mNormals;
|
||||
LLVector4a* t = (LLVector4a*)face.mMikktSpaceTangents;
|
||||
|
||||
for (U32 j = 0; j < face.mNumVertices; ++j)
|
||||
{
|
||||
|
|
@ -318,6 +328,14 @@ void LLModel::normalizeVolumeFaces()
|
|||
// </FS:Beq>
|
||||
norm[j].normalize3();
|
||||
}
|
||||
|
||||
if (t)
|
||||
{
|
||||
F32 w = t[j].getF32ptr()[3];
|
||||
t[j].mul(inv_scale);
|
||||
t[j].normalize3();
|
||||
t[j].getF32ptr()[3] = w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -741,10 +759,12 @@ LLSD LLModel::writeModel(
|
|||
LLSD::Binary verts(face.mNumVertices*3*2);
|
||||
LLSD::Binary tc(face.mNumVertices*2*2);
|
||||
LLSD::Binary normals(face.mNumVertices*3*2);
|
||||
LLSD::Binary tangents(face.mNumVertices * 4 * 2);
|
||||
LLSD::Binary indices(face.mNumIndices*2);
|
||||
|
||||
U32 vert_idx = 0;
|
||||
U32 norm_idx = 0;
|
||||
U32 tan_idx = 0;
|
||||
U32 tc_idx = 0;
|
||||
|
||||
LLVector2* ftc = (LLVector2*) face.mTexCoords;
|
||||
|
|
@ -797,6 +817,22 @@ LLSD LLModel::writeModel(
|
|||
normals[norm_idx++] = buff[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (face.mMikktSpaceTangents)
|
||||
{ //normals
|
||||
F32* tangent = face.mMikktSpaceTangents[j].getF32ptr();
|
||||
|
||||
for (U32 k = 0; k < 4; ++k)
|
||||
{ //for each component
|
||||
//convert to 16-bit normalized
|
||||
U16 val = (U16)((tangent[k] + 1.f) * 0.5f * 65535);
|
||||
U8* buff = (U8*)&val;
|
||||
|
||||
//write to binary buffer
|
||||
tangents[tan_idx++] = buff[0];
|
||||
tangents[tan_idx++] = buff[1];
|
||||
}
|
||||
}
|
||||
|
||||
//texcoord
|
||||
if (face.mTexCoords)
|
||||
|
|
@ -834,6 +870,11 @@ LLSD LLModel::writeModel(
|
|||
mdl[model_names[idx]][i]["Normal"] = normals;
|
||||
}
|
||||
|
||||
if (face.mMikktSpaceTangents)
|
||||
{
|
||||
mdl[model_names[idx]][i]["Tangent"] = tangents;
|
||||
}
|
||||
|
||||
if (face.mTexCoords)
|
||||
{
|
||||
mdl[model_names[idx]][i]["TexCoord0Domain"]["Min"] = min_tc.getValue();
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ public:
|
|||
void addFace(const LLVolumeFace& face);
|
||||
|
||||
void sortVolumeFacesByMaterialName();
|
||||
void preprocessVolumeFaces();
|
||||
void normalizeVolumeFaces();
|
||||
void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL);
|
||||
void remapVolumeFaces();
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ LLGLTexture* LLAtmosphere::getTransmittance()
|
|||
m_transmittance->generateGLTexture();
|
||||
m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_transmittance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT);
|
||||
m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
return m_transmittance;
|
||||
|
|
@ -255,7 +255,7 @@ LLGLTexture* LLAtmosphere::getScattering()
|
|||
m_scattering->generateGLTexture();
|
||||
m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);
|
||||
}
|
||||
return m_scattering;
|
||||
|
|
@ -269,7 +269,7 @@ LLGLTexture* LLAtmosphere::getMieScattering()
|
|||
m_mie_scatter_texture->generateGLTexture();
|
||||
m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_mie_scatter_texture->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);
|
||||
}
|
||||
return m_mie_scatter_texture;
|
||||
|
|
@ -283,7 +283,7 @@ LLGLTexture* LLAtmosphere::getIlluminance()
|
|||
m_illuminance->generateGLTexture();
|
||||
m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_illuminance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT);
|
||||
m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
return m_illuminance;
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@ LLCubeMap::LLCubeMap(bool init_as_srgb)
|
|||
mMatrixStage(0),
|
||||
mIssRGB(init_as_srgb)
|
||||
{
|
||||
mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB;
|
||||
mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
|
||||
mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB;
|
||||
mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB;
|
||||
mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB;
|
||||
mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB;
|
||||
mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
|
||||
mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
|
||||
mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
|
||||
mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
|
||||
mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
|
||||
mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
|
||||
}
|
||||
|
||||
LLCubeMap::~LLCubeMap()
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@
|
|||
// MUST match order of OpenGL face-layers
|
||||
GLenum LLCubeMapArray::sTargets[6] =
|
||||
{
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
|
||||
};
|
||||
|
||||
LLVector3 LLCubeMapArray::sLookVecs[6] =
|
||||
|
|
@ -122,14 +122,14 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count)
|
|||
|
||||
bind(0);
|
||||
|
||||
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, 0, GL_RGB, resolution, resolution, count*6, 0,
|
||||
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGB, resolution, resolution, count*6, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
|
||||
mImage->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
|
||||
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY_ARB);
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY);
|
||||
|
||||
unbind();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -37,7 +37,7 @@
|
|||
#include "OpenGL/OpenGL.h"
|
||||
#endif
|
||||
|
||||
// Print-print list of shader included source files that are linked together via glAttachObjectARB()
|
||||
// Print-print list of shader included source files that are linked together via glAttachShader()
|
||||
// i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state.
|
||||
#define DEBUG_SHADER_INCLUDES 0
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ using std::pair;
|
|||
using std::make_pair;
|
||||
using std::string;
|
||||
|
||||
GLhandleARB LLGLSLShader::sCurBoundShader = 0;
|
||||
GLuint LLGLSLShader::sCurBoundShader = 0;
|
||||
LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL;
|
||||
S32 LLGLSLShader::sIndexedTextureChannels = 0;
|
||||
bool LLGLSLShader::sProfileEnabled = false;
|
||||
|
|
@ -227,11 +227,11 @@ void LLGLSLShader::stopProfile(U32 count, U32 mode)
|
|||
|
||||
void LLGLSLShader::placeProfileQuery()
|
||||
{
|
||||
#if !LL_DARWIN
|
||||
#if 1 || !LL_DARWIN
|
||||
if (mTimerQuery == 0)
|
||||
{
|
||||
glGenQueriesARB(1, &mSamplesQuery);
|
||||
glGenQueriesARB(1, &mTimerQuery);
|
||||
glGenQueries(1, &mSamplesQuery);
|
||||
glGenQueries(1, &mTimerQuery);
|
||||
}
|
||||
|
||||
if (!mTextureStateFetched)
|
||||
|
|
@ -267,16 +267,16 @@ void LLGLSLShader::placeProfileQuery()
|
|||
}
|
||||
|
||||
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery);
|
||||
glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery);
|
||||
glBeginQuery(GL_SAMPLES_PASSED, mSamplesQuery);
|
||||
glBeginQuery(GL_TIME_ELAPSED, mTimerQuery);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLGLSLShader::readProfileQuery(U32 count, U32 mode)
|
||||
{
|
||||
#if !LL_DARWIN
|
||||
glEndQueryARB(GL_TIME_ELAPSED);
|
||||
glEndQueryARB(GL_SAMPLES_PASSED);
|
||||
glEndQuery(GL_TIME_ELAPSED);
|
||||
glEndQuery(GL_SAMPLES_PASSED);
|
||||
|
||||
//<FS:TS> U64 and GLuint64 somehow turn out different on x86_64
|
||||
//U64 time_elapsed = 0;
|
||||
|
|
@ -350,35 +350,37 @@ void LLGLSLShader::unloadInternal()
|
|||
|
||||
if (mProgramObject)
|
||||
{
|
||||
GLhandleARB obj[1024];
|
||||
GLsizei count;
|
||||
glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj);
|
||||
GLuint obj[1024];
|
||||
GLsizei count = 0;
|
||||
glGetAttachedShaders(mProgramObject, 1024, &count, obj);
|
||||
|
||||
for (GLsizei i = 0; i < count; i++)
|
||||
{
|
||||
glDetachObjectARB(mProgramObject, obj[i]);
|
||||
// <FS:Ansariel> OpenGL error: glDeleteObjectARB - GL_INVALID_VALUE
|
||||
#if !LL_DARWIN
|
||||
if (glIsProgramARB(obj[i]))
|
||||
#endif
|
||||
// </FS:Ansariel>
|
||||
glDeleteObjectARB(obj[i]);
|
||||
glDetachShader(mProgramObject, obj[i]);
|
||||
}
|
||||
|
||||
glDeleteObjectARB(mProgramObject);
|
||||
for (GLsizei i = 0; i < count; i++)
|
||||
{
|
||||
if (glIsShader(obj[i]))
|
||||
{
|
||||
glDeleteShader(obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
glDeleteProgram(mProgramObject);
|
||||
|
||||
mProgramObject = 0;
|
||||
}
|
||||
|
||||
if (mTimerQuery)
|
||||
{
|
||||
glDeleteQueriesARB(1, &mTimerQuery);
|
||||
glDeleteQueries(1, &mTimerQuery);
|
||||
mTimerQuery = 0;
|
||||
}
|
||||
|
||||
if (mSamplesQuery)
|
||||
{
|
||||
glDeleteQueriesARB(1, &mSamplesQuery);
|
||||
glDeleteQueries(1, &mSamplesQuery);
|
||||
mSamplesQuery = 0;
|
||||
}
|
||||
|
||||
|
|
@ -409,7 +411,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||
llassert_always(!mShaderFiles.empty());
|
||||
|
||||
// Create program
|
||||
mProgramObject = glCreateProgramObjectARB();
|
||||
mProgramObject = glCreateProgram();
|
||||
if (mProgramObject == 0)
|
||||
{
|
||||
// Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist.
|
||||
|
|
@ -433,7 +435,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
||||
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
||||
{
|
||||
GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
|
||||
GLuint shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
|
||||
LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL;
|
||||
if (shaderhandle)
|
||||
{
|
||||
|
|
@ -513,20 +515,20 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||
}
|
||||
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path )
|
||||
void dumpAttachObject( const char *func_name, GLuint program_object, const std::string &object_path )
|
||||
{
|
||||
GLcharARB* info_log;
|
||||
GLchar* info_log;
|
||||
GLint info_len_expect = 0;
|
||||
GLint info_len_actual = 0;
|
||||
|
||||
glGetObjectParameterivARB(program_object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len_expect);
|
||||
glGetShaderiv(program_object, GL_INFO_LOG_LENGTH,, &info_len_expect);
|
||||
fprintf(stderr, " * %-20s(), log size: %d, %s\n", func_name, info_len_expect, object_path.c_str());
|
||||
|
||||
if (info_len_expect > 0)
|
||||
{
|
||||
fprintf(stderr, " ========== %s() ========== \n", func_name);
|
||||
info_log = new GLcharARB [ info_len_expect ];
|
||||
glGetInfoLogARB(program_object, info_len_expect, &info_len_actual, info_log);
|
||||
info_log = new GLchar [ info_len_expect ];
|
||||
glGetProgramInfoLog(program_object, info_len_expect, &info_len_actual, info_log);
|
||||
fprintf(stderr, "%s\n", info_log);
|
||||
delete [] info_log;
|
||||
}
|
||||
|
|
@ -538,7 +540,7 @@ BOOL LLGLSLShader::attachVertexObject(std::string object_path)
|
|||
if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]);
|
||||
glAttachShader(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]);
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
dumpAttachObject("attachVertexObject", mProgramObject, object_path);
|
||||
#endif // DEBUG_SHADER_INCLUDES
|
||||
|
|
@ -557,7 +559,7 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
|
|||
if (LLShaderMgr::instance()->mFragmentShaderObjects.count(object_path) > 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]);
|
||||
glAttachShader(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]);
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
dumpAttachObject("attachFragmentObject", mProgramObject, object_path);
|
||||
#endif // DEBUG_SHADER_INCLUDES
|
||||
|
|
@ -571,12 +573,12 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::attachObject(GLhandleARB object)
|
||||
void LLGLSLShader::attachObject(GLuint object)
|
||||
{
|
||||
if (object != 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glAttachObjectARB(mProgramObject, object);
|
||||
glAttachShader(mProgramObject, object);
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
std::string object_path("???");
|
||||
dumpAttachObject("attachObject", mProgramObject, object_path);
|
||||
|
|
@ -589,7 +591,7 @@ void LLGLSLShader::attachObject(GLhandleARB object)
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
|
||||
void LLGLSLShader::attachObjects(GLuint* objects, S32 count)
|
||||
{
|
||||
for (S32 i = 0; i < count; i++)
|
||||
{
|
||||
|
|
@ -605,7 +607,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||
{
|
||||
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
||||
glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
|
||||
glBindAttribLocation(mProgramObject, i, (const GLchar *) name);
|
||||
}
|
||||
|
||||
//link the program
|
||||
|
|
@ -628,7 +630,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||
{
|
||||
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
||||
S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name);
|
||||
S32 index = glGetAttribLocation(mProgramObject, (const GLchar *)name);
|
||||
if (index != -1)
|
||||
{
|
||||
#if LL_RELEASE_WITH_DEBUG_INFO
|
||||
|
|
@ -645,7 +647,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
for (U32 i = 0; i < numAttributes; i++)
|
||||
{
|
||||
const char* name = (*attributes)[i].String().c_str();
|
||||
S32 index = glGetAttribLocationARB(mProgramObject, name);
|
||||
S32 index = glGetAttribLocation(mProgramObject, name);
|
||||
if (index != -1)
|
||||
{
|
||||
mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index;
|
||||
|
|
@ -676,7 +678,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> *
|
|||
name[0] = 0;
|
||||
|
||||
|
||||
glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
|
||||
glGetActiveUniform(mProgramObject, index, 1024, &length, &size, &type, (GLchar *)name);
|
||||
#if !LL_DARWIN
|
||||
if (size > 0)
|
||||
{
|
||||
|
|
@ -721,7 +723,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> *
|
|||
}
|
||||
#endif
|
||||
|
||||
S32 location = glGetUniformLocationARB(mProgramObject, name);
|
||||
S32 location = glGetUniformLocation(mProgramObject, name);
|
||||
if (location != -1)
|
||||
{
|
||||
//chop off "[0]" so we can always access the first element
|
||||
|
|
@ -787,14 +789,14 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
||||
if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) ||
|
||||
if ((type >= GL_SAMPLER_1D && type <= GL_SAMPLER_2D_RECT_SHADOW) ||
|
||||
type == GL_SAMPLER_2D_MULTISAMPLE ||
|
||||
type == GL_SAMPLER_CUBE_MAP_ARRAY_ARB)
|
||||
type == GL_SAMPLER_CUBE_MAP_ARRAY)
|
||||
{ //this here is a texture
|
||||
GLint ret = mActiveTextureChannels;
|
||||
if (size == 1)
|
||||
{
|
||||
glUniform1iARB(location, mActiveTextureChannels);
|
||||
glUniform1i(location, mActiveTextureChannels);
|
||||
LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL;
|
||||
mActiveTextureChannels++;
|
||||
}
|
||||
|
|
@ -808,7 +810,7 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint
|
|||
{
|
||||
channel[i] = mActiveTextureChannels++;
|
||||
}
|
||||
glUniform1ivARB(location, size, channel);
|
||||
glUniform1iv(location, size, channel);
|
||||
LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " <<
|
||||
(mActiveTextureChannels-size) << " through " << (mActiveTextureChannels-1) << LL_ENDL;
|
||||
}
|
||||
|
|
@ -841,7 +843,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
|
||||
//get the number of active uniforms
|
||||
GLint activeCount;
|
||||
glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount);
|
||||
glGetProgramiv(mProgramObject, GL_ACTIVE_UNIFORMS, &activeCount);
|
||||
|
||||
//........................................................................................................................................
|
||||
//........................................................................................
|
||||
|
|
@ -868,12 +870,12 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
*/
|
||||
|
||||
|
||||
S32 diffuseMap = glGetUniformLocationARB(mProgramObject, "diffuseMap");
|
||||
S32 specularMap = glGetUniformLocationARB(mProgramObject, "specularMap");
|
||||
S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap");
|
||||
S32 altDiffuseMap = glGetUniformLocationARB(mProgramObject, "altDiffuseMap");
|
||||
S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap");
|
||||
S32 reflectionMap = glGetUniformLocationARB(mProgramObject, "reflectionMap");
|
||||
S32 diffuseMap = glGetUniformLocation(mProgramObject, "diffuseMap");
|
||||
S32 specularMap = glGetUniformLocation(mProgramObject, "specularMap");
|
||||
S32 bumpMap = glGetUniformLocation(mProgramObject, "bumpMap");
|
||||
S32 altDiffuseMap = glGetUniformLocation(mProgramObject, "altDiffuseMap");
|
||||
S32 environmentMap = glGetUniformLocation(mProgramObject, "environmentMap");
|
||||
S32 reflectionMap = glGetUniformLocation(mProgramObject, "reflectionMap");
|
||||
|
||||
std::set<S32> skip_index;
|
||||
|
||||
|
|
@ -890,7 +892,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
{
|
||||
name[0] = '\0';
|
||||
|
||||
glGetActiveUniformARB(mProgramObject, i, 1024, &length, &size, &type, (GLcharARB *)name);
|
||||
glGetActiveUniform(mProgramObject, i, 1024, &length, &size, &type, (GLchar *)name);
|
||||
|
||||
if (-1 == diffuseMap && std::string(name) == "diffuseMap")
|
||||
{
|
||||
|
|
@ -973,6 +975,14 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
}
|
||||
//........................................................................................................................................
|
||||
|
||||
if (mFeatures.hasReflectionProbes) // Set up block binding, in a way supported by Apple (rather than binding = 1 in .glsl).
|
||||
{ // See slide 35 and more of https://docs.huihoo.com/apple/wwdc/2011/session_420__advances_in_opengl_for_mac_os_x_lion.pdf
|
||||
static const GLuint BLOCKBINDING = 1; //picked by us
|
||||
//Get the index, similar to a uniform location
|
||||
GLuint UBOBlockIndex = glGetUniformBlockIndex(mProgramObject, "ReflectionProbes");
|
||||
//Set this index to a binding index
|
||||
glUniformBlockBinding(mProgramObject, UBOBlockIndex, BLOCKBINDING);
|
||||
}
|
||||
unbind();
|
||||
|
||||
LL_DEBUGS("ShaderUniform") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
|
||||
|
|
@ -1003,7 +1013,7 @@ void LLGLSLShader::bind()
|
|||
if (sCurBoundShader != mProgramObject) // Don't re-bind current shader
|
||||
{
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(mProgramObject);
|
||||
glUseProgram(mProgramObject);
|
||||
sCurBoundShader = mProgramObject;
|
||||
sCurBoundShaderPtr = this;
|
||||
}
|
||||
|
|
@ -1035,7 +1045,7 @@ void LLGLSLShader::unbind()
|
|||
gGL.flush();
|
||||
stop_glerror();
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(0);
|
||||
glUseProgram(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
stop_glerror();
|
||||
|
|
@ -1046,7 +1056,7 @@ void LLGLSLShader::bindNoShader(void)
|
|||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(0);
|
||||
glUseProgram(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
}
|
||||
|
|
@ -1176,7 +1186,7 @@ void LLGLSLShader::uniform1i(U32 index, GLint x)
|
|||
const auto& iter = mValue.find(mUniform[index]);
|
||||
if (iter == mValue.end() || iter->second.mV[0] != x)
|
||||
{
|
||||
glUniform1iARB(mUniform[index], x);
|
||||
glUniform1i(mUniform[index], x);
|
||||
mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
|
||||
}
|
||||
}
|
||||
|
|
@ -1199,7 +1209,7 @@ void LLGLSLShader::uniform1f(U32 index, GLfloat x)
|
|||
const auto& iter = mValue.find(mUniform[index]);
|
||||
if (iter == mValue.end() || iter->second.mV[0] != x)
|
||||
{
|
||||
glUniform1fARB(mUniform[index], x);
|
||||
glUniform1f(mUniform[index], x);
|
||||
mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
|
||||
}
|
||||
}
|
||||
|
|
@ -1222,7 +1232,7 @@ void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y)
|
|||
LLVector4 vec(x,y,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform2fARB(mUniform[index], x, y);
|
||||
glUniform2f(mUniform[index], x, y);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1245,7 +1255,7 @@ void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z)
|
|||
LLVector4 vec(x,y,z,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform3fARB(mUniform[index], x, y, z);
|
||||
glUniform3f(mUniform[index], x, y, z);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1268,7 +1278,7 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat
|
|||
LLVector4 vec(x,y,z,w);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform4fARB(mUniform[index], x, y, z, w);
|
||||
glUniform4f(mUniform[index], x, y, z, w);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1291,7 +1301,7 @@ void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v)
|
|||
LLVector4 vec(v[0],0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform1ivARB(mUniform[index], count, v);
|
||||
glUniform1iv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1314,7 +1324,7 @@ void LLGLSLShader::uniform4iv(U32 index, U32 count, const GLint* v)
|
|||
LLVector4 vec(v[0], v[1], v[2], v[3]);
|
||||
if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1)
|
||||
{
|
||||
glUniform1ivARB(mUniform[index], count, v);
|
||||
glUniform1iv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1338,7 +1348,7 @@ void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v)
|
|||
LLVector4 vec(v[0],0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform1fvARB(mUniform[index], count, v);
|
||||
glUniform1fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1361,7 +1371,7 @@ void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v)
|
|||
LLVector4 vec(v[0],v[1],0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform2fvARB(mUniform[index], count, v);
|
||||
glUniform2fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1384,7 +1394,7 @@ void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v)
|
|||
LLVector4 vec(v[0],v[1],v[2],0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform3fvARB(mUniform[index], count, v);
|
||||
glUniform3fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1408,7 +1418,7 @@ void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v)
|
|||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform4fvARB(mUniform[index], count, v);
|
||||
glUniform4fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1427,7 +1437,7 @@ void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, c
|
|||
|
||||
if (mUniform[index] >= 0)
|
||||
{
|
||||
glUniformMatrix2fvARB(mUniform[index], count, transpose, v);
|
||||
glUniformMatrix2fv(mUniform[index], count, transpose, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1444,7 +1454,7 @@ void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, c
|
|||
|
||||
if (mUniform[index] >= 0)
|
||||
{
|
||||
glUniformMatrix3fvARB(mUniform[index], count, transpose, v);
|
||||
glUniformMatrix3fv(mUniform[index], count, transpose, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1480,7 +1490,7 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c
|
|||
|
||||
if (mUniform[index] >= 0)
|
||||
{
|
||||
glUniformMatrix4fvARB(mUniform[index], count, transpose, v);
|
||||
glUniformMatrix4fv(mUniform[index], count, transpose, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1498,7 +1508,7 @@ GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform)
|
|||
if (gDebugGL)
|
||||
{
|
||||
stop_glerror();
|
||||
if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str()))
|
||||
if (iter->second != glGetUniformLocation(mProgramObject, uniform.String().c_str()))
|
||||
{
|
||||
LL_ERRS() << "Uniform does not match." << LL_ENDL;
|
||||
}
|
||||
|
|
@ -1553,7 +1563,7 @@ void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v)
|
|||
LLVector4 vec(v,0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform1iARB(location, v);
|
||||
glUniform1i(location, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1570,7 +1580,7 @@ void LLGLSLShader::uniform1iv(const LLStaticHashedString& uniform, U32 count, co
|
|||
if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform1ivARB(location, count, v);
|
||||
glUniform1iv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1587,7 +1597,7 @@ void LLGLSLShader::uniform4iv(const LLStaticHashedString& uniform, U32 count, co
|
|||
if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform4ivARB(location, count, v);
|
||||
glUniform4iv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1603,7 +1613,7 @@ void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint
|
|||
LLVector4 vec(i,j,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform2iARB(location, i, j);
|
||||
glUniform2i(location, i, j);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1620,7 +1630,7 @@ void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v)
|
|||
LLVector4 vec(v,0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform1fARB(location, v);
|
||||
glUniform1f(location, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1636,7 +1646,7 @@ void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLf
|
|||
LLVector4 vec(x,y,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform2fARB(location, x,y);
|
||||
glUniform2f(location, x,y);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1653,7 +1663,7 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf
|
|||
LLVector4 vec(x,y,z,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform3fARB(location, x,y,z);
|
||||
glUniform3f(location, x,y,z);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1669,7 +1679,7 @@ void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
LLVector4 vec(v[0],0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform1fvARB(location, count, v);
|
||||
glUniform1fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1685,7 +1695,7 @@ void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
LLVector4 vec(v[0],v[1],0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform2fvARB(location, count, v);
|
||||
glUniform2fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1701,7 +1711,7 @@ void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
LLVector4 vec(v[0],v[1],v[2],0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform3fvARB(location, count, v);
|
||||
glUniform3fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1718,7 +1728,7 @@ void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform4fvARB(location, count, v);
|
||||
glUniform4fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1731,7 +1741,7 @@ void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 cou
|
|||
if (location >= 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glUniformMatrix4fvARB(location, count, transpose, v);
|
||||
glUniformMatrix4fv(location, count, transpose, v);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -1741,7 +1751,7 @@ void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GL
|
|||
{
|
||||
if (mAttribute[index] > 0)
|
||||
{
|
||||
glVertexAttrib4fARB(mAttribute[index], x, y, z, w);
|
||||
glVertexAttrib4f(mAttribute[index], x, y, z, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1749,7 +1759,7 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
|
|||
{
|
||||
if (mAttribute[index] > 0)
|
||||
{
|
||||
glVertexAttrib4fvARB(mAttribute[index], v);
|
||||
glVertexAttrib4fv(mAttribute[index], v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public:
|
|||
LLGLSLShader();
|
||||
~LLGLSLShader();
|
||||
|
||||
static GLhandleARB sCurBoundShader;
|
||||
static GLuint sCurBoundShader;
|
||||
static LLGLSLShader* sCurBoundShaderPtr;
|
||||
static S32 sIndexedTextureChannels;
|
||||
|
||||
|
|
@ -168,8 +168,8 @@ public:
|
|||
const char** varyings = NULL);
|
||||
BOOL attachFragmentObject(std::string object);
|
||||
BOOL attachVertexObject(std::string object);
|
||||
void attachObject(GLhandleARB object);
|
||||
void attachObjects(GLhandleARB* objects = NULL, S32 count = 0);
|
||||
void attachObject(GLuint object);
|
||||
void attachObjects(GLuint* objects = NULL, S32 count = 0);
|
||||
BOOL mapAttributes(const std::vector<LLStaticHashedString> * attributes);
|
||||
BOOL mapUniforms(const std::vector<LLStaticHashedString> *);
|
||||
void mapUniform(GLint index, const std::vector<LLStaticHashedString> *);
|
||||
|
|
@ -243,7 +243,7 @@ public:
|
|||
U32 mMatHash[LLRender::NUM_MATRIX_MODES];
|
||||
U32 mLightHash;
|
||||
|
||||
GLhandleARB mProgramObject;
|
||||
GLuint mProgramObject;
|
||||
#if LL_RELEASE_WITH_DEBUG_INFO
|
||||
struct attr_name
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
mLineStipple(GL_LINE_STIPPLE),
|
||||
mNormalize(GL_NORMALIZE),
|
||||
mPolygonSmooth(GL_POLYGON_SMOOTH),
|
||||
mGLMultisample(GL_MULTISAMPLE_ARB)
|
||||
mGLMultisample(GL_MULTISAMPLE)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32
|
|||
if (is_compressed)
|
||||
{
|
||||
S32 tex_size = dataFormatBytes(mFormatPrimary, w, h);
|
||||
glCompressedTexImage2DARB(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
glCompressedTexImage2D(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
|
|
@ -990,7 +990,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32
|
|||
if (is_compressed)
|
||||
{
|
||||
S32 tex_size = dataFormatBytes(mFormatPrimary, w, h);
|
||||
glCompressedTexImage2DARB(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
glCompressedTexImage2D(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
|
|
@ -1838,7 +1838,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
|
|||
return FALSE ;
|
||||
}
|
||||
|
||||
glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));
|
||||
glGetCompressedTexImage(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));
|
||||
//stop_glerror();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -239,17 +239,17 @@ void LLPostProcess::applyColorFilterShader(void)
|
|||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture);
|
||||
|
||||
getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject);
|
||||
glUniform1iARB(colorFilterUniforms["RenderTexture"], 0);
|
||||
glUniform1fARB(colorFilterUniforms["brightness"], tweaks.getBrightness());
|
||||
glUniform1fARB(colorFilterUniforms["contrast"], tweaks.getContrast());
|
||||
glUniform1i(colorFilterUniforms["RenderTexture"], 0);
|
||||
glUniform1f(colorFilterUniforms["brightness"], tweaks.getBrightness());
|
||||
glUniform1f(colorFilterUniforms["contrast"], tweaks.getContrast());
|
||||
float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f;
|
||||
baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI);
|
||||
float baseR = tweaks.getContrastBaseR() * baseI;
|
||||
float baseG = tweaks.getContrastBaseG() * baseI;
|
||||
float baseB = tweaks.getContrastBaseB() * baseI;
|
||||
glUniform3fARB(colorFilterUniforms["contrastBase"], baseR, baseG, baseB);
|
||||
glUniform1fARB(colorFilterUniforms["saturation"], tweaks.getSaturation());
|
||||
glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
glUniform3f(colorFilterUniforms["contrastBase"], baseR, baseG, baseB);
|
||||
glUniform1f(colorFilterUniforms["saturation"], tweaks.getSaturation());
|
||||
glUniform3f(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
|
|
@ -282,22 +282,22 @@ void LLPostProcess::applyNightVisionShader(void)
|
|||
|
||||
getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture);
|
||||
glUniform1iARB(nightVisionUniforms["RenderTexture"], 0);
|
||||
glUniform1i(nightVisionUniforms["RenderTexture"], 0);
|
||||
|
||||
gGL.getTexUnit(1)->activate();
|
||||
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
gGL.getTexUnit(1)->bindManual(LLTexUnit::TT_TEXTURE, noiseTexture);
|
||||
glUniform1iARB(nightVisionUniforms["NoiseTexture"], 1);
|
||||
glUniform1i(nightVisionUniforms["NoiseTexture"], 1);
|
||||
|
||||
|
||||
glUniform1fARB(nightVisionUniforms["brightMult"], tweaks.getBrightMult());
|
||||
glUniform1fARB(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength());
|
||||
glUniform1f(nightVisionUniforms["brightMult"], tweaks.getBrightMult());
|
||||
glUniform1f(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength());
|
||||
noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f);
|
||||
noiseTextureScale *= (screenH / NOISE_SIZE);
|
||||
|
||||
|
||||
glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
glUniform3f(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
|
|
@ -345,12 +345,12 @@ void LLPostProcess::createBloomShader(void)
|
|||
bloomBlurUniforms[sBlurWidth] = 0;
|
||||
}
|
||||
|
||||
void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog)
|
||||
void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog)
|
||||
{
|
||||
/// Find uniform locations and insert into map
|
||||
glslUniforms::iterator i;
|
||||
for (i = uniforms.begin(); i != uniforms.end(); ++i){
|
||||
i->second = glGetUniformLocationARB(prog, i->first.String().c_str());
|
||||
i->second = glGetUniformLocation(prog, i->first.String().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -391,10 +391,7 @@ void LLPostProcess::doEffects(void)
|
|||
void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height)
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture);
|
||||
// <FS:Ansariel> Replace GL_TEXTURE_RECTANGLE_ARB with GL_TEXTURE_RECTANGLE
|
||||
//glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0);
|
||||
glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, width, height, 0);
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type)
|
||||
|
|
@ -413,60 +410,60 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT
|
|||
|
||||
glBegin(GL_QUADS);
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height * 2.0f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height * 2.0f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
noiseX,
|
||||
noiseTextureScale + noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, (GLfloat) height * 0.5f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0.f, (GLfloat) height * 0.5f);
|
||||
}
|
||||
glVertex2f(0.f, (GLfloat) screenH - height);
|
||||
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
noiseX,
|
||||
noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0.f, 0.f);
|
||||
}
|
||||
glVertex2f(0.f, (GLfloat) height + (screenH - height));
|
||||
|
||||
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, 0.f);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, 0.f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
screenRatio * noiseTextureScale + noiseX,
|
||||
noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, 0.f);
|
||||
}
|
||||
glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height));
|
||||
|
||||
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, (GLfloat) height);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, (GLfloat) height);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
screenRatio * noiseTextureScale + noiseX,
|
||||
noiseTextureScale + noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f);
|
||||
}
|
||||
glVertex2f((GLfloat) width, (GLfloat) screenH - height);
|
||||
glEnd();
|
||||
|
|
@ -506,10 +503,7 @@ void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int wi
|
|||
if(texture->createGLTexture())
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName());
|
||||
// <FS:Ansariel> Replace GL_TEXTURE_RECTANGLE_ARB with GL_TEXTURE_RECTANGLE
|
||||
//glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0,
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0,
|
||||
// </FS:Ansariel>
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
|
|
@ -563,7 +557,7 @@ bool LLPostProcess::checkError(void)
|
|||
return retCode;
|
||||
}
|
||||
|
||||
void LLPostProcess::checkShaderError(GLhandleARB shader)
|
||||
void LLPostProcess::checkShaderError(GLuint shader)
|
||||
{
|
||||
GLint infologLength = 0;
|
||||
GLint charsWritten = 0;
|
||||
|
|
@ -571,7 +565,7 @@ void LLPostProcess::checkShaderError(GLhandleARB shader)
|
|||
|
||||
checkError(); // Check for OpenGL errors
|
||||
|
||||
glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength);
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength);
|
||||
|
||||
checkError(); // Check for OpenGL errors
|
||||
|
||||
|
|
@ -583,7 +577,7 @@ void LLPostProcess::checkShaderError(GLhandleARB shader)
|
|||
/// Could not allocate infolog buffer
|
||||
return;
|
||||
}
|
||||
glGetInfoLogARB(shader, infologLength, &charsWritten, infoLog);
|
||||
glGetProgramInfoLog(shader, infologLength, &charsWritten, infoLog);
|
||||
// shaderErrorLog << (char *) infoLog << std::endl;
|
||||
mShaderErrorString = (char *) infoLog;
|
||||
free(infoLog);
|
||||
|
|
|
|||
|
|
@ -249,12 +249,12 @@ private:
|
|||
void applyColorFilterShader(void);
|
||||
|
||||
/// OpenGL Helper Functions
|
||||
void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog);
|
||||
void getShaderUniforms(glslUniforms & uniforms, GLuint & prog);
|
||||
void createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height);
|
||||
void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height);
|
||||
void createNoiseTexture(LLPointer<LLImageGL>& texture);
|
||||
bool checkError(void);
|
||||
void checkShaderError(GLhandleARB shader);
|
||||
void checkShaderError(GLuint shader);
|
||||
void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type);
|
||||
void viewOrthogonal(unsigned int width, unsigned int height);
|
||||
void changeOrthogonal(unsigned int width, unsigned int height);
|
||||
|
|
|
|||
|
|
@ -69,12 +69,9 @@ static const U32 LL_NUM_LIGHT_UNITS = 8;
|
|||
static const GLenum sGLTextureType[] =
|
||||
{
|
||||
GL_TEXTURE_2D,
|
||||
// <FS:Ansariel> Replace GL_TEXTURE_RECTANGLE_ARB with GL_TEXTURE_RECTANGLE
|
||||
//GL_TEXTURE_RECTANGLE_ARB,
|
||||
GL_TEXTURE_RECTANGLE,
|
||||
// </FS:Ansariel>
|
||||
GL_TEXTURE_CUBE_MAP_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_ARRAY_ARB,
|
||||
GL_TEXTURE_CUBE_MAP,
|
||||
GL_TEXTURE_CUBE_MAP_ARRAY,
|
||||
GL_TEXTURE_2D_MULTISAMPLE,
|
||||
GL_TEXTURE_3D
|
||||
};
|
||||
|
|
@ -126,7 +123,7 @@ void LLTexUnit::refreshState(void)
|
|||
|
||||
gGL.flush();
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
|
||||
if (mCurrTexType != TT_NONE)
|
||||
{
|
||||
|
|
@ -147,7 +144,7 @@ void LLTexUnit::activate(void)
|
|||
if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
|
||||
{
|
||||
gGL.flush();
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
gGL.mCurrTextureUnitIndex = mIndex;
|
||||
}
|
||||
}
|
||||
|
|
@ -191,7 +188,7 @@ void LLTexUnit::bindFast(LLTexture* texture)
|
|||
{
|
||||
LLImageGL* gl_tex = texture->getGLTexture();
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
gGL.mCurrTextureUnitIndex = mIndex;
|
||||
mCurrTexture = gl_tex->getTexName();
|
||||
if (!mCurrTexture)
|
||||
|
|
@ -343,7 +340,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
|
|||
activate();
|
||||
enable(LLTexUnit::TT_CUBE_MAP);
|
||||
mCurrTexture = cubeMap->mImages[0]->getTexName();
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, mCurrTexture);
|
||||
mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps;
|
||||
cubeMap->mImages[0]->updateBindStats();
|
||||
if (cubeMap->mImages[0]->mTexOptionsDirty)
|
||||
|
|
@ -473,7 +470,7 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode)
|
|||
glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]);
|
||||
if (mCurrTexType == TT_CUBE_MAP)
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
|
||||
glTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -548,7 +545,7 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
|
|||
case TBS_PREV_ALPHA:
|
||||
case TBS_ONE_MINUS_PREV_COLOR:
|
||||
case TBS_ONE_MINUS_PREV_ALPHA:
|
||||
return GL_PREVIOUS_ARB;
|
||||
return GL_PREVIOUS;
|
||||
|
||||
// All four cases should return the same value.
|
||||
case TBS_TEX_COLOR:
|
||||
|
|
@ -562,18 +559,18 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
|
|||
case TBS_VERT_ALPHA:
|
||||
case TBS_ONE_MINUS_VERT_COLOR:
|
||||
case TBS_ONE_MINUS_VERT_ALPHA:
|
||||
return GL_PRIMARY_COLOR_ARB;
|
||||
return GL_PRIMARY_COLOR;
|
||||
|
||||
// All four cases should return the same value.
|
||||
case TBS_CONST_COLOR:
|
||||
case TBS_CONST_ALPHA:
|
||||
case TBS_ONE_MINUS_CONST_COLOR:
|
||||
case TBS_ONE_MINUS_CONST_ALPHA:
|
||||
return GL_CONSTANT_ARB;
|
||||
return GL_CONSTANT;
|
||||
|
||||
default:
|
||||
LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << LL_ENDL;
|
||||
return GL_PRIMARY_COLOR_ARB;
|
||||
return GL_PRIMARY_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -642,10 +639,10 @@ void LLTexUnit::debugTextureUnit(void)
|
|||
if (mIndex < 0) return;
|
||||
|
||||
GLint activeTexture;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture);
|
||||
if ((GL_TEXTURE0_ARB + mIndex) != activeTexture)
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture);
|
||||
if ((GL_TEXTURE0 + mIndex) != activeTexture)
|
||||
{
|
||||
U32 set_unit = (activeTexture - GL_TEXTURE0_ARB);
|
||||
U32 set_unit = (activeTexture - GL_TEXTURE0);
|
||||
LL_WARNS() << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
|
@ -883,9 +880,9 @@ void LLRender::init(bool needs_vertex_buffer)
|
|||
#if LL_WINDOWS
|
||||
if (gGLManager.mHasDebugOutput && gDebugGL)
|
||||
{ //setup debug output callback
|
||||
//glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
//glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
|
||||
glDebugMessageCallback((GLDEBUGPROC) gl_debug_callback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1507,7 +1504,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
|
|||
llassert(color_dfactor < BF_UNDEF);
|
||||
llassert(alpha_sfactor < BF_UNDEF);
|
||||
llassert(alpha_dfactor < BF_UNDEF);
|
||||
if (!gGLManager.mHasBlendFuncSeparate)
|
||||
if (!LLRender::sGLCoreProfile && !gGLManager.mHasBlendFuncSeparate)
|
||||
{
|
||||
LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << LL_ENDL;
|
||||
blendFunc(color_sfactor, color_dfactor);
|
||||
|
|
@ -1521,8 +1518,9 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
|
|||
mCurrBlendColorDFactor = color_dfactor;
|
||||
mCurrBlendAlphaDFactor = alpha_dfactor;
|
||||
flush();
|
||||
glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor],
|
||||
sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);
|
||||
|
||||
glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor],
|
||||
sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ void LLRenderTarget::bindTarget()
|
|||
GL_COLOR_ATTACHMENT1,
|
||||
GL_COLOR_ATTACHMENT2,
|
||||
GL_COLOR_ATTACHMENT3};
|
||||
glDrawBuffersARB(mTex.size(), drawbuffers);
|
||||
glDrawBuffers(mTex.size(), drawbuffers);
|
||||
}
|
||||
|
||||
if (mTex.empty())
|
||||
|
|
|
|||
|
|
@ -558,18 +558,18 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
//============================================================================
|
||||
// Load Shader
|
||||
|
||||
static std::string get_object_log(GLhandleARB ret)
|
||||
static std::string get_shader_log(GLuint ret)
|
||||
{
|
||||
std::string res;
|
||||
|
||||
//get log length
|
||||
GLint length;
|
||||
glGetObjectParameterivARB(ret, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
|
||||
glGetShaderiv(ret, GL_INFO_LOG_LENGTH, &length);
|
||||
if (length > 0)
|
||||
{
|
||||
//the log could be any size, so allocate appropriately
|
||||
GLcharARB* log = new GLcharARB[length];
|
||||
glGetInfoLogARB(ret, length, &length, log);
|
||||
GLchar* log = new GLchar[length];
|
||||
glGetShaderInfoLog(ret, length, &length, log);
|
||||
res = std::string((char *)log);
|
||||
delete[] log;
|
||||
}
|
||||
|
|
@ -582,8 +582,41 @@ static std::string get_object_log(GLhandleARB ret)
|
|||
return res;
|
||||
}
|
||||
|
||||
static std::string get_program_log(GLuint ret)
|
||||
{
|
||||
std::string res;
|
||||
|
||||
//get log length
|
||||
GLint length;
|
||||
glGetProgramiv(ret, GL_INFO_LOG_LENGTH, &length);
|
||||
if (length > 0)
|
||||
{
|
||||
//the log could be any size, so allocate appropriately
|
||||
GLchar* log = new GLchar[length];
|
||||
glGetProgramInfoLog(ret, length, &length, log);
|
||||
res = std::string((char*)log);
|
||||
delete[] log;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// get the info log for the given object, be it a shader or program object
|
||||
// NOTE: ret MUST be a shader OR a program object
|
||||
static std::string get_object_log(GLuint ret)
|
||||
{
|
||||
if (glIsProgram(ret))
|
||||
{
|
||||
return get_program_log(ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert(glIsShader(ret));
|
||||
return get_shader_log(ret);
|
||||
}
|
||||
}
|
||||
|
||||
//dump shader source for debugging
|
||||
void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text)
|
||||
void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text)
|
||||
{
|
||||
char num_str[16]; // U32 = max 10 digits
|
||||
|
||||
|
|
@ -598,9 +631,10 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_cod
|
|||
LL_CONT << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename)
|
||||
void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename)
|
||||
{
|
||||
std::string log = get_object_log(ret);
|
||||
std::string log;
|
||||
log = get_object_log(ret);
|
||||
std::string fname = filename;
|
||||
if (filename.empty())
|
||||
{
|
||||
|
|
@ -614,7 +648,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&
|
|||
}
|
||||
}
|
||||
|
||||
GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels)
|
||||
GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels)
|
||||
{
|
||||
|
||||
// endsure work-around for missing GLSL funcs gets propogated to feature shader files (e.g. srgbF.glsl)
|
||||
|
|
@ -685,9 +719,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
|
||||
//we can't have any lines longer than 1024 characters
|
||||
//or any shaders longer than 4096 lines... deal - DaveP
|
||||
GLcharARB buff[1024];
|
||||
GLcharARB *extra_code_text[1024];
|
||||
GLcharARB *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL };
|
||||
GLchar buff[1024];
|
||||
GLchar *extra_code_text[1024];
|
||||
GLchar *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL };
|
||||
GLuint extra_code_count = 0, shader_code_count = 0;
|
||||
BOOST_STATIC_ASSERT(LL_ARRAY_SIZE(extra_code_text) < LL_ARRAY_SIZE(shader_code_text));
|
||||
|
||||
|
|
@ -769,7 +803,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
|
||||
extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE in\n");
|
||||
|
||||
if (type == GL_VERTEX_SHADER_ARB)
|
||||
if (type == GL_VERTEX_SHADER)
|
||||
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
|
||||
// ("varying" is deprecated after version 1.20)
|
||||
extra_code_text[extra_code_count++] = strdup("#define VARYING out\n");
|
||||
|
|
@ -806,7 +840,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
for (std::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
|
||||
{
|
||||
std::string define = "#define " + iter->first + " " + iter->second + "\n";
|
||||
extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str());
|
||||
extra_code_text[extra_code_count++] = (GLchar *) strdup(define.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -815,7 +849,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
extra_code_text[extra_code_count++] = strdup( "#define IS_AMD_CARD 1\n" );
|
||||
}
|
||||
|
||||
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
|
||||
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER)
|
||||
{
|
||||
//use specified number of texture channels for indexed texture rendering
|
||||
|
||||
|
|
@ -955,7 +989,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
}
|
||||
else
|
||||
{
|
||||
shader_code_text[shader_code_count] = (GLcharARB *)strdup((char *)buff);
|
||||
shader_code_text[shader_code_count] = (GLchar *)strdup((char *)buff);
|
||||
|
||||
if(flag_write_to_out_of_extra_block_area & flags)
|
||||
{
|
||||
|
|
@ -992,40 +1026,40 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
fclose(file);
|
||||
|
||||
//create shader object
|
||||
GLhandleARB ret = glCreateShaderObjectARB(type);
|
||||
GLuint ret = glCreateShader(type);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShader: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
}
|
||||
|
||||
//load source
|
||||
glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL);
|
||||
glShaderSource(ret, shader_code_count, (const GLchar**) shader_code_text, NULL);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSource: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
}
|
||||
|
||||
//compile source
|
||||
glCompileShaderARB(ret);
|
||||
glCompileShader(ret);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShader: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
}
|
||||
|
||||
if (error == GL_NO_ERROR)
|
||||
{
|
||||
//check for errors
|
||||
GLint success = GL_TRUE;
|
||||
glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success);
|
||||
glGetShaderiv(ret, GL_COMPILE_STATUS, &success);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR || success == GL_FALSE)
|
||||
if (error != GL_NO_ERROR || success == GL_FALSE)
|
||||
{
|
||||
//an error occured, print log
|
||||
LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL;
|
||||
|
|
@ -1050,10 +1084,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
if (ret)
|
||||
{
|
||||
// Add shader file to map
|
||||
if (type == GL_VERTEX_SHADER_ARB) {
|
||||
if (type == GL_VERTEX_SHADER) {
|
||||
mVertexShaderObjects[filename] = ret;
|
||||
}
|
||||
else if (type == GL_FRAGMENT_SHADER_ARB) {
|
||||
else if (type == GL_FRAGMENT_SHADER) {
|
||||
mFragmentShaderObjects[filename] = ret;
|
||||
}
|
||||
shader_level = try_gpu_class;
|
||||
|
|
@ -1070,19 +1104,21 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
return ret;
|
||||
}
|
||||
|
||||
BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
|
||||
BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors)
|
||||
{
|
||||
//check for errors
|
||||
glLinkProgramARB(obj);
|
||||
glLinkProgram(obj);
|
||||
GLint success = GL_TRUE;
|
||||
glGetObjectParameterivARB(obj, GL_OBJECT_LINK_STATUS_ARB, &success);
|
||||
glGetProgramiv(obj, GL_LINK_STATUS, &success);
|
||||
if (!suppress_errors && success == GL_FALSE)
|
||||
{
|
||||
//an error occured, print log
|
||||
LL_SHADER_LOADING_WARNS() << "GLSL Linker Error:" << LL_ENDL;
|
||||
dumpObjectLog(obj, TRUE, "linker");
|
||||
return success;
|
||||
}
|
||||
|
||||
std::string log = get_object_log(obj);
|
||||
std::string log = get_program_log(obj);
|
||||
LLStringUtil::toLower(log);
|
||||
if (log.find("software") != std::string::npos)
|
||||
{
|
||||
|
|
@ -1093,12 +1129,12 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
|
|||
return success;
|
||||
}
|
||||
|
||||
BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj)
|
||||
BOOL LLShaderMgr::validateProgramObject(GLuint obj)
|
||||
{
|
||||
//check program validity against current GL
|
||||
glValidateProgramARB(obj);
|
||||
glValidateProgram(obj);
|
||||
GLint success = GL_TRUE;
|
||||
glGetObjectParameterivARB(obj, GL_OBJECT_VALIDATE_STATUS_ARB, &success);
|
||||
glGetProgramiv(obj, GL_LINK_STATUS, &success);
|
||||
if (success == GL_FALSE)
|
||||
{
|
||||
LL_SHADER_LOADING_WARNS() << "GLSL program not valid: " << LL_ENDL;
|
||||
|
|
@ -1179,7 +1215,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||
mReservedUniforms.push_back("emissiveColor");
|
||||
mReservedUniforms.push_back("metallicFactor");
|
||||
mReservedUniforms.push_back("roughnessFactor");
|
||||
|
||||
|
||||
mReservedUniforms.push_back("diffuseMap");
|
||||
mReservedUniforms.push_back("altDiffuseMap");
|
||||
mReservedUniforms.push_back("specularMap");
|
||||
|
|
|
|||
|
|
@ -283,11 +283,11 @@ public:
|
|||
virtual void initAttribsAndUniforms(void);
|
||||
|
||||
BOOL attachShaderFeatures(LLGLSLShader * shader);
|
||||
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE, const std::string& filename = "");
|
||||
void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text);
|
||||
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
||||
BOOL validateProgramObject(GLhandleARB obj);
|
||||
GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
|
||||
void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = "");
|
||||
void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text);
|
||||
BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE);
|
||||
BOOL validateProgramObject(GLuint obj);
|
||||
GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
|
||||
|
||||
// Implemented in the application to actually point to the shader directory.
|
||||
virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual
|
||||
|
|
@ -297,8 +297,8 @@ public:
|
|||
|
||||
public:
|
||||
// Map of shader names to compiled
|
||||
std::map<std::string, GLhandleARB> mVertexShaderObjects;
|
||||
std::map<std::string, GLhandleARB> mFragmentShaderObjects;
|
||||
std::map<std::string, GLuint> mVertexShaderObjects;
|
||||
std::map<std::string, GLuint> mFragmentShaderObjects;
|
||||
|
||||
//global (reserved slot) shader parameters
|
||||
std::vector<std::string> mReservedAttribs;
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE);
|
|||
//============================================================================
|
||||
|
||||
//static
|
||||
LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicCopyVBOPool(GL_DYNAMIC_COPY_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW, GL_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW, GL_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sDynamicCopyVBOPool(GL_DYNAMIC_COPY, GL_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW, GL_ELEMENT_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW, GL_ELEMENT_ARRAY_BUFFER);
|
||||
|
||||
U32 LLVBOPool::sBytesPooled = 0;
|
||||
U32 LLVBOPool::sIndexBytesPooled = 0;
|
||||
|
|
@ -126,7 +126,7 @@ U32 LLVBOPool::genBuffer()
|
|||
|
||||
if (sNameIdx == 0)
|
||||
{
|
||||
glGenBuffersARB(1024, sNamePool);
|
||||
glGenBuffers(1024, sNamePool);
|
||||
sNameIdx = 1024;
|
||||
}
|
||||
|
||||
|
|
@ -140,11 +140,11 @@ void LLVBOPool::deleteBuffer(U32 name)
|
|||
{
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
glBindBufferARB(mType, name);
|
||||
glBufferDataARB(mType, 0, NULL, mUsage);
|
||||
glBindBufferARB(mType, 0);
|
||||
glBindBuffer(mType, name);
|
||||
glBufferData(mType, 0, NULL, mUsage);
|
||||
glBindBuffer(mType, 0);
|
||||
|
||||
glDeleteBuffersARB(1, &name);
|
||||
glDeleteBuffers(1, &name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,14 +175,14 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
//make a new buffer
|
||||
name = genBuffer();
|
||||
|
||||
glBindBufferARB(mType, name);
|
||||
glBindBuffer(mType, name);
|
||||
|
||||
if (!for_seed && i < LL_VBO_POOL_SEED_COUNT)
|
||||
{ //record this miss
|
||||
mMissCount[i]++;
|
||||
}
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
LLVertexBuffer::sAllocatedBytes += size;
|
||||
}
|
||||
|
|
@ -191,10 +191,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
LLVertexBuffer::sAllocatedIndexBytes += size;
|
||||
}
|
||||
|
||||
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)
|
||||
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW)
|
||||
{
|
||||
glBufferDataARB(mType, size, 0, mUsage);
|
||||
if (mUsage != GL_DYNAMIC_COPY_ARB)
|
||||
glBufferData(mType, size, 0, mUsage);
|
||||
if (mUsage != GL_DYNAMIC_COPY)
|
||||
{ //data will be provided by application
|
||||
ret = (U8*) ll_aligned_malloc<64>(size);
|
||||
if (!ret)
|
||||
|
|
@ -211,10 +211,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
}
|
||||
else
|
||||
{ //always use a true hint of static draw when allocating non-client-backed buffers
|
||||
glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB);
|
||||
glBufferData(mType, size, 0, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
glBindBufferARB(mType, 0);
|
||||
glBindBuffer(mType, 0);
|
||||
|
||||
if (for_seed)
|
||||
{ //put into pool for future use
|
||||
|
|
@ -224,7 +224,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
rec.mGLName = name;
|
||||
rec.mClientData = ret;
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
sBytesPooled += size;
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
name = mFreeList[i].front().mGLName;
|
||||
ret = mFreeList[i].front().mClientData;
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
sBytesPooled -= size;
|
||||
}
|
||||
|
|
@ -262,7 +262,7 @@ void LLVBOPool::release(U32 name, U8* buffer, U32 size)
|
|||
deleteBuffer(name);
|
||||
ll_aligned_free_fallback((U8*) buffer);
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
LLVertexBuffer::sAllocatedBytes -= size;
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ void LLVBOPool::cleanup()
|
|||
|
||||
l.pop_front();
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
sBytesPooled -= size;
|
||||
LLVertexBuffer::sAllocatedBytes -= size;
|
||||
|
|
@ -450,14 +450,14 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
|||
{ //was enabled
|
||||
if (!(data_mask & mask))
|
||||
{ //needs to be disabled
|
||||
glDisableVertexAttribArrayARB(loc);
|
||||
glDisableVertexAttribArray(loc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //was disabled
|
||||
if (data_mask & mask)
|
||||
{ //needs to be enabled
|
||||
glEnableVertexAttribArrayARB(loc);
|
||||
glEnableVertexAttribArray(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -778,12 +778,12 @@ void LLVertexBuffer::unbind()
|
|||
|
||||
if (sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
sVBOActive = false;
|
||||
}
|
||||
if (sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
||||
|
|
@ -816,32 +816,32 @@ S32 LLVertexBuffer::determineUsage(S32 usage)
|
|||
ret_usage = 0;
|
||||
}
|
||||
|
||||
if (ret_usage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
|
||||
if (ret_usage == GL_STREAM_DRAW && !sUseStreamDraw)
|
||||
{
|
||||
ret_usage = 0;
|
||||
}
|
||||
|
||||
if (ret_usage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw)
|
||||
if (ret_usage == GL_DYNAMIC_DRAW && sPreferStreamDraw)
|
||||
{
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
ret_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
if (ret_usage == 0 && LLRender::sGLCoreProfile)
|
||||
{ //MUST use VBOs for all rendering
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
ret_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
if (ret_usage && ret_usage != GL_STREAM_DRAW_ARB)
|
||||
if (ret_usage && ret_usage != GL_STREAM_DRAW)
|
||||
{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default
|
||||
if (ret_usage != GL_DYNAMIC_COPY_ARB)
|
||||
if (ret_usage != GL_DYNAMIC_COPY)
|
||||
{
|
||||
if (sDisableVBOMapping)
|
||||
{ //always use stream draw if VBO mapping is disabled
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
ret_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_usage = GL_DYNAMIC_DRAW_ARB;
|
||||
ret_usage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -874,7 +874,7 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage)
|
|||
mMappable(false),
|
||||
mFence(NULL)
|
||||
{
|
||||
mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping);
|
||||
mMappable = (mUsage == GL_DYNAMIC_DRAW && !sDisableVBOMapping);
|
||||
|
||||
//zero out offsets
|
||||
for (U32 i = 0; i < TYPE_MAX; i++)
|
||||
|
|
@ -997,11 +997,11 @@ void LLVertexBuffer::genBuffer(U32 size)
|
|||
{
|
||||
mSize = vbo_block_size(size);
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
mMappedData = sStreamVBOPool.allocate(mGLBuffer, mSize);
|
||||
}
|
||||
else if (mUsage == GL_DYNAMIC_DRAW_ARB)
|
||||
else if (mUsage == GL_DYNAMIC_DRAW)
|
||||
{
|
||||
mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize);
|
||||
}
|
||||
|
|
@ -1018,7 +1018,7 @@ void LLVertexBuffer::genIndices(U32 size)
|
|||
{
|
||||
mIndicesSize = vbo_block_size(size);
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
mMappedIndexData = sStreamIBOPool.allocate(mGLIndices, mIndicesSize);
|
||||
}
|
||||
|
|
@ -1032,7 +1032,7 @@ void LLVertexBuffer::genIndices(U32 size)
|
|||
|
||||
void LLVertexBuffer::releaseBuffer()
|
||||
{
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
sStreamVBOPool.release(mGLBuffer, mMappedData, mSize);
|
||||
}
|
||||
|
|
@ -1049,7 +1049,7 @@ void LLVertexBuffer::releaseBuffer()
|
|||
|
||||
void LLVertexBuffer::releaseIndices()
|
||||
{
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
sStreamIBOPool.release(mGLIndices, mMappedIndexData, mIndicesSize);
|
||||
}
|
||||
|
|
@ -1349,7 +1349,7 @@ void LLVertexBuffer::setupVertexArray()
|
|||
{
|
||||
if (mTypeMask & (1 << i))
|
||||
{
|
||||
glEnableVertexAttribArrayARB(i);
|
||||
glEnableVertexAttribArray(i);
|
||||
|
||||
if (attrib_integer[i])
|
||||
{
|
||||
|
|
@ -1375,14 +1375,14 @@ void LLVertexBuffer::setupVertexArray()
|
|||
// pointer value. Ruslan asserts that in this case the last
|
||||
// param is interpreted as an array data offset within the VBO
|
||||
// rather than as an actual pointer, so it's okay.
|
||||
glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i],
|
||||
glVertexAttribPointer(i, attrib_size[i], attrib_type[i],
|
||||
attrib_normalized[i], sTypeSize[i],
|
||||
reinterpret_cast<GLvoid*>(intptr_t(mOffsets[i])));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisableVertexAttribArrayARB(i);
|
||||
glDisableVertexAttribArray(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1514,7 +1514,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
#ifdef GL_ARB_map_buffer_range
|
||||
S32 offset = mOffsets[type] + sTypeSize[type]*index;
|
||||
S32 length = (sTypeSize[type]*count+0xF) & ~0xF;
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length,
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, offset, length,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT |
|
||||
GL_MAP_INVALIDATE_RANGE_BIT);
|
||||
|
|
@ -1527,7 +1527,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
if (gDebugGL)
|
||||
{
|
||||
GLint size = 0;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
|
||||
if (size < mSize)
|
||||
{
|
||||
|
|
@ -1535,7 +1535,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
}
|
||||
}
|
||||
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize,
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, 0, mSize,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
#endif
|
||||
|
|
@ -1545,21 +1545,17 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
{
|
||||
if (map_range)
|
||||
{
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE);
|
||||
glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE);
|
||||
#endif
|
||||
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
map_range = false;
|
||||
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
llassert(src != NULL);
|
||||
|
|
@ -1583,8 +1579,8 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
//print out more debug info before crash
|
||||
LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL;
|
||||
GLint size;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL;
|
||||
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
LL_INFOS() << "GL_ARRAY_BUFFER size is " << size << LL_ENDL;
|
||||
//--------------------
|
||||
|
||||
GLint buff;
|
||||
|
|
@ -1699,7 +1695,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
|||
#ifdef GL_ARB_map_buffer_range
|
||||
S32 offset = sizeof(U16)*index;
|
||||
S32 length = sizeof(U16)*count;
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length,
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT |
|
||||
GL_MAP_INVALIDATE_RANGE_BIT);
|
||||
|
|
@ -1708,7 +1704,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
|||
else
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices,
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(U16)*mNumIndices,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
#endif
|
||||
|
|
@ -1718,21 +1714,17 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
|||
{
|
||||
if (map_range)
|
||||
{
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE);
|
||||
glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE);
|
||||
#endif
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
map_range = false;
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
llassert(src != NULL);
|
||||
|
|
@ -1808,12 +1800,12 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sTypeSize[region.mType]*region.mCount;
|
||||
if (mSize >= length + offset)
|
||||
{
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*)mMappedData + offset);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, offset, length, (U8*)mMappedData + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint size = 0;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
LL_WARNS() << "Attempted to map regions to a buffer that is too small, "
|
||||
<< "mapped size: " << mSize
|
||||
<< ", gl buffer size: " << size
|
||||
|
|
@ -1829,7 +1821,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
else
|
||||
{
|
||||
stop_glerror();
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, getSize(), (U8*) mMappedData);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -1847,15 +1839,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sTypeSize[region.mType]*region.mCount;
|
||||
if (gGLManager.mHasMapBufferRange)
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
}
|
||||
else if (gGLManager.mHasFlushBufferRange)
|
||||
{
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1863,7 +1847,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
}
|
||||
}
|
||||
stop_glerror();
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
stop_glerror();
|
||||
|
||||
mMappedData = NULL;
|
||||
|
|
@ -1888,12 +1872,12 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sizeof(U16)*region.mCount;
|
||||
if (mIndicesSize >= length + offset)
|
||||
{
|
||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, offset, length, (U8*) mMappedIndexData+offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint size = 0;
|
||||
glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
LL_WARNS() << "Attempted to map regions to a buffer that is too small, "
|
||||
<< "mapped size: " << mIndicesSize
|
||||
<< ", gl buffer size: " << size
|
||||
|
|
@ -1909,7 +1893,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
else
|
||||
{
|
||||
stop_glerror();
|
||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, getIndicesSize(), (U8*) mMappedIndexData);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -1927,17 +1911,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sizeof(U16)*region.mCount;
|
||||
if (gGLManager.mHasMapBufferRange)
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
}
|
||||
else if (gGLManager.mHasFlushBufferRange)
|
||||
{
|
||||
#ifdef GL_APPLE_flush_buffer_range
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
#endif
|
||||
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length);
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
|
@ -1946,7 +1920,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
}
|
||||
}
|
||||
|
||||
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
||||
|
||||
mMappedIndexData = NULL;
|
||||
}
|
||||
|
|
@ -2111,7 +2085,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
|
|||
if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))))
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
|
||||
sGLRenderBuffer = mGLBuffer;
|
||||
sBindCount++;
|
||||
sVBOActive = true;
|
||||
|
|
@ -2128,7 +2102,7 @@ bool LLVertexBuffer::bindGLBufferFast()
|
|||
{
|
||||
if (mGLBuffer != sGLRenderBuffer || !sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
|
||||
sGLRenderBuffer = mGLBuffer;
|
||||
sBindCount++;
|
||||
sVBOActive = true;
|
||||
|
|
@ -2151,7 +2125,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)
|
|||
{
|
||||
LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL;
|
||||
}*/
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
|
||||
sGLRenderIndices = mGLIndices;
|
||||
stop_glerror();
|
||||
sBindCount++;
|
||||
|
|
@ -2166,7 +2140,7 @@ bool LLVertexBuffer::bindGLIndicesFast()
|
|||
{
|
||||
if (mGLIndices != sGLRenderIndices || !sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
|
||||
sGLRenderIndices = mGLIndices;
|
||||
sBindCount++;
|
||||
sIBOActive = true;
|
||||
|
|
@ -2328,7 +2302,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
|||
{
|
||||
if (sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
sBindCount++;
|
||||
sVBOActive = false;
|
||||
setup = true; // ... or a VBO is deactivated
|
||||
|
|
@ -2343,7 +2317,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
|||
{
|
||||
if (sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
sBindCount++;
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
|
@ -2420,74 +2394,74 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_NORMAL;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD3)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD3;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD2)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD2;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD1)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD1;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TANGENT)
|
||||
{
|
||||
S32 loc = TYPE_TANGENT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]);
|
||||
glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
glVertexAttribPointer(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD0)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD0;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
}
|
||||
if (data_mask & MAP_COLOR)
|
||||
{
|
||||
S32 loc = TYPE_COLOR;
|
||||
//bind emissive instead of color pointer if emissive is present
|
||||
void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
}
|
||||
if (data_mask & MAP_EMISSIVE)
|
||||
{
|
||||
S32 loc = TYPE_EMISSIVE;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
|
||||
if (!(data_mask & MAP_COLOR))
|
||||
{ //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps
|
||||
loc = TYPE_COLOR;
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
}
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT4)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT4;
|
||||
void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
}
|
||||
if (data_mask & MAP_CLOTHWEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_CLOTHWEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXTURE_INDEX &&
|
||||
(gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later
|
||||
|
|
@ -2502,7 +2476,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_VERTEX;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
|
||||
glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
glVertexAttribPointer(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
}
|
||||
|
||||
llglassertok();
|
||||
|
|
@ -2516,74 +2490,74 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_NORMAL;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD3)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD3;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD2)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD2;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD1)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD1;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TANGENT)
|
||||
{
|
||||
S32 loc = TYPE_TANGENT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD0)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD0;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
}
|
||||
if (data_mask & MAP_COLOR)
|
||||
{
|
||||
S32 loc = TYPE_COLOR;
|
||||
//bind emissive instead of color pointer if emissive is present
|
||||
void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
}
|
||||
if (data_mask & MAP_EMISSIVE)
|
||||
{
|
||||
S32 loc = TYPE_EMISSIVE;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
|
||||
if (!(data_mask & MAP_COLOR))
|
||||
{ //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps
|
||||
loc = TYPE_COLOR;
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
}
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT4)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT4;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
}
|
||||
if (data_mask & MAP_CLOTHWEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_CLOTHWEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXTURE_INDEX)
|
||||
{
|
||||
|
|
@ -2597,7 +2571,7 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_VERTEX;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ public:
|
|||
U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||
S32 getUsage() const { return mUsage; }
|
||||
bool isWriteable() const { return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? true : false; }
|
||||
bool isWriteable() const { return (mMappable || mUsage == GL_STREAM_DRAW) ? true : false; }
|
||||
|
||||
void draw(U32 mode, U32 count, U32 indices_offset) const;
|
||||
void drawArrays(U32 mode, U32 offset, U32 count) const;
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
|
|||
NSOpenGLPFADepthSize, 24,
|
||||
NSOpenGLPFAAlphaSize, 8,
|
||||
NSOpenGLPFAColorSize, 24,
|
||||
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core,
|
||||
0
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,11 @@ float getDepth(vec2 pos_screen)
|
|||
|
||||
vec4 getTexture2DLodAmbient(vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
#ifndef FXAA_GLSL_120
|
||||
vec4 ret = textureLod(projectionMap, tc, lod);
|
||||
#else
|
||||
vec4 ret = texture2D(projectionMap, tc);
|
||||
#endif
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
|
@ -173,7 +177,11 @@ vec4 getTexture2DLodAmbient(vec2 tc, float lod)
|
|||
|
||||
vec4 getTexture2DLodDiffuse(vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
#ifndef FXAA_GLSL_120
|
||||
vec4 ret = textureLod(projectionMap, tc, lod);
|
||||
#else
|
||||
vec4 ret = texture2D(projectionMap, tc);
|
||||
#endif
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
|
@ -216,7 +224,11 @@ vec3 getProjectedLightDiffuseColor(float light_distance, vec2 projected_uv)
|
|||
|
||||
vec4 texture2DLodSpecular(vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
#ifndef FXAA_GLSL_120
|
||||
vec4 ret = textureLod(projectionMap, tc, lod);
|
||||
#else
|
||||
vec4 ret = texture2D(projectionMap, tc);
|
||||
#endif
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,364 @@
|
|||
/**
|
||||
* @file class1\deferred\pbralphaF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2022, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
#define PBR_USE_IBL 1
|
||||
#define PBR_USE_SUN 1
|
||||
#define PBR_USE_IRRADIANCE_HACK 1
|
||||
|
||||
#define DIFFUSE_ALPHA_MODE_NONE 0
|
||||
#define DIFFUSE_ALPHA_MODE_BLEND 1
|
||||
#define DIFFUSE_ALPHA_MODE_MASK 2
|
||||
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
|
||||
|
||||
#define DEBUG_PBR_LIGHT_TYPE 0 // Output Diffuse=0.75, Emissive=0, ORM=0,0,0
|
||||
|
||||
#define DEBUG_BASIC 0
|
||||
#define DEBUG_VERTEX 0
|
||||
#define DEBUG_NORMAL_MAP 0 // Output packed normal map "as is" to diffuse
|
||||
#define DEBUG_NORMAL_OUT 0 // Output unpacked normal to diffuse
|
||||
#define DEBUG_ORM 0 // Output Occlusion Roughness Metal "as is" to diffuse
|
||||
#define DEBUG_POSITION 0
|
||||
|
||||
uniform sampler2D diffuseMap; //always in sRGB space
|
||||
uniform sampler2D bumpMap;
|
||||
uniform sampler2D emissiveMap;
|
||||
uniform sampler2D specularMap; // PBR: Packed: Occlusion, Metal, Roughness
|
||||
|
||||
uniform float metallicFactor;
|
||||
uniform float roughnessFactor;
|
||||
uniform vec3 emissiveColor;
|
||||
|
||||
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
|
||||
uniform sampler2DRect lightMap;
|
||||
#endif
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
uniform mat3 env_mat;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
#else
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_data[4];
|
||||
#else
|
||||
#define frag_data gl_FragData
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SHADOW
|
||||
VARYING vec3 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
#endif
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
VARYING vec2 vary_texcoord2;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_ALPHA_MASK
|
||||
uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff()
|
||||
#endif
|
||||
|
||||
// Lights
|
||||
// See: LLRender::syncLightState()
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8]; // spot direction
|
||||
uniform vec4 light_attenuation[8]; // linear, quadratic, is omni, unused, See: LLPipeline::setupHWLights() and syncLightState()
|
||||
uniform vec3 light_diffuse[8];
|
||||
|
||||
vec2 encode_normal(vec3 n);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
// These are in deferredUtil.glsl but we can't set: mFeatures.isDeferred to include it
|
||||
vec3 BRDFLambertian( vec3 reflect0, vec3 reflect90, vec3 c_diff, float specWeight, float vh );
|
||||
vec3 BRDFSpecularGGX( vec3 reflect0, vec3 reflect90, float alphaRoughness, float specWeight, float vh, float nl, float nv, float nh );
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
|
||||
float calcLegacyDistanceAttenuation(float distance, float falloff);
|
||||
vec2 getGGX( vec2 brdfPoint );
|
||||
void initMaterial( vec3 diffuse, vec3 packedORM,
|
||||
out float alphaRough, out vec3 c_diff, out vec3 reflect0, out vec3 reflect90, out float specWeight );
|
||||
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
|
||||
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyEnv,
|
||||
vec3 pos, vec3 norm, float glossiness, float envIntensity);
|
||||
|
||||
vec3 hue_to_rgb(float hue);
|
||||
|
||||
// lp = light position
|
||||
// la = linear attenuation, light radius
|
||||
// fa = falloff
|
||||
// See: LLRender::syncLightState()
|
||||
vec3 calcPointLightOrSpotLight(vec3 reflect0, vec3 c_diff,
|
||||
vec3 lightColor, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln,
|
||||
float la, float fa, float is_pointlight, float ambiance)
|
||||
{
|
||||
vec3 intensity = vec3(0);
|
||||
|
||||
vec3 lv = lp.xyz - v;
|
||||
vec3 h, l;
|
||||
float nh, nl, nv, vh, lightDist;
|
||||
calcHalfVectors(lv,n,v,h,l,nh,nl,nv,vh,lightDist);
|
||||
|
||||
if (lightDist > 0.0)
|
||||
{
|
||||
float falloff_factor = (12.0 * fa) - 9.0;
|
||||
float inverted_la = falloff_factor / la;
|
||||
|
||||
float dist = lightDist / inverted_la;
|
||||
|
||||
float dist_atten = calcLegacyDistanceAttenuation(dist,fa);
|
||||
if (dist_atten <= 0.0)
|
||||
return intensity;
|
||||
|
||||
vec3 reflect90 = vec3(1);
|
||||
float specWeight = 1.0;
|
||||
|
||||
lv = normalize(lv);
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
nl *= spot * spot;
|
||||
|
||||
if (nl > 0.0)
|
||||
intensity = dist_atten * nl * lightColor * BRDFLambertian(reflect0, reflect90, c_diff, specWeight, vh);
|
||||
}
|
||||
return intensity;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
vec3 pos = vary_position;
|
||||
|
||||
float scol = 1.0;
|
||||
float ambocc = 1.0;
|
||||
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true);
|
||||
|
||||
// IF .mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
|
||||
// vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
|
||||
// else
|
||||
vec4 albedo = texture2D(diffuseMap, vary_texcoord0.xy).rgba;
|
||||
albedo.rgb = srgb_to_linear(albedo.rgb);
|
||||
#ifdef HAS_ALPHA_MASK
|
||||
if (albedo.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
// vec3 base = vertex_color.rgb * albedo.rgb * albedo.a;
|
||||
vec3 base = vertex_color.rgb * albedo.rgb;
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec4 norm = texture2D(bumpMap, vary_texcoord1.xy);
|
||||
norm.xyz = normalize(norm.xyz * 2 - 1);
|
||||
|
||||
vec3 tnorm = vec3(dot(norm.xyz,vary_mat0),
|
||||
dot(norm.xyz,vary_mat1),
|
||||
dot(norm.xyz,vary_mat2));
|
||||
#else
|
||||
vec4 norm = vec4(0,0,0,1.0);
|
||||
// vec3 tnorm = vary_normal;
|
||||
vec3 tnorm = vec3(0,0,1);
|
||||
#endif
|
||||
|
||||
tnorm = normalize(tnorm.xyz);
|
||||
norm.xyz = tnorm.xyz;
|
||||
|
||||
#if HAS_SHADOW
|
||||
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
|
||||
frag *= screen_res;
|
||||
scol = sampleDirectionalShadow(pos.xyz, norm.xyz, frag);
|
||||
#endif
|
||||
|
||||
// RGB = Occlusion, Roughness, Metal
|
||||
// default values, see LLViewerFetchedTexture::sWhiteImagep since roughnessFactor and metallicFactor are multiplied in
|
||||
// occlusion 1.0
|
||||
// roughness 0.0
|
||||
// metal 0.0
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec3 packedORM = texture2D(specularMap, vary_texcoord2.xy).rgb; // PBR linear packed Occlusion, Roughness, Metal. See: lldrawpoolapha.cpp
|
||||
#else
|
||||
vec3 packedORM = vec3(1,0,0);
|
||||
#endif
|
||||
|
||||
packedORM.g *= roughnessFactor;
|
||||
packedORM.b *= metallicFactor;
|
||||
|
||||
vec3 colorEmissive = emissiveColor;
|
||||
#ifdef HAS_EMISSIVE_MAP
|
||||
colorEmissive *= texture2D(emissiveMap, vary_texcoord0.xy).rgb;
|
||||
#endif
|
||||
|
||||
vec3 colorDiffuse = vec3(0);
|
||||
vec3 colorSpec = vec3(0);
|
||||
|
||||
float IOR = 1.5; // default Index Of Refraction 1.5 (dielectrics)
|
||||
float ao = packedORM.r;
|
||||
float perceptualRough = packedORM.g;
|
||||
float metal = packedORM.b;
|
||||
|
||||
vec3 v = -normalize(vary_position.xyz);
|
||||
vec3 n = norm.xyz;
|
||||
vec3 t = vec3(1,0,0);
|
||||
vec3 b = normalize(cross(n,t));
|
||||
vec3 reflectVN = normalize(reflect(-v,n));
|
||||
|
||||
vec3 h, l;
|
||||
float nh, nl, nv, vh, lightDist;
|
||||
calcHalfVectors(light_dir, n, v, h, l, nh, nl, nv, vh, lightDist);
|
||||
|
||||
vec3 c_diff, reflect0, reflect90;
|
||||
float alphaRough, specWeight;
|
||||
initMaterial( base, packedORM, alphaRough, c_diff, reflect0, reflect90, specWeight );
|
||||
|
||||
// Common to RadianceGGX and RadianceLambertian
|
||||
vec2 brdfPoint = clamp(vec2(nv, perceptualRough), vec2(0,0), vec2(1,1));
|
||||
vec2 vScaleBias = getGGX( brdfPoint); // Environment BRDF: scale and bias applied to reflect0
|
||||
vec3 fresnelR = max(vec3(1.0 - perceptualRough), reflect0) - reflect0; // roughness dependent fresnel
|
||||
vec3 kSpec = reflect0 + fresnelR*pow(1.0 - nv, 5.0);
|
||||
|
||||
vec3 legacyenv;
|
||||
|
||||
vec3 irradiance = vec3(0);
|
||||
vec3 specLight = vec3(0);
|
||||
float gloss = 1.0 - perceptualRough;
|
||||
sampleReflectionProbes(irradiance, specLight, legacyenv, pos.xyz, norm.xyz, gloss, 0.0);
|
||||
#if PBR_USE_IRRADIANCE_HACK
|
||||
irradiance = max(amblit,irradiance) * ambocc;
|
||||
#else
|
||||
irradiance = vec3(amblit);
|
||||
#endif
|
||||
|
||||
vec3 FssEssGGX = kSpec*vScaleBias.x + vScaleBias.y;
|
||||
#if PBR_USE_IBL
|
||||
colorSpec += specWeight * specLight * FssEssGGX;
|
||||
#endif
|
||||
|
||||
vec3 FssEssLambert = specWeight * kSpec * vScaleBias.x + vScaleBias.y; // NOTE: Very similar to FssEssRadiance but with extra specWeight term
|
||||
float Ems = 1.0 - (vScaleBias.x + vScaleBias.y);
|
||||
vec3 avg = specWeight * (reflect0 + (1.0 - reflect0) / 21.0);
|
||||
vec3 AvgEms = avg * Ems;
|
||||
vec3 FmsEms = AvgEms * FssEssLambert / (1.0 - AvgEms);
|
||||
vec3 kDiffuse = c_diff * (1.0 - FssEssLambert + FmsEms);
|
||||
#if PBR_USE_IBL
|
||||
colorDiffuse += (FmsEms + kDiffuse) * irradiance;
|
||||
#endif
|
||||
|
||||
colorDiffuse *= ao;
|
||||
colorSpec *= ao;
|
||||
|
||||
// Sun/Moon Lighting
|
||||
if (nl > 0.0 || nv > 0.0)
|
||||
{
|
||||
float scale = 4.9;
|
||||
vec3 sunColor = srgb_to_linear(sunlit * scale); // NOTE: Midday should have strong sunlight
|
||||
|
||||
// scol = sun shadow
|
||||
vec3 intensity = ambocc * sunColor * nl * scol;
|
||||
vec3 sunDiffuse = intensity * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
|
||||
vec3 sunSpec = intensity * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
|
||||
#if PBR_USE_SUN
|
||||
colorDiffuse += sunDiffuse;
|
||||
colorSpec += sunSpec;
|
||||
#endif
|
||||
}
|
||||
vec3 col = colorDiffuse + colorEmissive + colorSpec;
|
||||
vec3 light = vec3(0);
|
||||
|
||||
// Punctual lights
|
||||
#define LIGHT_LOOP(i) light += srgb_to_linear(vec3(scol)) * calcPointLightOrSpotLight( reflect0, c_diff, srgb_to_linear(2.2*light_diffuse[i].rgb), albedo.rgb, pos.xyz, n, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w );
|
||||
|
||||
LIGHT_LOOP(1)
|
||||
LIGHT_LOOP(2)
|
||||
LIGHT_LOOP(3)
|
||||
LIGHT_LOOP(4)
|
||||
LIGHT_LOOP(5)
|
||||
LIGHT_LOOP(6)
|
||||
LIGHT_LOOP(7)
|
||||
|
||||
#if !defined(LOCAL_LIGHT_KILL)
|
||||
col += light;
|
||||
#endif // !defined(LOCAL_LIGHT_KILL)
|
||||
|
||||
#if DEBUG_PBR_LIGHT_TYPE
|
||||
col.rgb = vec3(0.75);
|
||||
emissive = vec3(0);
|
||||
spec.rgb = vec3(0);
|
||||
#endif
|
||||
#if DEBUG_BASIC
|
||||
col.rgb = vec3( 1, 0, 1 );
|
||||
#endif
|
||||
#if DEBUG_VERTEX
|
||||
col.rgb = vertex_color.rgb;
|
||||
#endif
|
||||
#if DEBUG_NORMAL_MAP
|
||||
col.rgb = texture2D(bumpMap, vary_texcoord1.xy).rgb;
|
||||
#endif
|
||||
#if DEBUG_NORMAL_OUT
|
||||
col.rgb = vary_normal;
|
||||
#endif
|
||||
#if DEBUG_ORM
|
||||
col.rgb = linear_to_srgb(spec);
|
||||
#endif
|
||||
#if DEBUG_POSITION
|
||||
col.rgb = vary_position.xyz;
|
||||
#endif
|
||||
|
||||
// col.rgb = linear_to_srgb(col.rgb);
|
||||
// frag_color = vec4(albedo.rgb,albedo.a);
|
||||
// frag_color = vec4(base.rgb,albedo.a);
|
||||
// frag_color = vec4(irradiance,albedo.a);
|
||||
// frag_color = vec4(colorDiffuse,albedo.a);
|
||||
// frag_color = vec4(colorEmissive,albedo.a);
|
||||
// frag_color = vec4(sun_dir,albedo.a);
|
||||
// frag_color = vec4(sunlit,albedo.a);
|
||||
col = linear_to_srgb(col.rgb);
|
||||
frag_color = vec4(col,albedo.a);
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* @file class1\deferred\pbralphaV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2022, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#define DIFFUSE_ALPHA_MODE_IGNORE 0
|
||||
#define DIFFUSE_ALPHA_MODE_BLEND 1
|
||||
#define DIFFUSE_ALPHA_MODE_MASK 2
|
||||
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
|
||||
|
||||
#ifdef HAS_SKIN
|
||||
uniform mat4 modelview_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
mat4 getObjectSkinnedTransform();
|
||||
#else
|
||||
uniform mat3 normal_matrix;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
#if !defined(HAS_SKIN)
|
||||
uniform mat4 modelview_matrix;
|
||||
#endif
|
||||
VARYING vec3 vary_position;
|
||||
#endif
|
||||
|
||||
uniform mat4 texture_matrix0;
|
||||
|
||||
#ifdef HAS_SHADOW
|
||||
VARYING vec3 vary_fragcoord;
|
||||
uniform float near_clip;
|
||||
#endif
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
ATTRIBUTE vec4 tangent;
|
||||
ATTRIBUTE vec2 texcoord1;
|
||||
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
|
||||
VARYING vec2 vary_texcoord1;
|
||||
#else
|
||||
VARYING vec3 vary_normal;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
ATTRIBUTE vec2 texcoord2;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
#endif
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
#ifdef HAS_SKIN
|
||||
mat4 mat = getObjectSkinnedTransform();
|
||||
mat = modelview_matrix * mat;
|
||||
vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vary_position = pos;
|
||||
#endif
|
||||
vec4 vert = projection_matrix * vec4(pos,1.0);
|
||||
#else
|
||||
//transform vertex
|
||||
vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
#endif
|
||||
gl_Position = vert;
|
||||
|
||||
#if HAS_SHADOW
|
||||
vary_fragcoord.xyz = vert.xyz + vec3(0,0,near_clip);
|
||||
#endif
|
||||
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SKIN
|
||||
vec3 n = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz);
|
||||
vec3 b = cross(n, t)*tangent.w;
|
||||
|
||||
vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
vary_mat2 = vec3(t.z, b.z, n.z);
|
||||
#else //HAS_NORMAL_MAP
|
||||
vary_normal = n;
|
||||
#endif //HAS_NORMAL_MAP
|
||||
#else //HAS_SKIN
|
||||
vec3 n = normalize(normal_matrix * normal);
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec3 t = normalize(normal_matrix * tangent.xyz);
|
||||
vec3 b = cross(n,t)*tangent.w;
|
||||
|
||||
vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
vary_mat2 = vec3(t.z, b.z, n.z);
|
||||
#else //HAS_NORMAL_MAP
|
||||
vary_normal = n;
|
||||
#endif //HAS_NORMAL_MAP
|
||||
#endif //HAS_SKIN
|
||||
|
||||
vertex_color = diffuse_color;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
#if !defined(HAS_SKIN)
|
||||
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
@ -25,61 +25,34 @@
|
|||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
#define DEBUG_PBR_LIGHT_TYPE 0 // Output Diffuse=0.75, Emissive=0, ORM=0,0,0
|
||||
|
||||
#define DEBUG_BASIC 0
|
||||
#define DEBUG_VERTEX 0
|
||||
#define DEBUG_NORMAL_MAP 0 // Output packed normal map "as is" to diffuse
|
||||
#define DEBUG_NORMAL_OUT 0 // Output unpacked normal to diffuse
|
||||
#define DEBUG_ORM 0 // Output Occlusion Roughness Metal "as is" to diffuse
|
||||
#define DEBUG_POSITION 0
|
||||
|
||||
uniform sampler2D diffuseMap; //always in sRGB space
|
||||
|
||||
uniform float metallicFactor;
|
||||
uniform float roughnessFactor;
|
||||
uniform vec3 emissiveColor;
|
||||
uniform sampler2D bumpMap;
|
||||
uniform sampler2D emissiveMap;
|
||||
uniform sampler2D specularMap; // Packed: Occlusion, Metal, Roughness
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
uniform sampler2D bumpMap;
|
||||
VARYING vec3 vary_tangent;
|
||||
flat in float vary_sign;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_EMISSIVE_MAP
|
||||
uniform sampler2D emissiveMap;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
uniform sampler2D specularMap; // Packed: Occlusion, Metal, Roughness
|
||||
#endif
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
uniform mat3 env_mat;
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_data[4];
|
||||
#else
|
||||
#define frag_data gl_FragData
|
||||
#endif
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
#endif
|
||||
VARYING vec3 vary_tangent;
|
||||
flat in float vary_sign;
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
VARYING vec2 vary_texcoord2;
|
||||
#endif
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
|
||||
uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff()
|
||||
|
||||
vec2 encode_normal(vec3 n);
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
// IF .mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
|
||||
|
|
@ -94,11 +67,11 @@ void main()
|
|||
vec3 col = vertex_color.rgb * albedo.rgb;
|
||||
|
||||
// from mikktspace.com
|
||||
vec4 vNt = texture2D(bumpMap, vary_texcoord1.xy)*2.0-1.0;
|
||||
vec3 vNt = texture2D(bumpMap, vary_texcoord1.xy).xyz*2.0-1.0;
|
||||
float sign = vary_sign;
|
||||
vec3 vN = vary_normal;
|
||||
vec3 vT = vary_tangent.xyz;
|
||||
|
||||
|
||||
vec3 vB = sign * cross(vN, vT);
|
||||
vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
|
||||
|
||||
|
|
@ -107,49 +80,22 @@ void main()
|
|||
// occlusion 1.0
|
||||
// roughness 0.0
|
||||
// metal 0.0
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec3 spec = texture2D(specularMap, vary_texcoord2.xy).rgb;
|
||||
#else
|
||||
vec3 spec = vec3(1,0,0);
|
||||
#endif
|
||||
|
||||
spec.g *= roughnessFactor;
|
||||
spec.b *= metallicFactor;
|
||||
|
||||
vec3 emissive = emissiveColor;
|
||||
#ifdef HAS_EMISSIVE_MAP
|
||||
emissive *= texture2D(emissiveMap, vary_texcoord0.xy).rgb;
|
||||
#endif
|
||||
|
||||
#if DEBUG_PBR_LIGHT_TYPE
|
||||
col.rgb = vec3(0.75);
|
||||
emissive = vec3(0);
|
||||
spec.rgb = vec3(0);
|
||||
#endif
|
||||
#if DEBUG_BASIC
|
||||
col.rgb = vec3( 1, 0, 1 );
|
||||
#endif
|
||||
#if DEBUG_VERTEX
|
||||
col.rgb = vertex_color.rgb;
|
||||
#endif
|
||||
#if DEBUG_NORMAL_MAP
|
||||
col.rgb = texture2D(bumpMap, vary_texcoord1.xy).rgb;
|
||||
#endif
|
||||
#if DEBUG_NORMAL_OUT
|
||||
col.rgb = vary_normal;
|
||||
#endif
|
||||
#if DEBUG_ORM
|
||||
col.rgb = linear_to_srgb(spec);
|
||||
#endif
|
||||
#if DEBUG_POSITION
|
||||
col.rgb = vary_position.xyz;
|
||||
#endif
|
||||
|
||||
tnorm *= gl_FrontFacing ? 1.0 : -1.0;
|
||||
|
||||
//spec.rgb = vec3(1,1,0);
|
||||
//col = vec3(0,0,0);
|
||||
//emissive = vary_tangent.xyz*0.5+0.5;
|
||||
//emissive = vec3(vary_sign*0.5+0.5);
|
||||
//emissive = vec3(sign*0.5+0.5);
|
||||
//emissive = vNt * 0.5 + 0.5;
|
||||
//emissive = tnorm*0.5+0.5;
|
||||
// See: C++: addDeferredAttachments(), GLSL: softenLightF
|
||||
frag_data[0] = vec4(col, 0.0); // Diffuse
|
||||
frag_data[1] = vec4(emissive, vertex_color.a); // PBR sRGB Emissive
|
||||
|
|
|
|||
|
|
@ -37,41 +37,24 @@ uniform mat3 normal_matrix;
|
|||
uniform mat4 modelview_projection_matrix;
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
#if !defined(HAS_SKIN)
|
||||
uniform mat4 modelview_matrix;
|
||||
#endif
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
|
||||
#endif
|
||||
|
||||
uniform mat4 texture_matrix0;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
ATTRIBUTE vec4 tangent;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
ATTRIBUTE vec2 texcoord1;
|
||||
|
||||
VARYING vec2 vary_texcoord1;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
ATTRIBUTE vec2 texcoord2;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
#endif
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
VARYING vec3 vary_tangent;
|
||||
flat out float vary_sign;
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
|
||||
void main()
|
||||
|
|
@ -83,64 +66,27 @@ void main()
|
|||
|
||||
vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vary_position = pos;
|
||||
#endif
|
||||
|
||||
gl_Position = projection_matrix*vec4(pos,1.0);
|
||||
|
||||
#else
|
||||
//transform vertex
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
#endif
|
||||
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
|
||||
#ifdef HAS_SKIN
|
||||
vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
|
||||
vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
|
||||
#else //HAS_SKIN
|
||||
vec3 n = normal_matrix * normal;
|
||||
vec3 t = normal_matrix * tangent.xyz;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SKIN
|
||||
vec3 n = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz);
|
||||
vec3 b = cross(n, t)*tangent.w;
|
||||
|
||||
//vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
//vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
//vary_mat2 = vec3(t.z, b.z, n.z);
|
||||
#else //HAS_NORMAL_MAP
|
||||
vary_normal = n;
|
||||
#endif //HAS_NORMAL_MAP
|
||||
#else //HAS_SKIN
|
||||
vec3 n = normalize(normal_matrix * normal);
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec3 t = normalize(normal_matrix * tangent.xyz);
|
||||
vary_tangent = t;
|
||||
vary_tangent = normalize(t);
|
||||
vary_sign = tangent.w;
|
||||
vary_normal = n;
|
||||
|
||||
//vec3 b = cross(n,t)*tangent.w;
|
||||
//vec3 t = cross(b,n) * binormal.w;
|
||||
|
||||
//vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
//vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
//vary_mat2 = vec3(t.z, b.z, n.z);
|
||||
#else //HAS_NORMAL_MAP
|
||||
vary_normal = n;
|
||||
#endif //HAS_NORMAL_MAP
|
||||
#endif //HAS_SKIN
|
||||
vary_normal = normalize(n);
|
||||
|
||||
vertex_color = diffuse_color;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
#if !defined(HAS_SKIN)
|
||||
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
uniform samplerCubeArray reflectionProbes;
|
||||
|
||||
layout (std140, binding = 1) uniform ReflectionProbes
|
||||
layout (std140) uniform ReflectionProbes
|
||||
{
|
||||
// list of OBBs for user override probes
|
||||
// box is a set of 3 planes outward facing planes and the depth of the box along that plane
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
uniform samplerCubeArray reflectionProbes;
|
||||
uniform samplerCubeArray irradianceProbes;
|
||||
|
||||
layout (std140, binding = 1) uniform ReflectionProbes
|
||||
layout (std140) uniform ReflectionProbes
|
||||
{
|
||||
// list of OBBs for user override probes
|
||||
// box is a set of 3 planes outward facing planes and the depth of the box along that plane
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#define PBR_USE_IRRADIANCE_HACK 1
|
||||
|
||||
#define DEBUG_PBR_LIGHT_TYPE 0 // Output no global light to make it easier to see pointLight and spotLight
|
||||
#define DEBUG_PBR_PACKORM0 0 // Rough=0, Metal=0
|
||||
#define DEBUG_PBR_PACKORM1 0 // Rough=1, Metal=1
|
||||
#define DEBUG_PBR_PACK_ORM0 0 // Rough=0, Metal=0
|
||||
#define DEBUG_PBR_PACK_ORM1 0 // Rough=1, Metal=1
|
||||
#define DEBUG_PBR_TANGENT1 1 // Tangent = 1,0,0
|
||||
#define DEBUG_PBR_VERT2CAM1 0 // vertex2camera = 0,0,1
|
||||
#define DEBUG_PBR_SPECLIGHT051 0 // Force specLigh to be 0,0.5,1
|
||||
|
|
@ -76,6 +76,7 @@
|
|||
#define DEBUG_PBR_IRRADIANCE 0 // Output: Diffuse Irradiance, NOTE: SSAO is factored in
|
||||
#define DEBUG_PBR_FSS_ESS_LAMBERT 0 // Output: FssEssLambert
|
||||
#define DEBUG_PBR_EMS 0 // Output: Ems = (1 - BRDF Scale + BRDF Bias)
|
||||
#define DEBUG_PBR_EMS_AVG 0 // Output: Avg Ems
|
||||
#define DEBUG_PBR_AVG 0 // Output: Avg
|
||||
#define DEBUG_PBR_FMS_EMS 0 // Output: FmsEms
|
||||
#define DEBUG_PBR_DIFFUSE_K 0 // Output: diffuse FssEssLambert + FmsEms
|
||||
|
|
@ -114,6 +115,7 @@
|
|||
#define DEBUG_PBR_SUN_SPEC_FV 0 // F() * V()
|
||||
#define DEBUG_PBR_SUN_SPEC_DFV 0 // D() * F() * V()
|
||||
#define DEBUG_PBR_SUN_SPEC_NL_DFV 0 // nl * D() * F() * V()
|
||||
#define DEBUG_PBR_SUN_FINAL 0 // LAMBERT_NL + BRDF()
|
||||
|
||||
#define DEBUG_PBR_IOR 0 // Output: grayscale IOR
|
||||
#define DEBUG_PBR_REFLECT0_BASE 0 // Output: black reflect0 default from ior
|
||||
|
|
@ -338,9 +340,6 @@ void main()
|
|||
#if DEBUG_PBR_SPECLIGHT051
|
||||
specLight = vec3(0,0.5,1.0);
|
||||
irradiance = specLight;
|
||||
#endif
|
||||
#if HAS_IBL
|
||||
kSpec = mix( kSpec, iridescenceFresnel, iridescenceFactor);
|
||||
#endif
|
||||
vec3 FssEssGGX = kSpec*vScaleBias.x + vScaleBias.y;
|
||||
#if DEBUG_PBR_SPEC_IBL
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
#if DEBUG_SPOT_DIFFUSE
|
||||
#if DEBUG_PBR_SPOT_DIFFUSE
|
||||
final_color = vec3(nl * dist_atten);
|
||||
#endif
|
||||
#if DEBUG_SPOT_NL
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ static void settings_to_globals()
|
|||
|
||||
LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
|
||||
|
||||
LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLContextCoreProfile");
|
||||
LLRender::sGLCoreProfile = TRUE; // Now required, ignoring gSavedSettings.getBOOL("RenderGLContextCoreProfile");
|
||||
LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
|
||||
// <FS:Ansariel> Vertex Array Objects are required in OpenGL core profile
|
||||
LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO");
|
||||
|
|
|
|||
|
|
@ -1267,7 +1267,7 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
|
|||
|
||||
LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) :
|
||||
LLDrawable(root->getVObj(), true),
|
||||
LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB, regionp)
|
||||
LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW, regionp)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#include "llvoavatar.h"
|
||||
#include "fsperfstats.h" // <FS:Beq> performance stats support
|
||||
|
||||
#include "llenvironment.h"
|
||||
|
||||
BOOL LLDrawPoolAlpha::sShowDebugAlpha = FALSE;
|
||||
|
||||
#define current_shader (LLGLSLShader::sCurBoundShaderPtr)
|
||||
|
|
@ -82,6 +84,11 @@ void LLDrawPoolAlpha::prerender()
|
|||
// TODO: is this even necessay? These are probably set to never discard
|
||||
LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(1024.f*1024.f);
|
||||
LLViewerFetchedTexture::sWhiteImagep->addTextureStats(1024.f * 1024.f);
|
||||
|
||||
if (LLPipeline::sRenderPBR)
|
||||
{
|
||||
gPipeline.setupHWLights(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
|
||||
|
|
@ -650,65 +657,121 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
}
|
||||
}
|
||||
|
||||
LLRenderPass::applyModelMatrix(params);
|
||||
LLRenderPass::applyModelMatrix(params);
|
||||
|
||||
LLMaterial* mat = NULL;
|
||||
LLMaterial* mat = NULL;
|
||||
LLGLTFMaterial *gltf_mat = params.mGLTFMaterial; // Also see: LLPipeline::getPoolTypeFromTE()
|
||||
bool is_pbr = LLPipeline::sRenderPBR && gltf_mat;
|
||||
|
||||
if (deferred_render)
|
||||
{
|
||||
mat = params.mMaterial;
|
||||
}
|
||||
|
||||
if (params.mFullbright)
|
||||
{
|
||||
// Turn off lighting if it hasn't already been so.
|
||||
if (light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
target_shader = fullbright_shader;
|
||||
|
||||
light_enabled = FALSE;
|
||||
}
|
||||
}
|
||||
// Turn on lighting if it isn't already.
|
||||
else if (!light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
target_shader = simple_shader;
|
||||
light_enabled = TRUE;
|
||||
}
|
||||
|
||||
if (deferred_render && mat)
|
||||
{
|
||||
U32 mask = params.mShaderMask;
|
||||
|
||||
llassert(mask < LLMaterial::SHADER_COUNT);
|
||||
target_shader = &(gDeferredMaterialProgram[mask]);
|
||||
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
{
|
||||
target_shader = &(gDeferredMaterialWaterProgram[mask]);
|
||||
}
|
||||
|
||||
if (params.mAvatar != nullptr)
|
||||
if (is_pbr && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND)
|
||||
{
|
||||
target_shader = &gDeferredPBRAlphaProgram[rigged];
|
||||
if (current_shader != target_shader)
|
||||
{
|
||||
llassert(target_shader->mRiggedVariant != nullptr);
|
||||
target_shader = target_shader->mRiggedVariant;
|
||||
gPipeline.bindDeferredShader(*target_shader);
|
||||
}
|
||||
|
||||
if (current_shader != target_shader)
|
||||
{
|
||||
gPipeline.bindDeferredShader(*target_shader);
|
||||
}
|
||||
}
|
||||
else if (!params.mFullbright)
|
||||
{
|
||||
target_shader = simple_shader;
|
||||
}
|
||||
else
|
||||
{
|
||||
target_shader = fullbright_shader;
|
||||
}
|
||||
if (params.mTexture.notNull())
|
||||
{
|
||||
gGL.getTexUnit(0)->bindFast(params.mTexture); // diffuse
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep);
|
||||
}
|
||||
|
||||
if (params.mNormalMap)
|
||||
{
|
||||
target_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep);
|
||||
}
|
||||
|
||||
if (params.mSpecularMap)
|
||||
{
|
||||
target_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
}
|
||||
else
|
||||
{
|
||||
target_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
|
||||
}
|
||||
|
||||
if (params.mEmissiveMap)
|
||||
{
|
||||
target_shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, params.mEmissiveMap); // PBR sRGB Emissive
|
||||
}
|
||||
else
|
||||
{
|
||||
target_shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep);
|
||||
}
|
||||
|
||||
target_shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, params.mGLTFMaterial->mRoughnessFactor);
|
||||
target_shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, params.mGLTFMaterial->mMetallicFactor);
|
||||
target_shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, params.mGLTFMaterial->mEmissiveColor.mV);
|
||||
|
||||
target_shader->mLightHash = 0;
|
||||
gGL.syncLightState(); // Set light uniforms
|
||||
}
|
||||
else
|
||||
{
|
||||
if (deferred_render)
|
||||
{
|
||||
mat = params.mMaterial;
|
||||
}
|
||||
|
||||
if (params.mFullbright)
|
||||
{
|
||||
// Turn off lighting if it hasn't already been so.
|
||||
if (light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
target_shader = fullbright_shader;
|
||||
|
||||
light_enabled = FALSE;
|
||||
}
|
||||
}
|
||||
// Turn on lighting if it isn't already.
|
||||
else if (!light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
target_shader = simple_shader;
|
||||
light_enabled = TRUE;
|
||||
}
|
||||
|
||||
if (deferred_render && mat)
|
||||
{
|
||||
U32 mask = params.mShaderMask;
|
||||
|
||||
llassert(mask < LLMaterial::SHADER_COUNT);
|
||||
target_shader = &(gDeferredMaterialProgram[mask]);
|
||||
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
{
|
||||
target_shader = &(gDeferredMaterialWaterProgram[mask]);
|
||||
}
|
||||
|
||||
if (params.mAvatar != nullptr)
|
||||
{
|
||||
llassert(target_shader->mRiggedVariant != nullptr);
|
||||
target_shader = target_shader->mRiggedVariant;
|
||||
}
|
||||
|
||||
if (current_shader != target_shader)
|
||||
{
|
||||
gPipeline.bindDeferredShader(*target_shader);
|
||||
}
|
||||
}
|
||||
else if (!params.mFullbright)
|
||||
{
|
||||
target_shader = simple_shader;
|
||||
}
|
||||
else
|
||||
{
|
||||
target_shader = fullbright_shader;
|
||||
}
|
||||
}
|
||||
|
||||
if (params.mAvatar != nullptr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
|
||||
static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
|
||||
static U32 sBufferUsage = GL_STREAM_DRAW_ARB;
|
||||
static U32 sBufferUsage = GL_STREAM_DRAW;
|
||||
static U32 sShaderLevel = 0;
|
||||
|
||||
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
|
||||
|
|
@ -155,11 +155,11 @@ void LLDrawPoolAvatar::prerender()
|
|||
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
sBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
sBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
sBufferUsage = GL_STREAM_DRAW_ARB;
|
||||
sBufferUsage = GL_STREAM_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1052,7 +1052,7 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const
|
|||
|
||||
LLVertexBufferAvatar::LLVertexBufferAvatar()
|
||||
: LLVertexBuffer(sDataMask,
|
||||
GL_STREAM_DRAW_ARB) //avatars are always stream draw due to morph targets
|
||||
GL_STREAM_DRAW) //avatars are always stream draw due to morph targets
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1277,7 +1277,7 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf)
|
|||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW);
|
||||
vf.mVertexBuffer = buff;
|
||||
|
||||
buff->allocateBuffer(vf.mNumVertices, 0, true);
|
||||
|
|
@ -1616,7 +1616,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
#ifdef GL_TRANSFORM_FEEDBACK_BUFFER
|
||||
if (use_transform_feedback &&
|
||||
mVertexBuffer->getUsage() == GL_DYNAMIC_COPY_ARB &&
|
||||
mVertexBuffer->getUsage() == GL_DYNAMIC_COPY &&
|
||||
gTransformPositionProgram.mProgramObject && //transform shaders are loaded
|
||||
mVertexBuffer->useVBOs() && //target buffer is in VRAM
|
||||
!rebuild_weights && //TODO: add support for weights
|
||||
|
|
@ -1751,7 +1751,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
}
|
||||
}
|
||||
|
||||
glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
|
||||
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
|
||||
gGL.popMatrix();
|
||||
|
||||
if (cur_shader)
|
||||
|
|
@ -2268,6 +2268,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
mask.setElement<3>();
|
||||
|
||||
LLVector4a* tbuff = mikktspace ? vf.mMikktSpaceTangents : vf.mTangents;
|
||||
if (tbuff == nullptr)
|
||||
{ // non-mesh prims will not have mikktspace tangents
|
||||
tbuff = vf.mTangents;
|
||||
}
|
||||
|
||||
LLVector4a* src = tbuff;
|
||||
LLVector4a* end = tbuff+num_vertices;
|
||||
|
||||
|
|
@ -2275,7 +2280,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
{
|
||||
LLVector4a tangent_out;
|
||||
mat_normal.rotate(*src, tangent_out);
|
||||
tangent_out.normalize3fast();
|
||||
tangent_out.setSelectWithMask(mask, *src, tangent_out);
|
||||
tangent_out.store4a(tangents);
|
||||
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures)
|
|||
void LLFeatureManager::setGraphicsLevel(U32 level, bool skipFeatures)
|
||||
{
|
||||
LLViewerShaderMgr::sSkipReload = true;
|
||||
|
||||
flush_glerror(); // Whatever may have already happened (e.g., to cause us to change), don't let confuse it with new initializations.
|
||||
applyBaseMasks();
|
||||
|
||||
// if we're passed an invalid level, default to "Low"
|
||||
|
|
|
|||
|
|
@ -1150,8 +1150,8 @@ F32 gpu_benchmark()
|
|||
gBenchmarkProgram.mName = "Benchmark Shader";
|
||||
gBenchmarkProgram.mFeatures.attachNothing = true;
|
||||
gBenchmarkProgram.mShaderFiles.clear();
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER));
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER));
|
||||
gBenchmarkProgram.mShaderLevel = 1;
|
||||
if (!gBenchmarkProgram.createShader(NULL, NULL))
|
||||
{
|
||||
|
|
@ -1234,7 +1234,7 @@ F32 gpu_benchmark()
|
|||
delete [] pixels;
|
||||
|
||||
//make a dummy triangle to draw with
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, GL_STREAM_DRAW_ARB);
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, GL_STREAM_DRAW);
|
||||
|
||||
if (!buff->allocateBuffer(3, 0, true))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,9 +56,16 @@ LLGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id)
|
|||
}
|
||||
|
||||
LLFileSystem file(id, asset_type, LLFileSystem::READ);
|
||||
auto size = file.getSize();
|
||||
if (!size)
|
||||
{
|
||||
LL_DEBUGS() << "Zero size material." << LL_ENDL;
|
||||
mat->unref();
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<char> buffer;
|
||||
buffer.resize(file.getSize());
|
||||
buffer.resize(size);
|
||||
file.read((U8*)&buffer[0], buffer.size());
|
||||
|
||||
LLSD asset;
|
||||
|
|
|
|||
|
|
@ -2042,9 +2042,10 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
|
|||
|
||||
// extra space for normals and text coords
|
||||
S32 tc_bytes_size = ((size_vertices * sizeof(LLVector2)) + 0xF) & ~0xF;
|
||||
LLVector4a* combined_positions = (LLVector4a*)ll_aligned_malloc<64>(sizeof(LLVector4a) * 2 * size_vertices + tc_bytes_size);
|
||||
LLVector4a* combined_positions = (LLVector4a*)ll_aligned_malloc<64>(sizeof(LLVector4a) * 3 * size_vertices + tc_bytes_size);
|
||||
LLVector4a* combined_normals = combined_positions + size_vertices;
|
||||
LLVector2* combined_tex_coords = (LLVector2*)(combined_normals + size_vertices);
|
||||
LLVector4a* combined_tangents = combined_normals + size_vertices;
|
||||
LLVector2* combined_tex_coords = (LLVector2*)(combined_tangents + size_vertices);
|
||||
|
||||
// copy indices and vertices into new buffers
|
||||
S32 combined_positions_shift = 0;
|
||||
|
|
@ -2054,6 +2055,9 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
|
|||
{
|
||||
const LLVolumeFace &face = base_model->getVolumeFace(face_idx);
|
||||
|
||||
// ensure tangents have been generated or loaded
|
||||
llassert(face.mMikktSpaceTangents);
|
||||
|
||||
// Vertices
|
||||
S32 copy_bytes = face.mNumVertices * sizeof(LLVector4a);
|
||||
LLVector4a::memcpyNonAliased16((F32*)(combined_positions + combined_positions_shift), (F32*)face.mPositions, copy_bytes);
|
||||
|
|
@ -2061,6 +2065,9 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
|
|||
// Normals
|
||||
LLVector4a::memcpyNonAliased16((F32*)(combined_normals + combined_positions_shift), (F32*)face.mNormals, copy_bytes);
|
||||
|
||||
// Tangents
|
||||
LLVector4a::memcpyNonAliased16((F32*)(combined_tangents + combined_positions_shift), (F32*)face.mMikktSpaceTangents, copy_bytes);
|
||||
|
||||
// Tex coords
|
||||
copy_bytes = face.mNumVertices * sizeof(LLVector2);
|
||||
memcpy((void*)(combined_tex_coords + combined_positions_shift), (void*)face.mTexCoords, copy_bytes);
|
||||
|
|
@ -2184,9 +2191,10 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
|
|||
|
||||
// IV. Repack back into individual faces
|
||||
|
||||
LLVector4a* buffer_positions = (LLVector4a*)ll_aligned_malloc<64>(sizeof(LLVector4a) * 2 * size_vertices + tc_bytes_size);
|
||||
LLVector4a* buffer_positions = (LLVector4a*)ll_aligned_malloc<64>(sizeof(LLVector4a) * 3 * size_vertices + tc_bytes_size);
|
||||
LLVector4a* buffer_normals = buffer_positions + size_vertices;
|
||||
LLVector2* buffer_tex_coords = (LLVector2*)(buffer_normals + size_vertices);
|
||||
LLVector4a* buffer_tangents = buffer_normals + size_vertices;
|
||||
LLVector2* buffer_tex_coords = (LLVector2*)(buffer_tangents + size_vertices);
|
||||
S32 buffer_idx_size = (size_indices * sizeof(U16) + 0xF) & ~0xF;
|
||||
U16* buffer_indices = (U16*)ll_aligned_malloc_16(buffer_idx_size);
|
||||
S32* old_to_new_positions_map = new S32[size_vertices];
|
||||
|
|
@ -2279,6 +2287,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
|
|||
// Copy vertice, normals, tcs
|
||||
buffer_positions[buf_positions_copied] = combined_positions[idx];
|
||||
buffer_normals[buf_positions_copied] = combined_normals[idx];
|
||||
buffer_tangents[buf_positions_copied] = combined_tangents[idx];
|
||||
buffer_tex_coords[buf_positions_copied] = combined_tex_coords[idx];
|
||||
|
||||
old_to_new_positions_map[idx] = buf_positions_copied;
|
||||
|
|
@ -2317,12 +2326,13 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
|
|||
{
|
||||
new_face.resizeIndices(buf_indices_copied);
|
||||
new_face.resizeVertices(buf_positions_copied);
|
||||
|
||||
new_face.allocateTangents(buf_positions_copied, true);
|
||||
S32 idx_size = (buf_indices_copied * sizeof(U16) + 0xF) & ~0xF;
|
||||
LLVector4a::memcpyNonAliased16((F32*)new_face.mIndices, (F32*)buffer_indices, idx_size);
|
||||
|
||||
LLVector4a::memcpyNonAliased16((F32*)new_face.mPositions, (F32*)buffer_positions, buf_positions_copied * sizeof(LLVector4a));
|
||||
LLVector4a::memcpyNonAliased16((F32*)new_face.mNormals, (F32*)buffer_normals, buf_positions_copied * sizeof(LLVector4a));
|
||||
LLVector4a::memcpyNonAliased16((F32*)new_face.mMikktSpaceTangents, (F32*)buffer_tangents, buf_positions_copied * sizeof(LLVector4a));
|
||||
|
||||
U32 tex_size = (buf_positions_copied * sizeof(LLVector2) + 0xF)&~0xF;
|
||||
LLVector4a::memcpyNonAliased16((F32*)new_face.mTexCoords, (F32*)buffer_tex_coords, tex_size);
|
||||
|
|
|
|||
|
|
@ -1201,10 +1201,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
|
|||
mTextureCtrl->setTentative(FALSE);
|
||||
mTextureCtrl->setEnabled(editable);
|
||||
mTextureCtrl->setImageAssetID(id);
|
||||
getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f);
|
||||
getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
|
||||
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
|
||||
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
|
||||
getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material);
|
||||
getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material);
|
||||
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
|
||||
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
|
||||
|
||||
mTextureCtrl->setBakeTextureEnabled(TRUE);
|
||||
}
|
||||
|
|
@ -1227,10 +1227,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
|
|||
mTextureCtrl->setTentative(TRUE);
|
||||
mTextureCtrl->setEnabled(editable);
|
||||
mTextureCtrl->setImageAssetID(id);
|
||||
getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f);
|
||||
getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
|
||||
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
|
||||
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
|
||||
getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material);
|
||||
getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material);
|
||||
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
|
||||
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
|
||||
|
||||
mTextureCtrl->setBakeTextureEnabled(TRUE);
|
||||
}
|
||||
|
|
@ -1981,8 +1981,8 @@ void LLPanelFace::updateVisibility()
|
|||
|
||||
// Diffuse texture controls
|
||||
getChildView("texture control")->setVisible(show_texture && show_material);
|
||||
getChildView("label alphamode")->setVisible((show_texture && show_material) || show_pbr);
|
||||
getChildView("combobox alphamode")->setVisible((show_texture && show_material) || show_pbr);
|
||||
getChildView("label alphamode")->setVisible(show_texture && show_material);
|
||||
getChildView("combobox alphamode")->setVisible(show_texture && show_material);
|
||||
getChildView("label maskcutoff")->setVisible(false);
|
||||
getChildView("maskcutoff")->setVisible(false);
|
||||
if ((show_texture && show_material) || show_pbr)
|
||||
|
|
|
|||
|
|
@ -763,14 +763,14 @@ void LLReflectionMapManager::updateUniforms()
|
|||
//copy rpd into uniform buffer object
|
||||
if (mUBO == 0)
|
||||
{
|
||||
glGenBuffersARB(1, &mUBO);
|
||||
glGenBuffers(1, &mUBO);
|
||||
}
|
||||
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("rmmsu - update buffer");
|
||||
glBindBufferARB(GL_UNIFORM_BUFFER, mUBO);
|
||||
glBufferDataARB(GL_UNIFORM_BUFFER, sizeof(ReflectionProbeData), &rpd, GL_STREAM_DRAW);
|
||||
glBindBufferARB(GL_UNIFORM_BUFFER, 0);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, mUBO);
|
||||
glBufferData(GL_UNIFORM_BUFFER, sizeof(ReflectionProbeData), &rpd, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -445,14 +445,14 @@ void LLSceneMonitor::calcDiffAggregate()
|
|||
|
||||
if(mDiffState == EXECUTE_DIFF)
|
||||
{
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject);
|
||||
glBeginQuery(GL_SAMPLES_PASSED_ARB, mQueryObject);
|
||||
}
|
||||
|
||||
gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff);
|
||||
|
||||
if(mDiffState == EXECUTE_DIFF)
|
||||
{
|
||||
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
glEndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
mDiffState = WAIT_ON_RESULT;
|
||||
}
|
||||
|
||||
|
|
@ -483,11 +483,11 @@ void LLSceneMonitor::fetchQueryResult()
|
|||
mDiffState = WAITING_FOR_NEXT_DIFF;
|
||||
|
||||
GLuint available = 0;
|
||||
glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
if(available)
|
||||
{
|
||||
GLuint count = 0;
|
||||
glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count);
|
||||
glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_ARB, &count);
|
||||
|
||||
mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face)
|
||||
|
||||
|
|
|
|||
|
|
@ -6317,7 +6317,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
|
|||
auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor)
|
||||
{
|
||||
//Need to because crash on ATI 3800 (and similar cards) MAINT-5018
|
||||
LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1604,7 +1604,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||
if (group->mBuilt > 0.f)
|
||||
{
|
||||
group->mBuilt -= 2.f * gFrameIntervalSeconds.value();
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW_ARB)
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW)
|
||||
{
|
||||
col.setVec(1.0f, 0, 0, group->mBuilt*0.5f);
|
||||
}
|
||||
|
|
@ -1614,7 +1614,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||
//col.setVec(1.0f, 1.0f, 0, sinf(group->mBuilt*3.14159f)*0.5f);
|
||||
}
|
||||
|
||||
if (group->mBufferUsage != GL_STATIC_DRAW_ARB)
|
||||
if (group->mBufferUsage != GL_STATIC_DRAW)
|
||||
{
|
||||
LLGLDepthTest gl_depth(FALSE, FALSE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
|
@ -1709,7 +1709,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty()
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW && !group->isEmpty()
|
||||
&& group->getSpatialPartition()->mRenderByGroup)
|
||||
{
|
||||
col.setVec(0.8f, 0.4f, 0.1f, 0.1f);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ void LLSprite::updateFace(LLFace &face)
|
|||
{
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_TEXCOORD0,
|
||||
GL_STREAM_DRAW_ARB);
|
||||
GL_STREAM_DRAW);
|
||||
buff->allocateBuffer(4, 12, TRUE);
|
||||
face.setGeomIndex(0);
|
||||
face.setIndicesIndex(0);
|
||||
|
|
|
|||
|
|
@ -468,15 +468,6 @@ BOOL LLFloaterTexturePicker::postBuild()
|
|||
|
||||
mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
|
||||
|
||||
// if can select both materials and textures, set textures_material_combo's layout as visible
|
||||
childSetVisible("combo_layout", mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL);
|
||||
|
||||
mTextureMaterialsCombo = getChild<LLComboBox>("textures_material_combo");
|
||||
mTextureMaterialsCombo->setCommitCallback(onSelectTextureMaterials, this);
|
||||
|
||||
// set the combo box to the first entry in the list (currently textures and materials)
|
||||
mTextureMaterialsCombo->selectByValue(0);
|
||||
|
||||
// <FS:Ansariel> FIRE-30431: Keep radio button mode selection in texture selection
|
||||
//mModeSelector = getChild<LLComboBox>("mode_selection");
|
||||
//mModeSelector->setCommitCallback(onModeSelect, this);
|
||||
|
|
@ -492,7 +483,7 @@ BOOL LLFloaterTexturePicker::postBuild()
|
|||
// selected at startup, we call the same function that is triggered
|
||||
// when a texture/materials/both choice is made and let it take care
|
||||
// of setting the filters
|
||||
onSelectTextureMaterials(0, this);
|
||||
refreshInventoryFilter();
|
||||
|
||||
mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask);
|
||||
mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2));
|
||||
|
|
@ -526,21 +517,7 @@ BOOL LLFloaterTexturePicker::postBuild()
|
|||
|
||||
mLocalScrollCtrl = getChild<LLScrollListCtrl>("l_name_list");
|
||||
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
|
||||
mLocalScrollCtrl->clearRows();
|
||||
|
||||
if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
|
||||
{
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
refreshLocalList();
|
||||
|
||||
mNoCopyTextureSelected = FALSE;
|
||||
|
||||
|
|
@ -963,7 +940,6 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
|
|||
self->getChild<LLButton>("Transparent")->setVisible(index == 0 ? TRUE : FALSE); // <FS:PP> FIRE-5082: "Transparent" button in Texture Panel
|
||||
self->getChild<LLButton>("None")->setVisible(index == 0 ? TRUE : FALSE);
|
||||
self->getChild<LLButton>("Pipette")->setVisible(index == 0 ? TRUE : FALSE);
|
||||
self->getChild<LLComboBox>("textures_material_combo")->setVisible(index == 0 ? TRUE : FALSE);
|
||||
self->getChild<LLFilterEditor>("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE);
|
||||
self->getChild<LLInventoryPanel>("inventory panel")->setVisible(index == 0 ? TRUE : FALSE);
|
||||
|
||||
|
|
@ -1083,21 +1059,7 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata)
|
|||
|
||||
self->getChild<LLButton>("l_rem_btn")->setEnabled(false);
|
||||
self->getChild<LLButton>("l_upl_btn")->setEnabled(false);
|
||||
self->mLocalScrollCtrl->clearRows();
|
||||
|
||||
if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
|
||||
}
|
||||
else if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
|
||||
}
|
||||
else if (self->mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
|
||||
{
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
|
||||
}
|
||||
self->refreshLocalList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1330,36 +1292,46 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
|
|||
mInventoryPanel->setFilterSubString(search_string);
|
||||
}
|
||||
|
||||
void LLFloaterTexturePicker::onSelectTextureMaterials(LLUICtrl* ctrl, void *userdata)
|
||||
void LLFloaterTexturePicker::refreshLocalList()
|
||||
{
|
||||
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata;
|
||||
int index = self->mTextureMaterialsCombo->getValue().asInteger();
|
||||
mLocalScrollCtrl->clearRows();
|
||||
|
||||
if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
|
||||
{
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterTexturePicker::refreshInventoryFilter()
|
||||
{
|
||||
U32 filter_types = 0x0;
|
||||
|
||||
if (self->mInventoryPickType != LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
{
|
||||
// mInventoryPickType overrides combo
|
||||
index = self->mInventoryPickType;
|
||||
}
|
||||
|
||||
if (index == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
{
|
||||
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
|
||||
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
|
||||
filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
|
||||
}
|
||||
else if (index == LLTextureCtrl::PICK_TEXTURE)
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
|
||||
{
|
||||
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
|
||||
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
|
||||
}
|
||||
else if (index == LLTextureCtrl::PICK_MATERIAL)
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
|
||||
{
|
||||
filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
|
||||
}
|
||||
|
||||
self->mInventoryPanel->setFilterTypes(filter_types);
|
||||
mInventoryPanel->setFilterTypes(filter_types);
|
||||
}
|
||||
|
||||
void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
|
||||
|
|
@ -1409,27 +1381,8 @@ void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
|
|||
void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryType type)
|
||||
{
|
||||
mInventoryPickType = type;
|
||||
|
||||
// if can select both materials and textures, set textures_material_combo's layout as visible
|
||||
childSetVisible("combo_layout", mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL);
|
||||
|
||||
mLocalScrollCtrl->clearRows();
|
||||
if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
|
||||
{
|
||||
LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
|
||||
{
|
||||
LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
|
||||
}
|
||||
|
||||
// refresh filters
|
||||
onSelectTextureMaterials(0, this);
|
||||
refreshLocalList();
|
||||
refreshInventoryFilter();
|
||||
}
|
||||
|
||||
void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle)
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ public:
|
|||
TEXTURE_CANCEL
|
||||
} ETexturePickOp;
|
||||
|
||||
// Should match the entries in floater_texture_ctrl.xml
|
||||
// for the textures_material_combo combo box
|
||||
typedef enum e_pick_inventory_type
|
||||
{
|
||||
PICK_TEXTURE_MATERIAL = 0,
|
||||
|
|
@ -369,8 +367,6 @@ public:
|
|||
static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata);
|
||||
static void onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata);
|
||||
|
||||
static void onSelectTextureMaterials(LLUICtrl* ctrl, void *userdata);
|
||||
|
||||
void setLocalTextureEnabled(BOOL enabled);
|
||||
void setBakeTextureEnabled(BOOL enabled);
|
||||
|
||||
|
|
@ -379,6 +375,9 @@ public:
|
|||
static void onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle);
|
||||
|
||||
protected:
|
||||
void refreshLocalList();
|
||||
void refreshInventoryFilter();
|
||||
|
||||
LLPointer<LLViewerTexture> mTexturep;
|
||||
LLView* mOwner;
|
||||
|
||||
|
|
@ -401,7 +400,6 @@ protected:
|
|||
BOOL mActive;
|
||||
|
||||
LLFilterEditor* mFilterEdit;
|
||||
LLComboBox* mTextureMaterialsCombo;
|
||||
LLInventoryPanel* mInventoryPanel;
|
||||
PermissionMask mImmediateFilterPermMask;
|
||||
PermissionMask mDnDFilterPermMask;
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ U32 LLOcclusionCullingGroup::getNewOcclusionQueryObjectName()
|
|||
{
|
||||
//seed 1024 query names into the free query pool
|
||||
GLuint queries[1024];
|
||||
glGenQueriesARB(1024, queries);
|
||||
glGenQueries(1024, queries);
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
sFreeQueries.push(queries[i]);
|
||||
|
|
@ -1129,7 +1129,7 @@ void LLOcclusionCullingGroup::checkOcclusion()
|
|||
GLuint available;
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query available");
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
}
|
||||
|
||||
if (available)
|
||||
|
|
@ -1137,7 +1137,7 @@ void LLOcclusionCullingGroup::checkOcclusion()
|
|||
GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query result");
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &query_result);
|
||||
glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &query_result);
|
||||
}
|
||||
#if LL_TRACK_PENDING_OCCLUSION_QUERIES
|
||||
sPendingQueries.erase(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
|
|
@ -1250,7 +1250,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh
|
|||
//get an occlusion query that hasn't been used in awhile
|
||||
releaseOcclusionQueryObjectName(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName();
|
||||
glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
glBeginQuery(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
}
|
||||
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
|
@ -1292,7 +1292,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh
|
|||
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("glEndQuery");
|
||||
glEndQueryARB(mode);
|
||||
glEndQuery(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -325,5 +325,6 @@ extern LLGLSLShader gRlvSphereProgram;
|
|||
extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
|
||||
extern LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2];
|
||||
|
||||
extern LLGLSLShader gDeferredPBROpaqueProgram;
|
||||
extern LLGLSLShader gDeferredPBROpaqueProgram;
|
||||
extern LLGLSLShader gDeferredPBRAlphaProgram[2]; // not skinned, skinned
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ U32 LLVOGrass::getPartitionType() const
|
|||
}
|
||||
|
||||
LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_GRASS;
|
||||
mPartitionType = LLViewerRegion::PARTITION_GRASS;
|
||||
|
|
@ -612,7 +612,7 @@ LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
|
|||
mDepthMask = TRUE;
|
||||
mSlopRatio = 0.1f;
|
||||
mRenderPass = LLRenderPass::PASS_GRASS;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
|
||||
void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
|
||||
|
|
@ -649,7 +649,7 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{
|
||||
group->mBufferUsage = GL_STREAM_DRAW_ARB;
|
||||
group->mBufferUsage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
U32 count = 0;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
|
|||
if (!face->getVertexBuffer())
|
||||
{
|
||||
face->setSize(5, 12);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for VOGround to "
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void LLVOPartGroup::restoreGL()
|
|||
{
|
||||
|
||||
//TODO: optimize out binormal mask here. Specular and normal coords as well.
|
||||
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW_ARB);
|
||||
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW);
|
||||
U32 count = LL_MAX_PARTICLE_COUNT;
|
||||
if (!sVB->allocateBuffer(count*4, count*6, true))
|
||||
{
|
||||
|
|
@ -752,7 +752,7 @@ U32 LLVOPartGroup::getPartitionType() const
|
|||
}
|
||||
|
||||
LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp)
|
||||
{
|
||||
mRenderPass = LLRenderPass::PASS_ALPHA;
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES;
|
||||
|
|
|
|||
|
|
@ -1016,7 +1016,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
|
|||
face->setSize(4, 6);
|
||||
face->setGeomIndex(0);
|
||||
face->setIndicesIndex(0);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
buff->allocateBuffer(4, 6, TRUE);
|
||||
face->setVertexBuffer(buff);
|
||||
|
||||
|
|
@ -1148,7 +1148,7 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const
|
|||
if (!facep->getVertexBuffer())
|
||||
{
|
||||
facep->setSize(4, 6);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
|
||||
|
|
@ -1388,7 +1388,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
|
|||
if (!face->getVertexBuffer() || quads*4 != face->getGeomCount())
|
||||
{
|
||||
face->setSize(quads * 4, quads * 6);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class LLVertexBufferTerrain : public LLVertexBuffer
|
|||
{
|
||||
public:
|
||||
LLVertexBufferTerrain() :
|
||||
LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0 | MAP_TEXCOORD1 | MAP_COLOR, GL_DYNAMIC_DRAW_ARB)
|
||||
LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0 | MAP_TEXCOORD1 | MAP_COLOR, GL_DYNAMIC_DRAW)
|
||||
{
|
||||
//texture coordinates 2 and 3 exist, but use the same data as texture coordinate 1
|
||||
};
|
||||
|
|
@ -1001,7 +1001,7 @@ U32 LLVOSurfacePatch::getPartitionType() const
|
|||
}
|
||||
|
||||
LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
{
|
||||
mOcclusionEnabled = FALSE;
|
||||
mInfiniteFarClip = TRUE;
|
||||
|
|
|
|||
|
|
@ -932,7 +932,7 @@ void LLVOTree::updateMesh()
|
|||
|
||||
LLFace* facep = mDrawable->getFace(0);
|
||||
if (!facep) return;
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
if (!buff->allocateBuffer(vert_count, index_count, TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on mesh update to "
|
||||
|
|
@ -1236,7 +1236,7 @@ U32 LLVOTree::getPartitionType() const
|
|||
}
|
||||
|
||||
LLTreePartition::LLTreePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_TREE;
|
||||
mPartitionType = LLViewerRegion::PARTITION_TREE;
|
||||
|
|
|
|||
|
|
@ -5436,7 +5436,7 @@ U32 LLVOVolume::getPartitionType() const
|
|||
}
|
||||
|
||||
LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp),
|
||||
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW, regionp),
|
||||
LLVolumeGeometryManager()
|
||||
{
|
||||
mLODPeriod = 32;
|
||||
|
|
@ -5444,7 +5444,7 @@ LLVolumeGeometryManager()
|
|||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_VOLUME;
|
||||
mSlopRatio = 0.25f;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
|
||||
LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
|
||||
|
|
@ -5456,7 +5456,7 @@ LLVolumeGeometryManager()
|
|||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
|
||||
|
||||
mBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
|
||||
mSlopRatio = 0.25f;
|
||||
}
|
||||
|
|
@ -6068,7 +6068,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
useage = GL_STREAM_DRAW_ARB;
|
||||
useage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
LLVOVolume* vobj = drawablep->getVOVolume();
|
||||
|
|
@ -6213,7 +6213,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
bool is_pbr = false;
|
||||
#endif
|
||||
#else
|
||||
bool is_pbr = facep->getTextureEntry()->getGLTFMaterial() != nullptr;
|
||||
LLGLTFMaterial *gltf_mat = facep->getTextureEntry()->getGLTFMaterial();
|
||||
bool is_pbr = gltf_mat != nullptr;
|
||||
#endif
|
||||
|
||||
//ALWAYS null out vertex buffer on rebuild -- if the face lands in a render
|
||||
|
|
@ -6284,8 +6285,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
|
||||
BOOL force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA);
|
||||
U32 type = gPipeline.getPoolTypeFromTE(te, tex);
|
||||
|
||||
if (is_pbr)
|
||||
if (is_pbr && gltf_mat && gltf_mat->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_BLEND)
|
||||
{
|
||||
type = LLDrawPool::POOL_PBR_OPAQUE;
|
||||
}
|
||||
|
|
@ -6751,10 +6751,10 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
|
||||
if (use_transform_feedback &&
|
||||
gTransformPositionProgram.mProgramObject && //transform shaders are loaded
|
||||
buffer_usage == GL_DYNAMIC_DRAW_ARB && //target buffer is in VRAM
|
||||
buffer_usage == GL_DYNAMIC_DRAW && //target buffer is in VRAM
|
||||
!(mask & LLVertexBuffer::MAP_WEIGHT4)) //TODO: add support for weights
|
||||
{
|
||||
buffer_usage = GL_DYNAMIC_COPY_ARB;
|
||||
buffer_usage = GL_DYNAMIC_COPY;
|
||||
}
|
||||
|
||||
#if LL_DARWIN
|
||||
|
|
@ -6988,9 +6988,9 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
}
|
||||
|
||||
|
||||
if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW_ARB)
|
||||
if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW)
|
||||
{
|
||||
buffer_usage = GL_STREAM_DRAW_ARB;
|
||||
buffer_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
//create vertex buffer
|
||||
|
|
@ -7132,7 +7132,10 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
|
||||
if (gltf_mat)
|
||||
{ // all other parameters ignored if gltf material is present
|
||||
registerFace(group, facep, LLRenderPass::PASS_PBR_OPAQUE);
|
||||
if (gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND)
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
|
||||
else
|
||||
registerFace(group, facep, LLRenderPass::PASS_PBR_OPAQUE);
|
||||
}
|
||||
else
|
||||
// do NOT use 'fullbright' for this logic or you risk sending
|
||||
|
|
@ -7417,7 +7420,7 @@ void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& verte
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
usage = GL_STREAM_DRAW_ARB;
|
||||
usage = GL_STREAM_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7446,7 +7449,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
usage = GL_STREAM_DRAW_ARB;
|
||||
usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
//for each face
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
|
|||
LLVertexBuffer* buff = face->getVertexBuffer();
|
||||
if (!buff || !buff->isWriteable())
|
||||
{
|
||||
buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW_ARB);
|
||||
buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on water update to "
|
||||
|
|
@ -298,7 +298,7 @@ U32 LLVOVoidWater::getPartitionType() const
|
|||
}
|
||||
|
||||
LLWaterPartition::LLWaterPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
{
|
||||
mInfiniteFarClip = TRUE;
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_WATER;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
|
||||
if (mFsSkyVerts.isNull())
|
||||
{
|
||||
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
|
||||
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
|
||||
if (!mFsSkyVerts->allocateBuffer(4, 6, TRUE))
|
||||
{
|
||||
|
|
@ -216,7 +216,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
|
||||
for (U32 i = 0; i < strips_segments ;++i)
|
||||
{
|
||||
LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
|
||||
LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
mStripsVerts[i] = segment;
|
||||
|
||||
U32 num_stacks_this_seg = stacks_per_seg;
|
||||
|
|
|
|||
|
|
@ -578,7 +578,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);
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Reset VB during TP
|
||||
|
|
@ -800,7 +800,7 @@ void LLPipeline::destroyGL()
|
|||
|
||||
if (mMeshDirtyQueryObject)
|
||||
{
|
||||
glDeleteQueriesARB(1, &mMeshDirtyQueryObject);
|
||||
glDeleteQueries(1, &mMeshDirtyQueryObject);
|
||||
mMeshDirtyQueryObject = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1446,7 +1446,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);
|
||||
}
|
||||
|
||||
|
|
@ -1461,7 +1461,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);
|
||||
}
|
||||
|
||||
|
|
@ -1837,7 +1837,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
|
|||
}
|
||||
}
|
||||
|
||||
if (alpha)
|
||||
if (alpha || (gltf_mat && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND))
|
||||
{
|
||||
return LLDrawPool::POOL_ALPHA;
|
||||
}
|
||||
|
|
@ -1845,7 +1845,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
|
|||
{
|
||||
return LLDrawPool::POOL_BUMP;
|
||||
}
|
||||
else if (gltf_mat && !alpha)
|
||||
else if (gltf_mat)
|
||||
{
|
||||
return LLDrawPool::POOL_PBR_OPAQUE;
|
||||
}
|
||||
|
|
@ -2583,7 +2583,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);
|
||||
}
|
||||
|
|
@ -2842,7 +2842,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);
|
||||
|
||||
|
|
@ -4120,11 +4120,11 @@ void LLPipeline::postSort(LLCamera& camera)
|
|||
|
||||
if (!mMeshDirtyQueryObject)
|
||||
{
|
||||
glGenQueriesARB(1, &mMeshDirtyQueryObject);
|
||||
glGenQueries(1, &mMeshDirtyQueryObject);
|
||||
}
|
||||
|
||||
|
||||
glBeginQueryARB(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject);
|
||||
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject);
|
||||
}*/
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rebuild delayed upd groups");
|
||||
|
|
@ -4137,7 +4137,7 @@ void LLPipeline::postSort(LLCamera& camera)
|
|||
|
||||
/*if (use_transform_feedback)
|
||||
{
|
||||
glEndQueryARB(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
||||
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
||||
}*/
|
||||
|
||||
mMeshDirtyGroup.clear();
|
||||
|
|
@ -4275,7 +4275,7 @@ void render_hud_elements()
|
|||
|
||||
if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
|
||||
{
|
||||
LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
|
||||
|
||||
// Draw the tracking overlays
|
||||
|
|
@ -4583,7 +4583,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
|
|||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
LLGLSPipeline gls_pipeline;
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
LLGLState gls_color_material(GL_COLOR_MATERIAL, mLightingDetail < 2);
|
||||
|
||||
|
|
@ -4814,7 +4814,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
|
|||
}
|
||||
}
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
|
|
@ -4904,7 +4904,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
|
|||
|
||||
LLGLEnable cull(GL_CULL_FACE);
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
calcNearbyLights(camera);
|
||||
setupHWLights(NULL);
|
||||
|
|
@ -8426,7 +8426,7 @@ void LLPipeline::renderFinalize()
|
|||
// [/RLVa:KB]
|
||||
// gGL.getTexUnit(1)->bind(&mRT->screen);
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
buff->setBuffer(mask);
|
||||
buff->drawArrays(LLRender::TRIANGLE_STRIP, 0, 3);
|
||||
|
|
@ -8597,8 +8597,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_R_TO_TEXTURE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -8619,8 +8619,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_R_TO_TEXTURE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -8799,7 +8799,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
|
|||
GL_NEAREST);
|
||||
}
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
|
||||
{
|
||||
|
|
@ -9073,7 +9073,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);
|
||||
|
|
@ -9584,7 +9584,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9592,7 +9592,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11698,7 +11698,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar)
|
|||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
GLuint buff = GL_COLOR_ATTACHMENT0;
|
||||
glDrawBuffersARB(1, &buff);
|
||||
glDrawBuffers(1, &buff);
|
||||
}
|
||||
|
||||
LLGLDisable blend(GL_BLEND);
|
||||
|
|
|
|||
|
|
@ -164,77 +164,28 @@
|
|||
word_wrap="true"
|
||||
visible="false"
|
||||
width="87" />
|
||||
<layout_stack name="inventory_stack"
|
||||
width="231"
|
||||
height="276"
|
||||
top="20"
|
||||
left="175"
|
||||
follows="all"
|
||||
animate="false"
|
||||
orientation="vertical">
|
||||
<layout_panel name="combo_layout"
|
||||
border="false"
|
||||
bevel_style="in"
|
||||
auto_resize="false"
|
||||
user_resize="false"
|
||||
visible="false"
|
||||
width="231"
|
||||
height="24">
|
||||
<combo_box
|
||||
follows="left|top|right"
|
||||
height="23"
|
||||
label="Choose Textures, Materials or LIFE!"
|
||||
layout="topleft"
|
||||
left="0"
|
||||
name="textures_material_combo"
|
||||
top="0"
|
||||
width="231">
|
||||
<combo_box.item
|
||||
label="Materials & Textures"
|
||||
name="Materials_Textures"
|
||||
value="0" />
|
||||
<combo_box.item
|
||||
label="Textures"
|
||||
name="Textures"
|
||||
value="1" />
|
||||
<combo_box.item
|
||||
label="Materials"
|
||||
name="Materials"
|
||||
value="2" />
|
||||
</combo_box>
|
||||
</layout_panel>
|
||||
<layout_panel name="inventory_layout"
|
||||
border="false"
|
||||
bevel_style="in"
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
visible="true"
|
||||
width="231"
|
||||
height="252">
|
||||
<filter_editor
|
||||
follows="left|top|right"
|
||||
height="23"
|
||||
label="Filter Textures"
|
||||
layout="topleft"
|
||||
left="0"
|
||||
name="inventory search editor"
|
||||
top="4"
|
||||
width="231" />
|
||||
<asset_filtered_inv_panel
|
||||
allow_multi_select="false"
|
||||
bg_visible="true"
|
||||
bg_alpha_color="DkGray2"
|
||||
border="false"
|
||||
follows="all"
|
||||
height="221"
|
||||
layout="topleft"
|
||||
left_delta="0"
|
||||
name="inventory panel"
|
||||
top_pad="4"
|
||||
width="231"
|
||||
filter_asset_types="texture|material"/>
|
||||
</layout_panel>
|
||||
</layout_stack>
|
||||
<filter_editor
|
||||
follows="left|top|right"
|
||||
height="23"
|
||||
label="Filter Textures"
|
||||
layout="topleft"
|
||||
left="175"
|
||||
name="inventory search editor"
|
||||
top="20"
|
||||
width="231" />
|
||||
<asset_filtered_inv_panel
|
||||
allow_multi_select="false"
|
||||
bg_visible="true"
|
||||
bg_alpha_color="DkGray2"
|
||||
border="false"
|
||||
follows="all"
|
||||
height="242"
|
||||
layout="topleft"
|
||||
left_delta="0"
|
||||
name="inventory panel"
|
||||
top_pad="4"
|
||||
width="231"
|
||||
filter_asset_types="texture|material"/>
|
||||
|
||||
<!-- middle: local mode -->
|
||||
<button
|
||||
|
|
|
|||
Loading…
Reference in New Issue