From 5e2b781e7886c3238645b5fcff9017ed960396e9 Mon Sep 17 00:00:00 2001 From: Twisted_Laws Date: Thu, 14 Apr 2011 08:11:06 -0400 Subject: STORM-1103 Nearby sidebar minimap should be optional --- doc/contributions.txt | 1 + indra/newview/app_settings/settings.xml | 11 +++++ .../xui/en/menu_people_nearby_view_sort.xml | 8 ++++ .../newview/skins/default/xui/en/panel_people.xml | 51 ++++++++++++---------- 4 files changed, 49 insertions(+), 22 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index e7db8c0ded..4e11a74b28 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -820,6 +820,7 @@ Twisted Laws STORM-844 STORM-643 STORM-954 + STORM-1103 Vadim Bigbear VWR-2681 Vector Hastings diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d98f0da1c2..ebddb2d73a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9177,6 +9177,17 @@ Value 1 + NearbyListShowMap + + Comment + Show/hide map in nearby list + Persist + 1 + Type + Boolean + Value + 1 + NearbyListShowIcons Comment diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml index f9db64b524..65bd2793b6 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml @@ -42,6 +42,14 @@ function="CheckControl" parameter="NearbyListShowIcons" /> + + + + diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 1a00416b2a..1869eec476 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -99,28 +99,35 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M name="nearby_panel" top="0" width="313"> - - - + + + + + + + + Date: Fri, 15 Apr 2011 14:32:56 -0400 Subject: STORM-1103 Nearby sidebar minimap should be optional, changes from review --- indra/newview/app_settings/settings.xml | 2 +- .../newview/skins/default/xui/en/panel_people.xml | 79 ++++++++++++++-------- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ebddb2d73a..bb4f2664cd 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9180,7 +9180,7 @@ NearbyListShowMap Comment - Show/hide map in nearby list + Show/hide map above nearby people list Persist 1 Type diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 1869eec476..775805ad2e 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -87,7 +87,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M width="319"> - - - - - - - - - + + + + + + + + Date: Wed, 4 May 2011 20:45:14 -0500 Subject: SH-1497 Update mesh asset parser to use new format restrictions. --- indra/llmath/llvolume.cpp | 7 +-- indra/llprimitive/llmodel.cpp | 122 +++++++++++-------------------------- indra/newview/llmeshrepository.cpp | 12 ++-- 3 files changed, 43 insertions(+), 98 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 70e1e1f312..c44c95272e 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2239,13 +2239,12 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) } - LLVector3 minp; - LLVector3 maxp; + LLVector3 minp(-0.5f, -0.5f, -0.5f); + LLVector3 maxp(0.5f, 0.5f, 0.5f); LLVector2 min_tc; LLVector2 max_tc; - minp.setValue(mdl[i]["PositionDomain"]["Min"]); - maxp.setValue(mdl[i]["PositionDomain"]["Max"]); + LLVector4a min_pos, max_pos; min_pos.load3(minp.mV); max_pos.load3(maxp.mV); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 794cdb83d5..66b5150ed4 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -50,7 +50,7 @@ std::string model_names[] = "low_lod", "medium_lod", "high_lod", - "physics_shape" + "physics_mesh" }; const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string); @@ -1403,25 +1403,15 @@ LLSD LLModel::writeModel( if (!decomp.mBaseHull.empty() || !decomp.mHull.empty()) { - mdl["decomposition"] = decomp.asLLSD(); + mdl["physics_convex"] = decomp.asLLSD(); } for (U32 idx = 0; idx < MODEL_NAMES_LENGTH; ++idx) { if (model[idx] && model[idx]->getNumVolumeFaces() > 0) { - LLVector3 min_pos = LLVector3(model[idx]->getVolumeFace(0).mPositions[0].getF32ptr()); - LLVector3 max_pos = min_pos; - - //find position domain - for (S32 i = 0; i < model[idx]->getNumVolumeFaces(); ++i) - { //for each face - const LLVolumeFace& face = model[idx]->getVolumeFace(i); - for (U32 j = 0; j < face.mNumVertices; ++j) - { - update_min_max(min_pos, max_pos, face.mPositions[j].getF32ptr()); - } - } + LLVector3 min_pos(-0.5f, -0.5f, -0.5f); + LLVector3 max_pos(0.5f, 0.5f, 0.5f); LLVector3 pos_range = max_pos - min_pos; @@ -1462,6 +1452,7 @@ LLSD LLModel::writeModel( //position + normal for (U32 k = 0; k < 3; ++k) { //for each component + llassert(pos[k] <= 0.5001f && pos[k] >= -0.5001f); //convert to 16-bit normalized across domain U16 val = (U16) (((pos[k]-min_pos.mV[k])/pos_range.mV[k])*65535); @@ -1504,9 +1495,6 @@ LLSD LLModel::writeModel( } //write out face data - mdl[model_names[idx]][i]["PositionDomain"]["Min"] = min_pos.getValue(); - mdl[model_names[idx]][i]["PositionDomain"]["Max"] = max_pos.getValue(); - mdl[model_names[idx]][i]["TexCoord0Domain"]["Min"] = min_tc.getValue(); mdl[model_names[idx]][i]["TexCoord0Domain"]["Max"] = max_tc.getValue(); @@ -1608,15 +1596,15 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite) std::string decomposition; - if (mdl.has("decomposition")) + if (mdl.has("physics_convex")) { //write out convex decomposition - decomposition = zip_llsd(mdl["decomposition"]); + decomposition = zip_llsd(mdl["physics_convex"]); U32 size = decomposition.size(); if (size > 0) { - header["decomposition"]["offset"] = (LLSD::Integer) cur_offset; - header["decomposition"]["size"] = (LLSD::Integer) size; + header["physics_convex"]["offset"] = (LLSD::Integer) cur_offset; + header["physics_convex"]["size"] = (LLSD::Integer) size; cur_offset += size; bytes += size; } @@ -1637,11 +1625,6 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite) cur_offset += size; bytes += size; } - else - { - header[model_names[i]]["offset"] = -1; - header[model_names[i]]["size"] = 0; - } } if (!nowrite) @@ -1655,7 +1638,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite) if (!decomposition.empty()) { //write decomposition block - ostr.write((const char*) decomposition.data(), header["decomposition"]["size"].asInteger()); + ostr.write((const char*) decomposition.data(), header["physics_convex"]["size"].asInteger()); } for (S32 i = 0; i < MODEL_NAMES_LENGTH; i++) @@ -1794,7 +1777,7 @@ bool LLModel::loadModel(std::istream& is) "low_lod", "medium_lod", "high_lod", - "physics_shape", + "physics_mesh", }; const S32 MODEL_LODS = 5; @@ -1893,8 +1876,8 @@ bool LLModel::loadSkinInfo(LLSD& header, std::istream &is) bool LLModel::loadDecomposition(LLSD& header, std::istream& is) { - S32 offset = header["decomposition"]["offset"].asInteger(); - S32 size = header["decomposition"]["size"].asInteger(); + S32 offset = header["physics_convex"]["offset"].asInteger(); + S32 size = header["physics_convex"]["size"].asInteger(); if (offset >= 0 && size > 0) { @@ -2040,15 +2023,10 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) mHull.resize(hulls.size()); - LLVector3 min; - LLVector3 max; - LLVector3 range; - - min.setValue(decomp["Min"]); - max.setValue(decomp["Max"]); - range = max-min; + LLVector3 min(-0.5f,-0.5f,-0.5f); + LLVector3 max(0.5f,0.5f,0.5f); + LLVector3 range = max-min; - for (U32 i = 0; i < hulls.size(); ++i) { U16 count = (hulls[i] == 0) ? 256 : hulls[i]; @@ -2064,6 +2042,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) //point must be unique //llassert(valid.find(test) == valid.end()); valid.insert(test); + mHull[i].push_back(LLVector3( (F32) p[0]/65535.f*range.mV[0]+min.mV[0], (F32) p[1]/65535.f*range.mV[1]+min.mV[1], @@ -2078,28 +2057,15 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) } } - if (decomp.has("Hull")) + if (decomp.has("BoundingVerts")) { - const LLSD::Binary& position = decomp["Hull"].asBinary(); + const LLSD::Binary& position = decomp["BundingVerts"].asBinary(); U16* p = (U16*) &position[0]; - LLVector3 min; - LLVector3 max; - LLVector3 range; - - if (decomp.has("Min")) - { - min.setValue(decomp["Min"]); - max.setValue(decomp["Max"]); - } - else - { - min.set(-0.5f, -0.5f, -0.5f); - max.set(0.5f, 0.5f, 0.5f); - } - - range = max-min; + LLVector3 min(-0.5f,-0.5f,-0.5f); + LLVector3 max(0.5f,0.5f,0.5f); + LLVector3 range = max-min; U16 count = position.size()/6; @@ -2130,26 +2096,11 @@ LLSD LLModel::Decomposition::asLLSD() const } //write decomposition block - // ["decomposition"]["HullList"] -- list of 8 bit integers, each entry represents a hull with specified number of points - // ["decomposition"]["PositionDomain"]["Min"/"Max"] - // ["decomposition"]["Position"] -- list of 16-bit integers to be decoded to given domain, encoded 3D points - // ["decomposition"]["Hull"] -- list of 16-bit integers to be decoded to given domain, encoded 3D points representing a single hull approximation of given shape - + // ["physics_convex"]["HullList"] -- list of 8 bit integers, each entry represents a hull with specified number of points + // ["physics_convex"]["Position"] -- list of 16-bit integers to be decoded to given domain, encoded 3D points + // ["physics_convex"]["BoundingVerts"] -- list of 16-bit integers to be decoded to given domain, encoded 3D points representing a single hull approximation of given shape - //get minimum and maximum - LLVector3 min; - if (mHull.empty()) - { - min = mBaseHull[0]; - } - else - { - min = mHull[0][0]; - } - - LLVector3 max = min; - LLSD::Binary hulls(mHull.size()); U32 total = 0; @@ -2159,21 +2110,8 @@ LLSD LLModel::Decomposition::asLLSD() const U32 size = mHull[i].size(); total += size; hulls[i] = (U8) (size); - - for (U32 j = 0; j < mHull[i].size(); ++j) - { - update_min_max(min, max, mHull[i][j]); - } - } - - for (U32 i = 0; i < mBaseHull.size(); ++i) - { - update_min_max(min, max, mBaseHull[i]); } - ret["Min"] = min.getValue(); - ret["Max"] = max.getValue(); - if (!hulls.empty()) { ret["HullList"] = hulls; @@ -2183,6 +2121,8 @@ LLSD LLModel::Decomposition::asLLSD() const { LLSD::Binary p(total*3*2); + LLVector3 min(-0.5f, -0.5f, -0.5f); + LLVector3 max(0.5f, 0.5f, 0.5f); LLVector3 range = max-min; U32 vert_idx = 0; @@ -2198,6 +2138,8 @@ LLSD LLModel::Decomposition::asLLSD() const U64 test = 0; for (U32 k = 0; k < 3; k++) { + llassert(mHull[i][j].mV[k] <= 0.50001f && mHull[i][j].mV[k] >= -0.50001f); + //convert to 16-bit normalized across domain U16 val = (U16) (((mHull[i][j].mV[k]-min.mV[k])/range.mV[k])*65535); @@ -2231,6 +2173,8 @@ LLSD LLModel::Decomposition::asLLSD() const { LLSD::Binary p(mBaseHull.size()*3*2); + LLVector3 min(-0.5f, -0.5f, -0.5f); + LLVector3 max(0.5f, 0.5f, 0.5f); LLVector3 range = max-min; U32 vert_idx = 0; @@ -2238,6 +2182,8 @@ LLSD LLModel::Decomposition::asLLSD() const { for (U32 k = 0; k < 3; k++) { + llassert(mBaseHull[j].mV[k] <= 0.50001f && mBaseHull[j].mV[k] >= -0.50001f); + //convert to 16-bit normalized across domain U16 val = (U16) (((mBaseHull[j].mV[k]-min.mV[k])/range.mV[k])*65535); @@ -2253,7 +2199,7 @@ LLSD LLModel::Decomposition::asLLSD() const } } - ret["Hull"] = p; + ret["BoundingVerts"] = p; } return ret; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index dd2ffdf7f1..013fc43f99 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -772,8 +772,8 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) if (header_size > 0) { - S32 offset = header_size + mMeshHeader[mesh_id]["decomposition"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["decomposition"]["size"].asInteger(); + S32 offset = header_size + mMeshHeader[mesh_id]["physics_convex"]["offset"].asInteger(); + S32 size = mMeshHeader[mesh_id]["physics_convex"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -844,8 +844,8 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) if (header_size > 0) { - S32 offset = header_size + mMeshHeader[mesh_id]["physics_shape"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["physics_shape"]["size"].asInteger(); + S32 offset = header_size + mMeshHeader[mesh_id]["physics_mesh"]["offset"].asInteger(); + S32 size = mMeshHeader[mesh_id]["physics_mesh"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -1927,7 +1927,7 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, //just in case skin info or decomposition is at the end of the file (which it shouldn't be) lod_bytes = llmax(lod_bytes, header["skin"]["offset"].asInteger() + header["skin"]["size"].asInteger()); - lod_bytes = llmax(lod_bytes, header["decomposition"]["offset"].asInteger() + header["decomposition"]["size"].asInteger()); + lod_bytes = llmax(lod_bytes, header["physics_convex"]["offset"].asInteger() + header["physics_convex"]["size"].asInteger()); S32 header_bytes = (S32) gMeshRepo.mThread->mMeshHeaderSize[mesh_id]; S32 bytes = lod_bytes + header_bytes; @@ -2543,7 +2543,7 @@ void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail) bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) { LLSD mesh = mThread->getMeshHeader(mesh_id); - return mesh.has("physics_shape") && mesh["physics_shape"].has("size") && (mesh["physics_shape"]["size"].asInteger() > 0); + return mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0); } LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) -- cgit v1.2.3 From 3c516973f3a508d2bf0060d8dc70fa0d7809340f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 5 May 2011 17:12:41 -0500 Subject: SH-1497 "Positions" not "Position" for convex decomp. --- indra/llprimitive/llmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 66b5150ed4..ebd2fc7a29 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2017,7 +2017,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) { // updated for const-correctness. gcc is picky about this type of thing - Nyx const LLSD::Binary& hulls = decomp["HullList"].asBinary(); - const LLSD::Binary& position = decomp["Position"].asBinary(); + const LLSD::Binary& position = decomp["Positions"].asBinary(); U16* p = (U16*) &position[0]; @@ -2166,7 +2166,7 @@ LLSD LLModel::Decomposition::asLLSD() const llassert(valid.size() > 3); } - ret["Position"] = p; + ret["Positions"] = p; } if (!mBaseHull.empty()) -- cgit v1.2.3 From ca0a568264ca1f9990b2450cc55f3cc011d59e63 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 5 May 2011 18:33:03 -0500 Subject: SH-1497 Don't upload physics mesh if decomposition exists. --- indra/llprimitive/llmodel.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index ebd2fc7a29..e9e212c5c6 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1404,6 +1404,10 @@ LLSD LLModel::writeModel( !decomp.mHull.empty()) { mdl["physics_convex"] = decomp.asLLSD(); + if (!decomp.mHull.empty()) + { //convex decomposition exists, physics mesh will not be used + model[LLModel::LOD_PHYSICS] = NULL; + } } for (U32 idx = 0; idx < MODEL_NAMES_LENGTH; ++idx) @@ -2138,10 +2142,12 @@ LLSD LLModel::Decomposition::asLLSD() const U64 test = 0; for (U32 k = 0; k < 3; k++) { - llassert(mHull[i][j].mV[k] <= 0.50001f && mHull[i][j].mV[k] >= -0.50001f); + F32* src = (F32*) (mHull[i][j].mV); + + llassert(src[k] <= 0.501f && src[k] >= -0.501f); //convert to 16-bit normalized across domain - U16 val = (U16) (((mHull[i][j].mV[k]-min.mV[k])/range.mV[k])*65535); + U16 val = (U16) (((src[k]-min.mV[k])/range.mV[k])*65535); switch (k) { -- cgit v1.2.3 From 3acc3d39f0309a8e812838e22a8ff3eafe8da195 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 11 May 2011 19:13:18 -0500 Subject: Put back "PositionDomain" and "Min"/"Max" on convex decomposition. --- indra/llprimitive/llmodel.cpp | 82 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 10 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index e9e212c5c6..24d9a3a1e2 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1414,8 +1414,18 @@ LLSD LLModel::writeModel( { if (model[idx] && model[idx]->getNumVolumeFaces() > 0) { - LLVector3 min_pos(-0.5f, -0.5f, -0.5f); - LLVector3 max_pos(0.5f, 0.5f, 0.5f); + LLVector3 min_pos = LLVector3(model[idx]->getVolumeFace(0).mPositions[0].getF32ptr()); + LLVector3 max_pos = min_pos; + + //find position domain + for (S32 i = 0; i < model[idx]->getNumVolumeFaces(); ++i) + { //for each face + const LLVolumeFace& face = model[idx]->getVolumeFace(i); + for (U32 j = 0; j < face.mNumVertices; ++j) + { + update_min_max(min_pos, max_pos, face.mPositions[j].getF32ptr()); + } + } LLVector3 pos_range = max_pos - min_pos; @@ -1456,8 +1466,6 @@ LLSD LLModel::writeModel( //position + normal for (U32 k = 0; k < 3; ++k) { //for each component - llassert(pos[k] <= 0.5001f && pos[k] >= -0.5001f); - //convert to 16-bit normalized across domain U16 val = (U16) (((pos[k]-min_pos.mV[k])/pos_range.mV[k])*65535); @@ -1499,6 +1507,8 @@ LLSD LLModel::writeModel( } //write out face data + mdl[model_names[idx]][i]["PositionDomain"]["Min"] = min_pos.getValue(); + mdl[model_names[idx]][i]["PositionDomain"]["Max"] = max_pos.getValue(); mdl[model_names[idx]][i]["TexCoord0Domain"]["Min"] = min_tc.getValue(); mdl[model_names[idx]][i]["TexCoord0Domain"]["Max"] = max_tc.getValue(); @@ -2027,9 +2037,22 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) mHull.resize(hulls.size()); - LLVector3 min(-0.5f,-0.5f,-0.5f); - LLVector3 max(0.5f,0.5f,0.5f); - LLVector3 range = max-min; + LLVector3 min; + LLVector3 max; + LLVector3 range; + + if (decomp.has("Min")) + { + min.setValue(decomp["Min"]); + max.setValue(decomp["Max"]); + } + else + { + min.set(-0.5f, -0.5f, -0.5f); + max.set(0.5f, 0.5f, 0.5f); + } + + range = max-min; for (U32 i = 0; i < hulls.size(); ++i) { @@ -2067,9 +2090,22 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) U16* p = (U16*) &position[0]; - LLVector3 min(-0.5f,-0.5f,-0.5f); - LLVector3 max(0.5f,0.5f,0.5f); - LLVector3 range = max-min; + LLVector3 min; + LLVector3 max; + LLVector3 range; + + if (decomp.has("Min")) + { + min.setValue(decomp["Min"]); + max.setValue(decomp["Max"]); + } + else + { + min.set(-0.5f, -0.5f, -0.5f); + max.set(0.5f, 0.5f, 0.5f); + } + + range = max-min; U16 count = position.size()/6; @@ -2104,7 +2140,20 @@ LLSD LLModel::Decomposition::asLLSD() const // ["physics_convex"]["Position"] -- list of 16-bit integers to be decoded to given domain, encoded 3D points // ["physics_convex"]["BoundingVerts"] -- list of 16-bit integers to be decoded to given domain, encoded 3D points representing a single hull approximation of given shape + //get minimum and maximum + LLVector3 min; + if (mHull.empty()) + { + min = mBaseHull[0]; + } + else + { + min = mHull[0][0]; + } + + LLVector3 max = min; + LLSD::Binary hulls(mHull.size()); U32 total = 0; @@ -2114,8 +2163,21 @@ LLSD LLModel::Decomposition::asLLSD() const U32 size = mHull[i].size(); total += size; hulls[i] = (U8) (size); + + for (U32 j = 0; j < mHull[i].size(); ++j) + { + update_min_max(min, max, mHull[i][j]); + } } + for (U32 i = 0; i < mBaseHull.size(); ++i) + { + update_min_max(min, max, mBaseHull[i]); + } + + ret["Min"] = min.getValue(); + ret["Max"] = max.getValue(); + if (!hulls.empty()) { ret["HullList"] = hulls; -- cgit v1.2.3 From 51bb3c15c8ac6c85ed1a7e8526ba6b60794ac29e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 19 May 2011 20:38:39 -0500 Subject: SH-469 WIP -- get rid of LLMultiSampleBuffer and use GL_ARB_texture_multisample instead. --- indra/llrender/llgl.cpp | 49 ++- indra/llrender/llgl.h | 8 +- indra/llrender/llglheaders.h | 10 + indra/llrender/llglslshader.cpp | 3 +- indra/llrender/llimagegl.cpp | 2 +- indra/llrender/llrender.cpp | 25 +- indra/llrender/llrender.h | 1 + indra/llrender/llrendertarget.cpp | 394 +++++---------------- indra/llrender/llrendertarget.h | 26 +- .../shaders/class1/deferred/blurLightMSF.glsl | 102 ++++++ .../shaders/class1/deferred/cloudsF.glsl | 79 +++++ .../shaders/class1/deferred/cloudsV.glsl | 165 +++++++++ .../shaders/class1/deferred/pointLightMSF.glsl | 100 ++++++ .../shaders/class1/deferred/postDeferredMSF.glsl | 133 +++++++ .../class1/deferred/postDeferredNoDoFMSF.glsl | 36 ++ .../app_settings/shaders/class1/deferred/skyF.glsl | 44 +++ .../app_settings/shaders/class1/deferred/skyV.glsl | 140 ++++++++ .../shaders/class1/deferred/softenLightMSF.glsl | 318 +++++++++++++++++ .../shaders/class1/deferred/sunLightMSF.glsl | 17 + .../shaders/class1/deferred/sunLightSSAOMSF.glsl | 125 +++++++ .../shaders/class2/deferred/edgeMSF.glsl | 74 ++++ .../shaders/class2/deferred/softenLightMSF.glsl | 307 ++++++++++++++++ indra/newview/lldrawpoolwlsky.cpp | 88 ++++- indra/newview/lldrawpoolwlsky.h | 8 +- indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/llviewershadermgr.cpp | 114 +++++- indra/newview/llviewershadermgr.h | 2 + indra/newview/pipeline.cpp | 85 ++--- indra/newview/pipeline.h | 1 - 29 files changed, 2035 insertions(+), 423 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/skyF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/skyV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index f29ee0e57e..8d000d6fe3 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -178,6 +178,12 @@ PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer = NULL; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample = NULL; PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer = NULL; +//GL_ARB_texture_multisample +PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample; +PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample; +PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv; +PFNGLSAMPLEMASKIPROC glSampleMaski; + // GL_EXT_blend_func_separate PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL; @@ -321,6 +327,7 @@ LLGLManager::LLGLManager() : mHasMipMapGeneration(FALSE), mHasCompressedTextures(FALSE), mHasFramebufferObject(FALSE), + mMaxSamples(0), mHasBlendFuncSeparate(FALSE), mHasVertexBufferObject(FALSE), @@ -333,6 +340,11 @@ LLGLManager::LLGLManager() : mHasPointParameters(FALSE), mHasDrawBuffers(FALSE), mHasTextureRectangle(FALSE), + mHasTextureMultisample(FALSE), + mMaxSampleMaskWords(0), + mMaxColorTextureSamples(0), + mMaxDepthTextureSamples(0), + mMaxIntegerSamples(0), mHasAnisotropic(FALSE), mHasARBEnvCombine(FALSE), @@ -534,6 +546,19 @@ bool LLGLManager::initGL() return false; } + if (mHasTextureMultisample) + { + glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples); + glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples); + glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples); + glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords); + } + + if (mHasFramebufferObject) + { + glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples); + } + setToDebugGPU(); initGLStates(); @@ -734,6 +759,7 @@ void LLGLManager::initExtensions() mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts); mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts); mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts); + mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts); #if !LL_DARWIN mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); #endif @@ -943,6 +969,13 @@ void LLGLManager::initExtensions() { glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT"); } + if (mHasTextureRectangle) + { + glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage2DMultisample"); + glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage3DMultisample"); + glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv"); + glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski"); + } #if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS // This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); @@ -1374,7 +1407,8 @@ void LLGLState::checkTextureChannels(const std::string& msg) "GL_TEXTURE_GEN_T", "GL_TEXTURE_GEN_Q", "GL_TEXTURE_GEN_R", - "GL_TEXTURE_RECTANGLE_ARB" + "GL_TEXTURE_RECTANGLE_ARB", + "GL_TEXTURE_2D_MULTISAMPLE" }; static GLint value[] = @@ -1387,7 +1421,8 @@ void LLGLState::checkTextureChannels(const std::string& msg) GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_Q, GL_TEXTURE_GEN_R, - GL_TEXTURE_RECTANGLE_ARB + GL_TEXTURE_RECTANGLE_ARB, + GL_TEXTURE_2D_MULTISAMPLE }; GLint stackDepth = 0; @@ -1429,9 +1464,17 @@ void LLGLState::checkTextureChannels(const std::string& msg) } + S32 num_texture_types = 8; + for (S32 j = (i == 0 ? 1 : 0); - j < (gGLManager.mHasTextureRectangle ? 9 : 8); j++) + j < 9; j++) { + if (j == 8 && !gGLManager.mHasTextureRectangle || + j == 9 && !gGLManager.mHasTextureMultisample) + { + continue; + } + if (glIsEnabled(value[j])) { error = TRUE; diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 3d002fd8c4..7484196db5 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -83,8 +83,9 @@ public: BOOL mHasMipMapGeneration; BOOL mHasCompressedTextures; BOOL mHasFramebufferObject; + S32 mMaxSamples; BOOL mHasBlendFuncSeparate; - + // ARB Extensions BOOL mHasVertexBufferObject; BOOL mHasPBuffer; @@ -97,6 +98,11 @@ public: BOOL mHasDrawBuffers; BOOL mHasDepthClamp; BOOL mHasTextureRectangle; + BOOL mHasTextureMultisample; + S32 mMaxSampleMaskWords; + S32 mMaxColorTextureSamples; + S32 mMaxDepthTextureSamples; + S32 mMaxIntegerSamples; // Other extensions. BOOL mHasAnisotropic; diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index d8140a124d..825d304d35 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -474,6 +474,11 @@ extern PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer; //GL_ARB_draw_buffers extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB; +//GL_ARB_texture_multisample +extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample; +extern PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample; +extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv; +extern PFNGLSAMPLEMASKIPROC glSampleMaski; #elif LL_WINDOWS //---------------------------------------------------------------------------- @@ -673,6 +678,11 @@ extern PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer; //GL_ARB_draw_buffers extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB; +//GL_ARB_texture_multisample +extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample; +extern PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample; +extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv; +extern PFNGLSAMPLEMASKIPROC glSampleMaski; #elif LL_DARWIN //---------------------------------------------------------------------------- diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 257bcd9380..2e7147a3b4 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -293,7 +293,8 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) { - if (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) + if (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB || + type == GL_SAMPLER_2D_MULTISAMPLE) { //this here is a texture glUniform1iARB(location, mActiveTextureChannels); LL_DEBUGS("ShaderLoading") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index d408077c68..30b66ae542 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1417,7 +1417,7 @@ void LLImageGL::deleteDeadTextures() { if (sCurrentBoundTextures[i] == tex) { - gGL.getTexUnit(i)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); stop_glerror(); } } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 49e10c4790..d5eb3979c3 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -53,7 +53,8 @@ static GLenum sGLTextureType[] = { GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB, - GL_TEXTURE_CUBE_MAP_ARB + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_2D_MULTISAMPLE }; static GLint sGLAddressMode[] = @@ -121,12 +122,18 @@ void LLTexUnit::refreshState(void) glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); if (mCurrTexType != TT_NONE) { - glEnable(sGLTextureType[mCurrTexType]); + if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE) + { + glEnable(sGLTextureType[mCurrTexType]); + } glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture); } else { - glDisable(GL_TEXTURE_2D); + if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE) + { + glDisable(GL_TEXTURE_2D); + } glBindTexture(GL_TEXTURE_2D, 0); } @@ -167,7 +174,10 @@ void LLTexUnit::enable(eTextureType type) mCurrTexType = type; gGL.flush(); - glEnable(sGLTextureType[type]); + if (type != LLTexUnit::TT_MULTISAMPLE_TEXTURE) + { + glEnable(sGLTextureType[type]); + } } } @@ -180,7 +190,10 @@ void LLTexUnit::disable(void) activate(); unbind(mCurrTexType); gGL.flush(); - glDisable(sGLTextureType[mCurrTexType]); + if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE) + { + glDisable(sGLTextureType[mCurrTexType]); + } mCurrTexType = TT_NONE; } } @@ -399,7 +412,7 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option) { - if (mIndex < 0 || mCurrTexture == 0) return; + if (mIndex < 0 || mCurrTexture == 0 || mCurrTexType == LLTexUnit::TT_MULTISAMPLE_TEXTURE) return; gGL.flush(); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 7ba14f7b40..41e7b35341 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -57,6 +57,7 @@ public: TT_TEXTURE = 0, // Standard 2D Texture TT_RECT_TEXTURE, // Non power of 2 texture TT_CUBE_MAP, // 6-sided cube map texture + TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample TT_NONE // No texture type is currently enabled } eTextureType; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index cd2556d435..53c85e6c64 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -44,6 +44,7 @@ void check_framebuffer_status() case GL_FRAMEBUFFER_COMPLETE: break; default: + llwarns << "Bad framebuffer status: " << std::hex << status << llendl; ll_fail("check_framebuffer_status failed"); break; } @@ -62,8 +63,7 @@ LLRenderTarget::LLRenderTarget() : mUseDepth(false), mRenderDepth(false), mUsage(LLTexUnit::TT_TEXTURE), - mSamples(0), - mSampleBuffer(NULL) + mSamples(0) { } @@ -72,13 +72,7 @@ LLRenderTarget::~LLRenderTarget() release(); } - -void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer) -{ - mSampleBuffer = buffer; -} - -void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo) +void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples) { stop_glerror(); mResX = resx; @@ -87,6 +81,21 @@ void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo mStencil = stencil; mUsage = usage; mUseDepth = depth; + mSamples = samples; + + mSamples = llmin(mSamples, (U32) gGLManager.mMaxColorTextureSamples); + + if (mSamples > 0 && gGLManager.mHasTextureMultisample) + { + mSamples = llmin(mSamples, (U32) gGLManager.mMaxColorTextureSamples); + mUsage = LLTexUnit::TT_MULTISAMPLE_TEXTURE; + //no support for multisampled stencil targets yet + mStencil = false; + } + else + { + mSamples = 0; + } release(); @@ -145,29 +154,47 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt) stop_glerror(); - LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - stop_glerror(); - - if (offset == 0) + if (mSamples > 0) { - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, color_fmt, mResX, mResY, GL_TRUE); } else - { //don't filter data attachments - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - if (mUsage != LLTexUnit::TT_RECT_TEXTURE) { - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR); + LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL); } - else - { - // ATI doesn't support mirrored repeat for rectangular textures. - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + + stop_glerror(); + + if (mSamples == 0) + { + if (offset == 0) + { //use bilinear filtering on single texture render targets that aren't multisampled + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + stop_glerror(); + } + else + { //don't filter data attachments + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + stop_glerror(); + } + + if (mUsage != LLTexUnit::TT_RECT_TEXTURE) + { + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR); + stop_glerror(); + } + else + { + // ATI doesn't support mirrored repeat for rectangular textures. + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); + } } + if (mFBO) { + stop_glerror(); glBindFramebuffer(GL_FRAMEBUFFER, mFBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+offset, LLTexUnit::getInternalType(mUsage), tex, 0); @@ -196,9 +223,16 @@ void LLRenderTarget::allocateDepth() { LLImageGL::generateTextures(1, &mDepth); gGL.getTexUnit(0)->bindManual(mUsage, mDepth); - U32 internal_type = LLTexUnit::getInternalType(mUsage); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + if (mSamples == 0) + { + U32 internal_type = LLTexUnit::getInternalType(mUsage); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + } + else + { + glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, GL_DEPTH_COMPONENT32, mResX, mResY, GL_TRUE); + } } } @@ -288,7 +322,6 @@ void LLRenderTarget::release() mTex.clear(); } - mSampleBuffer = NULL; sBoundTarget = NULL; } @@ -297,34 +330,27 @@ void LLRenderTarget::bindTarget() if (mFBO) { stop_glerror(); - if (mSampleBuffer) - { - mSampleBuffer->bindTarget(this); - stop_glerror(); + + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); + stop_glerror(); + if (gGLManager.mHasDrawBuffers) + { //setup multiple render targets + GLenum drawbuffers[] = {GL_COLOR_ATTACHMENT0, + GL_COLOR_ATTACHMENT1, + GL_COLOR_ATTACHMENT2, + GL_COLOR_ATTACHMENT3}; + glDrawBuffersARB(mTex.size(), drawbuffers); } - else - { - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - stop_glerror(); - if (gGLManager.mHasDrawBuffers) - { //setup multiple render targets - GLenum drawbuffers[] = {GL_COLOR_ATTACHMENT0, - GL_COLOR_ATTACHMENT1, - GL_COLOR_ATTACHMENT2, - GL_COLOR_ATTACHMENT3}; - glDrawBuffersARB(mTex.size(), drawbuffers); - } - if (mTex.empty()) - { //no color buffer to draw to - glDrawBuffer(GL_NONE); - glReadBuffer(GL_NONE); - } + if (mTex.empty()) + { //no color buffer to draw to + glDrawBuffer(GL_NONE); + glReadBuffer(GL_NONE); + } - check_framebuffer_status(); + check_framebuffer_status(); - stop_glerror(); - } + stop_glerror(); } glViewport(0, 0, mResX, mResY); @@ -406,50 +432,8 @@ void LLRenderTarget::flush(bool fetch_depth) else { stop_glerror(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - stop_glerror(); - - if (mSampleBuffer) - { - LLGLEnable multisample(GL_MULTISAMPLE); - stop_glerror(); - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - stop_glerror(); - check_framebuffer_status(); - glBindFramebuffer(GL_READ_FRAMEBUFFER, mSampleBuffer->mFBO); - check_framebuffer_status(); - - stop_glerror(); - glBlitFramebuffer(0, 0, mResX, mResY, 0, 0, mResX, mResY, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); - stop_glerror(); - - if (mTex.size() > 1) - { - for (U32 i = 1; i < mTex.size(); ++i) - { - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - LLTexUnit::getInternalType(mUsage), mTex[i], 0); - stop_glerror(); - glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mSampleBuffer->mTex[i]); - stop_glerror(); - glBlitFramebuffer(0, 0, mResX, mResY, 0, 0, mResX, mResY, GL_COLOR_BUFFER_BIT, GL_NEAREST); - stop_glerror(); - } - - for (U32 i = 0; i < mTex.size(); ++i) - { - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, - LLTexUnit::getInternalType(mUsage), mTex[i], 0); - stop_glerror(); - glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_RENDERBUFFER, mSampleBuffer->mTex[i]); - stop_glerror(); - } - } - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); } } @@ -466,37 +450,31 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl; } - if (mSampleBuffer) + + if (mask == GL_DEPTH_BUFFER_BIT && source.mStencil != mStencil) { - mSampleBuffer->copyContents(source, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + stop_glerror(); + + glBindFramebuffer(GL_FRAMEBUFFER, source.mFBO); + gGL.getTexUnit(0)->bind(this, true); + stop_glerror(); + glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, srcX0, srcY0, dstX0, dstY0, dstX1, dstY1); + stop_glerror(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + stop_glerror(); } else { - if (mask == GL_DEPTH_BUFFER_BIT && source.mStencil != mStencil) - { - stop_glerror(); - - glBindFramebuffer(GL_FRAMEBUFFER, source.mFBO); - gGL.getTexUnit(0)->bind(this, true); - stop_glerror(); - glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, srcX0, srcY0, dstX0, dstY0, dstX1, dstY1); - stop_glerror(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - stop_glerror(); - } - else - { - glBindFramebuffer(GL_READ_FRAMEBUFFER, source.mFBO); - stop_glerror(); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFBO); - stop_glerror(); - check_framebuffer_status(); - stop_glerror(); - glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - stop_glerror(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - stop_glerror(); - } + glBindFramebuffer(GL_READ_FRAMEBUFFER, source.mFBO); + stop_glerror(); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFBO); + stop_glerror(); + check_framebuffer_status(); + stop_glerror(); + glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + stop_glerror(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + stop_glerror(); } } @@ -539,179 +517,3 @@ void LLRenderTarget::getViewport(S32* viewport) viewport[3] = mResY; } -//================================================== -// LLMultisampleBuffer implementation -//================================================== -LLMultisampleBuffer::LLMultisampleBuffer() -{ - -} - -LLMultisampleBuffer::~LLMultisampleBuffer() -{ - release(); -} - -void LLMultisampleBuffer::release() -{ - if (mFBO) - { - glDeleteFramebuffers(1, (GLuint *) &mFBO); - mFBO = 0; - } - - if (mTex.size() > 0) - { - glDeleteRenderbuffers(mTex.size(), (GLuint *) &mTex[0]); - mTex.clear(); - } - - if (mDepth) - { - glDeleteRenderbuffers(1, (GLuint *) &mDepth); - mDepth = 0; - } -} - -void LLMultisampleBuffer::bindTarget() -{ - bindTarget(this); -} - -void LLMultisampleBuffer::bindTarget(LLRenderTarget* ref) -{ - if (!ref) - { - ref = this; - } - - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - if (gGLManager.mHasDrawBuffers) - { //setup multiple render targets - GLenum drawbuffers[] = {GL_COLOR_ATTACHMENT0, - GL_COLOR_ATTACHMENT1, - GL_COLOR_ATTACHMENT2, - GL_COLOR_ATTACHMENT3}; - glDrawBuffersARB(ref->mTex.size(), drawbuffers); - } - - check_framebuffer_status(); - - glViewport(0, 0, mResX, mResY); - - sBoundTarget = this; -} - -void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo ) -{ - allocate(resx,resy,color_fmt,depth,stencil,usage,use_fbo,2); -} - -void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, U32 samples ) -{ - stop_glerror(); - mResX = resx; - mResY = resy; - - mUsage = usage; - mUseDepth = depth; - mStencil = stencil; - - release(); - - mSamples = samples; - - if (mSamples <= 1) - { - llerrs << "Cannot create a multisample buffer with less than 2 samples." << llendl; - } - - stop_glerror(); - - if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) - { - - if (depth) - { - stop_glerror(); - allocateDepth(); - stop_glerror(); - } - - glGenFramebuffers(1, (GLuint *) &mFBO); - - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - - if (mDepth) - { - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mDepth); - if (mStencil) - { - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, mDepth); - } - } - - stop_glerror(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - stop_glerror(); - } - - addColorAttachment(color_fmt); -} - -void LLMultisampleBuffer::addColorAttachment(U32 color_fmt) -{ - if (color_fmt == 0) - { - return; - } - - U32 offset = mTex.size(); - if (offset >= 4 || - (offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))) - { - llerrs << "Too many color attachments!" << llendl; - } - - U32 tex; - glGenRenderbuffers(1, &tex); - - glBindRenderbuffer(GL_RENDERBUFFER, tex); - glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, color_fmt, mResX, mResY); - stop_glerror(); - - if (mFBO) - { - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+offset, GL_RENDERBUFFER, tex); - stop_glerror(); - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - switch (status) - { - case GL_FRAMEBUFFER_COMPLETE: - break; - default: - llerrs << "WTF? " << std::hex << status << llendl; - break; - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } - - mTex.push_back(tex); -} - -void LLMultisampleBuffer::allocateDepth() -{ - glGenRenderbuffers(1, (GLuint* ) &mDepth); - glBindRenderbuffer(GL_RENDERBUFFER, mDepth); - if (mStencil) - { - glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY); - } - else - { - glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT16, mResX, mResY); - } -} - diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 12dd1c8b90..094b58b562 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -71,10 +71,7 @@ public: //allocate resources for rendering //must be called before use //multiple calls will release previously allocated resources - void allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, bool use_fbo = FALSE); - - //provide this render target with a multisample resource. - void setSampleBuffer(LLMultisampleBuffer* buffer); + void allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, bool use_fbo = false, S32 samples = 0); //add color buffer attachment //limit of 4 color attachments per render target @@ -141,7 +138,6 @@ public: static LLRenderTarget* getCurrentBoundTarget() { return sBoundTarget; } protected: - friend class LLMultisampleBuffer; U32 mResX; U32 mResY; std::vector mTex; @@ -152,26 +148,8 @@ protected: bool mRenderDepth; LLTexUnit::eTextureType mUsage; U32 mSamples; - LLMultisampleBuffer* mSampleBuffer; - - static LLRenderTarget* sBoundTarget; -}; - -class LLMultisampleBuffer : public LLRenderTarget -{ -public: - LLMultisampleBuffer(); - virtual ~LLMultisampleBuffer(); - - virtual void release(); - - virtual void bindTarget(); - void bindTarget(LLRenderTarget* ref); - virtual void allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo); - void allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, U32 samples); - virtual void addColorAttachment(U32 color_fmt); - virtual void allocateDepth(); + static LLRenderTarget* sBoundTarget; }; #endif //!LL_MESA_HEADLESS diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl new file mode 100644 index 0000000000..113197c871 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl @@ -0,0 +1,102 @@ +/** + * @file blurLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DMS lightMap; + +uniform float dist_factor; +uniform float blur_size; +uniform vec2 delta; +uniform vec3 kern[4]; +uniform float kern_scale; + +varying vec2 vary_fragcoord; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ + vec4 ret = vec4(0,0,0,0); + for (int i = 0; i < 4; i++) + { + ret += texelFetch(tex, tc, i); + } + + return ret * 0.25; +} + +vec4 getPosition(ivec2 pos_screen) +{ + float depth = texture2DMS(depthMap, pos_screen.xy).r; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec2 tc = vary_fragcoord.xy; + ivec2 itc = ivec2(tc); + + vec3 norm = texture2DMS(normalMap, itc).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + vec3 pos = getPosition(itc).xyz; + vec4 ccol = texture2DMS(lightMap, itc).rgba; + + vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); + dlt /= max(-pos.z*dist_factor, 1.0); + + vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' + vec4 col = defined_weight.xyxx * ccol; + + // relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances + float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; + + // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large + tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 ); + + for (int i = 1; i < 4; i++) + { + ivec2 samptc = ivec2(tc + kern[i].z*dlt); + vec3 samppos = getPosition(samptc).xyz; + float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane + if (d*d <= pointplanedist_tolerance_pow2) + { + col += texture2DMS(lightMap, samptc)*kern[i].xyxx; + defined_weight += kern[i].xy; + } + } + for (int i = 1; i < 4; i++) + { + ivec2 samptc = ivec2(tc - kern[i].z*dlt); + vec3 samppos = getPosition(samptc).xyz; + float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane + if (d*d <= pointplanedist_tolerance_pow2) + { + col += texture2DMS(lightMap, samptc)*kern[i].xyxx; + defined_weight += kern[i].xy; + } + } + + col /= defined_weight.xyxx; + col.y *= col.y; + + gl_FragColor = col; +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl new file mode 100644 index 0000000000..9e551fa976 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -0,0 +1,79 @@ +/** + * @file WLCloudsF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +varying vec4 vary_CloudColorSun; +varying vec4 vary_CloudColorAmbient; +varying float vary_CloudDensity; + +uniform sampler2D cloud_noise_texture; +uniform vec4 cloud_pos_density1; +uniform vec4 cloud_pos_density2; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +void main() +{ + // Set variables + vec2 uv1 = gl_TexCoord[0].xy; + vec2 uv2 = gl_TexCoord[1].xy; + + vec4 cloudColorSun = vary_CloudColorSun; + vec4 cloudColorAmbient = vary_CloudColorAmbient; + float cloudDensity = vary_CloudDensity; + vec2 uv3 = gl_TexCoord[2].xy; + vec2 uv4 = gl_TexCoord[3].xy; + + // Offset texture coords + uv1 += cloud_pos_density1.xy; //large texture, visible density + uv2 += cloud_pos_density1.xy; //large texture, self shadow + uv3 += cloud_pos_density2.xy; //small texture, visible density + uv4 += cloud_pos_density2.xy; //small texture, self shadow + + + // Compute alpha1, the main cloud opacity + float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; + alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); + + // And smooth + alpha1 = 1. - alpha1 * alpha1; + alpha1 = 1. - alpha1 * alpha1; + + + // Compute alpha2, for self shadowing effect + // (1 - alpha2) will later be used as percentage of incoming sunlight + float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); + alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); + + // And smooth + alpha2 = 1. - alpha2; + alpha2 = 1. - alpha2 * alpha2; + + // Combine + vec4 color; + color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); + color *= 2.; + + /// Gamma correct for WL (soft clip effect). + gl_FragData[0] = vec4(scaleSoftClip(color.rgb), alpha1); + gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); + gl_FragData[2] = vec4(0,0,1,0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl new file mode 100644 index 0000000000..267ef36d4d --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -0,0 +1,165 @@ +/** + * @file WLCloudsV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +////////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +varying vec4 vary_CloudColorSun; +varying vec4 vary_CloudColorAmbient; +varying float vary_CloudDensity; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; + +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +uniform vec4 cloud_scale; + +void main() +{ + + // World / view / projection + gl_Position = ftransform(); + + gl_TexCoord[0] = gl_MultiTexCoord0; + + // Get relative position + vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); + + // Set altitude + if (P.y > 0.) + { + P *= (max_y.x / P.y); + } + else + { + P *= (-32000. / P.y); + } + + // Can normalize then + vec3 Pn = normalize(P); + float Plen = length(P); + + // Initialize temp variables + vec4 temp1 = vec4(0.); + vec4 temp2 = vec4(0.); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x); + + // Calculate relative weights + temp1 = blue_density + haze_density.x; + blue_weight = blue_density / temp1; + haze_weight = haze_density.x / temp1; + + // Compute sunlight from P & lightnorm (for long rays like sky) + temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Distance + temp2.z = Plen * density_multiplier.x; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z); + + + // Compute haze glow + temp2.x = dot(Pn, lightnorm.xyz); + temp2.x = 1. - temp2.x; + // temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + // Add "minimum anti-solar illumination" + temp2.x += .25; + + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow.x); + + // Haze color below cloud + vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) + + (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient) + ); + + // CLOUDS + + sunlight = sunlight_color; + temp2.y = max(0., lightnorm.y * 2.); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Cloud color out + vary_CloudColorSun = (sunlight * temp2.x) * cloud_color; + vary_CloudColorAmbient = tmpAmbient * cloud_color; + + // Attenuate cloud color by atmosphere + temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds + vary_CloudColorSun *= temp1; + vary_CloudColorAmbient *= temp1; + vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1); + + // Make a nice cloud density based on the cloud_shadow value that was passed in. + vary_CloudDensity = 2. * (cloud_shadow.x - 0.25); + + + // Texture coords + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0].xy -= 0.5; + gl_TexCoord[0].xy /= cloud_scale.x; + gl_TexCoord[0].xy += 0.5; + + gl_TexCoord[1] = gl_TexCoord[0]; + gl_TexCoord[1].x += lightnorm.x * 0.0125; + gl_TexCoord[1].y += lightnorm.z * 0.0125; + + gl_TexCoord[2] = gl_TexCoord[0] * 16.; + gl_TexCoord[3] = gl_TexCoord[1] * 16.; + + // Combine these to minimize register use + vary_CloudColorAmbient += oHazeColorBelowCloud; + + // needs this to compile on mac + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + + // END CLOUDS +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl new file mode 100644 index 0000000000..22ed9dcd40 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl @@ -0,0 +1,100 @@ +/** + * @file pointLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + #version 120 + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect diffuseRect; +uniform sampler2DRect specularRect; +uniform sampler2DRect normalMap; +uniform samplerCube environmentMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2DRect depthMap; + +uniform vec3 env_mat[3]; +uniform float sun_wash; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; +uniform vec4 viewport; + +vec4 getPosition(vec2 pos_screen) +{ + float depth = texture2DRect(depthMap, pos_screen.xy).a; + vec2 sc = (pos_screen.xy-viewport.xy)*2.0; + sc /= viewport.zw; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec4 frag = vary_fragcoord; + frag.xyz /= frag.w; + frag.xyz = frag.xyz*0.5+0.5; + frag.xy *= screen_res; + + vec3 pos = getPosition(frag.xy).xyz; + vec3 lv = vary_light.xyz-pos; + float dist2 = dot(lv,lv); + dist2 /= vary_light.w; + if (dist2 > 1.0) + { + discard; + } + + vec3 norm = texture2DRect(normalMap, frag.xy).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + float da = dot(norm, lv); + if (da < 0.0) + { + discard; + } + + norm = normalize(norm); + lv = normalize(lv); + da = dot(norm, lv); + + float noise = texture2D(noiseMap, frag.xy/128.0).b; + + vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; + float fa = gl_Color.a+1.0; + float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + float lit = da * dist_atten * noise; + + col = gl_Color.rgb*lit*col; + + vec4 spec = texture2DRect(specularRect, frag.xy); + if (spec.a > 0.0) + { + float sa = dot(normalize(lv-normalize(pos)),norm); + if (sa > 0.0) + { + sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); + sa *= noise; + col += da*sa*gl_Color.rgb*spec.rgb; + } + } + + if (dot(col, col) <= 0.0) + { + discard; + } + + gl_FragColor.rgb = col; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl new file mode 100644 index 0000000000..a34f882c39 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl @@ -0,0 +1,133 @@ +/** + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS edgeMap; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D bloomMap; + +uniform float depth_cutoff; +uniform float norm_cutoff; +uniform float focal_distance; +uniform float blur_constant; +uniform float tan_pixel_angle; +uniform float magnification; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +varying vec2 vary_fragcoord; + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ + vec4 ret = vec4(0,0,0,0); + for (int i = 0; i < 4; ++i) + { + ret += texelFetch(tex, tc, i); + } + + return ret * 0.25; +} + +float getDepth(ivec2 pos_screen) +{ + float z = texture2DMS(depthMap, pos_screen.xy).r; + z = z*2.0-1.0; + vec4 ndc = vec4(0.0, 0.0, z, 1.0); + vec4 p = inv_proj*ndc; + return p.z/p.w; +} + +float calc_cof(float depth) +{ + float sc = abs(depth-focal_distance)/-depth*blur_constant; + + sc /= magnification; + + // tan_pixel_angle = pixel_length/-depth; + float pixel_length = tan_pixel_angle*-focal_distance; + + sc = sc/pixel_length; + sc *= 1.414; + + return sc; +} + +void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ivec2 tc) +{ + float d = getDepth(tc); + + float sc = calc_cof(d); + + if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius + || d < cur_depth) //sampled pixel is further away than current pixel + { + float wg = 0.25; + + vec4 s = texture2DMS(diffuseRect, tc); + // de-weight dull areas to make highlights 'pop' + wg += s.r+s.g+s.b; + + diff += wg*s; + + w += wg; + } +} + + +void main() +{ + ivec2 itc = ivec2(vary_fragcoord.xy); + + vec3 norm = texture2DMS(normalMap, itc).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + + float depth = getDepth(itc); + + vec4 diff = texture2DMS(diffuseRect, itc); + + { + float w = 1.0; + + float sc = calc_cof(depth); + sc = min(abs(sc), 10.0); + + float fd = depth*0.5f; + + float PI = 3.14159265358979323846264; + + int isc = int(sc); + + // sample quite uniformly spaced points within a circle, for a circular 'bokeh' + //if (depth < focal_distance) + { + for (int x = -isc; x <= isc; x+=2) + { + for (int y = -isc; y <= isc; y+=2) + { + ivec2 cur_samp = ivec2(x,y); + float cur_sc = length(vec2(cur_samp)); + if (cur_sc < sc) + { + dofSample(diff, w, cur_sc, depth, itc+cur_samp); + } + } + } + } + + diff /= w; + } + + vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); + gl_FragColor = diff + bloom; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl new file mode 100644 index 0000000000..7b14974f8b --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl @@ -0,0 +1,36 @@ +/** + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2D bloomMap; + +uniform vec2 screen_res; +varying vec2 vary_fragcoord; + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ + vec4 ret = texelFetch(tex,tc,0); + ret += texelFetch(tex,tc,1); + ret += texelFetch(tex,tc,2); + ret += texelFetch(tex,tc,3); + ret *= 0.25; + + return ret; +} + +void main() +{ + vec4 diff = texture2DMS(diffuseRect, ivec2(vary_fragcoord.xy)); + + vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); + gl_FragColor = diff + bloom; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl new file mode 100644 index 0000000000..91143943b6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -0,0 +1,44 @@ +/** + * @file WLSkyF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +varying vec4 vary_HazeColor; + +uniform sampler2D cloud_noise_texture; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +void main() +{ + // Potential Fill-rate optimization. Add cloud calculation + // back in and output alpha of 0 (so that alpha culling kills + // the fragment) if the sky wouldn't show up because the clouds + // are fully opaque. + + vec4 color; + color = vary_HazeColor; + color *= 2.; + + /// Gamma correct for WL (soft clip effect). + gl_FragData[0] = vec4(scaleSoftClip(color.rgb), 1.0); + gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); + gl_FragData[2] = vec4(0,0,1,0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl new file mode 100644 index 0000000000..03bca8f27e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -0,0 +1,140 @@ +/** + * @file WLSkyV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +// SKY //////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +varying vec4 vary_HazeColor; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; + +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +uniform vec4 cloud_scale; + +void main() +{ + + // World / view / projection + gl_Position = ftransform(); + gl_TexCoord[0] = gl_MultiTexCoord0; + + // Get relative position + vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); + //vec3 P = gl_Vertex.xyz + vec3(0,50,0); + + // Set altitude + if (P.y > 0.) + { + P *= (max_y.x / P.y); + } + else + { + P *= (-32000. / P.y); + } + + // Can normalize then + vec3 Pn = normalize(P); + float Plen = length(P); + + // Initialize temp variables + vec4 temp1 = vec4(0.); + vec4 temp2 = vec4(0.); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x); + + // Calculate relative weights + temp1 = blue_density + haze_density.x; + blue_weight = blue_density / temp1; + haze_weight = haze_density.x / temp1; + + // Compute sunlight from P & lightnorm (for long rays like sky) + temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Distance + temp2.z = Plen * density_multiplier.x; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z); + + + // Compute haze glow + temp2.x = dot(Pn, lightnorm.xyz); + temp2.x = 1. - temp2.x; + // temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + // Add "minimum anti-solar illumination" + temp2.x += .25; + + + // Haze color above cloud + vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient) + + (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient) + ); + + + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow.x); + + // Haze color below cloud + vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) + + (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient) + ); + + // Final atmosphere additive + vary_HazeColor *= (1. - temp1); + + // Attenuate cloud color by atmosphere + temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds + + // At horizon, blend high altitude sky color towards the darker color below the clouds + vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1)); + + // won't compile on mac without this being set + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl new file mode 100644 index 0000000000..4c38d91499 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl @@ -0,0 +1,318 @@ +/** + * @file softenLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2DMS depthMap; +uniform sampler2D noiseMap; +uniform samplerCube environmentMap; +uniform sampler2D lightFunc; + +uniform float blur_size; +uniform float blur_fidelity; + +// Inputs +uniform vec4 morphFactor; +uniform vec3 camPosLocal; +//uniform vec4 camPosWorld; +uniform vec4 gamma; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 distance_multiplier; +uniform vec4 max_y; +uniform vec4 glow; +uniform float scene_light_strength; +uniform vec3 env_mat[3]; +//uniform mat4 shadow_matrix[3]; +//uniform vec4 shadow_clip; +uniform mat3 ssao_effect_mat; + +varying vec4 vary_light; +varying vec2 vary_fragcoord; + +vec3 vary_PositionEye; + +vec3 vary_SunlitColor; +vec3 vary_AmblitColor; +vec3 vary_AdditiveColor; +vec3 vary_AtmosAttenuation; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +vec4 getPosition_d(vec2 pos_screen, float depth) +{ + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +vec3 getPositionEye() +{ + return vary_PositionEye; +} +vec3 getSunlitColor() +{ + return vary_SunlitColor; +} +vec3 getAmblitColor() +{ + return vary_AmblitColor; +} +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return vary_AtmosAttenuation; +} + + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ + vary_SunlitColor = v; +} + +void setAmblitColor(vec3 v) +{ + vary_AmblitColor = v; +} + +void setAdditiveColor(vec3 v) +{ + vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ + vary_AtmosAttenuation = v; +} + +void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + + vec3 P = inPositionEye; + setPositionEye(P); + + //(TERRAIN) limit altitude + if (P.y > max_y.x) P *= (max_y.x / P.y); + if (P.y < -max_y.x) P *= (-max_y.x / P.y); + + vec3 tmpLightnorm = lightnorm.xyz; + + vec3 Pn = normalize(P); + float Plen = length(P); + + vec4 temp1 = vec4(0); + vec3 temp2 = vec3(0); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + //sunlight attenuation effect (hue and brightness) due to atmosphere + //this is used later for sunlight modulation at various altitudes + light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); + //I had thought blue_density and haze_density should have equal weighting, + //but attenuation due to haze_density tends to seem too strong + + temp1 = blue_density + vec4(haze_density.r); + blue_weight = blue_density / temp1; + haze_weight = vec4(haze_density.r) / temp1; + + //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) + temp2.y = max(0.0, tmpLightnorm.y); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // main atmospheric scattering line integral + temp2.z = Plen * density_multiplier.x; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); + + //final atmosphere attenuation factor + setAtmosAttenuation(temp1.rgb); + + //compute haze glow + //(can use temp2.x as temp because we haven't used it yet) + temp2.x = dot(Pn, tmpLightnorm.xyz); + temp2.x = 1. - temp2.x; + //temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .03); //was glow.y + //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + //higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + //glow.z should be negative, so we're doing a sort of (1 / "angle") function + + //add "minimum anti-solar illumination" + temp2.x += .25; + + //increase ambient when there are more clouds + vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; + + /* decrease value and saturation (that in HSV, not HSL) for occluded areas + * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html + * // The following line of code performs the equivalent of: + * float ambAlpha = tmpAmbient.a; + * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis + * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); + * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); + */ + tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + + //haze color + setAdditiveColor( + vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) + + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x + + tmpAmbient))); + + //brightness of surface both sunlight and ambient + setSunlitColor(vec3(sunlight * .5)); + setAmblitColor(vec3(tmpAmbient * .25)); + setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); +} + +vec3 atmosLighting(vec3 light) +{ + light *= getAtmosAttenuation().r; + light += getAdditiveColor(); + return (2.0 * light); +} + +vec3 atmosTransport(vec3 light) { + light *= getAtmosAttenuation().r; + light += getAdditiveColor() * 2.0; + return light; +} +vec3 atmosGetDiffuseSunlightColor() +{ + return getSunlitColor(); +} + +vec3 scaleDownLight(vec3 light) +{ + return (light / scene_light_strength ); +} + +vec3 scaleUpLight(vec3 light) +{ + return (light * scene_light_strength); +} + +vec3 atmosAmbient(vec3 light) +{ + return getAmblitColor() + light / 2.0; +} + +vec3 atmosAffectDirectionalLight(float lightIntensity) +{ + return getSunlitColor() * lightIntensity; +} + +vec3 scaleSoftClip(vec3 light) +{ + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +{ + vec4 ret = texelFetch(tex,tc,0); + ret += texelFetch(tex,tc,1); + ret += texelFetch(tex,tc,2); + ret += texelFetch(tex,tc,3); + ret *= 0.25; + + return ret; +} + +void main() +{ + int samples = 4; + vec2 tc = vary_fragcoord.xy; + ivec2 itc = ivec2(tc); + + vec3 fcol = vec3(0,0,0); + + for (int i = 0; i < samples; ++i) + { + float depth = texelFetch(depthMap, itc, i).r; + vec3 pos = getPosition_d(tc, depth).xyz; + vec3 norm = texelFetch(normalMap, itc, i).xyz; + + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; + + float da = max(dot(norm.xyz, vary_light.xyz), 0.0); + + vec4 diffuse = texelFetch(diffuseRect, itc, i); + if (diffuse.a >= 1.0) + { + fcol += diffuse.rgb; + } + else + { + vec4 spec = texelFetch(specularRect, itc, i); + + calcAtmospherics(pos.xyz, 1.0); + + vec3 col = atmosAmbient(vec3(0)); + col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a)); + + col *= diffuse.rgb; + + if (spec.a > 0.0) // specular reflection + { + // the old infinite-sky shiny reflection + // + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); + float sa = dot(refnormpersp, vary_light.xyz); + vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a; + + // add the two types of shiny together + col += dumbshiny * spec.rgb; + } + + col = atmosLighting(col); + col = scaleSoftClip(col); + fcol += col; + } + } + + gl_FragColor.rgb = fcol.rgb/samples; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl new file mode 100644 index 0000000000..00093836a2 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl @@ -0,0 +1,17 @@ +/** + * @file sunLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +//class 1, no shadow, no SSAO, should never be called + +#extension GL_ARB_texture_rectangle : enable + +void main() +{ + gl_FragColor = vec4(0,0,0,0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl new file mode 100644 index 0000000000..49b45dedd6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl @@ -0,0 +1,125 @@ +/** + * @file sunLightSSAOF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +//class 1 -- no shadow, SSAO only + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; + + +// Inputs +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform float ssao_radius; +uniform float ssao_max_radius; +uniform float ssao_factor; +uniform float ssao_factor_inv; + +varying vec2 vary_fragcoord; +varying vec4 vary_light; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +uniform float shadow_bias; +uniform float shadow_offset; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +//calculate decreases in ambient lighting when crowded out (SSAO) +float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample) +{ + float ret = 1.0; + + vec2 kern[8]; + // exponentially (^2) distant occlusion samples spread around origin + kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; + kern[1] = vec2(1.0, 0.0) * 0.250*0.250; + kern[2] = vec2(0.0, 1.0) * 0.375*0.375; + kern[3] = vec2(0.0, -1.0) * 0.500*0.500; + kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; + kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; + kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; + kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + + vec2 pos_screen = vary_fragcoord.xy; + vec3 pos_world = pos.xyz; + vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; + + float angle_hidden = 0.0; + int points = 0; + + float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); + + // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?) + for (int i = 0; i < 8; i++) + { + ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect)); + vec3 samppos_world = getPosition(samppos_screen, sample).xyz; + + vec3 diff = pos_world - samppos_world; + float dist2 = dot(diff, diff); + + // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area + // --> solid angle shrinking by the square of distance + //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 + //(k should vary inversely with # of samples, but this is taken care of later) + + angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); + + // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" + points = points + int(diff.z > -1.0); + } + + angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); + + ret = (1.0 - (float(points != 0) * angle_hidden)); + + return min(ret, 1.0); +} + +void main() +{ + int samples = 4; + + vec2 pos_screen = vary_fragcoord.xy; + ivec2 itc = ivec2(pos_screen); + + float col = 0; + + for (int i = 0; i < samples; i++) + { + vec4 pos = getPosition(itc, i); + vec3 norm = texelFetch(normalMap, itc, i).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + col += calcAmbientOcclusion(pos,norm,i); + } + + col /= samples; + + gl_FragColor[0] = 1.0; + gl_FragColor[1] = col; + gl_FragColor[2] = 1.0; + gl_FragColor[3] = 1.0; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl new file mode 100644 index 0000000000..a47ee678f6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl @@ -0,0 +1,74 @@ +/** + * @file edgeF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; + +varying vec2 vary_fragcoord; + +uniform float depth_cutoff; +uniform float norm_cutoff; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +float getDepth(float z) +{ + z = z*2.0-1.0; + vec4 ndc = vec4(0.0, 0.0, z, 1.0); + vec4 p = inv_proj*ndc; + return p.z/p.w; +} + +void main() +{ + + float e = 0; + + ivec2 itc = ivec2(vary_fragcoord.xy); + + for (int i = 0; i < samples; i++) + { + vec3 norm = texelFetch(normalMap, itc, i).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + float depth = getDepth(texelFetch(depthMap, itc, i).r); + + vec2 tc = vary_fragcoord.xy; + + float sc = 0.75; + + vec2 de; + de.x = (depth-getDepth(tc+vec2(sc, sc))) + (depth-getDepth(tc+vec2(-sc, -sc))); + de.y = (depth-getDepth(tc+vec2(-sc, sc))) + (depth-getDepth(tc+vec2(sc, -sc))); + de /= depth; + de *= de; + de = step(depth_cutoff, de); + + vec2 ne; + vec3 nexnorm = texture2DRect(normalMap, tc+vec2(-sc,-sc)).rgb; + nexnorm = vec3((nexnorm.xy-0.5)*2.0,nexnorm.z); // unpack norm + ne.x = dot(nexnorm, norm); + vec3 neynorm = texture2DRect(normalMap, tc+vec2(sc,sc)).rgb; + neynorm = vec3((neynorm.xy-0.5)*2.0,neynorm.z); // unpack norm + ne.y = dot(neynorm, norm); + + ne = 1.0-ne; + + ne = step(norm_cutoff, ne); + + e += dot(de,de)+dot(ne,ne); + } + + e /= samples; + + gl_FragColor.a = e; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl new file mode 100644 index 0000000000..7d4548d6d9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -0,0 +1,307 @@ +/** + * @file softenLightMSF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2DMS lightMap; +uniform sampler2DMS depthMap; +uniform sampler2D noiseMap; +uniform samplerCube environmentMap; +uniform sampler2D lightFunc; +uniform vec3 gi_quad; + +uniform float blur_size; +uniform float blur_fidelity; + +// Inputs +uniform vec4 morphFactor; +uniform vec3 camPosLocal; +//uniform vec4 camPosWorld; +uniform vec4 gamma; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform vec4 haze_horizon; +uniform vec4 haze_density; +uniform vec4 cloud_shadow; +uniform vec4 density_multiplier; +uniform vec4 distance_multiplier; +uniform vec4 max_y; +uniform vec4 glow; +uniform float scene_light_strength; +uniform vec3 env_mat[3]; +uniform vec4 shadow_clip; +uniform mat3 ssao_effect_mat; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +varying vec4 vary_light; +varying vec2 vary_fragcoord; + +vec3 vary_PositionEye; + +vec3 vary_SunlitColor; +vec3 vary_AmblitColor; +vec3 vary_AdditiveColor; +vec3 vary_AtmosAttenuation; + +vec4 getPosition_d(vec2 pos_screen, float depth) +{ + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +vec3 getPositionEye() +{ + return vary_PositionEye; +} +vec3 getSunlitColor() +{ + return vary_SunlitColor; +} +vec3 getAmblitColor() +{ + return vary_AmblitColor; +} +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return vary_AtmosAttenuation; +} + + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ + vary_SunlitColor = v; +} + +void setAmblitColor(vec3 v) +{ + vary_AmblitColor = v; +} + +void setAdditiveColor(vec3 v) +{ + vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ + vary_AtmosAttenuation = v; +} + +void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + + vec3 P = inPositionEye; + setPositionEye(P); + + //(TERRAIN) limit altitude + if (P.y > max_y.x) P *= (max_y.x / P.y); + if (P.y < -max_y.x) P *= (-max_y.x / P.y); + + vec3 tmpLightnorm = lightnorm.xyz; + + vec3 Pn = normalize(P); + float Plen = length(P); + + vec4 temp1 = vec4(0); + vec3 temp2 = vec3(0); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + //sunlight attenuation effect (hue and brightness) due to atmosphere + //this is used later for sunlight modulation at various altitudes + light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); + //I had thought blue_density and haze_density should have equal weighting, + //but attenuation due to haze_density tends to seem too strong + + temp1 = blue_density + vec4(haze_density.r); + blue_weight = blue_density / temp1; + haze_weight = vec4(haze_density.r) / temp1; + + //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) + temp2.y = max(0.0, tmpLightnorm.y); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // main atmospheric scattering line integral + temp2.z = Plen * density_multiplier.x; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); + + //final atmosphere attenuation factor + setAtmosAttenuation(temp1.rgb); + + //compute haze glow + //(can use temp2.x as temp because we haven't used it yet) + temp2.x = dot(Pn, tmpLightnorm.xyz); + temp2.x = 1. - temp2.x; + //temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .03); //was glow.y + //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + //higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + //glow.z should be negative, so we're doing a sort of (1 / "angle") function + + //add "minimum anti-solar illumination" + temp2.x += .25; + + //increase ambient when there are more clouds + vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; + + /* decrease value and saturation (that in HSV, not HSL) for occluded areas + * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html + * // The following line of code performs the equivalent of: + * float ambAlpha = tmpAmbient.a; + * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis + * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); + * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); + */ + tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + + //haze color + setAdditiveColor( + vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) + + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x + + tmpAmbient))); + + //brightness of surface both sunlight and ambient + setSunlitColor(vec3(sunlight * .5)); + setAmblitColor(vec3(tmpAmbient * .25)); + setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); +} + +vec3 atmosLighting(vec3 light) +{ + light *= getAtmosAttenuation().r; + light += getAdditiveColor(); + return (2.0 * light); +} + +vec3 atmosTransport(vec3 light) { + light *= getAtmosAttenuation().r; + light += getAdditiveColor() * 2.0; + return light; +} +vec3 atmosGetDiffuseSunlightColor() +{ + return getSunlitColor(); +} + +vec3 scaleDownLight(vec3 light) +{ + return (light / scene_light_strength ); +} + +vec3 scaleUpLight(vec3 light) +{ + return (light * scene_light_strength); +} + +vec3 atmosAmbient(vec3 light) +{ + return getAmblitColor() + light / 2.0; +} + +vec3 atmosAffectDirectionalLight(float lightIntensity) +{ + return getSunlitColor() * lightIntensity; +} + +vec3 scaleSoftClip(vec3 light) +{ + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +void main() +{ + int samples = 4; + vec2 tc = vary_fragcoord.xy; + ivec2 itc = ivec2(tc); + + vec3 fcol = vec3(0,0,0); + + float amb = 0; + + for (int i = 0; i < samples; ++i) + { + float depth = texelFetch(depthMap, itc.xy, i).r; + vec3 pos = getPosition_d(tc, depth).xyz; + vec3 norm = texelFetch(normalMap, itc, i).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + + float da = max(dot(norm.xyz, vary_light.xyz), 0.0); + + vec4 diffuse = texelFetch(diffuseRect, itc, i); + vec4 spec = texelFetch(specularRect, itc, i); + + vec2 scol_ambocc = texelFetch(lightMap, itc, i).rg; + float scol = max(scol_ambocc.r, diffuse.a); + float ambocc = scol_ambocc.g; + amb += ambocc; + + calcAtmospherics(pos.xyz, ambocc); + + vec3 col = atmosAmbient(vec3(0)); + col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); + + col *= diffuse.rgb; + + if (spec.a > 0.0) // specular reflection + { + // the old infinite-sky shiny reflection + // + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); + float sa = dot(refnormpersp, vary_light.xyz); + vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; + + // add the two types of shiny together + col += dumbshiny * spec.rgb; + } + + col = atmosLighting(col); + col = scaleSoftClip(col); + + fcol += col; + } + + gl_FragColor.rgb = fcol/samples; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 696c2d1abd..66b834ab11 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -44,6 +44,8 @@ LLPointer LLDrawPoolWLSky::sCloudNoiseTexture = NULL; LLPointer LLDrawPoolWLSky::sCloudNoiseRawImage = NULL; +static LLGLSLShader* cloud_shader = NULL; +static LLGLSLShader* sky_shader = NULL; LLDrawPoolWLSky::LLDrawPoolWLSky(void) : @@ -83,12 +85,32 @@ LLViewerTexture *LLDrawPoolWLSky::getDebugTexture() void LLDrawPoolWLSky::beginRenderPass( S32 pass ) { + sky_shader = + LLPipeline::sUnderWaterRender ? + &gObjectSimpleWaterProgram : + &gWLSkyProgram; + + cloud_shader = + LLPipeline::sUnderWaterRender ? + &gObjectSimpleWaterProgram : + &gWLCloudProgram; } void LLDrawPoolWLSky::endRenderPass( S32 pass ) { } +void LLDrawPoolWLSky::beginDeferredPass(S32 pass) +{ + sky_shader = &gDeferredWLSkyProgram; + cloud_shader = &gDeferredWLCloudProgram; +} + +void LLDrawPoolWLSky::endDeferredPass(S32 pass) +{ + +} + void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) const { LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); @@ -128,19 +150,14 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const { if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) { - LLGLSLShader* shader = - LLPipeline::sUnderWaterRender ? - &gObjectSimpleWaterProgram : - &gWLSkyProgram; - LLGLDisable blend(GL_BLEND); - shader->bind(); + sky_shader->bind(); /// Render the skydome - renderDome(camHeightLocal, shader); + renderDome(camHeightLocal, sky_shader); - shader->unbind(); + sky_shader->unbind(); } } @@ -186,23 +203,18 @@ void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const { if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)) { - LLGLSLShader* shader = - LLPipeline::sUnderWaterRender ? - &gObjectSimpleWaterProgram : - &gWLCloudProgram; - LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); gGL.getTexUnit(0)->bind(sCloudNoiseTexture); - shader->bind(); + cloud_shader->bind(); /// Render the skydome - renderDome(camHeightLocal, shader); + renderDome(camHeightLocal, cloud_shader); - shader->unbind(); + cloud_shader->unbind(); } } @@ -246,6 +258,50 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() } } +void LLDrawPoolWLSky::renderDeferred(S32 pass) +{ + if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) + { + return; + } + LLFastTimer ftm(FTM_RENDER_WL_SKY); + + const F32 camHeightLocal = LLWLParamManager::instance()->getDomeOffset() * LLWLParamManager::instance()->getDomeRadius(); + + LLGLSNoFog disableFog; + LLGLDepthTest depth(GL_TRUE, GL_FALSE); + LLGLDisable clip(GL_CLIP_PLANE0); + + gGL.setColorMask(true, false); + + LLGLSquashToFarClip far_clip(glh_get_current_projection()); + + renderSkyHaze(camHeightLocal); + + /*LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + glPushMatrix(); + + glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); + + // *NOTE: have to bind a texture here since register combiners blending in + // renderStars() requires something to be bound and we might as well only + // bind the moon's texture once. + gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture()); + + renderHeavenlyBodies(); + + renderStars(); + + + glPopMatrix();*/ + + renderSkyClouds(camHeightLocal); + + gGL.setColorMask(true, true); + //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + +} + void LLDrawPoolWLSky::render(S32 pass) { if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index 8ca1ebb942..cd15c991ee 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -44,10 +44,10 @@ public: /*virtual*/ BOOL isDead() { return FALSE; } - /*virtual*/ S32 getNumPostDeferredPasses() { return getNumPasses(); } - /*virtual*/ void beginPostDeferredPass(S32 pass) { beginRenderPass(pass); } - /*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); } - /*virtual*/ void renderPostDeferred(S32 pass) { render(pass); } + /*virtual*/ S32 getNumDeferredPasses() { return 1; } + /*virtual*/ void beginDeferredPass(S32 pass); + /*virtual*/ void endDeferredPass(S32 pass); + /*virtual*/ void renderDeferred(S32 pass); /*virtual*/ LLViewerTexture *getDebugTexture(); /*virtual*/ void beginRenderPass( S32 pass ); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index e41773d273..10e96525ce 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -836,7 +836,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { gPipeline.mDeferredScreen.bindTarget(); - glClearColor(0,0,0,0); + glClearColor(1,0,1,1); gPipeline.mDeferredScreen.clear(); } else diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 3e85802ba6..84fb1eb5d0 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -138,7 +138,8 @@ LLGLSLShader gDeferredGIFinalProgram; LLGLSLShader gDeferredPostGIProgram; LLGLSLShader gDeferredPostProgram; LLGLSLShader gDeferredPostNoDoFProgram; - +LLGLSLShader gDeferredWLSkyProgram; +LLGLSLShader gDeferredWLCloudProgram; LLGLSLShader gLuminanceGatherProgram; @@ -190,6 +191,8 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredGIFinalProgram); mShaderList.push_back(&gDeferredWaterProgram); mShaderList.push_back(&gDeferredAvatarAlphaProgram); + mShaderList.push_back(&gDeferredWLSkyProgram); + mShaderList.push_back(&gDeferredWLCloudProgram); } LLViewerShaderMgr::~LLViewerShaderMgr() @@ -952,6 +955,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredGIProgram.unload(); gDeferredGIFinalProgram.unload(); gDeferredWaterProgram.unload(); + gDeferredWLSkyProgram.unload(); + gDeferredWLCloudProgram.unload(); return TRUE; } @@ -959,6 +964,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() BOOL success = TRUE; + bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 0 && gGLManager.mHasTextureMultisample; + if (success) { gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader"; @@ -1083,11 +1090,25 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (gSavedSettings.getBOOL("RenderDeferredSSAO")) { - fragment = "deferred/sunLightSSAOF.glsl"; + if (multisample) + { + fragment = "deferred/sunlightSSAOMSF.glsl"; + } + else + { + fragment = "deferred/sunLightSSAOF.glsl"; + } } else { - fragment = "deferred/sunLightF.glsl"; + if (multisample) + { + fragment = "deferred/sunlightMSF.glsl"; + } + else + { + fragment = "deferred/sunLightF.glsl"; + } } gDeferredSunProgram.mName = "Deferred Sun Shader"; @@ -1100,10 +1121,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { + std::string fragment; + + if (multisample) + { + fragment = "deferred/blurLightMSF.glsl"; + } + else + { + fragment = "deferred/blurLightF.glsl"; + } + gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader"; gDeferredBlurLightProgram.mShaderFiles.clear(); gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredBlurLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredBlurLightProgram.createShader(NULL, NULL); } @@ -1153,10 +1185,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { + std::string fragment; + + if (multisample) + { + fragment = "deferred/softenLightMSF.glsl"; + } + else + { + fragment = "deferred/softenLightF.glsl"; + } + gDeferredSoftenProgram.mName = "Deferred Soften Shader"; gDeferredSoftenProgram.mShaderFiles.clear(); gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredSoftenProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredSoftenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; @@ -1239,32 +1282,85 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { + std::string fragment; + if (multisample) + { + fragment = "deferred/postDeferredMSF.glsl"; + } + else + { + fragment = "deferred/postDeferredF.glsl"; + } + gDeferredPostProgram.mName = "Deferred Post Shader"; gDeferredPostProgram.mShaderFiles.clear(); gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredPostProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredPostProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredPostProgram.createShader(NULL, NULL); } if (success) { + std::string fragment; + if (multisample) + { + fragment = "deferred/postDeferredNoDoFMSF.glsl"; + } + else + { + fragment = "deferred/postDeferredNoDoFF.glsl"; + } + gDeferredPostNoDoFProgram.mName = "Deferred Post Shader"; gDeferredPostNoDoFProgram.mShaderFiles.clear(); gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredPostNoDoFProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredPostNoDoFProgram.createShader(NULL, NULL); } + if (success) + { + gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader"; + //gWLSkyProgram.mFeatures.hasGamma = true; + gDeferredWLSkyProgram.mShaderFiles.clear(); + gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; + success = gDeferredWLSkyProgram.createShader(NULL, &mWLUniforms); + } + + if (success) + { + gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program"; + gDeferredWLCloudProgram.mShaderFiles.clear(); + gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; + success = gDeferredWLCloudProgram.createShader(NULL, &mWLUniforms); + } + if (mVertexShaderLevel[SHADER_DEFERRED] > 1) { if (success) { + std::string fragment; + if (multisample) + { + fragment = "deferred/edgeMSF.glsl"; + } + else + { + fragment = "deferred/edgeF.glsl"; + } + gDeferredEdgeProgram.mName = "Deferred Edge Shader"; gDeferredEdgeProgram.mShaderFiles.clear(); gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredEdgeProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredEdgeProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredEdgeProgram.createShader(NULL, NULL); } @@ -1272,8 +1368,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (mVertexShaderLevel[SHADER_DEFERRED] > 2) { - - if (success) { gDeferredPostGIProgram.mName = "Deferred Post GI Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 72ac5e02ee..b13775742b 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -374,6 +374,8 @@ extern LLGLSLShader gDeferredAttachmentShadowProgram; extern LLGLSLShader gDeferredAlphaProgram; extern LLGLSLShader gDeferredFullbrightProgram; extern LLGLSLShader gDeferredAvatarAlphaProgram; +extern LLGLSLShader gDeferredWLSkyProgram; +extern LLGLSLShader gDeferredWLCloudProgram; extern LLGLSLShader gLuminanceGatherProgram; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f64eb89866..964836ff90 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -580,11 +580,6 @@ void LLPipeline::allocatePhysicsBuffer() if (mPhysicsDisplay.getWidth() != resX || mPhysicsDisplay.getHeight() != resY) { mPhysicsDisplay.allocate(resX, resY, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); - if (mSampleBuffer.getWidth() == mPhysicsDisplay.getWidth() && - mSampleBuffer.getHeight() == mPhysicsDisplay.getHeight()) - { - mPhysicsDisplay.setSampleBuffer(&mSampleBuffer); - } } } @@ -621,16 +616,16 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) bool gi = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED); //allocate deferred rendering color buffers - mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); - mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); + mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples); + mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples); addDeferredAttachments(mDeferredScreen); - mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); + mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples); mEdgeMap.allocate(resX, resY, GL_ALPHA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); if (shadow_detail > 0 || ssao) { //only need mDeferredLight[0] for shadows OR ssao - mDeferredLight[0].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); + mDeferredLight[0].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples); } else { @@ -639,7 +634,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) if (ssao) { //only need mDeferredLight[1] for ssao - mDeferredLight[1].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); + mDeferredLight[1].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, false, samples); } else { @@ -648,7 +643,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) if (gi) { //only need mDeferredLight[2] and mGIMapPost for gi - mDeferredLight[2].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); + mDeferredLight[2].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, false); for (U32 i = 0; i < 2; i++) { mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); @@ -729,25 +724,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); } - if (LLRenderTarget::sUseFBO && samples > 1) - { - mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); - if (LLPipeline::sRenderDeferred) - { - addDeferredAttachments(mSampleBuffer); - mDeferredScreen.setSampleBuffer(&mSampleBuffer); - mEdgeMap.setSampleBuffer(&mSampleBuffer); - } - - mScreen.setSampleBuffer(&mSampleBuffer); - - stop_glerror(); - } - else - { - mSampleBuffer.release(); - } - if (LLPipeline::sRenderDeferred) { //share depth buffer between deferred targets mDeferredScreen.shareDepthBuffer(mScreen); @@ -826,7 +802,6 @@ void LLPipeline::releaseGLBuffers() mScreen.release(); mPhysicsDisplay.release(); mUIScreen.release(); - mSampleBuffer.release(); mDeferredScreen.release(); mDeferredDepth.release(); for (U32 i = 0; i < 3; i++) @@ -6420,11 +6395,10 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f("magnification", magnification); } - S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE); + S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); if (channel > -1) { mScreen.bindTexture(0, channel); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } //channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); //if (channel > -1) @@ -6567,21 +6541,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen shader.bind(); S32 channel = 0; - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE); + channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); if (channel > -1) { mDeferredScreen.bindTexture(0,channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, LLTexUnit::TT_RECT_TEXTURE); + channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage()); if (channel > -1) { mDeferredScreen.bindTexture(1, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, LLTexUnit::TT_RECT_TEXTURE); + channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage()); if (channel > -1) { mDeferredScreen.bindTexture(2, channel); @@ -6704,22 +6678,16 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen shader.uniformMatrix4fv("gi_norm_mat", 1, FALSE, mGINormalMatrix.m); } } - - /*channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_POSITION, LLTexUnit::TT_RECT_TEXTURE); - if (channel > -1) - { - mDeferredScreen.bindTexture(3, channel); - }*/ + stop_glerror(); - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); + channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage()); if (channel > -1) { gGL.getTexUnit(channel)->bind(&mDeferredDepth, TRUE); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); stop_glerror(); - glTexParameteri(LLTexUnit::getInternalType(mDeferredDepth.getUsage()), GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); - glTexParameteri(LLTexUnit::getInternalType(mDeferredDepth.getUsage()), GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); + //glTexParameteri(LLTexUnit::getInternalType(mDeferredDepth.getUsage()), GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); + //glTexParameteri(LLTexUnit::getInternalType(mDeferredDepth.getUsage()), GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); stop_glerror(); @@ -6748,7 +6716,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen stop_glerror(); - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, LLTexUnit::TT_RECT_TEXTURE); + channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, mDeferredLight[light_index].getUsage()); if (channel > -1) { mDeferredLight[light_index].bindTexture(0, channel); @@ -6968,9 +6936,9 @@ void LLPipeline::renderDeferredLighting() } //ati doesn't seem to love actually using the stencil buffer on FBO's - LLGLEnable stencil(GL_STENCIL_TEST); - glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + LLGLDisable stencil(GL_STENCIL_TEST); + //glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF); + //glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); gGL.setColorMask(true, true); @@ -7789,16 +7757,15 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) { stop_glerror(); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_POSITION, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, LLTexUnit::TT_RECT_TEXTURE); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage()); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage()); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, mDeferredScreen.getUsage()); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, mDeferredLight[0].getUsage()); shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LIGHT, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_EDGE, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_SUN_LIGHT, LLTexUnit::TT_RECT_TEXTURE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_LOCAL_LIGHT, LLTexUnit::TT_RECT_TEXTURE); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_EDGE, mEdgeMap.getUsage()); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_SUN_LIGHT, mDeferredLight[1].getUsage()); + shader.disableTexture(LLViewerShaderMgr::DEFERRED_LOCAL_LIGHT, mDeferredLight[2].getUsage()); shader.disableTexture(LLViewerShaderMgr::DEFERRED_LUMINANCE); shader.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_MIP); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index e9a250cd6d..ed4a803e7e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -524,7 +524,6 @@ public: LLRenderTarget mEdgeMap; LLRenderTarget mDeferredDepth; LLRenderTarget mDeferredLight[3]; - LLMultisampleBuffer mSampleBuffer; LLRenderTarget mGIMap; LLRenderTarget mGIMapPost[2]; LLRenderTarget mLuminanceMap; -- cgit v1.2.3 From f15b6396ecf1a14802cd4977986af2bec30c76b5 Mon Sep 17 00:00:00 2001 From: prep linden Date: Fri, 20 May 2011 15:45:09 -0400 Subject: Added NewAccountingEnabled cap --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 590c82856d..fb608b3a4f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1508,6 +1508,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("LandResources"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); + capabilityNames.append("NewAccountingEnabled"); capabilityNames.append("NewFileAgentInventory"); capabilityNames.append("NewFileAgentInventoryVariablePrice"); capabilityNames.append("ObjectAdd"); @@ -1546,9 +1547,8 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("ViewerStartAuction"); capabilityNames.append("ViewerStats"); //prep# Finalize these!!!!!!!!! - //capabilityNames.append("AccountingVO"); capabilityNames.append("AccountingParcel"); - capabilityNames.append("AccountingRegion"); + capabilityNames.append("AccountingSelection"); // Please add new capabilities alphabetically to reduce // merge conflicts. -- cgit v1.2.3 From 0e99a8b2c5646ba2a3243de210cfcc7944b28719 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 20 May 2011 15:52:33 -0400 Subject: SH-1492 WIP --- indra/newview/llinventorymodel.cpp | 2 + indra/newview/llmeshrepository.cpp | 80 +++++++++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 19 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b5180854ef..318beafe65 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -632,10 +632,12 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) } // We're hiding mesh types +#if 0 if (item->getType() == LLAssetType::AT_MESH) { return mask; } +#endif LLViewerInventoryItem* old_item = getItem(item->getUUID()); LLPointer new_item; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d9a58d56fe..7fee7e0e3e 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -498,18 +498,29 @@ public: //assert_main_thread(); llinfos << "completed" << llendl; mThread->mPendingUploads--; - dumpLLSDToFile(content,"whole_model_response.xml"); + dumpLLSDToFile(content,"whole_model_fee_response.xml"); + if (isGoodStatus(status)) + { + mThread->mWholeModelUploadURL = content["uploader"].asString(); + } + else + { + llinfos << "upload failed" << llendl; + mThread->mWholeModelUploadURL = ""; + } - mThread->mWholeModelUploadURL = content["uploader"].asString(); } }; class LLWholeModelUploadResponder: public LLCurl::Responder { LLMeshUploadThread* mThread; + LLSD mPostData; + public: - LLWholeModelUploadResponder(LLMeshUploadThread* thread): - mThread(thread) + LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& post_data): + mThread(thread), + mPostData(post_data) { } virtual void completed(U32 status, @@ -520,6 +531,7 @@ public: llinfos << "upload completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,"whole_model_upload_response.xml"); + gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mPostData,content)); } }; @@ -1404,14 +1416,13 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) result["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); result["asset_type"] = "mesh"; result["inventory_type"] = "object"; - result["name"] = "your name here"; + result["name"] = "mesh model"; result["description"] = "your description here"; // TODO "optional" fields from the spec res["mesh_list"] = LLSD::emptyArray(); -// TODO Textures - //res["texture_list"] = LLSD::emptyArray(); + res["texture_list"] = LLSD::emptyArray(); S32 mesh_num = 0; S32 texture_num = 0; @@ -1421,8 +1432,15 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLMeshUploadData data; data.mBaseModel = iter->first; - LLModelInstance& instance = *(iter->second.begin()); + LLModel* model = instance.mModel; + + std::string model_name = data.mBaseModel->getName(); + + if (!model_name.empty()) + { + result["name"] = model_name; + } for (S32 i = 0; i < 5; i++) { @@ -1458,11 +1476,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLMatrix4 transformation = instance.mTransform; decomposeMeshMatrix(transformation,pos,rot,scale); -#if 0 - mesh_entry["childpos"] = ll_sd_from_vector3(pos); - mesh_entry["childrot"] = ll_sd_from_quaternion(rot); - mesh_entry["scale"] = ll_sd_from_vector3(scale); -#endif mesh_entry["position"] = ll_sd_from_vector3(LLVector3()); mesh_entry["rotation"] = ll_sd_from_quaternion(rot); mesh_entry["scale"] = ll_sd_from_vector3(scale); @@ -1471,14 +1484,19 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::string str = ostr.str(); mesh_entry["mesh_data"] = LLSD::Binary(str.begin(),str.end()); - res["mesh_list"][mesh_num] = mesh_entry; // TODO how do textures in the list map to textures in the meshes? if (mUploadTextures) { + mesh_entry["face_list"] = LLSD::emptyArray(); + + S32 face_num = 0; + for (std::vector::iterator material_iter = instance.mMaterial.begin(); material_iter != instance.mMaterial.end(); ++material_iter) { + LLSD face_entry = LLSD::emptyMap(); + if (textures.find(material_iter->mDiffuseMap.get()) == textures.end()) { @@ -1500,11 +1518,23 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLSD texture_entry; texture_entry["texture_data"] = ostr.str(); res["texture_list"][texture_num] = texture_entry; + face_entry["image"] = texture_num; + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + texture_num++; } + + mesh_entry["face_list"][face_num] = face_entry; + face_num++; } } + res["mesh_list"][mesh_num] = mesh_entry; + mesh_num++; } @@ -1577,12 +1607,22 @@ void LLMeshUploadThread::doWholeModelUpload() mCurlRequest->process(); } while (mCurlRequest->getQueued() > 0); - mCurlRequest->post(mWholeModelUploadURL, headers, model_data["asset_resources"], new LLWholeModelUploadResponder(this)); - - do + LLSD body = model_data["asset_resources"]; + dumpLLSDToFile(body,"whole_model_body.xml"); + + if (mWholeModelUploadURL.empty()) { - mCurlRequest->process(); - } while (mCurlRequest->getQueued() > 0); + llinfos << "unable to upload, fee request failed" << llendl; + } + else + { + mCurlRequest->post(mWholeModelUploadURL, headers, body, + new LLWholeModelUploadResponder(this, model_data)); + do + { + mCurlRequest->process(); + } while (mCurlRequest->getQueued() > 0); + } delete mCurlRequest; mCurlRequest = NULL; @@ -3243,6 +3283,8 @@ bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const void LLMeshRepository::updateInventory(inventory_data data) { LLMutexLock lock(mMeshMutex); + dumpLLSDToFile(data.mPostData,"update_inventory_post_data.xml"); + dumpLLSDToFile(data.mResponse,"update_inventory_response.xml"); mInventoryQ.push(data); } -- cgit v1.2.3 From 1330881ba1613570a6c07a4afd9eea34af1f4d7d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 20 May 2011 18:45:56 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 49 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 7fee7e0e3e..5388bd404a 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1427,6 +1427,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) S32 texture_num = 0; std::set textures; + std::map texture_index; for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) { @@ -1484,7 +1485,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::string str = ostr.str(); mesh_entry["mesh_data"] = LLSD::Binary(str.begin(),str.end()); - // TODO how do textures in the list map to textures in the meshes? if (mUploadTextures) { @@ -1492,20 +1492,24 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) S32 face_num = 0; - for (std::vector::iterator material_iter = instance.mMaterial.begin(); - material_iter != instance.mMaterial.end(); ++material_iter) + for (S32 face_num = 0; face_num < model->getNumVolumeFaces(); face_num++) { + LLImportMaterial& material = instance.mMaterial[face_num]; LLSD face_entry = LLSD::emptyMap(); - - - if (textures.find(material_iter->mDiffuseMap.get()) == textures.end()) + + LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); + + if (texture != NULL) { - textures.insert(material_iter->mDiffuseMap.get()); + if (textures.find(texture) == textures.end()) + { + textures.insert(texture); + } std::stringstream ostr; if (include_textures) // otherwise data is blank. { - LLTextureUploadData data(material_iter->mDiffuseMap.get(), material_iter->mDiffuseMapLabel); + LLTextureUploadData data(texture, material.mDiffuseMapLabel); if (!data.mTexture->isRawImageValid()) { data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); @@ -1515,22 +1519,25 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); } - LLSD texture_entry; - texture_entry["texture_data"] = ostr.str(); - res["texture_list"][texture_num] = texture_entry; - face_entry["image"] = texture_num; + + if (texture_index.find(texture) == texture_index.end()) + { + texture_index[texture] = texture_num; + std::string str = ostr.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); + texture_num++; + } + + face_entry["image"] = texture_index[texture]; face_entry["scales"] = 1.0; face_entry["scalet"] = 1.0; face_entry["offsets"] = 0.0; face_entry["offsett"] = 0.0; face_entry["imagerot"] = 0.0; - - texture_num++; } - mesh_entry["face_list"][face_num] = face_entry; - face_num++; } + } res["mesh_list"][mesh_num] = mesh_entry; @@ -1593,9 +1600,9 @@ void LLMeshUploadThread::doWholeModelUpload() apr_sleep(100); } - bool do_include_textures = false; // not needed for initial cost/validation check. LLSD model_data; - wholeModelToLLSD(model_data, do_include_textures); + wholeModelToLLSD(model_data,false); + dumpLLSDToFile(model_data,"whole_model_fee_request.xml"); mPendingUploads++; LLCurlRequest::headers_t headers; @@ -1607,8 +1614,6 @@ void LLMeshUploadThread::doWholeModelUpload() mCurlRequest->process(); } while (mCurlRequest->getQueued() > 0); - LLSD body = model_data["asset_resources"]; - dumpLLSDToFile(body,"whole_model_body.xml"); if (mWholeModelUploadURL.empty()) { @@ -1616,6 +1621,10 @@ void LLMeshUploadThread::doWholeModelUpload() } else { + LLSD full_model_data; + wholeModelToLLSD(full_model_data, true); + LLSD body = full_model_data["asset_resources"]; + dumpLLSDToFile(body,"whole_model_body.xml"); mCurlRequest->post(mWholeModelUploadURL, headers, body, new LLWholeModelUploadResponder(this, model_data)); do -- cgit v1.2.3 From 107ca81b8e9dcb072424673f8b81736cb359a1a0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 11:22:49 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 5388bd404a..21e4c35f8c 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1477,7 +1477,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLMatrix4 transformation = instance.mTransform; decomposeMeshMatrix(transformation,pos,rot,scale); - mesh_entry["position"] = ll_sd_from_vector3(LLVector3()); + mesh_entry["position"] = ll_sd_from_vector3(pos); mesh_entry["rotation"] = ll_sd_from_quaternion(rot); mesh_entry["scale"] = ll_sd_from_vector3(scale); -- cgit v1.2.3 From d348b69d93945e2e0269208c4a229fbe52e9ccf4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 13:45:02 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 21e4c35f8c..085dc64473 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -531,6 +531,9 @@ public: llinfos << "upload completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,"whole_model_upload_response.xml"); + // requested "mesh" asset type isn't actually the type + // of the resultant object, fix it up here. + mPostData["asset_type"] = "object"; gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mPostData,content)); } }; @@ -1435,6 +1438,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) data.mBaseModel = iter->first; LLModelInstance& instance = *(iter->second.begin()); LLModel* model = instance.mModel; + LLSD mesh_entry; std::string model_name = data.mBaseModel->getName(); @@ -1448,6 +1452,32 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) data.mModel[i] = instance.mLOD[i]; } +#if 1 + LLVolumeParams volume_params; + volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE ); + volume_params.setBeginAndEndS( 0.f, 1.f ); + volume_params.setBeginAndEndT( 0.f, 1.f ); + volume_params.setRatio ( 1, 1 ); + volume_params.setShear ( 0, 0 ); + volume_params.setSculptID(instance.mMeshID, LL_SCULPT_TYPE_MESH); + mesh_entry["shape"] = volume_params.asLLSD(); + mesh_entry["material"] = LL_MCODE_WOOD; + mesh_entry["group-id"] = gAgent.getGroupID(); + LLPermissions perm; + perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); + perm.setCreator(gAgent.getID()); + + perm.initMasks(PERM_ITEM_UNRESTRICTED | PERM_MOVE, //base + PERM_ITEM_UNRESTRICTED | PERM_MOVE, //owner + LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getGroupPerms(), + LLFloaterPerms::getNextOwnerPerms()); + + mesh_entry["permissions"] = ll_create_sd_from_permissions(perm); + + mesh_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); +#endif + std::stringstream ostr; LLModel::Decomposition& decomp = @@ -1470,8 +1500,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) data.mAssetData = ostr.str(); - LLSD mesh_entry; - LLVector3 pos, scale; LLQuaternion rot; LLMatrix4 transformation = instance.mTransform; @@ -1546,9 +1574,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } result["asset_resources"] = res; -#if 1 dumpLLSDToFile(result,"whole_model.xml"); -#endif dest = result; } -- cgit v1.2.3 From 19b93cb8c57ac043ff0c795e931f7863b0aa07a7 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 13:46:55 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 085dc64473..f3b1aa9a1b 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1401,13 +1401,13 @@ void LLMeshUploadThread::run() } } -#if 1 void dumpLLSDToFile(const LLSD& content, std::string filename) { +#if 1 std::ofstream of(filename.c_str()); LLSDSerialize::toPrettyXML(content,of); -} #endif +} void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { @@ -1452,7 +1452,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) data.mModel[i] = instance.mLOD[i]; } -#if 1 LLVolumeParams volume_params; volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE ); volume_params.setBeginAndEndS( 0.f, 1.f ); @@ -1472,11 +1471,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLFloaterPerms::getEveryonePerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getNextOwnerPerms()); - mesh_entry["permissions"] = ll_create_sd_from_permissions(perm); - mesh_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); -#endif std::stringstream ostr; -- cgit v1.2.3 From 8729c4ac2f3fdffa7863dc01b4f51d69f44ddbfd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 14:47:48 -0400 Subject: Fixing missing newline that's making linux build fail --- indra/newview/llaccountingquotamanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/llaccountingquotamanager.h diff --git a/indra/newview/llaccountingquotamanager.h b/indra/newview/llaccountingquotamanager.h old mode 100644 new mode 100755 index 4c20561bce..f605d1e6b2 --- a/indra/newview/llaccountingquotamanager.h +++ b/indra/newview/llaccountingquotamanager.h @@ -57,4 +57,4 @@ private: }; //=============================================================================== -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From 7b51aa0ba2a9cffba71e87ad5c19b30bf87904a1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 14:50:18 -0400 Subject: Another fix for build failure - unused variable warning --- indra/newview/llmeshrepository.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f3b1aa9a1b..5e006e90a1 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1514,8 +1514,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { mesh_entry["face_list"] = LLSD::emptyArray(); - S32 face_num = 0; - for (S32 face_num = 0; face_num < model->getNumVolumeFaces(); face_num++) { LLImportMaterial& material = instance.mMaterial[face_num]; -- cgit v1.2.3 From 1840a2a6926f6c6121fd7eb283e4a1c5bd817024 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 23 May 2011 16:55:23 -0400 Subject: Fix for sh-788 --- indra/newview/llvoavatar.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ec2b5a4c98..dc355362ce 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4968,19 +4968,6 @@ void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositionsToDefault( void ) { - const LLVector3& avPos = getCharacterPosition(); - - //Reposition the pelvis - LLJoint* pPelvis = mRoot.findJoint("mPelvis"); - if ( pPelvis ) - { - pPelvis->setPosition( avPos + pPelvis->getPosition() ); - } - else - { - llwarns<<"Can't get pelvis joint."<setId( LLUUID::null ); //restore joints to default positions, however skip over the pelvis - if ( pJoint && pPelvis != pJoint ) + if ( pJoint ) { pJoint->restoreOldXform(); } @@ -6028,6 +6015,14 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) if ( bindCnt > 0 ) { LLVOAvatar::resetJointPositionsToDefault(); + //Need to handle the repositioning of the cam, updating rig data etc during outfit editing + //This handles the case where we detach a replacement rig. + if ( gAgentCamera.cameraCustomizeAvatar() ) + { + gAgent.unpauseAnimation(); + //Still want to refocus on head bone + gAgentCamera.changeCameraToCustomizeAvatar(); + } } } } -- cgit v1.2.3 From 302ec5586d1b3d589af0baeb907d5be2d12407f4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 17:21:05 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 5e006e90a1..9e0b17280e 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1518,7 +1518,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLImportMaterial& material = instance.mMaterial[face_num]; LLSD face_entry = LLSD::emptyMap(); - LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); if (texture != NULL) @@ -1549,14 +1548,20 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); texture_num++; } + } + // Subset of TextureEntry fields. + if (texture) + { face_entry["image"] = texture_index[texture]; - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; } + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["fullbright"] = material.mFullbright; mesh_entry["face_list"][face_num] = face_entry; } -- cgit v1.2.3 From 3f182d220046d4a2ffb81743252124cbb8bb9a70 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 23 May 2011 18:08:21 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 9e0b17280e..263d704231 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1452,16 +1452,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) data.mModel[i] = instance.mLOD[i]; } - LLVolumeParams volume_params; - volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE ); - volume_params.setBeginAndEndS( 0.f, 1.f ); - volume_params.setBeginAndEndT( 0.f, 1.f ); - volume_params.setRatio ( 1, 1 ); - volume_params.setShear ( 0, 0 ); - volume_params.setSculptID(instance.mMeshID, LL_SCULPT_TYPE_MESH); - mesh_entry["shape"] = volume_params.asLLSD(); mesh_entry["material"] = LL_MCODE_WOOD; - mesh_entry["group-id"] = gAgent.getGroupID(); LLPermissions perm; perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); perm.setCreator(gAgent.getID()); -- cgit v1.2.3 From 79131e8a480ab3611ce739717ed84c6ad76aa234 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 24 May 2011 16:07:19 -0400 Subject: separating meshes from instances --- indra/newview/llmeshrepository.cpp | 118 +++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 58 deletions(-) mode change 100644 => 100755 indra/newview/llmeshrepository.cpp diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp old mode 100644 new mode 100755 index 263d704231..2f5563e1a6 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1411,8 +1411,6 @@ void dumpLLSDToFile(const LLSD& content, std::string filename) void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { - // TODO where do textures go? - LLSD result; LLSD res; @@ -1422,88 +1420,94 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) result["name"] = "mesh model"; result["description"] = "your description here"; - // TODO "optional" fields from the spec - res["mesh_list"] = LLSD::emptyArray(); res["texture_list"] = LLSD::emptyArray(); + res["instance_list"] = LLSD::emptyArray(); S32 mesh_num = 0; S32 texture_num = 0; std::set textures; std::map texture_index; + std::map mesh_index; + + S32 instance_num = 0; + for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) { LLMeshUploadData data; data.mBaseModel = iter->first; LLModelInstance& instance = *(iter->second.begin()); LLModel* model = instance.mModel; - LLSD mesh_entry; - - std::string model_name = data.mBaseModel->getName(); - - if (!model_name.empty()) + if (mesh_index.find(model) == mesh_index.end()) { - result["name"] = model_name; - } + // Have not seen this model before - create a new mesh_list entry for it. + std::string model_name = data.mBaseModel->getName(); + if (!model_name.empty()) + { + result["name"] = model_name; + } + std::stringstream ostr; + + LLModel::Decomposition& decomp = + data.mModel[LLModel::LOD_PHYSICS].notNull() ? + data.mModel[LLModel::LOD_PHYSICS]->mPhysics : + data.mBaseModel->mPhysics; + + decomp.mBaseHull = mHullMap[data.mBaseModel]; + + LLSD mesh_header = LLModel::writeModel( + ostr, + data.mModel[LLModel::LOD_PHYSICS], + data.mModel[LLModel::LOD_HIGH], + data.mModel[LLModel::LOD_MEDIUM], + data.mModel[LLModel::LOD_LOW], + data.mModel[LLModel::LOD_IMPOSTOR], + decomp, + mUploadSkin, + mUploadJoints); + + data.mAssetData = ostr.str(); + std::string str = ostr.str(); + + res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end()); + mesh_index[model] = mesh_num; + mesh_num++; + } + + LLSD instance_entry; + for (S32 i = 0; i < 5; i++) { data.mModel[i] = instance.mLOD[i]; } - - mesh_entry["material"] = LL_MCODE_WOOD; + + LLVector3 pos, scale; + LLQuaternion rot; + LLMatrix4 transformation = instance.mTransform; + decomposeMeshMatrix(transformation,pos,rot,scale); + instance_entry["position"] = ll_sd_from_vector3(pos); + instance_entry["rotation"] = ll_sd_from_quaternion(rot); + instance_entry["scale"] = ll_sd_from_vector3(scale); + + instance_entry["material"] = LL_MCODE_WOOD; LLPermissions perm; perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); perm.setCreator(gAgent.getID()); - + perm.initMasks(PERM_ITEM_UNRESTRICTED | PERM_MOVE, //base PERM_ITEM_UNRESTRICTED | PERM_MOVE, //owner LLFloaterPerms::getEveryonePerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getNextOwnerPerms()); - mesh_entry["permissions"] = ll_create_sd_from_permissions(perm); - mesh_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); - - std::stringstream ostr; - - LLModel::Decomposition& decomp = - data.mModel[LLModel::LOD_PHYSICS].notNull() ? - data.mModel[LLModel::LOD_PHYSICS]->mPhysics : - data.mBaseModel->mPhysics; - - decomp.mBaseHull = mHullMap[data.mBaseModel]; - - LLSD mesh_header = LLModel::writeModel( - ostr, - data.mModel[LLModel::LOD_PHYSICS], - data.mModel[LLModel::LOD_HIGH], - data.mModel[LLModel::LOD_MEDIUM], - data.mModel[LLModel::LOD_LOW], - data.mModel[LLModel::LOD_IMPOSTOR], - decomp, - mUploadSkin, - mUploadJoints); - - data.mAssetData = ostr.str(); + instance_entry["permissions"] = ll_create_sd_from_permissions(perm); + instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); + instance_entry["mesh"] = mesh_index[model]; - LLVector3 pos, scale; - LLQuaternion rot; - LLMatrix4 transformation = instance.mTransform; - decomposeMeshMatrix(transformation,pos,rot,scale); - - mesh_entry["position"] = ll_sd_from_vector3(pos); - mesh_entry["rotation"] = ll_sd_from_quaternion(rot); - mesh_entry["scale"] = ll_sd_from_vector3(scale); - - // TODO should be binary. - std::string str = ostr.str(); - mesh_entry["mesh_data"] = LLSD::Binary(str.begin(),str.end()); - - // TODO how do textures in the list map to textures in the meshes? if (mUploadTextures) { - mesh_entry["face_list"] = LLSD::emptyArray(); + instance_entry["face_list"] = LLSD::emptyArray(); for (S32 face_num = 0; face_num < model->getNumVolumeFaces(); face_num++) { @@ -1553,14 +1557,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) face_entry["imagerot"] = 0.0; face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); face_entry["fullbright"] = material.mFullbright; - mesh_entry["face_list"][face_num] = face_entry; + instance_entry["face_list"][face_num] = face_entry; } - } - res["mesh_list"][mesh_num] = mesh_entry; - - mesh_num++; + res["instance_list"][instance_num] = instance_entry; + instance_num++; } result["asset_resources"] = res; -- cgit v1.2.3 From 4353eeb9288c95b98935e60928ec0b80de4e6145 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 24 May 2011 15:29:33 -0500 Subject: SH-469 GL_ARB_texture_multisample support --- indra/llrender/llimagegl.cpp | 7 +- indra/llrender/llimagegl.h | 2 +- indra/llrender/llrendertarget.cpp | 4 +- indra/llrender/llshadermgr.cpp | 6 + indra/llrender/llshadermgr.h | 3 + .../shaders/class1/deferred/blurLightF.glsl | 4 +- .../shaders/class1/deferred/blurLightMSF.glsl | 4 +- .../shaders/class1/deferred/multiPointLightF.glsl | 2 +- .../class1/deferred/multiPointLightMSF.glsl | 137 ++++++++++++ .../shaders/class1/deferred/multiSpotLightMSF.glsl | 233 ++++++++++++++++++++ .../shaders/class1/deferred/pointLightF.glsl | 2 +- .../shaders/class1/deferred/pointLightMSF.glsl | 96 ++++---- .../shaders/class1/deferred/pointLightV.glsl | 7 +- .../shaders/class1/deferred/postDeferredF.glsl | 2 +- .../shaders/class1/deferred/postDeferredMSF.glsl | 4 +- .../class1/deferred/postDeferredNoDoFMSF.glsl | 13 +- .../shaders/class1/deferred/softenLightF.glsl | 2 +- .../shaders/class1/deferred/softenLightMSF.glsl | 14 +- .../shaders/class1/deferred/spotLightMSF.glsl | 234 ++++++++++++++++++++ .../shaders/class1/deferred/starsF.glsl | 19 ++ .../shaders/class1/deferred/starsV.glsl | 17 ++ .../shaders/class1/deferred/sunLightSSAOF.glsl | 2 +- .../shaders/class1/deferred/sunLightSSAOMSF.glsl | 2 - .../shaders/class1/effects/glowExtractMSF.glsl | 38 ++++ .../shaders/class2/deferred/edgeF.glsl | 2 +- .../shaders/class2/deferred/edgeMSF.glsl | 16 +- .../shaders/class2/deferred/multiSpotLightF.glsl | 2 +- .../shaders/class2/deferred/multiSpotLightMSF.glsl | 244 ++++++++++++++++++++ .../shaders/class2/deferred/softenLightF.glsl | 52 +---- .../shaders/class2/deferred/softenLightMSF.glsl | 1 - .../shaders/class2/deferred/spotLightMSF.glsl | 245 +++++++++++++++++++++ .../shaders/class2/deferred/sunLightF.glsl | 2 +- .../shaders/class2/deferred/sunLightMSF.glsl | 202 +++++++++++++++++ .../shaders/class2/deferred/sunLightSSAOF.glsl | 2 +- .../shaders/class2/deferred/sunLightSSAOMSF.glsl | 241 ++++++++++++++++++++ indra/newview/lldrawpoolwlsky.cpp | 7 +- indra/newview/llviewercontrol.cpp | 17 +- indra/newview/llviewershadermgr.cpp | 83 ++++++- indra/newview/llviewershadermgr.h | 2 +- indra/newview/pipeline.cpp | 14 +- 40 files changed, 1827 insertions(+), 159 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/starsF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/starsV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 30b66ae542..3a4139bace 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1083,12 +1083,17 @@ void LLImageGL::generateTextures(S32 numTextures, U32 *textures) } // static -void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) +void LLImageGL::deleteTextures(S32 numTextures, U32 *textures, bool immediate) { for (S32 i = 0; i < numTextures; i++) { sDeadTextureList.push_back(textures[i]); } + + if (immediate) + { + LLImageGL::deleteDeadTextures(); + } } // static diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 6c980984c0..2cfb15b0d9 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -98,7 +98,7 @@ public: // These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D() // for tracking purposes and will be deprecated in the future static void generateTextures(S32 numTextures, U32 *textures); - static void deleteTextures(S32 numTextures, U32 *textures); + static void deleteTextures(S32 numTextures, U32 *textures, bool immediate = false); static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels); BOOL createGLTexture() ; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 64caf77b87..ddd6072fff 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -289,7 +289,7 @@ void LLRenderTarget::release() } else { - LLImageGL::deleteTextures(1, &mDepth); + LLImageGL::deleteTextures(1, &mDepth, true); stop_glerror(); } mDepth = 0; @@ -318,7 +318,7 @@ void LLRenderTarget::release() if (mTex.size() > 0) { - LLImageGL::deleteTextures(mTex.size(), &mTex[0]); + LLImageGL::deleteTextures(mTex.size(), &mTex[0], true); mTex.clear(); } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 98a0a93084..b8f9c60ca9 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -374,6 +374,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade GLcharARB* text[1024]; GLuint count = 0; + //copy preprocessor definitions into buffer + for (std::map::iterator iter = mDefinitions.begin(); iter != mDefinitions.end(); ++iter) + { + std::string define = "#define " + iter->first + " " + iter->second + "\n"; + text[count++] = (GLcharARB *) strdup(define.c_str()); + } //copy file into memory while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(buff) ) diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index c54c4608d7..9ee11b98c8 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -60,6 +60,9 @@ public: std::vector mReservedUniforms; + //preprocessor definitions (name/value) + std::map mDefinitions; + protected: // our parameter manager singleton instance diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index d9f021b114..98d034c2b5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -26,7 +26,7 @@ uniform vec2 screen_res; vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); @@ -39,7 +39,7 @@ vec4 getPosition(vec2 pos_screen) void main() { - vec2 tc = vary_fragcoord.xy; + vec2 tc = vary_fragcoord.xy; vec3 norm = texture2DRect(normalMap, tc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm vec3 pos = getPosition(tc).xyz; diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl index 113197c871..4366376d99 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl @@ -28,12 +28,12 @@ uniform vec2 screen_res; vec4 texture2DMS(sampler2DMS tex, ivec2 tc) { vec4 ret = vec4(0,0,0,0); - for (int i = 0; i < 4; i++) + for (int i = 0; i < samples; i++) { ret += texelFetch(tex, tc, i); } - return ret * 0.25; + return ret/samples; } vec4 getPosition(ivec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 609fc4f14f..e10fb105e8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -36,7 +36,7 @@ uniform mat4 inv_proj; vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl new file mode 100644 index 0000000000..16e97109f9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl @@ -0,0 +1,137 @@ +/** + * @file multiPointLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS depthMap; +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; + + +uniform vec3 env_mat[3]; +uniform float sun_wash; + +uniform int light_count; + +#define MAX_LIGHT_COUNT 16 +uniform vec4 light[MAX_LIGHT_COUNT]; +uniform vec4 light_col[MAX_LIGHT_COUNT]; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform float far_z; + +uniform mat4 inv_proj; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; + ivec2 itc = ivec2(frag); + + int wght = 0; + vec3 fcol = vec3(0,0,0); + + for (int s = 0; s < samples; ++s) + { + vec3 pos = getPosition(itc, s).xyz; + if (pos.z >= far_z) + { + vec3 norm = texelFetch(normalMap, itc, s).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + norm = normalize(norm); + vec4 spec = texelFetch(specularRect, itc, s); + vec3 diff = texelFetch(diffuseRect, itc, s).rgb; + float noise = texture2D(noiseMap, frag.xy/128.0).b; + vec3 out_col = vec3(0,0,0); + vec3 npos = normalize(-pos); + + // As of OSX 10.6.7 ATI Apple's crash when using a variable size loop + for (int i = 0; i < MAX_LIGHT_COUNT; ++i) + { + bool light_contrib = (i < light_count); + + vec3 lv = light[i].xyz-pos; + float dist2 = dot(lv,lv); + dist2 /= light[i].w; + if (dist2 > 1.0) + { + light_contrib = false; + } + + float da = dot(norm, lv); + if (da < 0.0) + { + light_contrib = false; + } + + if (light_contrib) + { + lv = normalize(lv); + da = dot(norm, lv); + + float fa = light_col[i].a+1.0; + float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + dist_atten *= noise; + + float lit = da * dist_atten; + + vec3 col = light_col[i].rgb*lit*diff; + //vec3 col = vec3(dist2, light_col[i].a, lit); + + if (spec.a > 0.0) + { + //vec3 ref = dot(pos+lv, norm); + + float sa = dot(normalize(lv+npos),norm); + + if (sa > 0.0) + { + sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); + sa *= noise; + col += da*sa*light_col[i].rgb*spec.rgb; + } + } + + out_col += col; + } + } + + fcol += out_col; + ++wght; + } + } + + if (wght <= 0) + { + discard; + } + + gl_FragColor.rgb = fcol/wght; + gl_FragColor.a = 0.0; + + +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl new file mode 100644 index 0000000000..bdaa8e59c4 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl @@ -0,0 +1,233 @@ +/** + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +//class 1 -- no shadows + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod; //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float det = max(1.0-lod/(proj_lod*0.5), 0.0); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + + return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); + + float det = min(lod/(proj_lod*0.5), 1.0); + + float d = min(dist.x, dist.y); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); + + return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); + + return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + int wght = 0; + + vec3 fcol = vec3(0,0,0); + + vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; + + ivec2 itc = ivec2(frag.xy); + + for (int i = 0; i < samples; ++i) + { + vec3 pos = getPosition(itc, i).xyz; + vec3 lv = vary_light.xyz-pos.xyz; + float dist2 = dot(lv,lv); + dist2 /= vary_light.w; + if (dist2 <= 1.0) + { + vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0; + + norm = normalize(norm); + float l_dist = -dot(lv, proj_n); + + vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); + if (proj_tc.z >= 0.0) + { + proj_tc.xyz /= proj_tc.w; + + float fa = gl_Color.a+1.0; + float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); + if (dist_atten > 0.0) + { + lv = proj_origin-pos.xyz; + lv = normalize(lv); + float da = dot(norm, lv); + + vec3 col = vec3(0,0,0); + + vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; + + float noise = texture2D(noiseMap, frag.xy/128.0).b; + if (proj_tc.z > 0.0 && + proj_tc.x < 1.0 && + proj_tc.y < 1.0 && + proj_tc.x > 0.0 && + proj_tc.y > 0.0) + { + float lit = 0.0; + float amb_da = proj_ambiance; + + if (da > 0.0) + { + float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); + float lod = diff * proj_lod; + + vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); + + vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + + lit = da * dist_atten * noise; + + col = lcol*lit*diff_tex; + amb_da += (da*0.5)*proj_ambiance; + } + + //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); + vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); + + amb_da += (da*da*0.5+0.5)*proj_ambiance; + + amb_da *= dist_atten * noise; + + amb_da = min(amb_da, 1.0-lit); + + col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + } + + + vec4 spec = texelFetch(specularRect, itc, i); + if (spec.a > 0.0) + { + vec3 ref = reflect(normalize(pos), norm); + + //project from point pos in direction ref to plane proj_p, proj_n + vec3 pdelta = proj_p-pos; + float ds = dot(ref, proj_n); + + if (ds < 0.0) + { + vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; + + vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + + if (stc.z > 0.0) + { + stc.xy /= stc.w; + + float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); + + stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + + if (stc.x < 1.0 && + stc.y < 1.0 && + stc.x > 0.0 && + stc.y > 0.0) + { + vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); + col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; + } + } + } + } + + fcol += col; + ++wght; + } + } + } + } + + if (wght <= 0) + { + discard; + } + + gl_FragColor.rgb = fcol/wght; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 22ed9dcd40..0d771109fb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -30,7 +30,7 @@ uniform vec4 viewport; vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = (pos_screen.xy-viewport.xy)*2.0; sc /= viewport.zw; sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl index 22ed9dcd40..23b5e76735 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl @@ -8,14 +8,15 @@ #version 120 #extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; -uniform sampler2DRect normalMap; -uniform samplerCube environmentMap; +uniform sampler2DMS depthMap; +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS normalMap; uniform sampler2D noiseMap; uniform sampler2D lightFunc; -uniform sampler2DRect depthMap; + uniform vec3 env_mat[3]; uniform float sun_wash; @@ -28,10 +29,10 @@ uniform vec2 screen_res; uniform mat4 inv_proj; uniform vec4 viewport; -vec4 getPosition(vec2 pos_screen) +vec4 getPosition(ivec2 pos_screen, int sample) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; - vec2 sc = (pos_screen.xy-viewport.xy)*2.0; + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = (vec2(pos_screen.xy)-viewport.xy)*2.0; sc /= viewport.zw; sc -= vec2(1.0,1.0); vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); @@ -48,53 +49,60 @@ void main() frag.xyz = frag.xyz*0.5+0.5; frag.xy *= screen_res; - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = vary_light.xyz-pos; - float dist2 = dot(lv,lv); - dist2 /= vary_light.w; - if (dist2 > 1.0) - { - discard; - } - - vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - float da = dot(norm, lv); - if (da < 0.0) + ivec2 itc = ivec2(frag.xy); + + int wght = 0; + vec3 fcol = vec3(0,0,0); + + for (int s = 0; s < samples; ++s) { - discard; - } - - norm = normalize(norm); - lv = normalize(lv); - da = dot(norm, lv); + vec3 pos = getPosition(itc, s).xyz; + vec3 lv = vary_light.xyz-pos; + float dist2 = dot(lv,lv); + dist2 /= vary_light.w; + if (dist2 <= 1.0) + { + vec3 norm = texelFetch(normalMap, itc, s).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + float da = dot(norm, lv); + if (da >= 0.0) + { + norm = normalize(norm); + lv = normalize(lv); + da = dot(norm, lv); - float noise = texture2D(noiseMap, frag.xy/128.0).b; + float noise = texture2D(noiseMap, frag.xy/128.0).b; - vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; - float fa = gl_Color.a+1.0; - float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - float lit = da * dist_atten * noise; + vec3 col = texelFetch(diffuseRect, itc, s).rgb; + float fa = gl_Color.a+1.0; + float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + float lit = da * dist_atten * noise; - col = gl_Color.rgb*lit*col; + col = gl_Color.rgb*lit*col; - vec4 spec = texture2DRect(specularRect, frag.xy); - if (spec.a > 0.0) - { - float sa = dot(normalize(lv-normalize(pos)),norm); - if (sa > 0.0) - { - sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); - sa *= noise; - col += da*sa*gl_Color.rgb*spec.rgb; + vec4 spec = texelFetch(specularRect, itc, s); + if (spec.a > 0.0) + { + float sa = dot(normalize(lv-normalize(pos)),norm); + if (sa > 0.0) + { + sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); + sa *= noise; + col += da*sa*gl_Color.rgb*spec.rgb; + } + } + + fcol += col; + ++wght; + } } } - if (dot(col, col) <= 0.0) + if (wght <= 0) { discard; } - gl_FragColor.rgb = col; + gl_FragColor.rgb = fcol/wght; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index 8e74feb615..2377947e7f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -10,14 +10,9 @@ varying vec4 vary_light; varying vec4 vary_fragcoord; -uniform vec2 screen_res; -uniform float near_clip; - void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; vary_fragcoord = pos; @@ -25,6 +20,8 @@ void main() tex.w = 1.0; vary_light = gl_MultiTexCoord0; + + gl_Position = pos; gl_FrontColor = gl_Color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 77f1b2224c..d389add03b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -29,7 +29,7 @@ varying vec2 vary_fragcoord; float getDepth(vec2 pos_screen) { - float z = texture2DRect(depthMap, pos_screen.xy).a; + float z = texture2DRect(depthMap, pos_screen.xy).r; z = z*2.0-1.0; vec4 ndc = vec4(0.0, 0.0, z, 1.0); vec4 p = inv_proj*ndc; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl index a34f882c39..711c6dc96d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl @@ -31,12 +31,12 @@ varying vec2 vary_fragcoord; vec4 texture2DMS(sampler2DMS tex, ivec2 tc) { vec4 ret = vec4(0,0,0,0); - for (int i = 0; i < 4; ++i) + for (int i = 0; i < samples; ++i) { ret += texelFetch(tex, tc, i); } - return ret * 0.25; + return ret/samples; } float getDepth(ivec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl index 7b14974f8b..359b26b7d4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl @@ -18,13 +18,14 @@ varying vec2 vary_fragcoord; vec4 texture2DMS(sampler2DMS tex, ivec2 tc) { - vec4 ret = texelFetch(tex,tc,0); - ret += texelFetch(tex,tc,1); - ret += texelFetch(tex,tc,2); - ret += texelFetch(tex,tc,3); - ret *= 0.25; + vec4 ret = vec4(0,0,0,0); - return ret; + for (int i = 0; i < samples; ++i) + { + ret += texelFetch(tex,tc,i); + } + + return ret/samples; } void main() diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 29340c7e9f..c1147feff6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -259,7 +259,7 @@ vec3 scaleSoftClip(vec3 light) void main() { vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).a; + float depth = texture2DRect(depthMap, tc.xy).r; vec3 pos = getPosition_d(tc, depth).xyz; vec3 norm = texture2DRect(normalMap, tc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl index 4c38d91499..fcba4f57e6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl @@ -251,18 +251,18 @@ vec3 scaleSoftClip(vec3 light) vec4 texture2DMS(sampler2DMS tex, ivec2 tc) { - vec4 ret = texelFetch(tex,tc,0); - ret += texelFetch(tex,tc,1); - ret += texelFetch(tex,tc,2); - ret += texelFetch(tex,tc,3); - ret *= 0.25; + vec4 ret = vec4(0,0,0,0); - return ret; + for (int i = 0; i < samples; ++i) + { + ret += texelFetch(tex,tc,i); + } + + return ret/samples; } void main() { - int samples = 4; vec2 tc = vary_fragcoord.xy; ivec2 itc = ivec2(tc); diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl new file mode 100644 index 0000000000..3a9d9266bb --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl @@ -0,0 +1,234 @@ +/** + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +//class 1 -- no shadows + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod; //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float det = max(1.0-lod/(proj_lod*0.5), 0.0); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + + return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); + + float det = min(lod/(proj_lod*0.5), 1.0); + + float d = min(dist.x, dist.y); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); + + return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); + + return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec4 frag = vary_fragcoord; + frag.xyz /= frag.w; + frag.xyz = frag.xyz*0.5+0.5; + frag.xy *= screen_res; + ivec2 itc = ivec2(frag.xy); + + vec3 fcol = vec3(0,0,0); + int wght = 0; + + for (int i = 0; i < samples; ++i) + { + vec3 pos = getPosition(itc, i).xyz; + vec3 lv = vary_light.xyz-pos.xyz; + float dist2 = dot(lv,lv); + dist2 /= vary_light.w; + if (dist2 <= 1.0) + { + vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0; + + norm = normalize(norm); + float l_dist = -dot(lv, proj_n); + + vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); + if (proj_tc.z >= 0.0) + { + proj_tc.xyz /= proj_tc.w; + + float fa = gl_Color.a+1.0; + float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); + if (dist_atten > 0.0) + { + lv = proj_origin-pos.xyz; + lv = normalize(lv); + float da = dot(norm, lv); + + vec3 col = vec3(0,0,0); + + vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; + + float noise = texture2D(noiseMap, frag.xy/128.0).b; + if (proj_tc.z > 0.0 && + proj_tc.x < 1.0 && + proj_tc.y < 1.0 && + proj_tc.x > 0.0 && + proj_tc.y > 0.0) + { + float lit = 0.0; + float amb_da = proj_ambiance; + + if (da > 0.0) + { + float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); + float lod = diff * proj_lod; + + vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); + + vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + + lit = da * dist_atten * noise; + + col = lcol*lit*diff_tex; + amb_da += (da*0.5)*proj_ambiance; + } + + //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); + vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); + + amb_da += (da*da*0.5+0.5)*proj_ambiance; + + amb_da *= dist_atten * noise; + + amb_da = min(amb_da, 1.0-lit); + + col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + } + + + vec4 spec = texelFetch(specularRect, itc, i); + if (spec.a > 0.0) + { + vec3 ref = reflect(normalize(pos), norm); + + //project from point pos in direction ref to plane proj_p, proj_n + vec3 pdelta = proj_p-pos; + float ds = dot(ref, proj_n); + + if (ds < 0.0) + { + vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; + + vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + + if (stc.z > 0.0) + { + stc.xy /= stc.w; + + float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); + + stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + + if (stc.x < 1.0 && + stc.y < 1.0 && + stc.x > 0.0 && + stc.y > 0.0) + { + vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); + col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; + } + } + } + } + + fcol += col; + ++wght; + } + } + } + } + + if (wght <= 0) + { + discard; + } + + gl_FragColor.rgb = fcol/wght; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl new file mode 100644 index 0000000000..b1c25b7fd3 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -0,0 +1,19 @@ +/** + * @file starsF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +uniform sampler2D diffuseMap; + +void main() +{ + vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); + + gl_FragData[0] = col; + gl_FragData[1] = vec4(0,0,0,0); + gl_FragData[2] = vec4(0,0,1,0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl new file mode 100644 index 0000000000..1f0376ce6b --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -0,0 +1,17 @@ +/** + * @file starsV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + + +void main() +{ + //transform vertex + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index cd91351ad4..d1e8359742 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -35,7 +35,7 @@ uniform float shadow_offset; vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl index 49b45dedd6..ce0ebc54f8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl @@ -101,8 +101,6 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample) void main() { - int samples = 4; - vec2 pos_screen = vary_fragcoord.xy; ivec2 itc = ivec2(pos_screen); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl new file mode 100644 index 0000000000..c03a0c61bd --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl @@ -0,0 +1,38 @@ +/** + * @file glowExtractF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseMap; +uniform float minLuminance; +uniform float maxExtractAlpha; +uniform vec3 lumWeights; +uniform vec3 warmthWeights; +uniform float warmthAmount; + +void main() +{ + ivec2 itc = ivec2(gl_TexCoord[0].xy); + vec4 fcol = vec4(0,0,0,0); + + for (int i = 0; i < samples; i++) + { + vec4 col = texelFetch(diffuseMap, itc, i); + + /// CALCULATING LUMINANCE (Using NTSC lum weights) + /// http://en.wikipedia.org/wiki/Luma_%28video%29 + float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) ); + float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) ); + + fcol += vec4(col.rgb, max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha)); + } + + gl_FragColor = fcol/samples; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl index 3155f3f929..30e1702e9f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl @@ -22,7 +22,7 @@ uniform vec2 screen_res; float getDepth(vec2 pos_screen) { - float z = texture2DRect(depthMap, pos_screen.xy).a; + float z = texture2DRect(depthMap, pos_screen.xy).r; z = z*2.0-1.0; vec4 ndc = vec4(0.0, 0.0, z, 1.0); vec4 p = inv_proj*ndc; diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl index a47ee678f6..38100d1523 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl @@ -21,8 +21,9 @@ uniform float norm_cutoff; uniform mat4 inv_proj; uniform vec2 screen_res; -float getDepth(float z) +float getDepth(ivec2 pos_screen, int sample) { + float z = texelFetch(depthMap, pos_screen, sample).r; z = z*2.0-1.0; vec4 ndc = vec4(0.0, 0.0, z, 1.0); vec4 p = inv_proj*ndc; @@ -31,7 +32,6 @@ float getDepth(float z) void main() { - float e = 0; ivec2 itc = ivec2(vary_fragcoord.xy); @@ -40,24 +40,24 @@ void main() { vec3 norm = texelFetch(normalMap, itc, i).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - float depth = getDepth(texelFetch(depthMap, itc, i).r); + float depth = getDepth(itc, i); vec2 tc = vary_fragcoord.xy; - float sc = 0.75; + int sc = 1; vec2 de; - de.x = (depth-getDepth(tc+vec2(sc, sc))) + (depth-getDepth(tc+vec2(-sc, -sc))); - de.y = (depth-getDepth(tc+vec2(-sc, sc))) + (depth-getDepth(tc+vec2(sc, -sc))); + de.x = (depth-getDepth(itc+ivec2(sc, sc),i)) + (depth-getDepth(itc+ivec2(-sc, -sc), i)); + de.y = (depth-getDepth(itc+ivec2(-sc, sc),i)) + (depth-getDepth(itc+ivec2(sc, -sc), i)); de /= depth; de *= de; de = step(depth_cutoff, de); vec2 ne; - vec3 nexnorm = texture2DRect(normalMap, tc+vec2(-sc,-sc)).rgb; + vec3 nexnorm = texelFetch(normalMap, itc+ivec2(-sc,-sc), i).rgb; nexnorm = vec3((nexnorm.xy-0.5)*2.0,nexnorm.z); // unpack norm ne.x = dot(nexnorm, norm); - vec3 neynorm = texture2DRect(normalMap, tc+vec2(sc,sc)).rgb; + vec3 neynorm = texelFetch(normalMap, itc+ivec2(sc,sc), i).rgb; neynorm = vec3((neynorm.xy-0.5)*2.0,neynorm.z); // unpack norm ne.y = dot(neynorm, norm); diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index d6cd984ebe..de987b1233 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -91,7 +91,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl new file mode 100644 index 0000000000..c6f0ea2a5d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl @@ -0,0 +1,244 @@ +/** + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DMS lightMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod; //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float det = max(1.0-lod/(proj_lod*0.5), 0.0); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + + return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); + + float det = min(lod/(proj_lod*0.5), 1.0); + + float d = min(dist.x, dist.y); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); + + return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); + + return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + int wght = 0; + + vec3 fcol = vec3(0,0,0); + + vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; + + ivec2 itc = ivec2(frag.xy); + + for (int i = 0; i < samples; i++) + { + vec3 pos = getPosition(itc, i).xyz; + vec3 lv = vary_light.xyz-pos.xyz; + float dist2 = dot(lv,lv); + dist2 /= vary_light.w; + if (dist2 <= 1.0) + { + float shadow = 1.0; + + if (proj_shadow_idx >= 0) + { + vec4 shd = texelFetch(lightMap, itc, i); + float sh[2]; + sh[0] = shd.b; + sh[1] = shd.a; + shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); + } + + vec3 norm = texelFetch(normalMap, itc, i).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + + norm = normalize(norm); + float l_dist = -dot(lv, proj_n); + + vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); + if (proj_tc.z >= 0.0) + { + proj_tc.xyz /= proj_tc.w; + + float fa = gl_Color.a+1.0; + float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); + if (dist_atten > 0.0) + { + lv = proj_origin-pos.xyz; + lv = normalize(lv); + float da = dot(norm, lv); + + vec3 col = vec3(0,0,0); + + vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; + + float noise = texture2D(noiseMap, frag.xy/128.0).b; + if (proj_tc.z > 0.0 && + proj_tc.x < 1.0 && + proj_tc.y < 1.0 && + proj_tc.x > 0.0 && + proj_tc.y > 0.0) + { + float lit = 0.0; + float amb_da = proj_ambiance; + + if (da > 0.0) + { + float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); + float lod = diff * proj_lod; + + vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); + + vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + + lit = da * dist_atten * noise; + + col = lcol*lit*diff_tex*shadow; + amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; + } + + //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); + vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); + + amb_da += (da*da*0.5+0.5)*proj_ambiance; + + amb_da *= dist_atten * noise; + + amb_da = min(amb_da, 1.0-lit); + + col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + } + + + vec4 spec = texelFetch(specularRect, itc, i); + if (spec.a > 0.0) + { + vec3 ref = reflect(normalize(pos), norm); + + //project from point pos in direction ref to plane proj_p, proj_n + vec3 pdelta = proj_p-pos; + float ds = dot(ref, proj_n); + + if (ds < 0.0) + { + vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; + + vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + + if (stc.z > 0.0) + { + stc.xy /= stc.w; + + float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); + + stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + + if (stc.x < 1.0 && + stc.y < 1.0 && + stc.x > 0.0 && + stc.y > 0.0) + { + vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); + col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; + } + } + } + } + + fcol += col; + wght++; + } + } + } + } + + if (wght <= 0) + { + discard; + } + + gl_FragColor.rgb = fcol/wght; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 0160e84278..dfa1964142 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -71,7 +71,7 @@ vec4 getPosition_d(vec2 pos_screen, float depth) vec4 getPosition(vec2 pos_screen) { //get position in screen space (world units) given window coordinate and depth map - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; return getPosition_d(pos_screen, depth); } @@ -258,7 +258,7 @@ vec3 scaleSoftClip(vec3 light) void main() { vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).a; + float depth = texture2DRect(depthMap, tc.xy).r; vec3 pos = getPosition_d(tc, depth).xyz; vec3 norm = texture2DRect(normalMap, tc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm @@ -288,54 +288,8 @@ void main() float sa = dot(refnormpersp, vary_light.xyz); vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; - /* - // screen-space cheap fakey reflection map - // - vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz)); - depth -= 0.5; // unbias depth - // first figure out where we'll make our 2D guess from - vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth; - // Offset the guess source a little according to a trivial - // checkerboard dither function and spec.a. - // This is meant to be similar to sampling a blurred version - // of the diffuse map. LOD would be better in that regard. - // The goal of the blur is to soften reflections in surfaces - // with low shinyness, and also to disguise our lameness. - float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0 - float checkoffset = (3.0 + (7.0*(1.0-spec.a)))*(checkerboard-0.5); - ref2d += vec2(checkoffset, checkoffset); - ref2d += tc.xy; // use as offset from destination - // Get attributes from the 2D guess point. - // We average two samples of diffuse (not of anything else) per - // pixel to try to reduce aliasing some more. - vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d + vec2(0.0, -checkoffset)).rgb + - texture2DRect(diffuseRect, ref2d + vec2(-checkoffset, 0.0)).rgb); - float refdepth = texture2DRect(depthMap, ref2d).a; - vec3 refpos = getPosition_d(ref2d, refdepth).xyz; - float refshad = texture2DRect(lightMap, ref2d).r; - vec3 refn = texture2DRect(normalMap, ref2d).rgb; - refn = vec3((refn.xy-0.5)*2.0,refn.z); // unpack norm - refn = normalize(refn); - // figure out how appropriate our guess actually was - float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos))); - // darken reflections from points which face away from the reflected ray - our guess was a back-face - //refapprop *= step(dot(refnorm, refn), 0.0); - refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant - // get appropriate light strength for guess-point - // reflect light direction to increase the illusion that - // these are reflections. - vec3 reflight = reflect(lightnorm.xyz, norm.xyz); - float reflit = min(max(dot(refn, reflight.xyz), 0.0), refshad); - // apply sun color to guess-point, dampen according to inappropriateness of guess - float refmod = min(refapprop, reflit); - vec3 refprod = vary_SunlitColor * refcol.rgb * refmod; - vec3 ssshiny = (refprod * spec.a); - ssshiny *= 0.3; // dampen it even more - */ - vec3 ssshiny = vec3(0,0,0); - // add the two types of shiny together - col += (ssshiny + dumbshiny) * spec.rgb; + col += dumbshiny * spec.rgb; } col = atmosLighting(col); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl index 7d4548d6d9..71482d0c7b 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -252,7 +252,6 @@ vec3 scaleSoftClip(vec3 light) void main() { - int samples = 4; vec2 tc = vary_fragcoord.xy; ivec2 itc = ivec2(tc); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl new file mode 100644 index 0000000000..099a45718a --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl @@ -0,0 +1,245 @@ +/** + * @file multiSpotLightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS diffuseRect; +uniform sampler2DMS specularRect; +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DMS lightMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; +uniform sampler2D projectionMap; + +uniform mat4 proj_mat; //screen space to light space +uniform float proj_near; //near clip for projection +uniform vec3 proj_p; //plane projection is emitting from (in screen space) +uniform vec3 proj_n; +uniform float proj_focus; //distance from plane to begin blurring +uniform float proj_lod; //(number of mips in proj map) +uniform float proj_range; //range between near clip and far clip plane of projection +uniform float proj_ambient_lod; +uniform float proj_ambiance; +uniform float near_clip; +uniform float far_clip; + +uniform vec3 proj_origin; //origin of projection to be used for angular attenuation +uniform float sun_wash; +uniform int proj_shadow_idx; +uniform float shadow_fade; + +varying vec4 vary_light; + +varying vec4 vary_fragcoord; +uniform vec2 screen_res; + +uniform mat4 inv_proj; + +vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float det = max(1.0-lod/(proj_lod*0.5), 0.0); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + + return ret; +} + +vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); + + float det = min(lod/(proj_lod*0.5), 1.0); + + float d = min(dist.x, dist.y); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); + + return ret; +} + +vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) +{ + vec4 ret = texture2DLod(projectionMap, tc, lod); + + vec2 dist = tc-vec2(0.5); + + float d = dot(dist,dist); + + ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); + + return ret; +} + + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec4 frag = vary_fragcoord; + frag.xyz /= frag.w; + frag.xyz = frag.xyz*0.5+0.5; + frag.xy *= screen_res; + ivec2 itc = ivec2(frag.xy); + + vec3 fcol = vec3(0,0,0); + int wght = 0; + + for (int i = 0; i < samples; i++) + { + vec3 pos = getPosition(itc, i).xyz; + vec3 lv = vary_light.xyz-pos.xyz; + float dist2 = dot(lv,lv); + dist2 /= vary_light.w; + if (dist2 <= 1.0) + { + float shadow = 1.0; + + if (proj_shadow_idx >= 0) + { + vec4 shd = texelFetch(lightMap, itc, i); + float sh[2]; + sh[0] = shd.b; + sh[1] = shd.a; + shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); + } + + vec3 norm = texelFetch(normalMap, itc, i).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + + norm = normalize(norm); + float l_dist = -dot(lv, proj_n); + + vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); + if (proj_tc.z >= 0.0) + { + proj_tc.xyz /= proj_tc.w; + + float fa = gl_Color.a+1.0; + float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); + if (dist_atten > 0.0) + { + lv = proj_origin-pos.xyz; + lv = normalize(lv); + float da = dot(norm, lv); + + vec3 col = vec3(0,0,0); + + vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; + + float noise = texture2D(noiseMap, frag.xy/128.0).b; + if (proj_tc.z > 0.0 && + proj_tc.x < 1.0 && + proj_tc.y < 1.0 && + proj_tc.x > 0.0 && + proj_tc.y > 0.0) + { + float lit = 0.0; + float amb_da = proj_ambiance; + + if (da > 0.0) + { + float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); + float lod = diff * proj_lod; + + vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); + + vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + + lit = da * dist_atten * noise; + + col = lcol*lit*diff_tex*shadow; + amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; + } + + //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); + vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); + + amb_da += (da*da*0.5+0.5)*proj_ambiance; + + amb_da *= dist_atten * noise; + + amb_da = min(amb_da, 1.0-lit); + + col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + } + + + vec4 spec = texelFetch(specularRect, itc, i); + if (spec.a > 0.0) + { + vec3 ref = reflect(normalize(pos), norm); + + //project from point pos in direction ref to plane proj_p, proj_n + vec3 pdelta = proj_p-pos; + float ds = dot(ref, proj_n); + + if (ds < 0.0) + { + vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; + + vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); + + if (stc.z > 0.0) + { + stc.xy /= stc.w; + + float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); + + stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + + if (stc.x < 1.0 && + stc.y < 1.0 && + stc.x > 0.0 && + stc.y > 0.0) + { + vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); + col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; + } + } + } + } + + fcol += col; + wght++; + } + } + } + } + + if (wght <= 0) + { + discard; + } + + gl_FragColor.rgb = fcol/wght; + gl_FragColor.a = 0.0; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 4369b3b34f..b724c134b9 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -45,7 +45,7 @@ uniform float spot_shadow_offset; vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl new file mode 100644 index 0000000000..dd6fa958c9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl @@ -0,0 +1,202 @@ +/** + * @file sunLightMSF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +//class 2, shadows, no SSAO + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRectShadow shadowMap0; +uniform sampler2DRectShadow shadowMap1; +uniform sampler2DRectShadow shadowMap2; +uniform sampler2DRectShadow shadowMap3; +uniform sampler2DShadow shadowMap4; +uniform sampler2DShadow shadowMap5; + + +// Inputs +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform float ssao_radius; +uniform float ssao_max_radius; +uniform float ssao_factor; +uniform float ssao_factor_inv; + +varying vec2 vary_fragcoord; +varying vec4 vary_light; + +uniform mat4 inv_proj; +uniform vec2 screen_res; +uniform vec2 shadow_res; +uniform vec2 proj_shadow_res; + +uniform float shadow_bias; +uniform float shadow_offset; + +uniform float spot_shadow_bias; +uniform float spot_shadow_offset; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen.xy, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) +{ + stc.xyz /= stc.w; + stc.z += shadow_bias*scl; + + float cs = shadow2DRect(shadowMap, stc.xyz).x; + float shadow = cs; + + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs); + + return shadow/5.0; + + //return shadow; +} + +float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) +{ + stc.xyz /= stc.w; + stc.z += spot_shadow_bias*scl; + + float cs = shadow2D(shadowMap, stc.xyz).x; + float shadow = cs; + + vec2 off = 1.5/proj_shadow_res; + + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); + + return shadow/5.0; + + //return shadow; +} + +void main() +{ + vec2 pos_screen = vary_fragcoord.xy; + ivec2 itc = ivec2(pos_screen); + + //try doing an unproject here + + vec4 fcol = vec4(0,0,0,0); + + for (int i = 0; i < samples; i++) + { + vec4 pos = getPosition(itc, i); + + vec4 nmap4 = texelFetch(normalMap, itc, i); + nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm + float displace = nmap4.w; + vec3 norm = nmap4.xyz; + + /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL + { + gl_FragColor = vec4(0.0); // doesn't matter + return; + }*/ + + float shadow = 1.0; + float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); + + vec3 shadow_pos = pos.xyz + displace*norm; + vec3 offset = vary_light.xyz * (1.0-dp_directional_light); + + vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); + + if (spos.z > -shadow_clip.w) + { + if (dp_directional_light == 0.0) + { + // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup + shadow = 0.0; + } + else + { + vec4 lpos; + + if (spos.z < -shadow_clip.z) + { + lpos = shadow_matrix[3]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap3, lpos, 0.25); + shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); + } + else if (spos.z < -shadow_clip.y) + { + lpos = shadow_matrix[2]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap2, lpos, 0.5); + } + else if (spos.z < -shadow_clip.x) + { + lpos = shadow_matrix[1]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap1, lpos, 0.75); + } + else + { + lpos = shadow_matrix[0]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap0, lpos, 1.0); + } + + // take the most-shadowed value out of these two: + // * the blurred sun shadow in the light (shadow) map + // * an unblurred dot product between the sun and this norm + // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting + shadow = min(shadow, dp_directional_light); + + //lpos.xy /= lpos.w*32.0; + //if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1) + //{ + // shadow = 0.0; + //} + + } + } + else + { + // more distant than the shadow map covers + shadow = 1.0; + } + + fcol[0] += shadow; + fcol[1] += 1.0; + + spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0); + + //spotlight shadow 1 + vec4 lpos = shadow_matrix[4]*spos; + fcol[2] += pcfShadow(shadowMap4, lpos, 0.8); + + //spotlight shadow 2 + lpos = shadow_matrix[5]*spos; + fcol[3] += pcfShadow(shadowMap5, lpos, 0.8); + } + + gl_FragColor = fcol/samples; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 847b36b1ac..68e18162f6 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -45,7 +45,7 @@ uniform float spot_shadow_offset; vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl new file mode 100644 index 0000000000..d28741f945 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl @@ -0,0 +1,241 @@ +/** + * @file sunLightSSAOF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#version 120 + +#extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_texture_multisample : enable + +//class 2 -- shadows and SSAO + +uniform sampler2DMS depthMap; +uniform sampler2DMS normalMap; +uniform sampler2DRectShadow shadowMap0; +uniform sampler2DRectShadow shadowMap1; +uniform sampler2DRectShadow shadowMap2; +uniform sampler2DRectShadow shadowMap3; +uniform sampler2DShadow shadowMap4; +uniform sampler2DShadow shadowMap5; +uniform sampler2D noiseMap; + +// Inputs +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform float ssao_radius; +uniform float ssao_max_radius; +uniform float ssao_factor; +uniform float ssao_factor_inv; + +varying vec2 vary_fragcoord; +varying vec4 vary_light; + +uniform mat4 inv_proj; +uniform vec2 screen_res; +uniform vec2 shadow_res; +uniform vec2 proj_shadow_res; + +uniform float shadow_bias; +uniform float shadow_offset; + +uniform float spot_shadow_bias; +uniform float spot_shadow_offset; + +vec4 getPosition(ivec2 pos_screen, int sample) +{ + float depth = texelFetch(depthMap, pos_screen, sample).r; + vec2 sc = vec2(pos_screen.xy)*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +//calculate decreases in ambient lighting when crowded out (SSAO) +float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample) +{ + float ret = 1.0; + + vec2 kern[8]; + // exponentially (^2) distant occlusion samples spread around origin + kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; + kern[1] = vec2(1.0, 0.0) * 0.250*0.250; + kern[2] = vec2(0.0, 1.0) * 0.375*0.375; + kern[3] = vec2(0.0, -1.0) * 0.500*0.500; + kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; + kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; + kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; + kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + + vec2 pos_screen = vary_fragcoord.xy; + vec3 pos_world = pos.xyz; + vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; + + float angle_hidden = 0.0; + int points = 0; + + float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); + + // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) + for (int i = 0; i < 8; i++) + { + ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect)); + vec3 samppos_world = getPosition(samppos_screen, sample).xyz; + + vec3 diff = pos_world - samppos_world; + float dist2 = dot(diff, diff); + + // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area + // --> solid angle shrinking by the square of distance + //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 + //(k should vary inversely with # of samples, but this is taken care of later) + + angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); + + // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" + points = points + int(diff.z > -1.0); + } + + angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); + + ret = (1.0 - (float(points != 0) * angle_hidden)); + + return min(ret, 1.0); +} + +float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) +{ + stc.xyz /= stc.w; + stc.z += shadow_bias*scl; + + float cs = shadow2DRect(shadowMap, stc.xyz).x; + float shadow = cs; + + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs); + + return shadow/5.0; + + //return shadow; +} + +float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) +{ + stc.xyz /= stc.w; + stc.z += spot_shadow_bias*scl; + + float cs = shadow2D(shadowMap, stc.xyz).x; + float shadow = cs; + + vec2 off = 1.5/proj_shadow_res; + + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); + + + return shadow/5.0; + + //return shadow; +} + +void main() +{ + vec2 pos_screen = vary_fragcoord.xy; + ivec2 itc = ivec2(pos_screen); + vec4 fcol = vec4(0,0,0,0); + + for (int i = 0; i < samples; i++) + { + vec4 pos = getPosition(itc, i); + + vec4 nmap4 = texelFetch(normalMap, itc, i); + nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm + float displace = nmap4.w; + vec3 norm = nmap4.xyz; + + float shadow = 1.0; + float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); + + vec3 shadow_pos = pos.xyz + displace*norm; + vec3 offset = vary_light.xyz * (1.0-dp_directional_light); + + vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); + + if (spos.z > -shadow_clip.w) + { + if (dp_directional_light == 0.0) + { + // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup + shadow = 0.0; + } + else + { + vec4 lpos; + + if (spos.z < -shadow_clip.z) + { + lpos = shadow_matrix[3]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap3, lpos, 0.25); + shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); + } + else if (spos.z < -shadow_clip.y) + { + lpos = shadow_matrix[2]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap2, lpos, 0.5); + } + else if (spos.z < -shadow_clip.x) + { + lpos = shadow_matrix[1]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap1, lpos, 0.75); + } + else + { + lpos = shadow_matrix[0]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap0, lpos, 1.0); + } + + // take the most-shadowed value out of these two: + // * the blurred sun shadow in the light (shadow) map + // * an unblurred dot product between the sun and this norm + // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting + shadow = min(shadow, dp_directional_light); + + } + } + else + { + // more distant than the shadow map covers + shadow = 1.0; + } + + + fcol[0] += shadow; + fcol[1] += calcAmbientOcclusion(pos, norm, i); + + spos.xyz = shadow_pos+offset*spot_shadow_offset; + + //spotlight shadow 1 + vec4 lpos = shadow_matrix[4]*spos; + fcol[2] += pcfShadow(shadowMap4, lpos, 0.8); + + //spotlight shadow 2 + lpos = shadow_matrix[5]*spos; + fcol[3] += pcfShadow(shadowMap5, lpos, 0.8); + } + + gl_FragColor = fcol / samples; +} diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 66b834ab11..409b18d522 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -278,11 +278,13 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) renderSkyHaze(camHeightLocal); - /*LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); glPushMatrix(); + glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); + gDeferredStarProgram.bind(); // *NOTE: have to bind a texture here since register combiners blending in // renderStars() requires something to be bound and we might as well only // bind the moon's texture once. @@ -292,8 +294,9 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) renderStars(); + gDeferredStarProgram.unbind(); - glPopMatrix();*/ + glPopMatrix(); renderSkyClouds(camHeightLocal); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 379bbe614d..00a0b87d93 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -183,6 +183,21 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue) return true; } +static bool handleFSAASamplesChanged(const LLSD& newvalue) +{ + if (gPipeline.isInit()) + { + gPipeline.releaseGLBuffers(); + gPipeline.createGLBuffers(); + + if (LLPipeline::sRenderDeferred) + { + LLViewerShaderMgr::instance()->setShaders(); + } + } + return true; +} + static bool handleAnisotropicChanged(const LLSD& newvalue) { LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean(); @@ -568,7 +583,7 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); - gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleFSAASamplesChanged, _2)); gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2)); gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 84fb1eb5d0..911a8bb65f 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -140,6 +140,7 @@ LLGLSLShader gDeferredPostProgram; LLGLSLShader gDeferredPostNoDoFProgram; LLGLSLShader gDeferredWLSkyProgram; LLGLSLShader gDeferredWLCloudProgram; +LLGLSLShader gDeferredStarProgram; LLGLSLShader gLuminanceGatherProgram; @@ -193,6 +194,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredAvatarAlphaProgram); mShaderList.push_back(&gDeferredWLSkyProgram); mShaderList.push_back(&gDeferredWLCloudProgram); + mShaderList.push_back(&gDeferredStarProgram); } LLViewerShaderMgr::~LLViewerShaderMgr() @@ -350,6 +352,9 @@ void LLViewerShaderMgr::setShaders() return; } + //setup preprocessor definitions + LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples")); + reentrance = true; // Make sure the compiled shader map is cleared before we recompile shaders. @@ -836,6 +841,8 @@ BOOL LLViewerShaderMgr::loadShadersEffects() { BOOL success = TRUE; + bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 0 && gGLManager.mHasTextureMultisample; + if (mVertexShaderLevel[SHADER_EFFECT] == 0) { gGlowProgram.unload(); @@ -861,10 +868,21 @@ BOOL LLViewerShaderMgr::loadShadersEffects() if (success) { + std::string fragment; + + if (gSavedSettings.getU32("RenderFSAASamples") > 0 && LLRenderTarget::sUseFBO && gGLManager.mHasTextureMultisample) + { + fragment = "effects/glowExtractMSF.glsl"; + } + else + { + fragment = "effects/glowExtractF.glsl"; + } + gGlowExtractProgram.mName = "Glow Extract Shader (Post)"; gGlowExtractProgram.mShaderFiles.clear(); gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER_ARB)); - gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER_ARB)); + gGlowExtractProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gGlowExtractProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; success = gGlowExtractProgram.createShader(NULL, &mGlowExtractUniforms); if (!success) @@ -957,6 +975,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWaterProgram.unload(); gDeferredWLSkyProgram.unload(); gDeferredWLCloudProgram.unload(); + gDeferredStarProgram.unload(); return TRUE; } @@ -1046,40 +1065,83 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { + std::string fragment; + + if (multisample) + { + fragment = "deferred/pointLightMSF.glsl"; + } + else + { + fragment = "deferred/pointLightF.glsl"; + } + gDeferredLightProgram.mName = "Deferred Light Shader"; gDeferredLightProgram.mShaderFiles.clear(); gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredLightProgram.createShader(NULL, NULL); } if (success) { + std::string fragment; + if (multisample) + { + fragment = "deferred/multiPointLightMSF.glsl"; + } + else + { + fragment = "deferred/multiPointLightF.glsl"; + } + gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader"; gDeferredMultiLightProgram.mShaderFiles.clear(); gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredMultiLightProgram.createShader(NULL, NULL); } if (success) { + std::string fragment; + + if (multisample) + { + fragment = "deferred/spotLightMSF.glsl"; + } + else + { + fragment = "deferred/multiSpotLightF.glsl"; + } + gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader"; gDeferredSpotLightProgram.mShaderFiles.clear(); gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredSpotLightProgram.createShader(NULL, NULL); } if (success) { + std::string fragment; + + if (multisample) + { + fragment = "deferred/multiSpotLightMSF.glsl"; + } + else + { + fragment = "deferred/multiSpotLightF.glsl"; + } + gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader"; gDeferredMultiSpotLightProgram.mShaderFiles.clear(); gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL); } @@ -1343,6 +1405,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = gDeferredWLCloudProgram.createShader(NULL, &mWLUniforms); } + if (success) + { + gDeferredStarProgram.mName = "Deferred Star Program"; + gDeferredStarProgram.mShaderFiles.clear(); + gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredStarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY; + success = gDeferredStarProgram.createShader(NULL, &mWLUniforms); + } + if (mVertexShaderLevel[SHADER_DEFERRED] > 1) { if (success) diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index b13775742b..f5371f0619 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -376,7 +376,7 @@ extern LLGLSLShader gDeferredFullbrightProgram; extern LLGLSLShader gDeferredAvatarAlphaProgram; extern LLGLSLShader gDeferredWLSkyProgram; extern LLGLSLShader gDeferredWLCloudProgram; - +extern LLGLSLShader gDeferredStarProgram; extern LLGLSLShader gLuminanceGatherProgram; //current avatar shader parameter pointer diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ef3cbe5278..ffe3b4b1a4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -589,8 +589,8 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) mScreenWidth = resX; mScreenHeight = resY; - //never use more than 4 samples for render targets - U32 samples = llmin(gSavedSettings.getU32("RenderFSAASamples"), (U32) 4); + U32 samples = llmin(gSavedSettings.getU32("RenderFSAASamples"), (U32) 16); + if (gGLManager.mIsATI) { //disable multisampling of render targets where ATI is involved samples = 0; @@ -6170,11 +6170,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->disable(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); - gGL.getTexUnit(0)->bind(&mScreen); - + mScreen.bindTexture(0, 0); + gGL.color4f(1,1,1,1); gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); gGL.begin(LLRender::TRIANGLE_STRIP); @@ -6189,7 +6186,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.end(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->unbind(mScreen.getUsage()); mGlow[2].flush(); } @@ -6217,7 +6214,6 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) for (S32 i = 0; i < kernel; i++) { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); { LLFastTimer ftm(FTM_RENDER_BLOOM_FBO); mGlow[i%2].bindTarget(); -- cgit v1.2.3 From f5726a094db77ec4fbba67e33d436cba8bf60a4b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 24 May 2011 17:36:06 -0600 Subject: fix for SH-712:Asset error given on upload of duck.dae using High LOD for physics shape - Analyze seems to not complete; SH-889: Viewer crash when analyzing physics LOD; SH-890: Viewer crash on Exit after analyzing physics layer which never seems to complete --- indra/llprimitive/llmodel.cpp | 31 +++++++++++++++++-------------- indra/llprimitive/llmodel.h | 1 + indra/newview/llfloatermodelpreview.cpp | 25 ++++++++++++++++++++++--- indra/newview/llfloatermodelwizard.cpp | 25 ++++++++++++++++++++++--- indra/newview/llmeshrepository.cpp | 19 +++++++++++++++++++ indra/newview/llmeshrepository.h | 10 +++++++++- 6 files changed, 90 insertions(+), 21 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 57ac7a143f..030a61cd55 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1778,7 +1778,7 @@ void LLModel::updateHullCenters() if (mHullPoints > 0) { mCenterOfHullCenters *= 1.f / mHullPoints; - llassert(mPhysics.asLLSD().has("HullList")); + llassert(mPhysics.hasHullList()); } } @@ -2127,6 +2127,11 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) } } +bool LLModel::Decomposition::hasHullList() const +{ + return !mHull.empty() ; +} + LLSD LLModel::Decomposition::asLLSD() const { LLSD ret; @@ -2208,14 +2213,17 @@ LLSD LLModel::Decomposition::asLLSD() const //convert to 16-bit normalized across domain U16 val = (U16) (((mHull[i][j].mV[k]-min.mV[k])/range.mV[k])*65535); - switch (k) + if(valid.size() < 3) { - case 0: test = test | (U64) val; break; - case 1: test = test | ((U64) val << 16); break; - case 2: test = test | ((U64) val << 32); break; - }; + switch (k) + { + case 0: test = test | (U64) val; break; + case 1: test = test | ((U64) val << 16); break; + case 2: test = test | ((U64) val << 32); break; + }; - valid.insert(test); + valid.insert(test); + } U8* buff = (U8*) &val; //write to binary buffer @@ -2227,8 +2235,8 @@ LLSD LLModel::Decomposition::asLLSD() const } } - //must have at least 4 unique points - llassert(valid.size() > 3); + //must have at least 3 unique points + llassert(valid.size() > 2); } ret["Position"] = p; @@ -2290,10 +2298,5 @@ void LLModel::Decomposition::merge(const LLModel::Decomposition* rhs) { //take physics shape mesh from rhs mPhysicsShapeMesh = rhs->mPhysicsShapeMesh; } - - if (!mHull.empty()) - { //verify - llassert(asLLSD().has("HullList")); - } } diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 23f4b5cb42..ebca1f9d9d 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -106,6 +106,7 @@ public: Decomposition(LLSD& data); void fromLLSD(LLSD& data); LLSD asLLSD() const; + bool hasHullList() const; void merge(const Decomposition* rhs); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 9dd5269a6b..2a3bd37129 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4962,9 +4962,12 @@ LLFloaterModelPreview::DecompRequest::DecompRequest(const std::string& stage, LL if (mdl) { U16 index_offset = 0; + U16 tri[3] ; mPositions.clear(); mIndices.clear(); + mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; + mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; //queue up vertex positions and indices for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) @@ -4978,12 +4981,28 @@ LLFloaterModelPreview::DecompRequest::DecompRequest(const std::string& stage, LL for (U32 j = 0; j < face.mNumVertices; ++j) { mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); + for(U32 k = 0 ; k < 3 ; k++) + { + mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; + mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; + } } - for (U32 j = 0; j < face.mNumIndices; ++j) + updateTriangleAreaThreshold() ; + + for (U32 j = 0; j+2 < face.mNumIndices; j += 3) { - mIndices.push_back(face.mIndices[j]+index_offset); - } + tri[0] = face.mIndices[j] + index_offset ; + tri[1] = face.mIndices[j + 1] + index_offset ; + tri[2] = face.mIndices[j + 2] + index_offset ; + + if(isValidTriangle(tri[0], tri[1], tri[2])) + { + mIndices.push_back(tri[0]); + mIndices.push_back(tri[1]); + mIndices.push_back(tri[2]); + } + } index_offset += face.mNumVertices; } diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index faf81dbc5c..e44737f39e 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -441,10 +441,13 @@ LLFloaterModelWizard::DecompRequest::DecompRequest(const std::string& stage, LLM if (mdl) { U16 index_offset = 0; + U16 tri[3] ; mPositions.clear(); mIndices.clear(); - + mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; + mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; + //queue up vertex positions and indices for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) { @@ -457,11 +460,27 @@ LLFloaterModelWizard::DecompRequest::DecompRequest(const std::string& stage, LLM for (U32 j = 0; j < face.mNumVertices; ++j) { mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); + for(U32 k = 0 ; k < 3 ; k++) + { + mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; + mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; + } } - for (U32 j = 0; j < face.mNumIndices; ++j) + updateTriangleAreaThreshold() ; + + for (U32 j = 0; j+2 < face.mNumIndices; j += 3) { - mIndices.push_back(face.mIndices[j]+index_offset); + tri[0] = face.mIndices[j] + index_offset ; + tri[1] = face.mIndices[j + 1] + index_offset ; + tri[2] = face.mIndices[j + 2] + index_offset ; + + if(isValidTriangle(tri[0], tri[1], tri[2])) + { + mIndices.push_back(tri[0]); + mIndices.push_back(tri[1]); + mIndices.push_back(tri[2]); + } } index_offset += face.mNumVertices; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d9a58d56fe..90e8f055dc 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3751,6 +3751,25 @@ void LLPhysicsDecomp::run() mDone = true; } +void LLPhysicsDecomp::Request::updateTriangleAreaThreshold() +{ + F32 range = mBBox[1].mV[0] - mBBox[0].mV[0] ; + range = llmin(range, mBBox[1].mV[1] - mBBox[0].mV[1]) ; + range = llmin(range, mBBox[1].mV[2] - mBBox[0].mV[2]) ; + + mTriangleAreaThreshold = llmin(0.0002f, range * 0.000002f) ; +} + +//check if the triangle area is large enough to qualify for a valid triangle +bool LLPhysicsDecomp::Request::isValidTriangle(U16 idx1, U16 idx2, U16 idx3) +{ + LLVector3 a = mPositions[idx2] - mPositions[idx1] ; + LLVector3 b = mPositions[idx3] - mPositions[idx1] ; + F32 c = a * b ; + + return ((a*a) * (b*b) - c * c) > mTriangleAreaThreshold ; +} + void LLPhysicsDecomp::Request::setStatusMessage(const std::string& msg) { mStatusMessage = msg; diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index f859e29c07..0a6954bade 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -152,7 +152,7 @@ public: std::string mStatusMessage; std::vector mHullMesh; LLModel::convex_hull_decomposition mHull; - + //status message callback, called from decomposition thread virtual S32 statusCallback(const char* status, S32 p1, S32 p2) = 0; @@ -160,6 +160,14 @@ public: virtual void completed() = 0; virtual void setStatusMessage(const std::string& msg); + + protected: + //internal use + LLVector3 mBBox[2] ; + F32 mTriangleAreaThreshold ; + + void updateTriangleAreaThreshold() ; + bool isValidTriangle(U16 idx1, U16 idx2, U16 idx3) ; }; LLCondition* mSignal; -- cgit v1.2.3 From 594f1da03b02d09c57699b543692ebd85cdcff17 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 25 May 2011 11:36:19 -0400 Subject: SH-657 FIXED Preview normals inverted for mesh mirrored by negative scale transformation SH-810 FIXED Mesh uploader should enable Physics Analyze after "Use Level of Detail" is picked. Both changes together in this changeset. --- indra/newview/llfloatermodelpreview.cpp | 30 ++++++++++++++++++++++++++++-- indra/newview/llfloatermodelpreview.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 2a3bd37129..46327a6211 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -314,7 +314,7 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("pelvis_offset", onPelvisOffsetCommit, this); childSetCommitCallback("lod_file_or_limit", refresh, this); - childSetCommitCallback("physics_load_radio", refresh, this); + childSetCommitCallback("physics_load_radio", onPhysicsLoadRadioCommit, this); //childSetCommitCallback("physics_optimize", refresh, this); //childSetCommitCallback("physics_use_hull", refresh, this); @@ -469,6 +469,29 @@ void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata ) fp->mModelPreview->refresh(); } +//static +void LLFloaterModelPreview::onPhysicsLoadRadioCommit( LLUICtrl*, void *userdata) +{ + LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; + if (fmp) + { + if (fmp->childGetValue("physics_use_lod").asBoolean()) + { + onPhysicsUseLOD(NULL,NULL); + } + if (fmp->childGetValue("physics_load_from_file").asBoolean()) + { + + } + LLModelPreview *model_preview = fmp->mModelPreview; + if (model_preview) + { + model_preview->refresh(); + model_preview->updateStatusMessages(); + } + } +} + //static void LLFloaterModelPreview::onUploadJointsCommit(LLUICtrl*,void* userdata) { @@ -2296,8 +2319,11 @@ void LLModelLoader::processElement(daeElement* element) { domFloat3 dom_value = scale->getValue(); + + LLVector3 scale_vector = LLVector3(dom_value[0], dom_value[1], dom_value[2]); + scale_vector.abs(); // Set all values positive, since we don't currently support mirrored meshes LLMatrix4 scaling; - scaling.initScale(LLVector3(dom_value[0], dom_value[1], dom_value[2])); + scaling.initScale(scale_vector); scaling *= mTransform; mTransform = scaling; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index f6d4a08d1f..ed7cbe6d1e 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -199,6 +199,8 @@ protected: static void onUploadJointsCommit(LLUICtrl*,void*); static void onUploadSkinCommit(LLUICtrl*,void*); + static void onPhysicsLoadRadioCommit(LLUICtrl*,void *data); + static void onPreviewLODCommit(LLUICtrl*,void*); static void onGenerateNormalsCommit(LLUICtrl*,void*); -- cgit v1.2.3 From b76d15ed14abfe3b4c422ba9ff3d4151de8a31ea Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 25 May 2011 12:40:51 -0400 Subject: SH-1252 & SH-1253 accesor cleanup --- indra/newview/llviewerobjectlist.cpp | 4 ++-- indra/newview/llviewerobjectlist.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 007b3416f1..78b06b0764 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1418,12 +1418,12 @@ void LLViewerObjectList::onObjectCostFetchFailure(const LLUUID& object_id) mPendingObjectCost.erase(object_id); } -void LLViewerObjectList::updateQuotaCost( const LLUUID& objectId, const SelectionQuota& quota ) +void LLViewerObjectList::updateQuota( const LLUUID& objectId, const SelectionQuota& quota ) { LLViewerObject* pVO = findObject( objectId ); if ( pVO ) { - //pVO->updateQuota( quota ); + pVO->updateQuota( quota ); } } diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 8e211eaf73..6f0d285f5d 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -102,7 +102,7 @@ public: F32 restitution, F32 gravity_multiplier); - void updateQuotaCost( const LLUUID& objectId, const SelectionQuota& costs ); + void updateQuota( const LLUUID& objectId, const SelectionQuota& costs ); void shiftObjects(const LLVector3 &offset); -- cgit v1.2.3 From 8e728befa57bcea0981179709dd5f13af1cd29a8 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 25 May 2011 15:57:12 -0400 Subject: Sh-1647: Accounting caps update --- indra/llcommon/llaccountingquota.h | 26 +++++--- indra/newview/llaccountingquotamanager.cpp | 98 ++++++++++++++++++------------ indra/newview/llviewerregion.cpp | 5 +- 3 files changed, 78 insertions(+), 51 deletions(-) diff --git a/indra/llcommon/llaccountingquota.h b/indra/llcommon/llaccountingquota.h index f52d94f868..567d02dac1 100644 --- a/indra/llcommon/llaccountingquota.h +++ b/indra/llcommon/llaccountingquota.h @@ -35,30 +35,38 @@ struct ParcelQuota { - ParcelQuota( F32 ownerRenderCost, F32 ownerPhysicsCost, F32 ownerNetworkCost, F32 ownerSimulationCost, - F32 groupRenderCost, F32 groupPhysicsCost, F32 groupNetworkCost, F32 groupSimulationCost, - F32 otherRenderCost, F32 otherPhysicsCost, F32 otherNetworkCost, F32 otherSimulationCost, - F32 totalRenderCost, F32 totalPhysicsCost, F32 totalNetworkCost, F32 totalSimulationCost) + ParcelQuota( F32 ownerRenderCost, F32 ownerPhysicsCost, F32 ownerNetworkCost, F32 ownerSimulationCost, + F32 groupRenderCost, F32 groupPhysicsCost, F32 groupNetworkCost, F32 groupSimulationCost, + F32 otherRenderCost, F32 otherPhysicsCost, F32 otherNetworkCost, F32 otherSimulationCost, + F32 tempRenderCost, F32 tempPhysicsCost, F32 tempNetworkCost, F32 tempSimulationCost, + F32 selectedRenderCost, F32 selectedPhysicsCost, F32 selectedNetworkCost, F32 selectedSimulationCost, + F32 parcelCapacity ) : mOwnerRenderCost( ownerRenderCost ), mOwnerPhysicsCost( ownerPhysicsCost ) , mOwnerNetworkCost( ownerNetworkCost ), mOwnerSimulationCost( ownerSimulationCost ) , mGroupRenderCost( groupRenderCost ), mGroupPhysicsCost( groupPhysicsCost ) , mGroupNetworkCost( groupNetworkCost ), mGroupSimulationCost( groupSimulationCost ) , mOtherRenderCost( otherRenderCost ), mOtherPhysicsCost( otherPhysicsCost ) , mOtherNetworkCost( otherNetworkCost ), mOtherSimulationCost( otherSimulationCost ) - , mTotalRenderCost( totalRenderCost ), mTotalPhysicsCost( totalPhysicsCost ) - , mTotalNetworkCost( totalNetworkCost ), mTotalSimulationCost( totalSimulationCost ) + , mTempRenderCost( tempRenderCost ), mTempPhysicsCost( tempPhysicsCost ) + , mTempNetworkCost( tempNetworkCost ), mTempSimulationCost( tempSimulationCost ) + , mSelectedRenderCost( tempRenderCost ), mSelectedPhysicsCost( tempPhysicsCost ) + , mSelectedNetworkCost( tempNetworkCost ), mSelectedSimulationCost( selectedSimulationCost ) + , mParcelCapacity( parcelCapacity ) { } + ParcelQuota(){} F32 mOwnerRenderCost, mOwnerPhysicsCost, mOwnerNetworkCost, mOwnerSimulationCost; F32 mGroupRenderCost, mGroupPhysicsCost, mGroupNetworkCost, mGroupSimulationCost; F32 mOtherRenderCost, mOtherPhysicsCost, mOtherNetworkCost, mOtherSimulationCost; - F32 mTotalRenderCost, mTotalPhysicsCost, mTotalNetworkCost, mTotalSimulationCost; + F32 mTempRenderCost, mTempPhysicsCost, mTempNetworkCost, mTempSimulationCost; + F32 mSelectedRenderCost, mSelectedPhysicsCost, mSelectedNetworkCost, mSelectedSimulationCost; + F32 mParcelCapacity; }; struct SelectionQuota { - SelectionQuota( S32 localId, F32 renderCost, F32 physicsCost, F32 networkCost, F32 simulationCost ) + SelectionQuota( LLUUID localId, F32 renderCost, F32 physicsCost, F32 networkCost, F32 simulationCost ) : mLocalId( localId) , mRenderCost( renderCost ) , mPhysicsCost( physicsCost ) @@ -69,7 +77,7 @@ struct SelectionQuota SelectionQuota() {} F32 mRenderCost, mPhysicsCost, mNetworkCost, mSimulationCost; - S32 mLocalId; + LLUUID mLocalId; }; #endif diff --git a/indra/newview/llaccountingquotamanager.cpp b/indra/newview/llaccountingquotamanager.cpp index ada74ea44c..9b77ada8b7 100644 --- a/indra/newview/llaccountingquotamanager.cpp +++ b/indra/newview/llaccountingquotamanager.cpp @@ -77,12 +77,10 @@ public: return; } - //Differentiate what the incoming caps could be from the data - //bool VOContent = content.has("Objects"); + //Differentiate what the incoming caps could be from the data bool containsParcel = content.has("parcel"); bool containsSelection = content.has("selected"); - //bool VORegion = content.has("region"); - + //Loop over the stored object ids checking against the incoming data for ( LLSD::array_iterator iter = mObjectIDs.beginArray(); iter != mObjectIDs.endArray(); ++iter ) { @@ -97,16 +95,17 @@ public: for(S32 i = 0; i < dataCount; i++) { //prep#todo verify that this is safe, otherwise just add a bool - S32 parcelId = 0; - S32 parcelOwner = 0; + LLUUID parcelId; + //S32 parcelOwner = 0; if ( content["parcel"][i].has("parcel_id") ) { - parcelId = content["parcel"][i]["parcel_id"].asInteger(); - } - if ( content["parcel"][i].has("parcel_owner") ) - { - parcelOwner = content["parcel"][i]["parcel_owner"].asInteger(); + parcelId = content["parcel"][i]["parcel_id"].asUUID(); } + + //if ( content["parcel"][i].has("parcel_owner") ) + //{ + // parcelOwner = content["parcel"][i]["parcel_owner"].asInteger(); + //} F32 ownerRenderCost = 0; F32 ownerPhysicsCost = 0; @@ -123,48 +122,69 @@ public: F32 otherNetworkCost = 0; F32 otherSimulationCost = 0; - F32 totalRenderCost = 0; - F32 totalPhysicsCost = 0; - F32 totalNetworkCost = 0; - F32 totalSimulationCost = 0; + F32 tempRenderCost = 0; + F32 tempPhysicsCost = 0; + F32 tempNetworkCost = 0; + F32 tempSimulationCost = 0; + + F32 selectedRenderCost = 0; + F32 selectedPhysicsCost = 0; + F32 selectedNetworkCost = 0; + F32 selectedSimulationCost = 0; + F32 parcelCapacity = 0; + + if ( content["parcel"][i].has("capacity") ) + { + parcelCapacity = content["parcel"][i].has("capacity"); + } + if ( content["parcel"][i].has("owner") ) { - ownerRenderCost = content["parcel"][i]["owner"]["render"].asReal(); + ownerRenderCost = content["parcel"][i]["owner"]["rendering"].asReal(); ownerPhysicsCost = content["parcel"][i]["owner"]["physics"].asReal(); - ownerNetworkCost = content["parcel"][i]["owner"]["network"].asReal(); - ownerSimulationCost = content["parcel"][i]["owner"]["simulation"].asReal(); - + ownerNetworkCost = content["parcel"][i]["owner"]["streaming"].asReal(); + ownerSimulationCost = content["parcel"][i]["owner"]["simulation"].asReal(); } + if ( content["parcel"][i].has("group") ) { - groupRenderCost = content["parcel"][i]["group"]["render"].asReal(); + groupRenderCost = content["parcel"][i]["group"]["rendering"].asReal(); groupPhysicsCost = content["parcel"][i]["group"]["physics"].asReal(); - groupNetworkCost = content["parcel"][i]["group"]["network"].asReal(); + groupNetworkCost = content["parcel"][i]["group"]["streaming"].asReal(); groupSimulationCost = content["parcel"][i]["group"]["simulation"].asReal(); } if ( content["parcel"][i].has("other") ) { - otherRenderCost = content["parcel"][i]["other"]["render"].asReal(); + otherRenderCost = content["parcel"][i]["other"]["rendering"].asReal(); otherPhysicsCost = content["parcel"][i]["other"]["physics"].asReal(); - otherNetworkCost = content["parcel"][i]["other"]["network"].asReal(); + otherNetworkCost = content["parcel"][i]["other"]["streaming"].asReal(); otherSimulationCost = content["parcel"][i]["other"]["simulation"].asReal(); } - if ( content["parcel"][i].has("total") ) + if ( content["parcel"][i].has("temp") ) { - totalRenderCost = content["parcel"][i]["total"]["render"].asReal(); - totalPhysicsCost = content["parcel"][i]["total"]["physics"].asReal(); - totalNetworkCost = content["parcel"][i]["total"]["network"].asReal(); - totalSimulationCost = content["parcel"][i]["total"]["simulation"].asReal(); - + tempRenderCost = content["parcel"][i]["total"]["rendering"].asReal(); + tempPhysicsCost = content["parcel"][i]["total"]["physics"].asReal(); + tempNetworkCost = content["parcel"][i]["total"]["streaming"].asReal(); + tempSimulationCost = content["parcel"][i]["total"]["simulation"].asReal(); + } + + if ( content["parcel"][i].has("selected") ) + { + selectedRenderCost = content["parcel"][i]["total"]["rendering"].asReal(); + selectedPhysicsCost = content["parcel"][i]["total"]["physics"].asReal(); + selectedNetworkCost = content["parcel"][i]["total"]["streaming"].asReal(); + selectedSimulationCost = content["parcel"][i]["total"]["simulation"].asReal(); } - ParcelQuota parcelQuota( ownerRenderCost, ownerPhysicsCost, ownerNetworkCost, ownerSimulationCost, - groupRenderCost, groupPhysicsCost, groupNetworkCost, groupSimulationCost, - otherRenderCost, otherPhysicsCost, otherNetworkCost, otherSimulationCost, - totalRenderCost, totalPhysicsCost, totalNetworkCost, totalSimulationCost ); + ParcelQuota parcelQuota( ownerRenderCost, ownerPhysicsCost, ownerNetworkCost, ownerSimulationCost, + groupRenderCost, groupPhysicsCost, groupNetworkCost, groupSimulationCost, + otherRenderCost, otherPhysicsCost, otherNetworkCost, otherSimulationCost, + tempRenderCost, tempPhysicsCost, tempNetworkCost, tempSimulationCost, + selectedRenderCost, selectedPhysicsCost, selectedNetworkCost, selectedSimulationCost, + parcelCapacity ); //Update the Parcel LLParcel* pParcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if ( pParcel ) @@ -185,18 +205,18 @@ public: F32 networkCost = 0; F32 simulationCost = 0; - S32 localId = 0; + LLUUID objectId; - localId = content["selected"][i]["local_id"].asInteger(); - renderCost = content["selected"][i]["render"].asReal(); + objectId = content["selected"][i]["local_id"].asUUID(); + renderCost = content["selected"][i]["rendering"].asReal(); physicsCost = content["selected"][i]["physics"].asReal(); - networkCost = content["selected"][i]["network"].asReal(); + networkCost = content["selected"][i]["streaming"].asReal(); simulationCost = content["selected"][i]["simulation"].asReal(); - SelectionQuota selectionQuota( localId, renderCost, physicsCost, networkCost, simulationCost ); + SelectionQuota selectionQuota( objectId, renderCost, physicsCost, networkCost, simulationCost ); //Update the objects - //gObjectList.updateQuota( localId, selectionQuota ); + gObjectList.updateQuota( objectId, selectionQuota ); } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index fb608b3a4f..c4ca5d37ce 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1480,6 +1480,8 @@ void LLViewerRegion::setSeedCapability(const std::string& url) LLSD capabilityNames = LLSD::emptyArray(); + capabilityNames.append("AccountingParcel"); + capabilityNames.append("AccountingSelection"); capabilityNames.append("AttachmentResources"); capabilityNames.append("AvatarPickerSearch"); capabilityNames.append("ChatSessionRequest"); @@ -1546,9 +1548,6 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("ViewerMetrics"); capabilityNames.append("ViewerStartAuction"); capabilityNames.append("ViewerStats"); - //prep# Finalize these!!!!!!!!! - capabilityNames.append("AccountingParcel"); - capabilityNames.append("AccountingSelection"); // Please add new capabilities alphabetically to reduce // merge conflicts. -- cgit v1.2.3 From d79468057c954a05acdb9dd69d398dd004425ec0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 25 May 2011 16:08:21 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 155 +++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 74 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index b79f120eda..79541e49d3 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1437,9 +1437,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLMeshUploadData data; data.mBaseModel = iter->first; - LLModelInstance& instance = *(iter->second.begin()); - LLModel* model = instance.mModel; - if (mesh_index.find(model) == mesh_index.end()) + if (mesh_index.find(data.mBaseModel) == mesh_index.end()) { // Have not seen this model before - create a new mesh_list entry for it. std::string model_name = data.mBaseModel->getName(); @@ -1472,97 +1470,106 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::string str = ostr.str(); res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end()); - mesh_index[model] = mesh_num; + mesh_index[data.mBaseModel] = mesh_num; mesh_num++; } + + // For all instances that use this model + for (instance_list::iterator instance_iter = iter->second.begin(); + instance_iter != iter->second.end(); + ++instance_iter) + { + + LLModelInstance& instance = *instance_iter; - LLSD instance_entry; + LLSD instance_entry; - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = instance.mLOD[i]; - } + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = instance.mLOD[i]; + } - LLVector3 pos, scale; - LLQuaternion rot; - LLMatrix4 transformation = instance.mTransform; - decomposeMeshMatrix(transformation,pos,rot,scale); - instance_entry["position"] = ll_sd_from_vector3(pos); - instance_entry["rotation"] = ll_sd_from_quaternion(rot); - instance_entry["scale"] = ll_sd_from_vector3(scale); + LLVector3 pos, scale; + LLQuaternion rot; + LLMatrix4 transformation = instance.mTransform; + decomposeMeshMatrix(transformation,pos,rot,scale); + instance_entry["position"] = ll_sd_from_vector3(pos); + instance_entry["rotation"] = ll_sd_from_quaternion(rot); + instance_entry["scale"] = ll_sd_from_vector3(scale); - instance_entry["material"] = LL_MCODE_WOOD; - LLPermissions perm; - perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); - perm.setCreator(gAgent.getID()); + instance_entry["material"] = LL_MCODE_WOOD; + LLPermissions perm; + perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); + perm.setCreator(gAgent.getID()); - perm.initMasks(PERM_ITEM_UNRESTRICTED | PERM_MOVE, //base - PERM_ITEM_UNRESTRICTED | PERM_MOVE, //owner - LLFloaterPerms::getEveryonePerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getNextOwnerPerms()); - instance_entry["permissions"] = ll_create_sd_from_permissions(perm); - instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); - instance_entry["mesh"] = mesh_index[model]; - - if (mUploadTextures) - { - instance_entry["face_list"] = LLSD::emptyArray(); - - for (S32 face_num = 0; face_num < model->getNumVolumeFaces(); face_num++) + perm.initMasks(PERM_ITEM_UNRESTRICTED | PERM_MOVE, //base + PERM_ITEM_UNRESTRICTED | PERM_MOVE, //owner + LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getGroupPerms(), + LLFloaterPerms::getNextOwnerPerms()); + instance_entry["permissions"] = ll_create_sd_from_permissions(perm); + instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); + instance_entry["mesh"] = mesh_index[data.mBaseModel]; + + if (mUploadTextures) { - LLImportMaterial& material = instance.mMaterial[face_num]; - LLSD face_entry = LLSD::emptyMap(); - LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); - - if (texture != NULL) - { - if (textures.find(texture) == textures.end()) - { - textures.insert(texture); - } + instance_entry["face_list"] = LLSD::emptyArray(); - std::stringstream ostr; - if (include_textures) // otherwise data is blank. + for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) + { + LLImportMaterial& material = instance.mMaterial[face_num]; + LLSD face_entry = LLSD::emptyMap(); + LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); + + if (texture != NULL) { - LLTextureUploadData data(texture, material.mDiffuseMapLabel); - if (!data.mTexture->isRawImageValid()) + if (textures.find(texture) == textures.end()) { - data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + textures.insert(texture); } + + std::stringstream ostr; + if (include_textures) // otherwise data is blank. + { + LLTextureUploadData data(texture, material.mDiffuseMapLabel); + if (!data.mTexture->isRawImageValid()) + { + data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + } - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); - ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); + LLPointer upload_file = + LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); + ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } + + if (texture_index.find(texture) == texture_index.end()) + { + texture_index[texture] = texture_num; + std::string str = ostr.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); + texture_num++; + } } - if (texture_index.find(texture) == texture_index.end()) + // Subset of TextureEntry fields. + if (texture) { - texture_index[texture] = texture_num; - std::string str = ostr.str(); - res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); - texture_num++; + face_entry["image"] = texture_index[texture]; } + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["fullbright"] = material.mFullbright; + instance_entry["face_list"][face_num] = face_entry; } + } - // Subset of TextureEntry fields. - if (texture) - { - face_entry["image"] = texture_index[texture]; - } - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; - face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); - face_entry["fullbright"] = material.mFullbright; - instance_entry["face_list"][face_num] = face_entry; - } + res["instance_list"][instance_num] = instance_entry; + instance_num++; } - - res["instance_list"][instance_num] = instance_entry; - instance_num++; } result["asset_resources"] = res; -- cgit v1.2.3 From 9eea451a82379a61fa4a6cc2a55274e06cecbd58 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 15:51:15 -0500 Subject: SH-469 Don't use depth buffers and multisample buffers where not absolutely needed -- make sample counts consistent between shaders and render targets. --- indra/llrender/llgl.cpp | 10 +++++- indra/llrender/llgl.h | 1 + indra/llrender/llrendertarget.cpp | 23 ++++++++++--- .../shaders/class1/deferred/blurLightMSF.glsl | 37 +++++++++++++------- .../class1/deferred/multiPointLightMSF.glsl | 2 +- .../shaders/class1/deferred/multiSpotLightMSF.glsl | 3 +- .../shaders/class1/deferred/pointLightMSF.glsl | 2 +- .../shaders/class1/deferred/spotLightMSF.glsl | 2 +- .../shaders/class2/deferred/multiSpotLightMSF.glsl | 26 +++++++------- .../shaders/class2/deferred/softenLightMSF.glsl | 9 ++--- .../shaders/class2/deferred/spotLightMSF.glsl | 24 ++++++------- indra/newview/llviewershadermgr.cpp | 10 +++--- indra/newview/pipeline.cpp | 40 +++++++++++++--------- 13 files changed, 116 insertions(+), 73 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 68892453b7..77b34eb546 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -673,6 +673,14 @@ std::string LLGLManager::getRawGLString() return gl_string; } +U32 LLGLManager::getNumFBOFSAASamples(U32 samples) +{ + samples = llmin(samples, (U32) mMaxColorTextureSamples); + samples = llmin(samples, (U32) mMaxDepthTextureSamples); + samples = llmin(samples, (U32) 4); + return samples; +} + void LLGLManager::shutdownGL() { if (mInited) @@ -979,7 +987,7 @@ void LLGLManager::initExtensions() { glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT"); } - if (mHasTextureRectangle) + if (mHasTextureMultisample) { glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage2DMultisample"); glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage3DMultisample"); diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 3719b25557..420922cf06 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -145,6 +145,7 @@ public: void printGLInfoString(); void getGLInfo(LLSD& info); + U32 getNumFBOFSAASamples(U32 desired_samples = 32); // In ALL CAPS std::string mGLVendor; std::string mGLVendorShort; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index ddd6072fff..715f466314 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -83,11 +83,10 @@ void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo mUseDepth = depth; mSamples = samples; - mSamples = llmin(mSamples, (U32) gGLManager.mMaxColorTextureSamples); - - if (mSamples > 0 && gGLManager.mHasTextureMultisample) + mSamples = gGLManager.getNumFBOFSAASamples(mSamples); + + if (mSamples > 1 && gGLManager.mHasTextureMultisample) { - mSamples = llmin(mSamples, (U32) gGLManager.mMaxColorTextureSamples); mUsage = LLTexUnit::TT_MULTISAMPLE_TEXTURE; //no support for multisampled stencil targets yet mStencil = false; @@ -155,7 +154,7 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt) stop_glerror(); - if (mSamples > 0) + if (mSamples > 1) { glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, color_fmt, mResX, mResY, GL_TRUE); } @@ -207,6 +206,12 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt) mTex.push_back(tex); + if (gDebugGL) + { //bind and unbind to validate target + bindTarget(); + flush(); + } + } void LLRenderTarget::allocateDepth() @@ -272,6 +277,9 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), mDepth, 0); stop_glerror(); } + + check_framebuffer_status(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); target.mUseDepth = true; @@ -456,6 +464,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, stop_glerror(); glBindFramebuffer(GL_FRAMEBUFFER, source.mFBO); + check_framebuffer_status(); gGL.getTexUnit(0)->bind(this, true); stop_glerror(); glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, srcX0, srcY0, dstX0, dstY0, dstX1, dstY1); @@ -473,6 +482,10 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, stop_glerror(); glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); stop_glerror(); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + stop_glerror(); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + stop_glerror(); glBindFramebuffer(GL_FRAMEBUFFER, 0); stop_glerror(); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl index 4366376d99..edec83ea07 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl @@ -12,7 +12,7 @@ uniform sampler2DMS depthMap; uniform sampler2DMS normalMap; -uniform sampler2DMS lightMap; +uniform sampler2DRect lightMap; uniform float dist_factor; uniform float blur_size; @@ -25,12 +25,23 @@ varying vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; -vec4 texture2DMS(sampler2DMS tex, ivec2 tc) +vec3 texture2DMS3(sampler2DMS tex, ivec2 tc) { - vec4 ret = vec4(0,0,0,0); + vec3 ret = vec3(0,0,0); for (int i = 0; i < samples; i++) { - ret += texelFetch(tex, tc, i); + ret += texelFetch(tex, tc, i).rgb; + } + + return ret/samples; +} + +float texture2DMS1(sampler2DMS tex, ivec2 tc) +{ + float ret = 0; + for (int i = 0; i < samples; i++) + { + ret += texelFetch(tex, tc, i).r; } return ret/samples; @@ -38,7 +49,7 @@ vec4 texture2DMS(sampler2DMS tex, ivec2 tc) vec4 getPosition(ivec2 pos_screen) { - float depth = texture2DMS(depthMap, pos_screen.xy).r; + float depth = texture2DMS1(depthMap, pos_screen.xy); vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); @@ -54,10 +65,10 @@ void main() vec2 tc = vary_fragcoord.xy; ivec2 itc = ivec2(tc); - vec3 norm = texture2DMS(normalMap, itc).xyz; + vec3 norm = texture2DMS3(normalMap, itc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm vec3 pos = getPosition(itc).xyz; - vec4 ccol = texture2DMS(lightMap, itc).rgba; + vec4 ccol = texture2DRect(lightMap, tc).rgba; vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); dlt /= max(-pos.z*dist_factor, 1.0); @@ -73,23 +84,23 @@ void main() for (int i = 1; i < 4; i++) { - ivec2 samptc = ivec2(tc + kern[i].z*dlt); - vec3 samppos = getPosition(samptc).xyz; + vec2 samptc = tc + kern[i].z*dlt; + vec3 samppos = getPosition(ivec2(samptc)).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DMS(lightMap, samptc)*kern[i].xyxx; + col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; } } for (int i = 1; i < 4; i++) { - ivec2 samptc = ivec2(tc - kern[i].z*dlt); - vec3 samppos = getPosition(samptc).xyz; + vec2 samptc = vec2(tc - kern[i].z*dlt); + vec3 samppos = getPosition(ivec2(samptc)).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DMS(lightMap, samptc)*kern[i].xyxx; + col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl index 16e97109f9..66c7a5cb4a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl @@ -130,7 +130,7 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl index bdaa8e59c4..b450ff1ca2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl @@ -34,7 +34,6 @@ uniform float far_clip; uniform vec3 proj_origin; //origin of projection to be used for angular attenuation uniform float sun_wash; -uniform int proj_shadow_idx; uniform float shadow_fade; varying vec4 vary_light; @@ -228,6 +227,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl index 23b5e76735..7521c3310c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl @@ -103,6 +103,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl index 3a9d9266bb..6702bd5014 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl @@ -229,6 +229,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl index c6f0ea2a5d..d0f9101774 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl @@ -14,7 +14,7 @@ uniform sampler2DMS diffuseRect; uniform sampler2DMS specularRect; uniform sampler2DMS depthMap; uniform sampler2DMS normalMap; -uniform sampler2DMS lightMap; +uniform sampler2DRect lightMap; uniform sampler2D noiseMap; uniform sampler2D lightFunc; uniform sampler2D projectionMap; @@ -112,6 +112,17 @@ void main() ivec2 itc = ivec2(frag.xy); + float shadow = 1.0; + + if (proj_shadow_idx >= 0) + { + vec4 shd = texture2DRect(lightMap, frag); + float sh[2]; + sh[0] = shd.b; + sh[1] = shd.a; + shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); + } + for (int i = 0; i < samples; i++) { vec3 pos = getPosition(itc, i).xyz; @@ -120,17 +131,6 @@ void main() dist2 /= vary_light.w; if (dist2 <= 1.0) { - float shadow = 1.0; - - if (proj_shadow_idx >= 0) - { - vec4 shd = texelFetch(lightMap, itc, i); - float sh[2]; - sh[0] = shd.b; - sh[1] = shd.a; - shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); - } - vec3 norm = texelFetch(normalMap, itc, i).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm @@ -239,6 +239,6 @@ void main() discard; } - gl_FragColor.rgb = fcol/wght; + gl_FragColor.rgb = fcol/samples; gl_FragColor.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl index 71482d0c7b..cb09fe9895 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -13,7 +13,7 @@ uniform sampler2DMS diffuseRect; uniform sampler2DMS specularRect; uniform sampler2DMS normalMap; -uniform sampler2DMS lightMap; +uniform sampler2DRect lightMap; uniform sampler2DMS depthMap; uniform sampler2D noiseMap; uniform samplerCube environmentMap; @@ -257,7 +257,8 @@ void main() vec3 fcol = vec3(0,0,0); - float amb = 0; + vec2 scol_ambocc = texture2DRect(lightMap, tc).rg; + float ambocc = scol_ambocc.g; for (int i = 0; i < samples; ++i) { @@ -271,9 +272,9 @@ void main() vec4 diffuse = texelFetch(diffuseRect, itc, i); vec4 spec = texelFetch(specularRect, itc, i); - vec2 scol_ambocc = texelFetch(lightMap, itc, i).rg; + float amb = 0; + float scol = max(scol_ambocc.r, diffuse.a); - float ambocc = scol_ambocc.g; amb += ambocc; calcAtmospherics(pos.xyz, ambocc); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl index 099a45718a..8d6ffd79c5 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl @@ -14,7 +14,7 @@ uniform sampler2DMS diffuseRect; uniform sampler2DMS specularRect; uniform sampler2DMS depthMap; uniform sampler2DMS normalMap; -uniform sampler2DMS lightMap; +uniform sampler2DRect lightMap; uniform sampler2D noiseMap; uniform sampler2D lightFunc; uniform sampler2D projectionMap; @@ -113,6 +113,17 @@ void main() vec3 fcol = vec3(0,0,0); int wght = 0; + float shadow = 1.0; + + if (proj_shadow_idx >= 0) + { + vec4 shd = texture2DRect(lightMap, frag.xy); + float sh[2]; + sh[0] = shd.b; + sh[1] = shd.a; + shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); + } + for (int i = 0; i < samples; i++) { vec3 pos = getPosition(itc, i).xyz; @@ -121,17 +132,6 @@ void main() dist2 /= vary_light.w; if (dist2 <= 1.0) { - float shadow = 1.0; - - if (proj_shadow_idx >= 0) - { - vec4 shd = texelFetch(lightMap, itc, i); - float sh[2]; - sh[0] = shd.b; - sh[1] = shd.a; - shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); - } - vec3 norm = texelFetch(normalMap, itc, i).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 911a8bb65f..b818da205e 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -353,7 +353,7 @@ void LLViewerShaderMgr::setShaders() } //setup preprocessor definitions - LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples")); + LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"))); reentrance = true; @@ -841,7 +841,8 @@ BOOL LLViewerShaderMgr::loadShadersEffects() { BOOL success = TRUE; - bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 0 && gGLManager.mHasTextureMultisample; + U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")); + bool multisample = samples > 1 && LLPipeline::sRenderDeferred && gGLManager.mHasTextureMultisample; if (mVertexShaderLevel[SHADER_EFFECT] == 0) { @@ -870,7 +871,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() { std::string fragment; - if (gSavedSettings.getU32("RenderFSAASamples") > 0 && LLRenderTarget::sUseFBO && gGLManager.mHasTextureMultisample) + if (multisample) { fragment = "effects/glowExtractMSF.glsl"; } @@ -983,7 +984,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() BOOL success = TRUE; - bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 0 && gGLManager.mHasTextureMultisample; + U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")); + bool multisample = samples > 1 && gGLManager.mHasTextureMultisample; if (success) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ffe3b4b1a4..1214d1b545 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -589,7 +589,8 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) mScreenWidth = resX; mScreenHeight = resY; - U32 samples = llmin(gSavedSettings.getU32("RenderFSAASamples"), (U32) 16); + //cap samples at 4 for render targets to avoid out of memory errors + U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")); if (gGLManager.mIsATI) { //disable multisampling of render targets where ATI is involved @@ -631,7 +632,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) if (shadow_detail > 0 || ssao) { //only need mDeferredLight[0] for shadows OR ssao - mDeferredLight[0].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples); + mDeferredLight[0].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); } else { @@ -640,7 +641,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) if (ssao) { //only need mDeferredLight[1] for ssao - mDeferredLight[1].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, false, samples); + mDeferredLight[1].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, false); } else { @@ -742,13 +743,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) if (LLPipeline::sRenderDeferred) { //share depth buffer between deferred targets mDeferredScreen.shareDepthBuffer(mScreen); - for (U32 i = 0; i < 3; i++) - { //share stencil buffer with screen space lightmap to stencil out sky - if (mDeferredLight[i].getTexture(0)) - { - mDeferredScreen.shareDepthBuffer(mDeferredLight[i]); - } - } } gGL.getTexUnit(0)->disable(); @@ -7751,18 +7745,27 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) LLViewerTexture* img = volume->getLightTexture(); + if (img == NULL) + { + img = LLViewerFetchedTexture::sWhiteImagep; + } + S32 channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); - if (channel > -1 && img) + if (channel > -1) { - gGL.getTexUnit(channel)->bind(img); + if (img) + { + gGL.getTexUnit(channel)->bind(img); - F32 lod_range = logf(img->getWidth())/logf(2.f); + F32 lod_range = logf(img->getWidth())/logf(2.f); - shader.uniform1f("proj_focus", focus); - shader.uniform1f("proj_lod", lod_range); - shader.uniform1f("proj_ambient_lod", llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f)); + shader.uniform1f("proj_focus", focus); + shader.uniform1f("proj_lod", lod_range); + shader.uniform1f("proj_ambient_lod", llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f)); + } } + } void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) @@ -9372,6 +9375,11 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mShadow[i+4].flush(); } } + else + { //no spotlight shadows + mShadowSpotLight[0] = mShadowSpotLight[1] = NULL; + } + if (!gSavedSettings.getBOOL("CameraOffset")) { -- cgit v1.2.3 From 354f0e84eb178be79aa08420725ea745376f0e83 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 16:09:32 -0500 Subject: SH-1537 Make mesh importer use physics shape for bounding hull (again). --- indra/newview/llmeshrepository.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index b79f120eda..1ba553f927 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1702,7 +1702,13 @@ void LLMeshUploadThread::doIterativeUpload() } //queue up models for hull generation - DecompRequest* request = new DecompRequest(data.mModel[LLModel::LOD_HIGH], data.mBaseModel, this); + LLModel* physics = data.mModel[LLModel::LOD_PHYSICS]; + if (physics == NULL) + { //no physics model available, use high lod + physics = data.mModel[LLModel::LOD_HIGH]; + } + + DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); gMeshRepo.mDecompThread->submitRequest(request); } -- cgit v1.2.3 From e3782b56337a9e0026ce4d2e6e9dabb2d8801be1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 17:21:48 -0500 Subject: SH-1644 Don't default avatar hardware skinning to off on all ATI cards. --- indra/newview/featuretable.txt | 1 - indra/newview/featuretable_mac.txt | 27 +-------------------------- indra/newview/featuretable_xp.txt | 1 - 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index dd8a88e558..25dd2ffe78 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -467,7 +467,6 @@ RenderAvatarCloth 0 0 list ATI RenderUseStreamVBO 1 0 -RenderAvatarVP 1 0 // Disable vertex buffer objects by default for ATI cards with little video memory list ATIVramLT256 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index e2b979d9e9..8b8340bd71 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 23 +version 24 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -412,31 +412,6 @@ Disregard128DefaultDrawDistance 1 0 list ATI_Mobility_Radeon_X1xxx Disregard128DefaultDrawDistance 1 0 - - - -// Avatar hardware skinning causes -// invisible avatars on HD 2600... so I masked -// out other possible bad ones till it's fixed - -list ATI_Radeon_HD_2300 -RenderAvatarVP 0 0 -RenderAvatarCloth 0 0 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_HD_2400 -RenderAvatarVP 0 0 -RenderAvatarCloth 0 0 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_HD_2600 -RenderAvatarVP 0 0 -RenderAvatarCloth 0 0 -list ATI_Radeon_HD_2900 -RenderAvatarVP 0 0 -RenderAvatarCloth 0 0 -list ATI_Radeon_HD_3800 -RenderAvatarVP 0 0 -RenderAvatarCloth 0 0 - /// Tweaked NVIDIA list NVIDIA_GeForce_FX_5100 diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index 3339172a1a..65a6f59bbe 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -466,7 +466,6 @@ RenderAvatarCloth 0 0 list ATI RenderUseStreamVBO 1 0 -RenderAvatarVP 1 0 // Disable vertex buffer objects by default for ATI cards with little video memory list ATIVramLT256 -- cgit v1.2.3 From 081ba71f9632153efa86df07b33c28471b31e2cb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 25 May 2011 18:36:01 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 79541e49d3..d4be311be8 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -62,6 +62,8 @@ #include "llinventorymodel.h" #include "llfoldertype.h" +#include "boost/lexical_cast.hpp" + #ifndef LL_WINDOWS #include "netdb.h" #endif @@ -85,6 +87,12 @@ U32 LLMeshRepository::sPeakKbps = 0; const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5; +static S32 dump_num = 0; +std::string make_dump_name(std::string prefix, S32 num) +{ + return prefix + boost::lexical_cast(num) + std::string(".xml"); + +} void dumpLLSDToFile(const LLSD& content, std::string filename); std::string header_lod[] = @@ -498,7 +506,7 @@ public: //assert_main_thread(); llinfos << "completed" << llendl; mThread->mPendingUploads--; - dumpLLSDToFile(content,"whole_model_fee_response.xml"); + dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num)); if (isGoodStatus(status)) { mThread->mWholeModelUploadURL = content["uploader"].asString(); @@ -530,7 +538,7 @@ public: //assert_main_thread(); llinfos << "upload completed" << llendl; mThread->mPendingUploads--; - dumpLLSDToFile(content,"whole_model_upload_response.xml"); + dumpLLSDToFile(content,make_dump_name("whole_model_upload_response_",dump_num)); // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. mPostData["asset_type"] = "object"; @@ -1437,6 +1445,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLMeshUploadData data; data.mBaseModel = iter->first; + LLModelInstance& first_instance = *(iter->second.begin()); + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = first_instance.mLOD[i]; + } + if (mesh_index.find(data.mBaseModel) == mesh_index.end()) { // Have not seen this model before - create a new mesh_list entry for it. @@ -1573,13 +1587,15 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } result["asset_resources"] = res; - dumpLLSDToFile(result,"whole_model.xml"); + dumpLLSDToFile(result,make_dump_name("whole_model_",dump_num)); dest = result; } void LLMeshUploadThread::doWholeModelUpload() { + dump_num++; + mCurlRequest = new LLCurlRequest(); // Queue up models for hull generation (viewer-side) @@ -1627,7 +1643,7 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD model_data; wholeModelToLLSD(model_data,false); - dumpLLSDToFile(model_data,"whole_model_fee_request.xml"); + dumpLLSDToFile(model_data,make_dump_name("whole_model_fee_request_",dump_num)); mPendingUploads++; LLCurlRequest::headers_t headers; @@ -1649,7 +1665,7 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD full_model_data; wholeModelToLLSD(full_model_data, true); LLSD body = full_model_data["asset_resources"]; - dumpLLSDToFile(body,"whole_model_body.xml"); + dumpLLSDToFile(body,make_dump_name("whole_model_body_",dump_num)); mCurlRequest->post(mWholeModelUploadURL, headers, body, new LLWholeModelUploadResponder(this, model_data)); do @@ -3317,8 +3333,8 @@ bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const void LLMeshRepository::updateInventory(inventory_data data) { LLMutexLock lock(mMeshMutex); - dumpLLSDToFile(data.mPostData,"update_inventory_post_data.xml"); - dumpLLSDToFile(data.mResponse,"update_inventory_response.xml"); + dumpLLSDToFile(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num)); + dumpLLSDToFile(data.mResponse,make_dump_name("update_inventory_response_",dump_num)); mInventoryQ.push(data); } -- cgit v1.2.3 From 9ef81de6e15fe41a056112810237d2fdb908775b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 18:18:34 -0500 Subject: SH-1527 Fix for black alpha objects with lighting and shadows enabled and no lights around. --- .../shaders/class1/deferred/alphaSkinnedV.glsl | 25 +++++++++++++--------- .../shaders/class1/deferred/alphaV.glsl | 25 +++++++++++++--------- .../shaders/class1/deferred/avatarAlphaV.glsl | 25 +++++++++++++--------- .../shaders/class2/deferred/alphaSkinnedV.glsl | 25 +++++++++++++--------- .../shaders/class2/deferred/alphaV.glsl | 25 +++++++++++++--------- .../shaders/class2/deferred/avatarAlphaV.glsl | 25 +++++++++++++--------- 6 files changed, 90 insertions(+), 60 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 5addbbb176..65d9209983 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -35,19 +35,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa //get distance float d = length(lv); - //normalize light vector - lv *= 1.0/d; + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv *= 1.0/d; - //distance attenuation - float dist2 = d*d/(la*la); - float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + //distance attenuation + float dist2 = d*d/(la*la); + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 - //angular attenuation - da *= calcDirectionalLight(n, lv); + //angular attenuation + da *= calcDirectionalLight(n, lv); + } return da; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 525b68c437..2691fc8ded 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -36,19 +36,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa //get distance float d = length(lv); - //normalize light vector - lv *= 1.0/d; + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv *= 1.0/d; - //distance attenuation - float dist2 = d*d/(la*la); - float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + //distance attenuation + float dist2 = d*d/(la*la); + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 - //angular attenuation - da *= calcDirectionalLight(n, lv); + //angular attenuation + da *= calcDirectionalLight(n, lv); + } return da; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index a2a7dea20d..a012cb5030 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -35,19 +35,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa //get distance float d = length(lv); - //normalize light vector - lv *= 1.0/d; + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv *= 1.0/d; - //distance attenuation - float dist2 = d*d/(la*la); - float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + //distance attenuation + float dist2 = d*d/(la*la); + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 - //angular attenuation - da *= calcDirectionalLight(n, lv); + //angular attenuation + da *= calcDirectionalLight(n, lv); + } return da; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index d227346163..dfb36980b0 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -35,19 +35,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa //get distance float d = length(lv); - //normalize light vector - lv *= 1.0/d; + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv *= 1.0/d; - //distance attenuation - float dist2 = d*d/(la*la); - float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + //distance attenuation + float dist2 = d*d/(la*la); + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 - //angular attenuation - da *= calcDirectionalLight(n, lv); + //angular attenuation + da *= calcDirectionalLight(n, lv); + } return da; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 86f014df35..f6160815eb 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -35,19 +35,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa //get distance float d = length(lv); - //normalize light vector - lv *= 1.0/d; + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv *= 1.0/d; - //distance attenuation - float dist2 = d*d/(la*la); - float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + //distance attenuation + float dist2 = d*d/(la*la); + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 - //angular attenuation - da *= calcDirectionalLight(n, lv); + //angular attenuation + da *= calcDirectionalLight(n, lv); + } return da; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 495e86c8db..0ae09df0c6 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -37,19 +37,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa //get distance float d = length(lv); - //normalize light vector - lv *= 1.0/d; + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv *= 1.0/d; - //distance attenuation - float dist2 = d*d/(la*la); - float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + //distance attenuation + float dist2 = d*d/(la*la); + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 - //angular attenuation - da *= calcDirectionalLight(n, lv); + //angular attenuation + da *= calcDirectionalLight(n, lv); + } return da; } -- cgit v1.2.3 From 3a409e6edc95ddee8ea0ff88f8388a8aa840d871 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 18:45:21 -0500 Subject: SH-1603 Replace every occurrence of "WTF" with something more appropriate. --- indra/llcommon/llsdserialize.cpp | 4 ++- indra/llcommon/llstat.cpp | 2 +- indra/llmath/llvolume.cpp | 11 ++++---- indra/llprimitive/llmodel.cpp | 37 +++----------------------- indra/newview/lldrawable.cpp | 3 ++- indra/newview/llface.cpp | 9 +------ indra/newview/llfloatermodelpreview.cpp | 8 ++---- indra/newview/llmeshrepository.cpp | 35 +++++-------------------- indra/newview/llspatialpartition.cpp | 46 +++++++-------------------------- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llvotree.cpp | 5 ---- indra/newview/llvovolume.cpp | 10 +------ 12 files changed, 38 insertions(+), 134 deletions(-) diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 5be5ecc492..bf62600514 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2036,7 +2036,9 @@ std::string zip_llsd(LLSD& data) { //copy result into output if (strm.avail_out >= CHUNK) { - llerrs << "WTF?" << llendl; + free(output); + llwarns << "Failed to compress LLSD block." << llendl; + return std::string(); } have = CHUNK-strm.avail_out; diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp index 8ba97d7730..b2c495d093 100644 --- a/indra/llcommon/llstat.cpp +++ b/indra/llcommon/llstat.cpp @@ -737,7 +737,7 @@ void LLPerfBlock::addStatsToLLSDandReset( LLSD & stats, } } else - { // WTF? Shouldn't have a NULL pointer in the map. + { // Shouldn't have a NULL pointer in the map. llwarns << "Unexpected NULL dynamic stat at '" << stats_full_path << "'" << llendl; } } diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index c504215ee5..fbda824179 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -100,7 +100,7 @@ void assert_aligned(void* ptr, uintptr_t alignment) uintptr_t t = (uintptr_t) ptr; if (t%alignment != 0) { - llerrs << "WTF?" << llendl; + llerrs << "Alignment check failed." << llendl; } #endif } @@ -361,7 +361,7 @@ public: } else { - llerrs << "WTF? Empty leaf" << llendl; + llerrs << "Empty leaf" << llendl; } for (S32 i = 0; i < branch->getChildCount(); ++i) @@ -2159,8 +2159,9 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) U32 face_count = mdl.size(); if (face_count == 0) - { - llerrs << "WTF?" << llendl; + { //no faces unpacked, treat as failed decode + llwarns << "found no faces!" << llendl; + return false; } mVolumeFaces.resize(face_count); @@ -2179,7 +2180,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) if (idx.empty() || face.mNumIndices < 3) { //why is there an empty index list? - llerrs <<"WTF?" << llendl; + llwarns <<"Empty face present!" << llendl; continue; } diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 030a61cd55..3439cf3310 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -84,7 +84,7 @@ void load_face_from_dom_inputs(LLVolumeFace& face, const domInputLocalOffset_Arr domInputLocal_Array& v_inp = vertices->getInput_array(); if (inputs[j]->getOffset() != 0) { - llerrs << "WTF?" << llendl; + llerrs << "Vertex array offset MUST be zero." << llendl; } for (U32 k = 0; k < v_inp.getCount(); ++k) @@ -98,7 +98,7 @@ void load_face_from_dom_inputs(LLVolumeFace& face, const domInputLocalOffset_Arr if (src->getTechnique_common()->getAccessor()->getStride() != 3) { - llerrs << "WTF?" << llendl; + llerrs << "Vertex array stride MUST be three." << llendl; } domListOfFloats& v = src->getFloat_array()->getValue(); @@ -667,11 +667,6 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac } } - if (cur_idx != vert_idx.size()) - { - llerrs << "WTF?" << llendl; - } - //build vertex array from map std::vector new_verts; new_verts.resize(vert_idx.size()); @@ -926,11 +921,6 @@ void LLModel::normalizeVolumeFaces() { LLVector4a min, max; - if (mVolumeFaces[0].mNumVertices <= 0) - { - llerrs << "WTF?" << llendl; - } - // For all of the volume faces // in the model, loop over // them and see what the extents @@ -942,11 +932,6 @@ void LLModel::normalizeVolumeFaces() { LLVolumeFace& face = mVolumeFaces[i]; - if (face.mNumVertices <= 0) - { - llerrs << "WTF?" << llendl; - } - update_min_max(min, max, face.mExtents[0]); update_min_max(min, max, face.mExtents[1]); } @@ -1289,11 +1274,6 @@ void LLModel::generateNormals(F32 angle_cutoff) { LLVector4a& n = iter->second[k].getNormal(); - if (!iter->second[k].getPosition().equals3(new_face.mPositions[i])) - { - llerrs << "WTF?" << llendl; - } - F32 cur = n.dot3(ref_norm).getF32(); if (cur > best) @@ -1539,11 +1519,6 @@ LLSD LLModel::writeModel( weight_list& weights = high->getJointInfluences(pos); - if (weights.size() > 4) - { - llerrs << "WTF?" << llendl; - } - S32 count = 0; for (weight_list::iterator iter = weights.begin(); iter != weights.end(); ++iter) { @@ -1607,10 +1582,6 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite) cur_offset += size; bytes += size; } - else - { - llerrs << "WTF?" << llendl; - } } std::string decomposition; @@ -1685,7 +1656,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) { if ((iter->first - pos).magVec() > 0.1f) { - llerrs << "WTF?" << llendl; + llerrs << "Couldn't find weight list." << llendl; } return iter->second; @@ -2263,7 +2234,7 @@ LLSD LLModel::Decomposition::asLLSD() const if (vert_idx > p.size()) { - llerrs << "WTF?" << llendl; + llerrs << "Index out of bounds" << llendl; } } } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index bdc12ec0e3..7db13868d6 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -695,7 +695,8 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) { if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { - llerrs << "WTF?" << llendl; + llwarns << "Attempted to update distance for non-world camera." << llendl; + return; } //switch LOD with the spatial group to avoid artifacts diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 5398c13c44..9f9e50ad0a 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -364,14 +364,7 @@ void LLFace::setSize(S32 num_vertices, S32 num_indices, bool align) //allocate vertices in blocks of 4 for alignment num_vertices = (num_vertices + 0x3) & ~0x3; } - else - { - if (mDrawablep->getVOVolume()) - { - llerrs << "WTF?" << llendl; - } - } - + if (mGeomCount != num_vertices || mIndicesCount != num_indices) { diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 46327a6211..3bddd020e1 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1657,7 +1657,7 @@ bool LLModelLoader::doLoadModel() { if (pos.getCount() <= j+2) { - llerrs << "WTF?" << llendl; + llerrs << "Invalid position array size." << llendl; } LLVector3 v(pos[j], pos[j+1], pos[j+2]); @@ -4264,11 +4264,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) const LLModel::weight_list& weight_list = base_mdl->getJointInfluences(pos); LLVector4 w(0,0,0,0); - if (weight_list.size() > 4) - { - llerrs << "WTF?" << llendl; - } - + for (U32 i = 0; i < weight_list.size(); ++i) { F32 wght = llmin(weight_list[i].mWeight, 0.999999f); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index b79f120eda..429d035dd7 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -709,10 +709,7 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) if (pending != mPendingLOD.end()) { //append this lod request to existing header request pending->second.push_back(lod); - if (pending->second.size() > 4) - { - llerrs << "WTF?" << llendl; - } + llassert(pending->second.size() <= LLModel::NUM_LODS) } else { //if no header request is pending, fetch header @@ -1359,11 +1356,8 @@ void LLMeshUploadThread::DecompRequest::completed() mThread->mPhysicsComplete = true; } - if (mHull.size() != 1) - { - llerrs << "WTF?" << llendl; - } - + llassert(mHull.size() == 1); + mThread->mHullMap[mBaseModel] = mHull[0]; } @@ -1604,11 +1598,8 @@ void LLMeshUploadThread::doWholeModelUpload() physics = data.mModel[LLModel::LOD_HIGH]; } - if (!physics) - { - llerrs << "WTF?" << llendl; - } - + llassert(physics != NULL); + DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); gMeshRepo.mDecompThread->submitRequest(request); } @@ -2454,10 +2445,6 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para group->derefLOD(lod); } } - else - { - llerrs << "WTF?" << llendl; - } } return detail; @@ -3142,11 +3129,8 @@ LLSD LLMeshUploadThread::createObject(LLModelInstance& instance) { LLMatrix4 transformation = instance.mTransform; - if (instance.mMeshID.isNull()) - { - llerrs << "WTF?" << llendl; - } - + llassert(instance.mMeshID.notNull()); + // check for reflection BOOL reflected = (transformation.determinant() < 0); @@ -3535,11 +3519,6 @@ void LLPhysicsDecomp::doDecomposition() { ret = LLConvexDecomposition::getInstance()->setParam(param->mName, value.asBoolean()); } - - if (ret) - { - llerrs << "WTF?" << llendl; - } } mCurRequest->setStatusMessage("Executing."); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index fa329eb0ae..a812ba4e03 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -689,17 +689,8 @@ static LLFastTimer::DeclareTimer FTM_REBUILD_VBO("VBO Rebuilt"); void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) { - /*if (!gPipeline.hasRenderType(mDrawableType)) - { - return; - }*/ - if (group->isDead() || !group->isState(LLSpatialGroup::GEOM_DIRTY)) { - /*if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && mRenderByGroup) - { - llerrs << "WTF?" << llendl; - }*/ return; } @@ -961,21 +952,15 @@ void LLSpatialGroup::setState(U32 state) { mState |= state; - if (state > LLSpatialGroup::STATE_MASK) - { - llerrs << "WTF?" << llendl; - } + llassert(state <= LLSpatialGroup::STATE_MASK); } void LLSpatialGroup::setState(U32 state, S32 mode) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); - if (state > LLSpatialGroup::STATE_MASK) - { - llerrs << "WTF?" << llendl; - } - + llassert(state <= LLSpatialGroup::STATE_MASK); + if (mode > STATE_MODE_SINGLE) { if (mode == STATE_MODE_DIFF) @@ -1021,20 +1006,14 @@ public: void LLSpatialGroup::clearState(U32 state) { - if (state > LLSpatialGroup::STATE_MASK) - { - llerrs << "WTF?" << llendl; - } + llassert(state <= LLSpatialGroup::STATE_MASK); mState &= ~state; } void LLSpatialGroup::clearState(U32 state, S32 mode) { - if (state > LLSpatialGroup::STATE_MASK) - { - llerrs << "WTF?" << llendl; - } + llassert(state <= LLSpatialGroup::STATE_MASK); LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); @@ -1059,10 +1038,7 @@ void LLSpatialGroup::clearState(U32 state, S32 mode) BOOL LLSpatialGroup::isState(U32 state) const { - if (state > LLSpatialGroup::STATE_MASK) - { - llerrs << "WTF?" << llendl; - } + llassert(state <= LLSpatialGroup::STATE_MASK); return mState & state ? TRUE : FALSE; } @@ -1250,7 +1226,8 @@ void LLSpatialGroup::updateDistance(LLCamera &camera) { if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { - llerrs << "WTF?" << llendl; + llwarns << "Attempted to update distance for camera other than world camera!" << llendl; + return; } #if !LL_RELEASE_FOR_DOWNLOAD @@ -2064,11 +2041,8 @@ public: virtual void processGroup(LLSpatialGroup* group) { - if (group->isState(LLSpatialGroup::DIRTY) || group->getData().empty()) - { - llerrs << "WTF?" << llendl; - } - + llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->getData().empty()) + if (mRes < 2) { if (mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]) > 0) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e7878d8adf..72cdb4b355 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1894,7 +1894,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // - // WTF? If we're going to skip this message, why are we + // If we're going to skip this message, why are we // doing all the parenting, etc above? U32 packet_id = mesgsys->getCurrentRecvPacketID(); if (packet_id < mLatestRecvPacketID && diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 8946d4e0b6..3c7fe708e6 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -980,11 +980,6 @@ void LLVOTree::appendMesh(LLStrider& vertices, for (S32 i = 0; i < index_count; i++) { U16 index = index_offset + i; - if (idx[index] >= vert_start + vert_count || - idx[index] < vert_start) - { - llerrs << "WTF?" << llendl; - } *indices++ = idx[index]-vert_start+cur_idx; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e9a8c9b80a..943de669f6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4297,11 +4297,6 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) face->getGeometryVolume(*volume, face->getTEOffset(), vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex()); } - - if (!face) - { - llerrs << "WTF?" << llendl; - } } drawablep->clearState(LLDrawable::REBUILD_ALL); @@ -4356,10 +4351,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO); } - if (group && group->isState(LLSpatialGroup::NEW_DRAWINFO)) - { - llerrs << "WTF?" << llendl; - } + llassert(!group || !group->isState(LLSpatialGroup::NEW_DRAWINFO)); } void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort) -- cgit v1.2.3 From 3a2c3a45aa5db8592c75601ec1fbf43eea85ccb6 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 19:23:41 -0500 Subject: Remove unused variable. --- indra/llrender/llgl.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 77b34eb546..96b1838158 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1480,10 +1480,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) gFailLog << "Texture matrix in channel " << i << " corrupt." << std::endl; } } - - - S32 num_texture_types = 8; - + for (S32 j = (i == 0 ? 1 : 0); j < 9; j++) { -- cgit v1.2.3 From a6fa155725205d1e6207abfe1112f92bbe38203d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 May 2011 19:23:57 -0500 Subject: Make avatars use same shadow offset magic as prims. --- .../app_settings/shaders/class1/deferred/avatarShadowF.glsl | 3 +++ .../app_settings/shaders/class1/deferred/avatarShadowV.glsl | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 1b7ae06888..3d0884bbe8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -9,10 +9,13 @@ uniform sampler2D diffuseMap; +varying vec4 post_pos; void main() { //gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); gl_FragColor = vec4(1,1,1,1); + + gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index cf6579a40d..3460f40657 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -11,6 +11,8 @@ mat4 getSkinnedTransform(); attribute vec4 weight; +varying vec4 post_pos; + void main() { gl_TexCoord[0] = gl_MultiTexCoord0; @@ -30,8 +32,9 @@ void main() norm = normalize(norm); pos = gl_ProjectionMatrix * pos; - pos.z = max(pos.z, -pos.w+0.01); - gl_Position = pos; + post_pos = pos; + + gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); gl_FrontColor = gl_Color; } -- cgit v1.2.3 From 9ecc872b731b5863f320446089bc5679832b0890 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 26 May 2011 05:43:35 -0400 Subject: STORM-1273 Duplicate entries in settings.xml --- doc/contributions.txt | 1 + indra/newview/app_settings/settings.xml | 22 ---------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index dfbccb5a6c..f226865442 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -440,6 +440,7 @@ Jonathan Yap STORM-1095 STORM-1236 STORM-1259 + STORM-1273 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 78db307d64..1a202c168a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3245,17 +3245,6 @@ Value 1 - FirstLoginThisInstall - - Comment - Specifies that you have not successfully logged in since you installed the latest update - Persist - 1 - Type - Boolean - Value - 1 - FirstName Comment @@ -8857,17 +8846,6 @@ 0 RenderUseTriStrips - - Comment - Use triangle strips for rendering prims. - Persist - 1 - Type - Boolean - Value - 0 - - RenderUseTriStrips Comment Use triangle strips for rendering prims. -- cgit v1.2.3 From bf8b02b1f31ac1b3959a537568b712fdf16d02e2 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 26 May 2011 09:17:14 -0400 Subject: STORM-899 'No attachments worn' text on blank 'Attachments' accordion remains in English for all locales --- doc/contributions.txt | 1 + indra/newview/llcofwearables.cpp | 3 ++- indra/newview/llcofwearables.h | 2 +- indra/newview/skins/default/xui/en/panel_cof_wearables.xml | 3 --- indra/newview/skins/default/xui/en/strings.xml | 2 ++ 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index dfbccb5a6c..c837fdd468 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -440,6 +440,7 @@ Jonathan Yap STORM-1095 STORM-1236 STORM-1259 + STORM-899 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 84c560639e..9a30979b9b 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -296,7 +296,7 @@ LLCOFWearables::~LLCOFWearables() // virtual BOOL LLCOFWearables::postBuild() { - mAttachments = getChild("list_attachments"); + mAttachments = getChild("list_attachments"); mClothing = getChild("list_clothing"); mBodyParts = getChild("list_body_parts"); @@ -317,6 +317,7 @@ BOOL LLCOFWearables::postBuild() mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR); mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR); + mAttachments->setNoItemsMsg(getString("no_attachments")); mClothingTab = getChild("tab_clothing"); mClothingTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 1f8d6d0c94..271e36e87d 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -106,7 +106,7 @@ protected: void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu); - LLFlatListView* mAttachments; + LLFlatListViewEx* mAttachments; LLFlatListView* mClothing; LLFlatListView* mBodyParts; diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml index f438e3d42d..bbeb592e96 100644 --- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml +++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml @@ -53,9 +53,6 @@ name="list_attachments" top="0" width="311"> - - Friends All + No attachments worn + Buy -- cgit v1.2.3 From 8b552a25c4fb1e9babdd52c5a5acee3540f353ac Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 26 May 2011 13:56:12 -0400 Subject: SH-1492 WIP - include face info even if textures not being uploaded --- indra/newview/llmeshrepository.cpp | 88 ++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d4be311be8..7c75599a15 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1525,60 +1525,56 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); instance_entry["mesh"] = mesh_index[data.mBaseModel]; - if (mUploadTextures) + instance_entry["face_list"] = LLSD::emptyArray(); + + for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) { - instance_entry["face_list"] = LLSD::emptyArray(); + LLImportMaterial& material = instance.mMaterial[face_num]; + LLSD face_entry = LLSD::emptyMap(); + LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); + + if ((texture != NULL) && + (textures.find(texture) == textures.end())) + { + textures.insert(texture); + } - for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) + std::stringstream texture_str; + if (texture != NULL && include_textures && mUploadTextures) { - LLImportMaterial& material = instance.mMaterial[face_num]; - LLSD face_entry = LLSD::emptyMap(); - LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); - - if (texture != NULL) + // Get binary rep of texture, if needed. + LLTextureUploadData data(texture, material.mDiffuseMapLabel); + if (!data.mTexture->isRawImageValid()) { - if (textures.find(texture) == textures.end()) - { - textures.insert(texture); - } - - std::stringstream ostr; - if (include_textures) // otherwise data is blank. - { - LLTextureUploadData data(texture, material.mDiffuseMapLabel); - if (!data.mTexture->isRawImageValid()) - { - data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); - } + data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + } - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); - ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); - } + LLPointer upload_file = + LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); + texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } - if (texture_index.find(texture) == texture_index.end()) - { - texture_index[texture] = texture_num; - std::string str = ostr.str(); - res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); - texture_num++; - } - } + if (texture_index.find(texture) == texture_index.end()) + { + texture_index[texture] = texture_num; + std::string str = texture_str.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); + texture_num++; + } - // Subset of TextureEntry fields. - if (texture) - { - face_entry["image"] = texture_index[texture]; - } - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; - face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); - face_entry["fullbright"] = material.mFullbright; - instance_entry["face_list"][face_num] = face_entry; + // Subset of TextureEntry fields. + if (texture) + { + face_entry["image"] = texture_index[texture]; } + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["fullbright"] = material.mFullbright; + instance_entry["face_list"][face_num] = face_entry; } res["instance_list"][instance_num] = instance_entry; -- cgit v1.2.3 From 01c5e12853b60d6f9ddc4f32b1450548beb09736 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 26 May 2011 18:22:14 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 7c75599a15..5074caccb6 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1554,7 +1554,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); } - if (texture_index.find(texture) == texture_index.end()) + if (texture != NULL && + mUploadTextures && + texture_index.find(texture) == texture_index.end()) { texture_index[texture] = texture_num; std::string str = texture_str.str(); @@ -1563,15 +1565,15 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } // Subset of TextureEntry fields. - if (texture) + if (texture != NULL && mUploadTextures) { face_entry["image"] = texture_index[texture]; + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; } - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); face_entry["fullbright"] = material.mFullbright; instance_entry["face_list"][face_num] = face_entry; -- cgit v1.2.3 From 53e890f4fdab1ab014b745c5d872b240b8c4ce76 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 26 May 2011 20:37:15 -0500 Subject: SH-1359 General octree tune-up -- increase maximum capacity of an octree node and rework requested octree node sizes for minimum triangles per frame and maximum triangles per drawing call. --- indra/llmath/lloctree.h | 11 +++-- indra/newview/app_settings/settings.xml | 75 +++++++++++++++++++++++++++++++-- indra/newview/lldrawable.cpp | 9 +++- indra/newview/lldrawable.h | 1 + indra/newview/llspatialpartition.cpp | 42 ++++++++---------- indra/newview/llviewercontrol.cpp | 16 +++++++ indra/newview/llviewerdisplay.cpp | 1 + indra/newview/llviewerobjectlist.cpp | 18 ++++++++ indra/newview/llviewerobjectlist.h | 1 + indra/newview/llvovolume.cpp | 48 +++++++++++++++------ indra/newview/pipeline.cpp | 28 +++++++++++- indra/newview/pipeline.h | 7 ++- 12 files changed, 208 insertions(+), 49 deletions(-) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index fdfc24f8b7..e5ca47da69 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -35,12 +35,14 @@ #define OCT_ERRS LL_WARNS("OctreeErrors") -#define LL_OCTREE_PARANOIA_CHECK 0 + +extern U32 gOctreeMaxCapacity; +/*#define LL_OCTREE_PARANOIA_CHECK 0 #if LL_DARWIN #define LL_OCTREE_MAX_CAPACITY 32 #else #define LL_OCTREE_MAX_CAPACITY 128 -#endif +#endif*/ template class LLOctreeNode; @@ -74,6 +76,7 @@ template class LLOctreeNode : public LLTreeNode { public: + typedef LLOctreeTraveler oct_traveler; typedef LLTreeTraveler tree_traveler; typedef typename std::set > element_list; @@ -294,8 +297,8 @@ public: //is it here? if (isInside(data->getPositionGroup())) { - if ((getElementCount() < LL_OCTREE_MAX_CAPACITY && contains(data->getBinRadius()) || - (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= LL_OCTREE_MAX_CAPACITY))) + if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) || + (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) { //it belongs here #if LL_OCTREE_PARANOIA_CHECK //if this is a redundant insertion, error out (should never happen) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 78db307d64..2c6d75e3c9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7091,7 +7091,76 @@ Value 1 - RenderAnisotropic + + OctreeMaxNodeCapacity + + Comment + Maximum number of elements to store in a single octree node + Persist + 1 + Type + U32 + Value + 128 + + + OctreeStaticObjectSizeFactor + + Comment + Multiplier on static object size for determining octree node size + Persist + 1 + Type + S32 + Value + 1 + + + OctreeAlphaDistanceFactor + + Comment + Multiplier on alpha object distance for determining octree node size + Persist + 1 + Type + Vector3 + Value + + 0.05 + 0.0 + 0.0 + + + + OctreeAttachmentSizeFactor + + Comment + Multiplier on attachment size for determining octree node size + Persist + 1 + Type + S32 + Value + 4 + + + OctreeDistanceFactor + + Comment + Multiplier on distance for determining octree node size + Persist + 1 + Type + Vector3 + Value + + 0.05 + 0.0 + 0.0 + + + + RenderAnisotropic Comment Render textures using anisotropic filtering @@ -7188,7 +7257,7 @@ Type F32 Value - 1.0 + 1.0 RenderAvatarVP @@ -8589,7 +8658,7 @@ Type S32 Value - 8192 + 65536 RenderMaxVBOSize diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 7db13868d6..ad3710843c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -94,7 +94,9 @@ void LLDrawable::init() mRenderType = 0; mCurrentScale = LLVector3(1,1,1); mDistanceWRTCamera = 0.0f; - + mPositionGroup.clear(); + mExtents[0].clear(); + mExtents[1].clear(); mQuietCount = 0; mState = 0; @@ -587,7 +589,10 @@ void LLDrawable::setRadius(F32 radius) void LLDrawable::moveUpdatePipeline(BOOL moved) { - makeActive(); + if (moved) + { + makeActive(); + } // Update the face centers. for (S32 i = 0; i < getNumFaces(); i++) diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 9ebe1a45b4..e268640a21 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -276,6 +276,7 @@ public: REBUILD_SHADOW = 0x02000000, HAS_ALPHA = 0x04000000, RIGGED = 0x08000000, + PARTITION_MOVE = 0x10000000, } EDrawableFlags; private: //aligned members diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index a812ba4e03..8143d6a41f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -69,6 +69,7 @@ U32 LLSpatialGroup::sNodeCount = 0; std::set LLSpatialGroup::sPendingQueries; +U32 gOctreeMaxCapacity; BOOL LLSpatialGroup::sNoDelete = FALSE; @@ -630,7 +631,7 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate) if (mOctreeNode->isInside(drawablep->getPositionGroup()) && (mOctreeNode->contains(drawablep) || (drawablep->getBinRadius() > mOctreeNode->getSize()[0] && - parent && parent->getElementCount() >= LL_OCTREE_MAX_CAPACITY))) + parent && parent->getElementCount() >= gOctreeMaxCapacity))) { unbound(); setState(OBJECT_DIRTY); @@ -2515,7 +2516,7 @@ void renderOctree(LLSpatialGroup* group) //coded by buffer usage and activity gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); LLVector4 col; - if (group->mBuilt > 0.f) + /*if (group->mBuilt > 0.f) { group->mBuilt -= 2.f * gFrameIntervalSeconds; if (group->mBufferUsage == GL_STATIC_DRAW_ARB) @@ -2584,7 +2585,7 @@ void renderOctree(LLSpatialGroup* group) gGL.color4f(1,1,1,1); } } - else + else*/ { if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty() && group->mSpatialPartition->mRenderByGroup) @@ -2604,33 +2605,24 @@ void renderOctree(LLSpatialGroup* group) size.mul(1.01f); size.add(fudge); - { - LLGLDepthTest depth(GL_TRUE, GL_FALSE); - drawBox(group->mObjectBounds[0], fudge); - } + //{ + // LLGLDepthTest depth(GL_TRUE, GL_FALSE); + // drawBox(group->mObjectBounds[0], fudge); + //} gGL.setSceneBlendType(LLRender::BT_ALPHA); - if (group->mBuilt <= 0.f) + //if (group->mBuilt <= 0.f) { //draw opaque outline - gGL.color4f(col.mV[0], col.mV[1], col.mV[2], 1.f); - drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); + //gGL.color4f(col.mV[0], col.mV[1], col.mV[2], 1.f); + //drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); - if (group->mOctreeNode->isLeaf()) - { - gGL.color4f(1,1,1,1); - } - else - { - gGL.color4f(0,1,1,1); - } - + gGL.color4f(0,1,1,1); drawBoxOutline(group->mBounds[0],group->mBounds[1]); - - + //draw bounding box for draw info - if (group->mSpatialPartition->mRenderByGroup) + /*if (group->mSpatialPartition->mRenderByGroup) { gGL.color4f(1.0f, 0.75f, 0.25f, 0.6f); for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) @@ -2647,7 +2639,7 @@ void renderOctree(LLSpatialGroup* group) drawBoxOutline(center, size); } } - } + }*/ } // LLSpatialGroup::OctreeNode* node = group->mOctreeNode; @@ -2690,7 +2682,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) gGL.color4f(0.f, 0.75f, 0.f, 0.5f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } - else if (camera && group->mOcclusionVerts.notNull()) + /*else if (camera && group->mOcclusionVerts.notNull()) { LLVertexBuffer::unbind(); group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -2702,7 +2694,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) glColor4f(1.0f, 1.f, 1.f, 1.0f); group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0])); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } + }*/ } } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 00a0b87d93..61200db2b9 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -57,6 +57,7 @@ #include "llworld.h" #include "pipeline.h" #include "llviewerjoystick.h" +#include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llparcel.h" #include "llkeyboard.h" @@ -372,6 +373,16 @@ static bool handleResetVertexBuffersChanged(const LLSD&) return true; } +static bool handleRepartition(const LLSD&) +{ + if (gPipeline.isInit()) + { + gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); + gObjectList.repartitionObjects(); + } + return true; +} + static bool handleRenderDynamicLODChanged(const LLSD& newvalue) { LLPipeline::sDynamicLOD = newvalue.asBoolean(); @@ -575,6 +586,11 @@ void settings_setup_listeners() gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2)); gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2)); gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2)); + gSavedSettings.getControl("OctreeStaticObjectSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); + gSavedSettings.getControl("OctreeDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); + gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2)); + gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); + gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 10e96525ce..5dadd2c33b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -582,6 +582,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLMemType mt_ug(LLMemType::MTYPE_DISPLAY_UPDATE_GEOM); const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time gPipeline.createObjects(max_geom_update_time); + gPipeline.processPartitionQ(); gPipeline.updateGeom(max_geom_update_time); stop_glerror(); } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 78b06b0764..45c6777ae8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1497,6 +1497,24 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset) LLWorld::getInstance()->shiftRegions(offset); } +void LLViewerObjectList::repartitionObjects() +{ + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) + { + LLViewerObject* objectp = *iter; + if (!objectp->isDead()) + { + LLDrawable* drawable = objectp->mDrawable; + if (drawable && !drawable->isDead()) + { + drawable->updateBinRadius(); + drawable->updateSpatialExtents(); + drawable->movePartition(); + } + } + } +} + //debug code bool LLViewerObjectList::hasMapObjectInRegion(LLViewerRegion* regionp) { diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 6f0d285f5d..9d1b5cb56f 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -105,6 +105,7 @@ public: void updateQuota( const LLUUID& objectId, const SelectionQuota& costs ); void shiftObjects(const LLVector3 &offset); + void repartitionObjects(); bool hasMapObjectInRegion(LLViewerRegion* regionp) ; void clearAllMapObjectsInRegion(LLViewerRegion* regionp) ; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 943de669f6..cc443d32fb 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1245,7 +1245,19 @@ BOOL LLVOVolume::calcLOD() if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LOD_INFO)) { - setDebugText(llformat("%.2f:%.2f, %d", debug_distance, radius, cur_detail)); + //setDebugText(llformat("%.2f:%.2f, %d", debug_distance, radius, cur_detail)); + + F32 bin_radius = getBinRadius(); + F32 node_size = 0.f; + + LLSpatialGroup* group = mDrawable->getSpatialGroup(); + if (group) + { + LLSpatialGroup::OctreeNode* node = group->mOctreeNode; + node_size = node->getSize()[0]; + } + + setDebugText(llformat("%.2f:%.2f", bin_radius, node_size)); } if (cur_detail != mLOD) @@ -1274,6 +1286,15 @@ BOOL LLVOVolume::updateLOD() gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); mLODChanged = TRUE; } + else + { + F32 new_radius = getBinRadius(); + F32 old_radius = mDrawable->getBinRadius(); + if (new_radius < old_radius * 0.9f || new_radius > old_radius*1.1f) + { + gPipeline.markPartitionMove(mDrawable); + } + } lod_changed = lod_changed || LLViewerObject::updateLOD(); @@ -3187,6 +3208,10 @@ F32 LLVOVolume::getBinRadius() F32 scale = 1.f; + S32 size_factor = llmax(gSavedSettings.getS32("OctreeStaticObjectSizeFactor"), 1); + S32 attachment_size_factor = llmax(gSavedSettings.getS32("OctreeAttachmentSizeFactor"), 1); + LLVector3 distance_factor = gSavedSettings.getVector3("OctreeDistanceFactor"); + LLVector3 alpha_distance_factor = gSavedSettings.getVector3("OctreeAlphaDistanceFactor"); const LLVector4a* ext = mDrawable->getSpatialExtents(); BOOL shrink_wrap = mDrawable->isAnimating(); @@ -3216,6 +3241,8 @@ F32 LLVOVolume::getBinRadius() radius = llmin(bounds.mV[1], bounds.mV[2]); radius = llmin(radius, bounds.mV[0]); radius *= 0.5f; + radius *= 1.f+mDrawable->mDistanceWRTCamera*alpha_distance_factor[1]; + radius += mDrawable->mDistanceWRTCamera*alpha_distance_factor[0]; } else if (shrink_wrap) { @@ -3226,24 +3253,19 @@ F32 LLVOVolume::getBinRadius() } else if (mDrawable->isStatic()) { - /*if (mDrawable->getRadius() < 2.0f) - { - radius = 16.f; - } - else - { - radius = llmax(mDrawable->getRadius(), 32.f); - }*/ - - radius = (((S32) mDrawable->getRadius())/2+1)*8; + radius = llmax((S32) mDrawable->getRadius(), 1)*size_factor; + radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1]; + radius += mDrawable->mDistanceWRTCamera * distance_factor[0]; } else if (mDrawable->getVObj()->isAttachment()) { - radius = (((S32) (mDrawable->getRadius()*4)+1))*2; + radius = llmax((S32) mDrawable->getRadius(),1)*attachment_size_factor; } else { - radius = 8.f; + radius = mDrawable->getRadius(); + radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1]; + radius += mDrawable->mDistanceWRTCamera * distance_factor[0]; } return llclamp(radius*scale, 0.5f, 256.f); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1214d1b545..fadae7c71e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -392,6 +392,7 @@ void LLPipeline::init() { LLMemType mt(LLMemType::MTYPE_PIPELINE_INIT); + gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); @@ -2519,6 +2520,32 @@ void LLPipeline::markGLRebuild(LLGLUpdate* glu) } } +void LLPipeline::markPartitionMove(LLDrawable* drawable) +{ + if (!drawable->isState(LLDrawable::PARTITION_MOVE) && + !drawable->getPositionGroup().equals3(LLVector4a::getZero())) + { + drawable->setState(LLDrawable::PARTITION_MOVE); + mPartitionQ.push_back(drawable); + } +} + +void LLPipeline::processPartitionQ() +{ + for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter) + { + LLDrawable* drawable = *iter; + if (!drawable->isDead()) + { + drawable->updateBinRadius(); + drawable->movePartition(); + } + drawable->clearState(LLDrawable::PARTITION_MOVE); + } + + mPartitionQ.clear(); +} + void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority) { LLMemType mt(LLMemType::MTYPE_PIPELINE); @@ -5888,7 +5915,6 @@ LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj) return NULL; } - void LLPipeline::resetVertexBuffers(LLDrawable* drawable) { if (!drawable || drawable->isDead()) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index ed4a803e7e..e967b8c31e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -157,7 +157,8 @@ public: void markGLRebuild(LLGLUpdate* glu); void markRebuild(LLSpatialGroup* group, BOOL priority = FALSE); void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE); - + void markPartitionMove(LLDrawable* drawablep); + //get the object between start and end that's closest to start. LLViewerObject* lineSegmentIntersectInWorld(const LLVector3& start, const LLVector3& end, BOOL pick_transparent, @@ -211,6 +212,7 @@ public: void updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip = 0, LLPlane* plane = NULL); //if water_clip is 0, ignore water plane, 1, cull to above plane, -1, cull to below plane void createObjects(F32 max_dtime); void createObject(LLViewerObject* vobj); + void processPartitionQ(); void updateGeom(F32 max_dtime); void updateGL(); void rebuildPriorityGroups(); @@ -636,6 +638,9 @@ protected: LLDrawable::drawable_list_t mBuildQ2; // non-priority LLSpatialGroup::sg_vector_t mGroupQ1; //priority LLSpatialGroup::sg_vector_t mGroupQ2; // non-priority + + LLDrawable::drawable_list_t mPartitionQ; //drawables that need to update their spatial partition radius + bool mGroupQ2Locked; bool mGroupQ1Locked; -- cgit v1.2.3 From 31e850d04885bed2ac779c66bb6b7923a0a51d96 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 27 May 2011 11:50:39 -0700 Subject: transplant fix for SH-1467 viewer now uses simulatorfeatures to check whether to show UI elements for mesh or not --- indra/llmessage/message_prehash.cpp | 1 + indra/llmessage/message_prehash.h | 1 + indra/newview/llfloaterregioninfo.cpp | 5 ++- indra/newview/llfloatertools.cpp | 7 ++--- indra/newview/llmanipscale.cpp | 5 ++- indra/newview/llmeshrepository.cpp | 31 +++++++++++++++++++ indra/newview/llmeshrepository.h | 4 +++ indra/newview/llpanelobject.cpp | 5 ++- indra/newview/llpanelvolume.cpp | 14 +++++++-- indra/newview/llviewermenufile.cpp | 4 +-- indra/newview/llviewerregion.cpp | 57 +++++++++++++++++++++++++++++++++++ indra/newview/llviewerregion.h | 4 +++ indra/newview/llviewerwindow.cpp | 2 +- 13 files changed, 120 insertions(+), 20 deletions(-) diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 5d03615e53..6133f50637 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -742,6 +742,7 @@ char const* const _PREHASH_MoneyData = LLMessageStringTable::getInstance()->getS char const* const _PREHASH_ObjectDeselect = LLMessageStringTable::getInstance()->getString("ObjectDeselect"); char const* const _PREHASH_NewAssetID = LLMessageStringTable::getInstance()->getString("NewAssetID"); char const* const _PREHASH_ObjectAdd = LLMessageStringTable::getInstance()->getString("ObjectAdd"); +char const* const _PREHASH_SimulatorFeatures = LLMessageStringTable::getInstance()->getString("SimulatorFeatures"); char const* const _PREHASH_RayEndIsIntersection = LLMessageStringTable::getInstance()->getString("RayEndIsIntersection"); char const* const _PREHASH_CompleteAuction = LLMessageStringTable::getInstance()->getString("CompleteAuction"); char const* const _PREHASH_CircuitCode = LLMessageStringTable::getInstance()->getString("CircuitCode"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 8dc86601e6..f94ee1ed22 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -742,6 +742,7 @@ extern char const* const _PREHASH_MoneyData; extern char const* const _PREHASH_ObjectDeselect; extern char const* const _PREHASH_NewAssetID; extern char const* const _PREHASH_ObjectAdd; +extern char const* const _PREHASH_SimulatorFeatures; extern char const* const _PREHASH_RayEndIsIntersection; extern char const* const _PREHASH_CompleteAuction; extern char const* const _PREHASH_CircuitCode; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fc6976755f..6b3e3088d5 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -82,6 +82,7 @@ #include "llvlcomposition.h" #include "lltrans.h" #include "llagentui.h" +#include "llmeshrepository.h" const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; @@ -590,9 +591,7 @@ bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) getChildView("im_btn")->setEnabled(allow_modify); getChildView("manage_telehub_btn")->setEnabled(allow_modify); - const bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") && - gAgent.getRegion() && - !gAgent.getRegion()->getCapability("GetMesh").empty(); + const bool enable_mesh = gMeshRepo.meshRezEnabled(); getChildView("mesh_rez_enabled_check")->setVisible(enable_mesh); getChildView("mesh_rez_enabled_check")->setEnabled(getChildView("mesh_rez_enabled_check")->getEnabled() && enable_mesh); // Data gets filled in by processRegionInfo diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 061a42ab57..0f11d05175 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -86,6 +86,7 @@ #include "llvovolume.h" #include "lluictrlfactory.h" #include "llaccountingquotamanager.h" +#include "llmeshrepository.h" // Globals LLFloaterTools *gFloaterTools = NULL; @@ -423,7 +424,7 @@ void LLFloaterTools::refresh() // Refresh object and prim count labels LLLocale locale(LLLocale::USER_LOCALE); - if ((gAgent.getRegion() && gAgent.getRegion()->getCapability("GetMesh").empty()) || !gSavedSettings.getBOOL("MeshEnabled")) + if (gMeshRepo.meshRezEnabled()) { std::string obj_count_string; LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); @@ -788,9 +789,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) getChildView("Strength:")->setVisible( land_visible); } - bool show_mesh_cost = gAgent.getRegion() && - !gAgent.getRegion()->getCapability("GetMesh").empty() && - gSavedSettings.getBOOL("MeshEnabled"); + bool show_mesh_cost = gMeshRepo.meshRezEnabled(); getChildView("obj_count")->setVisible( !land_visible && !show_mesh_cost); getChildView("prim_count")->setVisible( !land_visible && !show_mesh_cost); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 738d82e732..4eb94dfb8e 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -58,6 +58,7 @@ #include "llworld.h" #include "v2math.h" #include "llvoavatar.h" +#include "llmeshrepository.h" const F32 MAX_MANIP_SELECT_DISTANCE_SQUARED = 11.f * 11.f; @@ -90,9 +91,7 @@ F32 get_default_max_prim_scale(bool is_flora) { // a bit of a hack, but if it's foilage, we don't want to use the // new larger scale which would result in giant trees and grass - if (gSavedSettings.getBOOL("MeshEnabled") && - gAgent.getRegion() && - !gAgent.getRegion()->getCapability("GetMesh").empty() && + if (gMeshRepo.meshRezEnabled() && !is_flora) { return DEFAULT_MAX_PRIM_SCALE; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4464d299ed..4e75219c3e 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -61,6 +61,7 @@ #include "pipeline.h" #include "llinventorymodel.h" #include "llfoldertype.h" +#include "llviewerparcelmgr.h" #include "boost/lexical_cast.hpp" @@ -3957,3 +3958,33 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) } } } + +bool LLMeshRepository::meshUploadEnabled() +{ + LLViewerRegion *region = gAgent.getRegion(); + if(gSavedSettings.getBOOL("MeshEnabled") && + LLViewerParcelMgr::getInstance()->allowAgentBuild() && + region) + { + LLSD sim_features; + region->getSimulatorFeatures(sim_features); + return (sim_features.has("MeshUploadEnabled") && + sim_features["MeshUploadEnabled"].asBoolean()); + } + return false; +} + +bool LLMeshRepository::meshRezEnabled() +{ + LLViewerRegion *region = gAgent.getRegion(); + if(gSavedSettings.getBOOL("MeshEnabled") && + region) + { + LLSD sim_features; + region->getSimulatorFeatures(sim_features); + return (sim_features.has("MeshRezEnabled") && + sim_features["MeshRezEnabled"].asBoolean()); + } + return false; +} + diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 0a6954bade..44cf7dadf6 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -482,6 +482,10 @@ public: void buildHull(const LLVolumeParams& params, S32 detail); void buildPhysicsMesh(LLModel::Decomposition& decomp); + + bool meshUploadEnabled(); + bool meshRezEnabled(); + LLSD& getMeshHeader(const LLUUID& mesh_id); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 34a92cd0ac..61241e3ce5 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -64,6 +64,7 @@ #include "pipeline.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" +#include "llmeshrepository.h" //#include "llfirstuse.h" #include "lldrawpool.h" @@ -1740,9 +1741,7 @@ void LLPanelObject::refresh() mRootObject = NULL; } - bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") && - gAgent.getRegion() && - !gAgent.getRegion()->getCapability("GetMesh").empty(); + bool enable_mesh = gMeshRepo.meshRezEnabled(); F32 max_scale = get_default_max_prim_scale(LLPickInfo::isFlora(mObject)); diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index ebddaa90bc..bb87601d20 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -530,16 +530,24 @@ void LLPanelVolume::refresh() getChildView("Light Ambiance")->setVisible( visible); getChildView("light texture control")->setVisible( visible); - bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") && - gAgent.getRegion() && - !gAgent.getRegion()->getCapability("GetMesh").empty(); + bool enable_mesh = false; + LLSD sim_features; + LLViewerRegion *region = gAgent.getRegion(); + if(region) + { + LLSD sim_features; + region->getSimulatorFeatures(sim_features); + enable_mesh = sim_features.has("PhysicsShapeTypes"); + } getChildView("label physicsshapetype")->setVisible(enable_mesh); getChildView("Physics Shape Type Combo Ctrl")->setVisible(enable_mesh); getChildView("Physics Gravity")->setVisible(enable_mesh); getChildView("Physics Friction")->setVisible(enable_mesh); getChildView("Physics Density")->setVisible(enable_mesh); getChildView("Physics Restitution")->setVisible(enable_mesh); + + /* TODO: add/remove individual physics shape types as per the PhysicsShapeTypes simulator features */ } diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 37640ad0d4..b2080a5b82 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -107,9 +107,7 @@ class LLMeshUploadVisible : public view_listener_t { bool handleEvent(const LLSD& userdata) { - return gSavedSettings.getBOOL("MeshEnabled") && - LLViewerParcelMgr::getInstance()->allowAgentBuild() && - !gAgent.getRegion()->getCapability("ObjectAdd").empty(); + return gMeshRepo.meshUploadEnabled(); } }; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index fb608b3a4f..41437329c1 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -69,6 +69,7 @@ #include "llspatialpartition.h" #include "stringize.h" #include "llviewercontrol.h" +#include "llsdserialize.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -1140,6 +1141,20 @@ void LLViewerRegion::getInfo(LLSD& info) info["Region"]["Handle"]["y"] = (LLSD::Integer)y; } +void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features) +{ + sim_features = mSimulatorFeatures; +} + +void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) +{ + std::stringstream str; + + LLSDSerialize::toPrettyXML(sim_features, str); + llinfos << str.str() << llendl; + mSimulatorFeatures = sim_features; +} + LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) { U32 local_id = objectp->getLocalID(); @@ -1559,6 +1574,42 @@ void LLViewerRegion::setSeedCapability(const std::string& url) LLHTTPClient::post(url, capabilityNames, mImpl->mHttpResponderPtr); } +class SimulatorFeaturesReceived : public LLHTTPClient::Responder +{ + LOG_CLASS(SimulatorFeaturesReceived); +public: + SimulatorFeaturesReceived(LLViewerRegion* region) + : mRegion(region) + { } + + + void error(U32 statusNum, const std::string& reason) + { + LL_WARNS2("AppInit", "SimulatorFeatures") << statusNum << ": " << reason << LL_ENDL; + } + + void result(const LLSD& content) + { + if(!mRegion) //region is removed or responder is not created. + { + return ; + } + + mRegion->setSimulatorFeatures(content); + } + + static boost::intrusive_ptr build( + LLViewerRegion* region) + { + return boost::intrusive_ptr( + new SimulatorFeaturesReceived(region)); + } + +private: + LLViewerRegion* mRegion; +}; + + void LLViewerRegion::setCapability(const std::string& name, const std::string& url) { if(name == "EventQueueGet") @@ -1571,6 +1622,11 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u { LLHTTPSender::setSender(mImpl->mHost, new LLCapHTTPSender(url)); } + else if (name == "SimulatorFeatures") + { + // kick off a request for simulator features + LLHTTPClient::get(url, new SimulatorFeaturesReceived(this)); + } else { mImpl->mCapabilities[name] = url; @@ -1664,3 +1720,4 @@ std::string LLViewerRegion::getDescription() const return stringize(*this); } + diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a6e5c47b86..d936277231 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -276,6 +276,8 @@ public: void getInfo(LLSD& info); + void getSimulatorFeatures(LLSD& info); + void setSimulatorFeatures(const LLSD& info); typedef enum { @@ -401,6 +403,8 @@ private: bool mCapabilitiesReceived; BOOL mReleaseNotesRequested; + + LLSD mSimulatorFeatures; }; inline BOOL LLViewerRegion::getAllowDamage() const diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6fe79c2e85..4ecf156646 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -601,7 +601,7 @@ public: ypos += y_inc; - if (gSavedSettings.getBOOL("MeshEnabled")) + if (gMeshRepo.meshRezEnabled()) { addText(xpos, ypos, llformat("%.3f MB Mesh Data Received", LLMeshRepository::sBytesReceived/(1024.f*1024.f))); -- cgit v1.2.3 From 1fd46831f0ea7309d83c1fa2eecc611b3bada719 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sun, 29 May 2011 00:40:57 -0500 Subject: SH-1682 Work in progress on using texture indexes to improve batch size (wow, super fast so far) --- indra/llrender/llrender.cpp | 3 + indra/llrender/llvertexbuffer.cpp | 9 +- indra/llrender/llvertexbuffer.h | 4 + indra/newview/app_settings/settings.xml | 2 +- .../shaders/class1/deferred/diffuseF.glsl | 1 + .../shaders/class1/deferred/diffuseV.glsl | 4 +- .../shaders/class1/deferred/fullbrightF.glsl | 64 ++++----- .../shaders/class1/deferred/fullbrightV.glsl | 21 +-- indra/newview/lldrawpool.cpp | 42 ++++-- indra/newview/lldrawpool.h | 4 +- indra/newview/lldrawpoolalpha.cpp | 2 +- indra/newview/lldrawpoolbump.cpp | 2 +- indra/newview/lldrawpoolbump.h | 2 +- indra/newview/lldrawpoolsimple.cpp | 83 ++++++++++- indra/newview/lldrawpoolsimple.h | 14 +- indra/newview/llface.cpp | 35 +++++ indra/newview/llface.h | 3 + indra/newview/llspatialpartition.cpp | 24 ++++ indra/newview/llspatialpartition.h | 4 +- indra/newview/llviewershadermgr.cpp | 27 +++- indra/newview/llvopartgroup.cpp | 1 + indra/newview/llvosurfacepatch.cpp | 2 + indra/newview/llvovolume.cpp | 158 +++++++++++++++++---- 23 files changed, 398 insertions(+), 113 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 049dd4346b..0532510996 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -203,7 +203,9 @@ void LLTexUnit::disable(void) if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE && mIndex < gGLManager.mNumTextureUnits) { + stop_glerror(); glDisable(sGLTextureType[mCurrTexType]); + stop_glerror(); } mCurrTexType = TT_NONE; @@ -403,6 +405,7 @@ void LLTexUnit::unbind(eTextureType type) activate(); mCurrTexture = 0; glBindTexture(sGLTextureType[type], 0); + stop_glerror(); } } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 8c9171ccf4..f715a8e9ba 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1497,7 +1497,14 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const } if (data_mask & MAP_VERTEX) { - glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + if (data_mask & MAP_TEXTURE_INDEX) + { + glVertexPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + } + else + { + glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + } } llglassertok(); diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index a9f22193f8..0c4b241537 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -130,6 +130,9 @@ public: TYPE_CLOTHWEIGHT, TYPE_MAX, TYPE_INDEX, + + //no actual additional data, but indicates position.w is texture index + TYPE_TEXTURE_INDEX, }; enum { MAP_VERTEX = (1<Type Boolean Value - 0 + 1 RenderDebugNormalScale diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 35cfb80c93..f71d9f0b49 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -20,3 +20,4 @@ void main() vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } + diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 03d3322cb6..b8de629fc8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -8,13 +8,15 @@ #version 120 varying vec3 vary_normal; +varying float vary_texture_index; void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + vary_texture_index = gl_Vertex.w; vary_normal = normalize(gl_NormalMatrix * gl_Normal); gl_FrontColor = gl_Color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 3429877397..30231039b0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -9,56 +9,48 @@ #extension GL_ARB_texture_rectangle : enable -uniform sampler2D diffuseMap; -uniform sampler2DRect depthMap; -uniform sampler2D noiseMap; - -uniform vec4 shadow_clip; -uniform vec2 screen_res; +varying float vary_texture_index; + +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; +uniform sampler2D tex7; + +vec4 textureLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + case 7: return texture2D(tex7, texcoord); + } + + return vec4(0,0,0,0); +} vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec4 vary_position; -varying vec3 vary_normal; -varying vec3 vary_fragcoord; - -uniform mat4 inv_proj; - -vec4 getPosition(vec2 pos_screen) -{ - float depth = texture2DRect(depthMap, pos_screen.xy).a; - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} void main() { - vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; - frag *= screen_res; - - vec3 samp_pos = getPosition(frag).xyz; - float shadow = 1.0; - vec4 pos = vary_position; - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy)*gl_Color; + vec4 color = textureLookup(gl_TexCoord[0].xy)*gl_Color; color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - //gl_FragColor = gl_Color; gl_FragColor = color; - //gl_FragColor = vec4(1,0,1,1); - } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 6c38d220e2..6890360c56 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -14,30 +14,23 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_normal; -varying vec3 vary_fragcoord; -uniform float near_clip; -varying vec4 vary_position; +varying float vary_texture_index; void main() { //transform vertex - gl_Position = ftransform(); + vec4 vert = vec4(gl_Vertex.xyz, 1.0); + vary_texture_index = gl_Vertex.w; + + gl_Position = gl_ModelViewProjectionMatrix*vert; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - vary_position = pos; - + vec4 pos = (gl_ModelViewMatrix * vert); + calcAtmospherics(pos.xyz); gl_FrontColor = gl_Color; gl_FogFragCoord = pos.z; - - pos = gl_ModelViewProjectionMatrix * gl_Vertex; - vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); - } diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 25e4bc847c..9645693493 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -430,14 +430,14 @@ void LLRenderPass::renderTexture(U32 type, U32 mask) pushBatches(type, mask, TRUE); } -void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture) +void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) { for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) { LLDrawInfo* pparams = *i; if (pparams) { - pushBatch(*pparams, mask, texture); + pushBatch(*pparams, mask, texture, batch_textures); } } } @@ -456,26 +456,42 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params) } } -void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) +void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures) { applyModelMatrix(params); + bool tex_setup = false; + if (texture) { - if (params.mTexture.notNull()) + if (batch_textures && params.mTextureList.size() > 1) { - params.mTexture->addTextureStats(params.mVSize); - gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ; - if (params.mTextureMatrix) + for (U32 i = 0; i < params.mTextureList.size(); ++i) { - glMatrixMode(GL_TEXTURE); - glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); - gPipeline.mTextureMatrixOps++; + if (params.mTextureList[i].notNull()) + { + gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE); + } } } else - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + { //not batching textures or batch has only 1 texture -- might need a texture matrix + if (params.mTexture.notNull()) + { + params.mTexture->addTextureStats(params.mVSize); + gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ; + if (params.mTextureMatrix) + { + tex_setup = true; + glMatrixMode(GL_TEXTURE); + glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); + gPipeline.mTextureMatrixOps++; + } + } + else + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } } } @@ -490,7 +506,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); } - if (params.mTextureMatrix && texture && params.mTexture.notNull()) + if (tex_setup) { glLoadIdentity(); glMatrixMode(GL_MODELVIEW); diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index d3fd9ead0d..c7acbb42c6 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -146,8 +146,8 @@ public: void resetDrawOrders() { } static void applyModelMatrix(LLDrawInfo& params); - virtual void pushBatches(U32 type, U32 mask, BOOL texture = TRUE); - virtual void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture); + virtual void pushBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE); + virtual void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE); virtual void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE); virtual void renderGroups(U32 type, U32 mask, BOOL texture = TRUE); virtual void renderTexture(U32 type, U32 mask); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 8b5a2ce781..3b3d48ab36 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -124,7 +124,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) if (pass == 0) { simple_shader = &gDeferredAlphaProgram; - fullbright_shader = &gDeferredFullbrightProgram; + fullbright_shader = &gObjectFullbrightProgram; } else { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 5f89d11391..3531073896 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1292,7 +1292,7 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask) } } -void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) +void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures) { applyModelMatrix(params); diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index f4702bf61d..476b1d41b7 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -55,7 +55,7 @@ public: virtual void endRenderPass( S32 pass ); virtual S32 getNumPasses(); /*virtual*/ void prerender(); - /*virtual*/ void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture); + /*virtual*/ void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE); void renderBump(U32 type, U32 mask); void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture); diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 2e83167851..8ff60f73cc 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -44,6 +44,43 @@ static LLGLSLShader* fullbright_shader = NULL; static LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE_DEFERRED("Deferred Simple"); static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); +void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) +{ + gDeferredFullbrightProgram.bind(); +} + +void LLDrawPoolGlow::renderPostDeferred(S32 pass) +{ + LLFastTimer t(FTM_RENDER_GLOW); + LLGLEnable blend(GL_BLEND); + LLGLDisable test(GL_ALPHA_TEST); + gGL.flush(); + /// Get rid of z-fighting with non-glow pass. + LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.0f, -1.0f); + gGL.setSceneBlendType(LLRender::BT_ADD); + + LLGLDepthTest depth(GL_TRUE, GL_FALSE); + gGL.setColorMask(false, true); + pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + + gGL.setColorMask(true, false); + gGL.setSceneBlendType(LLRender::BT_ALPHA); +} + +void LLDrawPoolGlow::endPostDeferredPass(S32 pass) +{ + gDeferredFullbrightProgram.unbind(); + for (U32 i = 0; i < 8; i++) + { + if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) + { + gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); + gGL.getTexUnit(i)->disable(); + } + } +} + void LLDrawPoolGlow::render(S32 pass) { LLFastTimer t(FTM_RENDER_GLOW); @@ -79,10 +116,10 @@ void LLDrawPoolGlow::render(S32 pass) } } -void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) +void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures) { glColor4ubv(params.mGlowColor.mV); - LLRenderPass::pushBatch(params, mask, texture); + LLRenderPass::pushBatch(params, mask, texture, batch_textures); } @@ -128,8 +165,8 @@ void LLDrawPoolSimple::endRenderPass(S32 pass) LLFastTimer t(FTM_RENDER_SIMPLE); LLRenderPass::endRenderPass(pass); - if (mVertexShaderLevel > 0){ - + if (mVertexShaderLevel > 0) + { simple_shader->unbind(); } } @@ -168,6 +205,15 @@ void LLDrawPoolSimple::endDeferredPass(S32 pass) LLRenderPass::endRenderPass(pass); gDeferredDiffuseProgram.unbind(); + + for (U32 i = 0; i < 8; i++) + { + if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) + { + gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); + gGL.getTexUnit(i)->disable(); + } + } } void LLDrawPoolSimple::renderDeferred(S32 pass) @@ -177,7 +223,7 @@ void LLDrawPoolSimple::renderDeferred(S32 pass) { //render simple LLFastTimer t(FTM_RENDER_SIMPLE_DEFERRED); - renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); + pushBatches(LLRenderPass::PASS_SIMPLE, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } } @@ -285,6 +331,33 @@ void LLDrawPoolFullbright::prerender() mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } +void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) +{ + gDeferredFullbrightProgram.bind(); +} + +void LLDrawPoolFullbright::renderPostDeferred(S32 pass) +{ + LLFastTimer t(FTM_RENDER_FULLBRIGHT); + + gGL.setSceneBlendType(LLRender::BT_ALPHA); + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; + pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); +} + +void LLDrawPoolFullbright::endPostDeferredPass(S32 pass) +{ + gDeferredFullbrightProgram.unbind(); + for (U32 i = 0; i < 8; i++) + { + if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) + { + gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); + gGL.getTexUnit(i)->disable(); + } + } +} + void LLDrawPoolFullbright::beginRenderPass(S32 pass) { LLFastTimer t(FTM_RENDER_FULLBRIGHT); diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h index 5f3bbebbda..3811b3d398 100644 --- a/indra/newview/lldrawpoolsimple.h +++ b/indra/newview/lldrawpoolsimple.h @@ -98,9 +98,9 @@ public: LLDrawPoolFullbright(); /*virtual*/ S32 getNumPostDeferredPasses() { return 1; } - /*virtual*/ void beginPostDeferredPass(S32 pass) { beginRenderPass(pass); } - /*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); } - /*virtual*/ void renderPostDeferred(S32 pass) { render(pass); } + /*virtual*/ void beginPostDeferredPass(S32 pass); + /*virtual*/ void endPostDeferredPass(S32 pass); + /*virtual*/ void renderPostDeferred(S32 pass); /*virtual*/ void beginRenderPass(S32 pass); /*virtual*/ void endRenderPass(S32 pass); @@ -126,12 +126,12 @@ public: virtual void prerender() { } /*virtual*/ S32 getNumPostDeferredPasses() { return 1; } - /*virtual*/ void beginPostDeferredPass(S32 pass) { beginRenderPass(pass); } - /*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); } - /*virtual*/ void renderPostDeferred(S32 pass) { render(pass); } + /*virtual*/ void beginPostDeferredPass(S32 pass); + /*virtual*/ void endPostDeferredPass(S32 pass); + /*virtual*/ void renderPostDeferred(S32 pass); void render(S32 pass = 0); - void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture = TRUE); + void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE); }; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 9f9e50ad0a..e30522d380 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -165,6 +165,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mIndexInTex = 0; mTexture = NULL; mTEOffset = -1; + mTextureIndex = 255; setDrawable(drawablep); mVObjp = objp; @@ -386,6 +387,26 @@ void LLFace::setGeomIndex(U16 idx) } } +void LLFace::setTextureIndex(U8 index) +{ + if (index != mTextureIndex) + { + mTextureIndex = index; + + if (mTextureIndex != 255) + { + mDrawablep->setState(LLDrawable::REBUILD_POSITION); + } + else + { + if (mDrawInfo && !mDrawInfo->mTextureList.empty()) + { + llerrs << "Face with no texture index references indexed texture draw info." << llendl; + } + } + } +} + void LLFace::setIndicesIndex(S32 idx) { if (mIndicesIndex != idx) @@ -1573,6 +1594,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mat_vert.affineTransform(*src++, *dst++); } while(dst < end); + + F32 index = (F32) (mTextureIndex < 255 ? mTextureIndex : 0); + F32 *index_dst = (F32*) vertices; + F32 *index_end = (F32*) end; + + index_dst += 3; + index_end += 3; + do + { + *index_dst = index; + index_dst += 4; + } + while (index_dst < index_end); + } if (rebuild_normal) diff --git a/indra/newview/llface.h b/indra/newview/llface.h index b2170c4cf3..b5eaeecd60 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -94,6 +94,8 @@ public: U16 getGeomCount() const { return mGeomCount; } // vertex count for this face U16 getGeomIndex() const { return mGeomIndex; } // index into draw pool U16 getGeomStart() const { return mGeomIndex; } // index into draw pool + void setTextureIndex(U8 index); + U8 getTextureIndex() const { return mTextureIndex; } void setTexture(LLViewerTexture* tex) ; void switchTexture(LLViewerTexture* new_texture); void dirtyTexture(); @@ -262,6 +264,7 @@ private: U16 mGeomCount; // vertex count for this face U16 mGeomIndex; // index into draw pool + U8 mTextureIndex; // index of texture channel to use for pseudo-atlasing U32 mIndicesCount; U32 mIndicesIndex; // index into draw pool for indices (yeah, I know!) S32 mIndexInTex ; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 8143d6a41f..7f91f9a952 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3439,6 +3439,8 @@ void renderTextureAnim(LLDrawInfo* params) void renderBatchSize(LLDrawInfo* params) { + LLGLEnable offset(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.f, 1.f); glColor3ubv((GLubyte*) &(params->mDebugColor)); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } @@ -3876,6 +3878,28 @@ public: renderAgentTarget(avatar); } + if (gDebugGL) + { + for (U32 i = 0; i < drawable->getNumFaces(); ++i) + { + LLFace* facep = drawable->getFace(i); + U8 index = facep->getTextureIndex(); + if (facep->mDrawInfo) + { + if (index < 255) + { + if (facep->mDrawInfo->mTextureList.size() <= index) + { + llerrs << "Face texture index out of bounds." << llendl; + } + else if (facep->mDrawInfo->mTextureList[index] != facep->getTexture()) + { + llerrs << "Face texture index incorrect." << llendl; + } + } + } + } + } } for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 0d9cad914a..ae5d4fa463 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -91,6 +91,8 @@ public: LLPointer mVertexBuffer; LLPointer mTexture; + std::vector > mTextureList; + LLColor4U mGlowColor; S32 mDebugColor; const LLMatrix4* mTextureMatrix; @@ -684,7 +686,7 @@ class LLVolumeGeometryManager: public LLGeometryManager virtual void rebuildGeom(LLSpatialGroup* group); virtual void rebuildMesh(LLSpatialGroup* group); virtual void getGeometry(LLSpatialGroup* group); - void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort = FALSE); + void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE); void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type); }; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index b818da205e..29f3acdf91 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -354,6 +354,7 @@ void LLViewerShaderMgr::setShaders() //setup preprocessor definitions LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"))); + LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits); reentrance = true; @@ -941,6 +942,20 @@ BOOL LLViewerShaderMgr::loadShadersEffects() } +void setup_indexed_texture(LLGLSLShader& shader) +{ + shader.bind(); + shader.uniform1i("tex0", 0); + shader.uniform1i("tex1", 1); + shader.uniform1i("tex2", 2); + shader.uniform1i("tex3", 3); + shader.uniform1i("tex4", 4); + shader.uniform1i("tex5", 5); + shader.uniform1i("tex6", 6); + shader.uniform1i("tex7", 7); + shader.unbind(); +} + BOOL LLViewerShaderMgr::loadShadersDeferred() { if (mVertexShaderLevel[SHADER_DEFERRED] == 0) @@ -992,9 +1007,14 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader"; gDeferredDiffuseProgram.mShaderFiles.clear(); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredDiffuseProgram.createShader(NULL, NULL); + + if (success) + { //force tex0-7 to appropriate texture channels + setup_indexed_texture(gDeferredDiffuseProgram); + } } if (success) @@ -1231,6 +1251,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredFullbrightProgram.createShader(NULL, NULL); + + if (success) + { + setup_indexed_texture(gDeferredFullbrightProgram); + } } if (success) diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 6f354b78b1..85b740d819 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -418,6 +418,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co mFaceList.push_back(facep); vertex_count += facep->getGeomCount(); index_count += facep->getIndicesCount(); + llassert(facep->getIndicesCount() < 65536); } obj->mDepth /= count; diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index dbcd4f50ca..510525259f 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -375,6 +375,8 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, S32 num_vertices, num_indices; U32 index; + llassert(mLastStride > 0); + render_stride = mLastStride; patch_size = mPatchp->getSurface()->getGridsPerPatchEdge(); S32 vert_size = patch_size / render_stride; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index cc443d32fb..87de064ad1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1247,17 +1247,7 @@ BOOL LLVOVolume::calcLOD() { //setDebugText(llformat("%.2f:%.2f, %d", debug_distance, radius, cur_detail)); - F32 bin_radius = getBinRadius(); - F32 node_size = 0.f; - - LLSpatialGroup* group = mDrawable->getSpatialGroup(); - if (group) - { - LLSpatialGroup::OctreeNode* node = group->mOctreeNode; - node_size = node->getSize()[0]; - } - - setDebugText(llformat("%.2f:%.2f", bin_radius, node_size)); + setDebugText(llformat("%d", mDrawable->getFace(0)->getTextureIndex())); } if (cur_detail != mLOD) @@ -3734,6 +3724,21 @@ LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep) mSlopRatio = 0.25f; } +bool can_batch_texture(LLFace* facep) +{ + if (facep->getTextureEntry()->getBumpmap()) + { //bump maps aren't worked into texture batching yet + return false; + } + + if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE) + { //texture animation breaks batches + return false; + } + + return true; +} + void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); @@ -3784,12 +3789,36 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLViewerTexture* tex = facep->getTexture(); + U8 index = facep->getTextureIndex(); + + bool batchable = false; + + if (index < 255 && idx >= 0) + { + if (index < draw_vec[idx]->mTextureList.size()) + { + if (draw_vec[idx]->mTextureList[index].isNull()) + { + batchable = true; + draw_vec[idx]->mTextureList[index] = tex; + } + else if (draw_vec[idx]->mTextureList[index] == tex) + { //this face's texture index can be used with this batch + batchable = true; + } + } + else + { //texture list can be expanded to fit this texture index + batchable = true; + } + } + U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255); if (idx >= 0 && draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 && - (LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex) && + (LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex || batchable) && #if LL_DARWIN draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange && draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange && @@ -3803,6 +3832,12 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mCount += facep->getIndicesCount(); draw_vec[idx]->mEnd += facep->getGeomCount(); draw_vec[idx]->mVSize = llmax(draw_vec[idx]->mVSize, facep->getVirtualSize()); + + if (index >= draw_vec[idx]->mTextureList.size()) + { + draw_vec[idx]->mTextureList.resize(index+1); + draw_vec[idx]->mTextureList[index] = tex; + } draw_vec[idx]->validate(); update_min_max(draw_vec[idx]->mExtents[0], draw_vec[idx]->mExtents[1], facep->mExtents[0]); update_min_max(draw_vec[idx]->mExtents[0], draw_vec[idx]->mExtents[1], facep->mExtents[1]); @@ -3833,6 +3868,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mDrawMode = LLRender::TRIANGLE_STRIP; } + if (index < 255) + { //initialize texture list for texture batching + draw_info->mTextureList.resize(index+1); + draw_info->mTextureList[index] = tex; + } draw_info->validate(); } } @@ -4258,11 +4298,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (LLPipeline::sRenderDeferred) { bump_mask |= LLVertexBuffer::MAP_BINORMAL; + genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, TRUE); + genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, TRUE); + genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, TRUE); + } + else + { + genDrawInfo(group, simple_mask, simple_faces); + genDrawInfo(group, fullbright_mask, fullbright_faces); + genDrawInfo(group, bump_mask, bump_faces, FALSE, TRUE); } - - genDrawInfo(group, simple_mask, simple_faces); - genDrawInfo(group, bump_mask, bump_faces); - genDrawInfo(group, fullbright_mask, fullbright_faces); genDrawInfo(group, alpha_mask, alpha_faces, TRUE); if (!LLPipeline::sDelayVBUpdate) @@ -4376,7 +4421,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) llassert(!group || !group->isState(LLSpatialGroup::NEW_DRAWINFO)); } -void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort) +void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort, BOOL batch_textures) { //calculate maximum number of vertices to store in a single buffer U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask); @@ -4435,19 +4480,71 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: std::vector::iterator i = face_iter; ++i; - while (i != faces.end() && - (LLPipeline::sTextureBindTest || (distance_sort || (*i)->getTexture() == tex))) + std::vector texture_list; + + if (!distance_sort && batch_textures) { - facep = *i; - - if (geom_count + facep->getGeomCount() > max_vertices) - { //cut batches on geom count too big - break; + U8 cur_tex = 0; + facep->setTextureIndex(cur_tex); + texture_list.push_back(tex); + + if (can_batch_texture(facep)) + { + while (i != faces.end()) + { + facep = *i; + if (facep->getTexture() != tex) + { + cur_tex++; + if (cur_tex >= 8) + { //cut batches on every 8 textures + break; + } + tex = facep->getTexture(); + texture_list.push_back(tex); + } + + if (geom_count + facep->getGeomCount() > max_vertices) + { //cut batches on geom count too big + break; + } + + if (!can_batch_texture(facep)) + { //cut batches on things that require single texture rendering (animated texture, bump maps) + break; + } + + ++i; + index_count += facep->getIndicesCount(); + geom_count += facep->getGeomCount(); + + facep->setTextureIndex(cur_tex); + } } - ++i; - index_count += facep->getIndicesCount(); - geom_count += facep->getGeomCount(); + tex = texture_list[0]; + } + else + { + while (i != faces.end() && + (LLPipeline::sTextureBindTest || (distance_sort || (*i)->getTexture() == tex))) + { + facep = *i; + + + //face has no texture index + facep->mDrawInfo = NULL; + facep->setTextureIndex(255); + + if (geom_count + facep->getGeomCount() > max_vertices) + { //cut batches on geom count too big + break; + } + + ++i; + index_count += facep->getIndicesCount(); + geom_count += facep->getGeomCount(); + } } //create/delete/resize vertex buffer if needed @@ -4497,6 +4594,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: facep->setGeomIndex(index_offset); facep->setVertexBuffer(buffer); + if (batch_textures && facep->getTextureIndex() == 255) + { + llerrs << "Invalid texture index." << llendl; + } + { //for debugging, set last time face was updated vs moved facep->updateRebuildFlags(); @@ -4695,7 +4797,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun { vertex_count += facep->getGeomCount(); index_count += facep->getIndicesCount(); - + llassert(facep->getIndicesCount() < 65536); //remember face (for sorting) mFaceList.push_back(facep); } -- cgit v1.2.3 From 57725bd6a14f471cae1a0f4ac7485ab9ccd8bfc6 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sun, 29 May 2011 00:41:28 -0500 Subject: SH-1682 indexd diffuse fragment shader for deferred rendering --- .../shaders/class1/deferred/diffuseIndexedF.glsl | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl new file mode 100644 index 0000000000..1bbaeb44ff --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -0,0 +1,50 @@ +/** + * @file diffuseIndexedF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +varying float vary_texture_index; +varying vec3 vary_normal; + +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; +uniform sampler2D tex7; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + case 7: return texture2D(tex7, texcoord); + } + + return vec4(0,0,0,0); +} + +void main() +{ + vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb; + + //col = vec3(vary_texture_index*0.25, 0, 0); + + gl_FragData[0] = vec4(col, 0.0); + gl_FragData[1] = gl_Color.aaaa; // spec + //gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested + vec3 nvn = normalize(vary_normal); + gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); +} -- cgit v1.2.3 From eca17c8993aecfd8d69c1b1765f8ac841ad29119 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 30 May 2011 01:25:55 -0500 Subject: SH-1682 Full integration if indexed texture rendering to improve batch size. --- indra/llrender/llglslshader.cpp | 2 +- indra/llrender/llglslshader.h | 1 + indra/llrender/llshadermgr.cpp | 72 +++++- indra/newview/app_settings/settings.xml | 2 +- .../shaders/class1/deferred/alphaF.glsl | 5 +- .../shaders/class1/deferred/alphaV.glsl | 9 +- .../shaders/class1/deferred/avatarEyesV.glsl | 21 ++ .../shaders/class2/deferred/alphaF.glsl | 5 +- .../shaders/class2/deferred/alphaV.glsl | 9 +- .../shaders/class2/lighting/lightF.glsl | 30 ++- .../shaders/class2/lighting/lightFullbrightF.glsl | 32 ++- .../lighting/lightFullbrightNonIndexedF.glsl | 25 ++ .../class2/lighting/lightFullbrightShinyF.glsl | 30 ++- .../lighting/lightFullbrightShinyNonIndexedF.glsl | 32 +++ .../lighting/lightFullbrightShinyWaterF.glsl | 29 ++- .../lightFullbrightShinyWaterNonIndexedF.glsl | 32 +++ .../class2/lighting/lightFullbrightWaterF.glsl | 30 ++- .../lighting/lightFullbrightWaterNonIndexedF.glsl | 23 ++ .../shaders/class2/lighting/lightNonIndexedF.glsl | 25 ++ .../shaders/class2/lighting/lightShinyF.glsl | 29 ++- .../class2/lighting/lightShinyNonIndexedF.glsl | 32 +++ .../shaders/class2/lighting/lightShinyWaterF.glsl | 28 ++- .../lighting/lightShinyWaterNonIndexedF.glsl | 29 +++ .../shaders/class2/lighting/lightWaterF.glsl | 30 ++- .../class2/lighting/lightWaterNonIndexedF.glsl | 23 ++ .../shaders/class2/objects/fullbrightShinyV.glsl | 35 +++ .../shaders/class2/objects/fullbrightV.glsl | 29 +++ .../shaders/class2/objects/shinyV.glsl | 8 +- .../shaders/class2/objects/simpleV.glsl | 33 +++ indra/newview/lldrawpool.cpp | 8 + indra/newview/lldrawpoolalpha.cpp | 153 +++++++----- indra/newview/lldrawpoolavatar.cpp | 26 +- indra/newview/lldrawpoolbump.cpp | 94 ++++--- indra/newview/lldrawpoolsimple.cpp | 51 ++-- indra/newview/lldrawpooltree.cpp | 4 +- indra/newview/llviewershadermgr.cpp | 276 ++++++++++++++++++++- indra/newview/llviewershadermgr.h | 11 + indra/newview/llvopartgroup.cpp | 12 +- indra/newview/llvosky.cpp | 2 + indra/newview/llvovolume.cpp | 55 +++- indra/newview/pipeline.cpp | 6 +- 41 files changed, 1201 insertions(+), 187 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl create mode 100644 indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl create mode 100644 indra/newview/app_settings/shaders/class2/objects/simpleV.glsl diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 2e7147a3b4..71d24bcf13 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -56,7 +56,7 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) LLShaderFeatures::LLShaderFeatures() : calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false), hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false), -hasGamma(false), hasLighting(false), calculatesAtmospherics(false) +hasGamma(false), hasLighting(false), calculatesAtmospherics(false), disableTextureIndex(false) { } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index d46ddbbe18..392688bba3 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -45,6 +45,7 @@ public: bool hasObjectSkinning; bool hasAtmospherics; bool hasGamma; + bool disableTextureIndex; // char numLights; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b8f9c60ca9..6fb1e6e437 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -209,7 +209,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if (features->hasWaterFog) { - if (!shader->attachObject("lighting/lightWaterF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightWaterNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightWaterF.glsl")) { return FALSE; } @@ -217,7 +224,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) else { - if (!shader->attachObject("lighting/lightF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightF.glsl")) { return FALSE; } @@ -230,14 +244,28 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if (features->isShiny && features->hasWaterFog) { - if (!shader->attachObject("lighting/lightFullbrightShinyWaterF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightFullbrightShinyWaterNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightFullbrightShinyWaterF.glsl")) { return FALSE; } } else if (features->hasWaterFog) { - if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightFullbrightWaterNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl")) { return FALSE; } @@ -245,7 +273,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) else if (features->isShiny) { - if (!shader->attachObject("lighting/lightFullbrightShinyF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightFullbrightShinyNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightFullbrightShinyF.glsl")) { return FALSE; } @@ -253,7 +288,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) else { - if (!shader->attachObject("lighting/lightFullbrightF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightFullbrightNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightFullbrightF.glsl")) { return FALSE; } @@ -266,7 +308,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if (features->hasWaterFog) { - if (!shader->attachObject("lighting/lightShinyWaterF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightShinyWaterNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightShinyWaterF.glsl")) { return FALSE; } @@ -274,7 +323,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) else { - if (!shader->attachObject("lighting/lightShinyF.glsl")) + if (features->disableTextureIndex) + { + if (!shader->attachObject("lighting/lightShinyNonIndexedF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("lighting/lightShinyF.glsl")) { return FALSE; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 22d8ce49c1..2c6d75e3c9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7489,7 +7489,7 @@ Type Boolean Value - 1 + 0 RenderDebugNormalScale diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 3b12a07a27..f6b7f42c22 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -9,9 +9,10 @@ #extension GL_ARB_texture_rectangle : enable -uniform sampler2D diffuseMap; uniform sampler2DRect depthMap; +vec4 diffuseLookup(vec2 texcoord); + uniform mat4 shadow_matrix[6]; uniform vec4 shadow_clip; uniform vec2 screen_res; @@ -47,7 +48,7 @@ void main() vec4 pos = vec4(vary_position, 1.0); - vec4 diff= texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 diff= diffuseLookup(gl_TexCoord[0].xy); vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 2691fc8ded..5890c30d8f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -23,6 +23,7 @@ varying vec3 vary_fragcoord; varying vec3 vary_position; varying vec3 vary_light; varying vec3 vary_pointlight_col; +varying float vary_texture_index; uniform float near_clip; uniform float shadow_offset; @@ -61,11 +62,13 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { //transform vertex - gl_Position = ftransform(); + vec4 vert = vec4(gl_Vertex.xyz, 1.0); + vary_texture_index = gl_Vertex.w; + gl_Position = gl_ModelViewProjectionMatrix * vert; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); + vec4 pos = (gl_ModelViewMatrix * vert); vec3 norm = normalize(gl_NormalMatrix * gl_Normal); float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); @@ -102,7 +105,7 @@ void main() gl_FogFragCoord = pos.z; - pos = gl_ModelViewProjectionMatrix * gl_Vertex; + pos = gl_ModelViewProjectionMatrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl new file mode 100644 index 0000000000..536bacd23c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl @@ -0,0 +1,21 @@ +/** + * @file avatarEyesV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +varying vec3 vary_normal; + +void main() +{ + //transform vertex + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + + vary_normal = normalize(gl_NormalMatrix * gl_Normal); + + gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 6dfc1b952c..bd4875f3ff 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -9,13 +9,14 @@ #extension GL_ARB_texture_rectangle : enable -uniform sampler2D diffuseMap; uniform sampler2DRectShadow shadowMap0; uniform sampler2DRectShadow shadowMap1; uniform sampler2DRectShadow shadowMap2; uniform sampler2DRectShadow shadowMap3; uniform sampler2DRect depthMap; +vec4 diffuseLookup(vec2 texcoord); + uniform mat4 shadow_matrix[6]; uniform vec4 shadow_clip; uniform vec2 screen_res; @@ -105,7 +106,7 @@ void main() } } - vec4 diff= texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 diff = diffuseLookup(gl_TexCoord[0].xy); vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index f6160815eb..c6c0b0f32a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -22,6 +22,7 @@ varying vec3 vary_directional; varying vec3 vary_fragcoord; varying vec3 vary_position; varying vec3 vary_pointlight_col; +varying float vary_texture_index; uniform float near_clip; uniform float shadow_offset; @@ -60,11 +61,13 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { //transform vertex - gl_Position = ftransform(); + vec4 vert = vec4(gl_Vertex.xyz, 1.0); + vary_texture_index = gl_Vertex.w; + gl_Position = gl_ModelViewProjectionMatrix * vert; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); + vec4 pos = (gl_ModelViewMatrix * vert); vec3 norm = normalize(gl_NormalMatrix * gl_Normal); float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); @@ -99,7 +102,7 @@ void main() gl_FogFragCoord = pos.z; - pos = gl_ModelViewProjectionMatrix * gl_Vertex; + pos = gl_ModelViewProjectionMatrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl index 342bc2ab66..d5775f4506 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl @@ -7,14 +7,40 @@ #version 120 -uniform sampler2D diffuseMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; +uniform sampler2D tex7; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + case 7: return texture2D(tex7, texcoord); + } + + return vec4(0,0,0,0); +} vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); void default_lighting() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl index dad18b5883..e64b089dca 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl @@ -7,14 +7,40 @@ #version 120 -uniform sampler2D diffuseMap; - vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; +uniform sampler2D tex7; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + case 7: return texture2D(tex7, texcoord); + } + + return vec4(0,0,0,0); +} + void fullbright_lighting() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl new file mode 100644 index 0000000000..811a919d52 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl @@ -0,0 +1,25 @@ +/** + * @file lightFullbrightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +vec3 fullbrightAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + +uniform sampler2D diffuseMap; + +void fullbright_lighting() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + + color.rgb = fullbrightAtmosTransport(color.rgb); + + color.rgb = fullbrightScaleSoftClip(color.rgb); + + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl index 73ff81e03a..f4ac789a74 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl @@ -7,15 +7,41 @@ #version 120 -uniform sampler2D diffuseMap; uniform samplerCube environmentMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + } + + return vec4(0,0,0,0); +} + + vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); void fullbright_shiny_lighting() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = diffuseLookup(gl_TexCoord[0].xy); color.rgb *= gl_Color.rgb; vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl new file mode 100644 index 0000000000..51a7ddb89a --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl @@ -0,0 +1,32 @@ +/** + * @file lightFullbrightShinyF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +uniform samplerCube environmentMap; +uniform sampler2D diffuseMap; + +vec3 fullbrightShinyAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + +void fullbright_shiny_lighting() +{ + vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); + color.rgb *= gl_Color.rgb; + + vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + + color.rgb = fullbrightShinyAtmosTransport(color.rgb); + + color.rgb = fullbrightScaleSoftClip(color.rgb); + + color.a = max(color.a, gl_Color.a); + + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl index 9b4b584369..277170e8af 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl @@ -7,8 +7,33 @@ #version 120 -uniform sampler2D diffuseMap; + uniform samplerCube environmentMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + } + + return vec4(0,0,0,0); +} vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -16,7 +41,7 @@ vec4 applyWaterFog(vec4 color); void fullbright_shiny_lighting_water() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = diffuseLookup(gl_TexCoord[0].xy); color.rgb *= gl_Color.rgb; vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl new file mode 100644 index 0000000000..a9a95940e6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl @@ -0,0 +1,32 @@ +/** + * @file lightFullbrightShinyWaterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#version 120 + + +uniform samplerCube environmentMap; +uniform sampler2D diffuseMap; + +vec3 fullbrightShinyAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); +vec4 applyWaterFog(vec4 color); + +void fullbright_shiny_lighting_water() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); + color.rgb *= gl_Color.rgb; + + vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + + color.rgb = fullbrightShinyAtmosTransport(color.rgb); + color.rgb = fullbrightScaleSoftClip(color.rgb); + color.a = max(color.a, gl_Color.a); + + gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl index 3d46c8d874..37e33059a6 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl @@ -7,14 +7,40 @@ #version 120 -uniform sampler2D diffuseMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; +uniform sampler2D tex7; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + case 7: return texture2D(tex7, texcoord); + } + + return vec4(0,0,0,0); +} vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); void fullbright_lighting_water() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl new file mode 100644 index 0000000000..3d46c8d874 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl @@ -0,0 +1,23 @@ +/** + * @file lightFullbrightWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +uniform sampler2D diffuseMap; + +vec3 fullbrightAtmosTransport(vec3 light); +vec4 applyWaterFog(vec4 color); + +void fullbright_lighting_water() +{ + vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + + color.rgb = fullbrightAtmosTransport(color.rgb); + + gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl new file mode 100644 index 0000000000..787eeb7af6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl @@ -0,0 +1,25 @@ +/** + * @file lightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +uniform sampler2D diffuseMap; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +void default_lighting() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + + color.rgb = atmosLighting(color.rgb); + + color.rgb = scaleSoftClip(color.rgb); + + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl index ebe21320b4..9f438f513f 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl @@ -7,8 +7,33 @@ #version 120 -uniform sampler2D diffuseMap; + uniform samplerCube environmentMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + } + + return vec4(0,0,0,0); +} vec3 scaleSoftClip(vec3 light); vec3 atmosLighting(vec3 light); @@ -16,7 +41,7 @@ vec4 applyWaterFog(vec4 color); void shiny_lighting() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = diffuseLookup(gl_TexCoord[0].xy); color.rgb *= gl_Color.rgb; vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl new file mode 100644 index 0000000000..212eacd6ea --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl @@ -0,0 +1,32 @@ +/** + * @file lightShinyF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + + +uniform samplerCube environmentMap; +uniform sampler2D diffuseMap; + +vec3 scaleSoftClip(vec3 light); +vec3 atmosLighting(vec3 light); +vec4 applyWaterFog(vec4 color); + +void shiny_lighting() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); + color.rgb *= gl_Color.rgb; + + vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + + color.rgb = atmosLighting(color.rgb); + + color.rgb = scaleSoftClip(color.rgb); + color.a = max(color.a, gl_Color.a); + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl index 7f48e2cf1d..5e11f6585c 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl @@ -8,15 +8,39 @@ #version 120 -uniform sampler2D diffuseMap; uniform samplerCube environmentMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + } + + return vec4(0,0,0,0); +} vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); void shiny_lighting_water() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = diffuseLookup(gl_TexCoord[0].xy); color.rgb *= gl_Color.rgb; vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl new file mode 100644 index 0000000000..cb8a24da60 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl @@ -0,0 +1,29 @@ +/** + * @file lightShinyWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + + +uniform sampler2D diffuseMap; +uniform samplerCube environmentMap; + +vec3 atmosLighting(vec3 light); +vec4 applyWaterFog(vec4 color); + +void shiny_lighting_water() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); + color.rgb *= gl_Color.rgb; + + vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + + color.rgb = atmosLighting(color.rgb); + color.a = max(color.a, gl_Color.a); + gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl index 97eba92d7b..022544a917 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl @@ -7,14 +7,40 @@ #version 120 -uniform sampler2D diffuseMap; +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; +uniform sampler2D tex4; +uniform sampler2D tex5; +uniform sampler2D tex6; +uniform sampler2D tex7; + +varying float vary_texture_index; + +vec4 diffuseLookup(vec2 texcoord) +{ + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + case 3: return texture2D(tex3, texcoord); + case 4: return texture2D(tex4, texcoord); + case 5: return texture2D(tex5, texcoord); + case 6: return texture2D(tex6, texcoord); + case 7: return texture2D(tex7, texcoord); + } + + return vec4(0,0,0,0); +} vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); void default_lighting_water() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl new file mode 100644 index 0000000000..dc16f2d5cd --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl @@ -0,0 +1,23 @@ +/** + * @file lightWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +uniform sampler2D diffuseMap; + +vec3 atmosLighting(vec3 light); +vec4 applyWaterFog(vec4 color); + +void default_lighting_water() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + + color.rgb = atmosLighting(color.rgb); + + gl_FragColor = applyWaterFog(color); +} + diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl new file mode 100644 index 0000000000..e2145e1956 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -0,0 +1,35 @@ +/** + * @file fullbrightShinyV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +void calcAtmospherics(vec3 inPositionEye); + +uniform vec4 origin; + +varying float vary_texture_index; + +void main() +{ + //transform vertex + vec4 vert = vec4(gl_Vertex.xyz,1.0); + vary_texture_index = gl_Vertex.w; + gl_Position = gl_ModelViewProjectionMatrix*vert; + + vec4 pos = (gl_ModelViewMatrix * vert); + vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 ref = reflect(pos.xyz, -norm); + + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); + + calcAtmospherics(pos.xyz); + + gl_FrontColor = gl_Color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl new file mode 100644 index 0000000000..c4a3611a29 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -0,0 +1,29 @@ +/** + * @file fullbrightV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +void calcAtmospherics(vec3 inPositionEye); + +varying float vary_texture_index; + +void main() +{ + //transform vertex + vec4 vert = vec4(gl_Vertex.xyz,1.0); + vary_texture_index = gl_Vertex.w; + gl_Position = gl_ModelViewProjectionMatrix*vert; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + + vec4 pos = (gl_ModelViewMatrix * vert); + + calcAtmospherics(pos.xyz); + + gl_FrontColor = gl_Color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 4cebb06df0..436c193c5d 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -11,14 +11,18 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); +varying float vary_texture_index; + uniform vec4 origin; void main() { //transform vertex - gl_Position = ftransform(); + vec4 vert = vec4(gl_Vertex.xyz,1.0); + vary_texture_index = gl_Vertex.w; + gl_Position = gl_ModelViewProjectionMatrix*vert; - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); + vec4 pos = (gl_ModelViewMatrix * vert); vec3 norm = normalize(gl_NormalMatrix * gl_Normal); vec3 ref = reflect(pos.xyz, -norm); diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl new file mode 100644 index 0000000000..50d2beee57 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -0,0 +1,33 @@ +/** + * @file simpleV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#version 120 + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +varying float vary_texture_index; + +void main() +{ + //transform vertex + vec4 vert = vec4(gl_Vertex.xyz,1.0); + vary_texture_index = gl_Vertex.w; + gl_Position = gl_ModelViewProjectionMatrix*vert; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + + vec4 pos = (gl_ModelViewMatrix * vert); + + vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 9645693493..b8b12018d2 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -191,6 +191,14 @@ void LLDrawPool::renderPostDeferred(S32 pass) //virtual void LLDrawPool::endRenderPass( S32 pass ) { + for (U32 i = 1; i < 8; i++) + { //dummy cleanup of any currently bound textures + if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) + { + gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); + gGL.getTexUnit(i)->disable(); + } + } } //virtual diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 3b3d48ab36..71eee0188c 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -228,13 +228,13 @@ void LLDrawPoolAlpha::render(S32 pass) if (!LLPipeline::sRenderDeferred) { simple_shader->bind(); - pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask()); + pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } if (fullbright_shader) { fullbright_shader->bind(); } - pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask()); + pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); LLGLSLShader::bindNoShader(); } else @@ -273,7 +273,14 @@ void LLDrawPoolAlpha::render(S32 pass) } } - renderAlpha(getVertexDataMask()); + if (mVertexShaderLevel > 0) + { + renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX); + } + else + { + renderAlpha(getVertexDataMask()); + } gGL.setColorMask(true, false); @@ -341,10 +348,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) BOOL light_enabled = TRUE; S32 diffuse_channel = 0; - BOOL use_shaders = (LLPipeline::sUnderWaterRender && gPipeline.canUseVertexShaders()) - || gPipeline.canUseWindLightShadersOnObjects(); - - + BOOL use_shaders = gPipeline.canUseVertexShaders(); + for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) { LLSpatialGroup* group = *i; @@ -368,92 +373,107 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) LLRenderPass::applyModelMatrix(params); + + if (params.mFullbright) { - if (params.mFullbright) - { - // Turn off lighting if it hasn't already been so. - if (light_enabled || !initialized_lighting) - { - initialized_lighting = TRUE; - if (use_shaders) - { - target_shader = fullbright_shader; - } - else - { - gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - } - light_enabled = FALSE; - } - } - // Turn on lighting if it isn't already. - else if (!light_enabled || !initialized_lighting) + // Turn off lighting if it hasn't already been so. + if (light_enabled || !initialized_lighting) { initialized_lighting = TRUE; if (use_shaders) { - target_shader = simple_shader; + target_shader = fullbright_shader; } else { - gPipeline.enableLightsDynamic(); + gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); } - light_enabled = TRUE; + light_enabled = FALSE; } - - // If we need shaders, and we're not ALREADY using the proper shader, then bind it - // (this way we won't rebind shaders unnecessarily). - if(use_shaders && (current_shader != target_shader)) + } + // Turn on lighting if it isn't already. + else if (!light_enabled || !initialized_lighting) + { + initialized_lighting = TRUE; + if (use_shaders) { - llassert(target_shader != NULL); - if (deferred_render && current_shader != NULL) - { - gPipeline.unbindDeferredShader(*current_shader); - diffuse_channel = 0; - } - current_shader = target_shader; - if (deferred_render) - { - gPipeline.bindDeferredShader(*current_shader); - diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - } - else - { - current_shader->bind(); - } + target_shader = simple_shader; } - else if (!use_shaders && current_shader != NULL) + else { - if (deferred_render) - { - gPipeline.unbindDeferredShader(*current_shader); - diffuse_channel = 0; - } - LLGLSLShader::bindNoShader(); - current_shader = NULL; + gPipeline.enableLightsDynamic(); } + light_enabled = TRUE; + } - if (params.mGroup) + // If we need shaders, and we're not ALREADY using the proper shader, then bind it + // (this way we won't rebind shaders unnecessarily). + if(use_shaders && (current_shader != target_shader)) + { + llassert(target_shader != NULL); + if (deferred_render && current_shader != NULL) + { + gPipeline.unbindDeferredShader(*current_shader); + diffuse_channel = 0; + } + current_shader = target_shader; + if (deferred_render) { - params.mGroup->rebuildMesh(); + gPipeline.bindDeferredShader(*current_shader); + diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); } + else + { + current_shader->bind(); + } + } + else if (!use_shaders && current_shader != NULL) + { + if (deferred_render) + { + gPipeline.unbindDeferredShader(*current_shader); + diffuse_channel = 0; + } + LLGLSLShader::bindNoShader(); + current_shader = NULL; + } - - if (params.mTexture.notNull()) + if (params.mGroup) + { + params.mGroup->rebuildMesh(); + } + + bool tex_setup = false; + + if (use_shaders && params.mTextureList.size() > 1) + { + for (U32 i = 0; i < params.mTextureList.size(); ++i) { - gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); - if(params.mTexture.notNull()) + if (params.mTextureList[i].notNull()) { - params.mTexture->addTextureStats(params.mVSize); + gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE); } + } + } + else + { //not batching textures or batch has only 1 texture -- might need a texture matrix + if (params.mTexture.notNull()) + { + params.mTexture->addTextureStats(params.mVSize); + gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ; if (params.mTextureMatrix) { + tex_setup = true; gGL.getTexUnit(0)->activate(); glMatrixMode(GL_TEXTURE); glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; } } + else + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } } params.mVertexBuffer->setBuffer(mask); @@ -480,7 +500,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor); } - if (params.mTextureMatrix && params.mTexture.notNull()) + if (tex_setup) { gGL.getTexUnit(0)->activate(); glLoadIdentity(); @@ -494,9 +514,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) { gPipeline.unbindDeferredShader(*current_shader); LLVertexBuffer::unbind(); - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); } if (!light_enabled) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 645c7ebcae..7c017f5694 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -613,11 +613,11 @@ void LLDrawPoolAvatar::beginRigid() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectSimpleWaterProgram; + sVertexProgram = &gObjectSimpleNonIndexedWaterProgram; } else { - sVertexProgram = &gObjectSimpleProgram; + sVertexProgram = &gObjectSimpleNonIndexedProgram; } if (sVertexProgram != NULL) @@ -669,7 +669,7 @@ void LLDrawPoolAvatar::endDeferredImpostor() void LLDrawPoolAvatar::beginDeferredRigid() { - sVertexProgram = &gDeferredDiffuseProgram; + sVertexProgram = &gDeferredNonIndexedDiffuseProgram; sVertexProgram->bind(); } @@ -700,11 +700,11 @@ void LLDrawPoolAvatar::beginSkinned() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectSimpleWaterProgram; + sVertexProgram = &gObjectSimpleNonIndexedWaterProgram; } else { - sVertexProgram = &gObjectSimpleProgram; + sVertexProgram = &gObjectSimpleNonIndexedProgram; } } @@ -789,11 +789,11 @@ void LLDrawPoolAvatar::beginRiggedSimple() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectSimpleWaterProgram; + sVertexProgram = &gObjectSimpleNonIndexedWaterProgram; } else { - sVertexProgram = &gObjectSimpleProgram; + sVertexProgram = &gObjectSimpleNonIndexedProgram; } } @@ -864,11 +864,11 @@ void LLDrawPoolAvatar::beginRiggedFullbright() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectFullbrightWaterProgram; + sVertexProgram = &gObjectFullbrightNonIndexedWaterProgram; } else { - sVertexProgram = &gObjectFullbrightProgram; + sVertexProgram = &gObjectFullbrightNonIndexedProgram; } } @@ -908,11 +908,11 @@ void LLDrawPoolAvatar::beginRiggedShinySimple() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectShinyWaterProgram; + sVertexProgram = &gObjectShinyNonIndexedWaterProgram; } else { - sVertexProgram = &gObjectShinyProgram; + sVertexProgram = &gObjectShinyNonIndexedProgram; } } @@ -953,11 +953,11 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectFullbrightShinyWaterProgram; + sVertexProgram = &gObjectFullbrightShinyNonIndexedWaterProgram; } else { - sVertexProgram = &gObjectFullbrightShinyProgram; + sVertexProgram = &gObjectFullbrightShinyNonIndexedProgram; } } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 3531073896..4ac4b89ab4 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -309,6 +309,9 @@ void LLDrawPoolBump::endRenderPass(S32 pass) llassert(0); break; } + + //to cleanup texture channels + LLRenderPass::endRenderPass(pass); } //static @@ -347,6 +350,11 @@ void LLDrawPoolBump::beginShiny(bool invisible) } bindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible); + + if (mVertexShaderLevel > 1) + { //indexed texture rendering, channel 0 is always diffuse + diffuse_channel = 0; + } } //static @@ -414,16 +422,16 @@ void LLDrawPoolBump::renderShiny(bool invisible) LLGLEnable blend_enable(GL_BLEND); if (!invisible && mVertexShaderLevel > 1) { - LLRenderPass::renderTexture(LLRenderPass::PASS_SHINY, sVertexMask); + LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } else if (!invisible) { renderGroups(LLRenderPass::PASS_SHINY, sVertexMask); } - else // invisible - { - renderGroups(LLRenderPass::PASS_INVISI_SHINY, sVertexMask); - } + //else // invisible (deprecated) + //{ + //renderGroups(LLRenderPass::PASS_INVISI_SHINY, sVertexMask); + //} } } @@ -536,7 +544,15 @@ void LLDrawPoolBump::renderFullbrightShiny() if( gSky.mVOSkyp->getCubeMap() ) { LLGLEnable blend_enable(GL_BLEND); - LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask); + + if (mVertexShaderLevel > 1) + { + LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + } + else + { + LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask); + } } } @@ -836,6 +852,9 @@ void LLDrawPoolBump::endPostDeferredPass(S32 pass) endBump(LLRenderPass::PASS_POST_BUMP); break; } + + //to disable texture channels + LLRenderPass::endRenderPass(pass); } void LLDrawPoolBump::renderPostDeferred(S32 pass) @@ -1296,39 +1315,56 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL { applyModelMatrix(params); - if (params.mTextureMatrix) + bool tex_setup = false; + + if (batch_textures && params.mTextureList.size() > 1) { - if (mShiny) + for (U32 i = 0; i < params.mTextureList.size(); ++i) { - gGL.getTexUnit(0)->activate(); - glMatrixMode(GL_TEXTURE); + if (params.mTextureList[i].notNull()) + { + gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE); + } } - else + } + else + { //not batching textures or batch has only 1 texture -- might need a texture matrix + if (params.mTextureMatrix) { - gGL.getTexUnit(1)->activate(); - glMatrixMode(GL_TEXTURE); + if (mShiny) + { + gGL.getTexUnit(0)->activate(); + glMatrixMode(GL_TEXTURE); + } + else + { + gGL.getTexUnit(1)->activate(); + glMatrixMode(GL_TEXTURE); + glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); + gPipeline.mTextureMatrixOps++; + gGL.getTexUnit(0)->activate(); + } + glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; - gGL.getTexUnit(0)->activate(); - } - glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); - gPipeline.mTextureMatrixOps++; - } - - if (mShiny && mVertexShaderLevel > 1 && texture) - { - if (params.mTexture.notNull()) - { - gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ; - params.mTexture->addTextureStats(params.mVSize); + tex_setup = true; } - else + + if (mShiny && mVertexShaderLevel > 1 && texture) { - gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); + if (params.mTexture.notNull()) + { + gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ; + params.mTexture->addTextureStats(params.mVSize); + } + else + { + gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); + } } } - + if (params.mGroup) { params.mGroup->rebuildMesh(); @@ -1336,7 +1372,7 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL params.mVertexBuffer->setBuffer(mask); params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); - if (params.mTextureMatrix) + if (tex_setup) { if (mShiny) { diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 8ff60f73cc..9b73b2f9b6 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -105,7 +105,15 @@ void LLDrawPoolGlow::render(S32 pass) LLGLDepthTest depth(GL_TRUE, GL_FALSE); gGL.setColorMask(false, true); - renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask()); + + if (shader_level > 1) + { + pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + } + else + { + renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask()); + } gGL.setColorMask(true, false); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -179,13 +187,24 @@ void LLDrawPoolSimple::render(S32 pass) { //render simple LLFastTimer t(FTM_RENDER_SIMPLE); gPipeline.enableLightsDynamic(); - renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); - if (LLPipeline::sRenderDeferred) - { //if deferred rendering is enabled, bump faces aren't registered as simple - //render bump faces here as simple so bump faces will appear under water - renderTexture(LLRenderPass::PASS_BUMP, getVertexDataMask()); + if (mVertexShaderLevel > 0) + { + U32 mask = getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX; + + pushBatches(LLRenderPass::PASS_SIMPLE, mask, TRUE, TRUE); + + if (LLPipeline::sRenderDeferred) + { //if deferred rendering is enabled, bump faces aren't registered as simple + //render bump faces here as simple so bump faces will appear under water + pushBatches(LLRenderPass::PASS_BUMP, mask, TRUE, TRUE); + } } + else + { + renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); + } + } } @@ -246,11 +265,11 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) if (LLPipeline::sUnderWaterRender) { - simple_shader = &gObjectSimpleWaterProgram; + simple_shader = &gObjectSimpleNonIndexedWaterProgram; } else { - simple_shader = &gObjectSimpleProgram; + simple_shader = &gObjectSimpleNonIndexedProgram; } if (mVertexShaderLevel > 0) @@ -386,25 +405,21 @@ void LLDrawPoolFullbright::endRenderPass(S32 pass) void LLDrawPoolFullbright::render(S32 pass) { //render fullbright LLFastTimer t(FTM_RENDER_FULLBRIGHT); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + if (mVertexShaderLevel > 0) { fullbright_shader->bind(); fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; + pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); } else { gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR; + renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); } - - //gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); - - //LLGLEnable test(GL_ALPHA_TEST); - //LLGLEnable blend(GL_BLEND); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR; - renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); - - //gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } S32 LLDrawPoolFullbright::getNumPasses() diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 195ee60a2e..81c796b146 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -66,11 +66,11 @@ void LLDrawPoolTree::beginRenderPass(S32 pass) if (LLPipeline::sUnderWaterRender) { - shader = &gObjectSimpleWaterProgram; + shader = &gObjectSimpleNonIndexedWaterProgram; } else { - shader = &gObjectSimpleProgram; + shader = &gObjectSimpleNonIndexedProgram; } if (gPipeline.canUseWindLightShadersOnObjects()) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 29f3acdf91..e60b3f4543 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -66,12 +66,20 @@ LLGLSLShader gObjectSimpleProgram; LLGLSLShader gObjectSimpleWaterProgram; LLGLSLShader gObjectFullbrightProgram; LLGLSLShader gObjectFullbrightWaterProgram; - LLGLSLShader gObjectFullbrightShinyProgram; LLGLSLShader gObjectFullbrightShinyWaterProgram; LLGLSLShader gObjectShinyProgram; LLGLSLShader gObjectShinyWaterProgram; +LLGLSLShader gObjectSimpleNonIndexedProgram; +LLGLSLShader gObjectSimpleNonIndexedWaterProgram; +LLGLSLShader gObjectFullbrightNonIndexedProgram; +LLGLSLShader gObjectFullbrightNonIndexedWaterProgram; +LLGLSLShader gObjectFullbrightShinyNonIndexedProgram; +LLGLSLShader gObjectFullbrightShinyNonIndexedWaterProgram; +LLGLSLShader gObjectShinyNonIndexedProgram; +LLGLSLShader gObjectShinyNonIndexedWaterProgram; + //object hardware skinning shaders LLGLSLShader gSkinnedObjectSimpleProgram; LLGLSLShader gSkinnedObjectFullbrightProgram; @@ -113,6 +121,7 @@ LLGLSLShader gDeferredImpostorProgram; LLGLSLShader gDeferredEdgeProgram; LLGLSLShader gDeferredWaterProgram; LLGLSLShader gDeferredDiffuseProgram; +LLGLSLShader gDeferredNonIndexedDiffuseProgram; LLGLSLShader gDeferredSkinnedDiffuseProgram; LLGLSLShader gDeferredSkinnedBumpProgram; LLGLSLShader gDeferredSkinnedAlphaProgram; @@ -132,6 +141,7 @@ LLGLSLShader gDeferredShadowProgram; LLGLSLShader gDeferredAvatarShadowProgram; LLGLSLShader gDeferredAttachmentShadowProgram; LLGLSLShader gDeferredAlphaProgram; +LLGLSLShader gDeferredAvatarEyesProgram; LLGLSLShader gDeferredFullbrightProgram; LLGLSLShader gDeferredGIProgram; LLGLSLShader gDeferredGIFinalProgram; @@ -162,6 +172,10 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gObjectFullbrightProgram); mShaderList.push_back(&gObjectFullbrightShinyProgram); mShaderList.push_back(&gObjectFullbrightShinyWaterProgram); + mShaderList.push_back(&gObjectSimpleNonIndexedProgram); + mShaderList.push_back(&gObjectFullbrightNonIndexedProgram); + mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram); + mShaderList.push_back(&gObjectFullbrightShinyNonIndexedWaterProgram); mShaderList.push_back(&gSkinnedObjectSimpleProgram); mShaderList.push_back(&gSkinnedObjectFullbrightProgram); mShaderList.push_back(&gSkinnedObjectFullbrightShinyProgram); @@ -185,6 +199,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredAlphaProgram); mShaderList.push_back(&gDeferredSkinnedAlphaProgram); mShaderList.push_back(&gDeferredFullbrightProgram); + mShaderList.push_back(&gDeferredAvatarEyesProgram); mShaderList.push_back(&gDeferredPostGIProgram); mShaderList.push_back(&gDeferredEdgeProgram); mShaderList.push_back(&gDeferredPostProgram); @@ -586,6 +601,16 @@ void LLViewerShaderMgr::unloadShaders() gObjectFullbrightShinyWaterProgram.unload(); gObjectShinyWaterProgram.unload(); + gObjectSimpleNonIndexedProgram.unload(); + gObjectSimpleNonIndexedWaterProgram.unload(); + gObjectFullbrightNonIndexedProgram.unload(); + gObjectFullbrightNonIndexedWaterProgram.unload(); + + gObjectShinyNonIndexedProgram.unload(); + gObjectFullbrightShinyNonIndexedProgram.unload(); + gObjectFullbrightShinyNonIndexedWaterProgram.unload(); + gObjectShinyNonIndexedWaterProgram.unload(); + gSkinnedObjectSimpleProgram.unload(); gSkinnedObjectFullbrightProgram.unload(); gSkinnedObjectFullbrightShinyProgram.unload(); @@ -616,6 +641,7 @@ void LLViewerShaderMgr::unloadShaders() gPostNightVisionProgram.unload(); gDeferredDiffuseProgram.unload(); + gDeferredNonIndexedDiffuseProgram.unload(); gDeferredSkinnedDiffuseProgram.unload(); gDeferredSkinnedBumpProgram.unload(); gDeferredSkinnedAlphaProgram.unload(); @@ -707,6 +733,14 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightFullbrightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); for (U32 i = 0; i < shaders.size(); i++) { @@ -953,6 +987,32 @@ void setup_indexed_texture(LLGLSLShader& shader) shader.uniform1i("tex5", 5); shader.uniform1i("tex6", 6); shader.uniform1i("tex7", 7); + + S32 cur_tex = 8; //adjust any texture channels that might have been overwritten + for (U32 i = 0; i < shader.mTexture.size(); i++) + { + if (shader.mTexture[i] > -1 && shader.mTexture[i] < 7) + { + shader.uniform1i(i, cur_tex); + shader.mTexture[i] = cur_tex++; + } + } + shader.unbind(); +} + +void setup_indexed_texture_with_cubemap(LLGLSLShader& shader) +{ + shader.bind(); + shader.uniform1i("tex0", 0); + shader.uniform1i("tex1", 1); + shader.uniform1i("tex2", 2); + shader.uniform1i("tex3", 3); + shader.uniform1i("tex4", 4); + shader.uniform1i("tex5", 5); + shader.uniform1i("tex6", 6); + shader.uniform1i("environmentMap", 7); + shader.mTexture[LLViewerShaderMgr::ENVIRONMENT_MAP] = 7; + shader.mTexture[LLViewerShaderMgr::DIFFUSE_MAP] = 0; shader.unbind(); } @@ -962,6 +1022,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredTreeProgram.unload(); gDeferredDiffuseProgram.unload(); + gDeferredNonIndexedDiffuseProgram.unload(); gDeferredSkinnedDiffuseProgram.unload(); gDeferredSkinnedBumpProgram.unload(); gDeferredSkinnedAlphaProgram.unload(); @@ -982,6 +1043,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.unload(); gDeferredAlphaProgram.unload(); gDeferredFullbrightProgram.unload(); + gDeferredAvatarEyesProgram.unload(); gDeferredPostGIProgram.unload(); gDeferredEdgeProgram.unload(); gDeferredPostProgram.unload(); @@ -1017,6 +1079,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() } } + if (success) + { + gDeferredNonIndexedDiffuseProgram.mName = "Non Indexed Deferred Diffuse Shader"; + gDeferredNonIndexedDiffuseProgram.mShaderFiles.clear(); + gDeferredNonIndexedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredNonIndexedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredNonIndexedDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + success = gDeferredNonIndexedDiffuseProgram.createShader(NULL, NULL); + } + + if (success) { gDeferredSkinnedDiffuseProgram.mName = "Deferred Skinned Diffuse Shader"; @@ -1237,6 +1310,24 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredAlphaProgram.createShader(NULL, NULL); + if (success) + { + setup_indexed_texture(gDeferredAlphaProgram); + } + } + + if (success) + { + gDeferredAvatarEyesProgram.mName = "Deferred Avatar Eyes Shader"; + gDeferredAvatarEyesProgram.mFeatures.calculatesAtmospherics = true; + gDeferredAvatarEyesProgram.mFeatures.hasGamma = true; + gDeferredAvatarEyesProgram.mFeatures.hasTransport = true; + gDeferredAvatarEyesProgram.mFeatures.isFullbright = true; + gDeferredAvatarEyesProgram.mShaderFiles.clear(); + gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredAvatarEyesProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + success = gDeferredAvatarEyesProgram.createShader(NULL, NULL); } if (success) @@ -1515,6 +1606,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() BOOL LLViewerShaderMgr::loadShadersObject() { BOOL success = TRUE; + bool batch_textures = mVertexShaderLevel[SHADER_OBJECT] > 1; if (mVertexShaderLevel[SHADER_OBJECT] == 0) { @@ -1526,6 +1618,14 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectSimpleWaterProgram.unload(); gObjectFullbrightProgram.unload(); gObjectFullbrightWaterProgram.unload(); + gObjectShinyNonIndexedProgram.unload(); + gObjectFullbrightShinyNonIndexedProgram.unload(); + gObjectFullbrightShinyNonIndexedWaterProgram.unload(); + gObjectShinyNonIndexedWaterProgram.unload(); + gObjectSimpleNonIndexedProgram.unload(); + gObjectSimpleNonIndexedWaterProgram.unload(); + gObjectFullbrightNonIndexedProgram.unload(); + gObjectFullbrightNonIndexedWaterProgram.unload(); gSkinnedObjectSimpleProgram.unload(); gSkinnedObjectFullbrightProgram.unload(); gSkinnedObjectFullbrightShinyProgram.unload(); @@ -1538,6 +1638,137 @@ BOOL LLViewerShaderMgr::loadShadersObject() return TRUE; } + if (success) + { + gObjectSimpleNonIndexedProgram.mName = "Non indexed Shader"; + gObjectSimpleNonIndexedProgram.mFeatures.calculatesLighting = true; + gObjectSimpleNonIndexedProgram.mFeatures.calculatesAtmospherics = true; + gObjectSimpleNonIndexedProgram.mFeatures.hasGamma = true; + gObjectSimpleNonIndexedProgram.mFeatures.hasAtmospherics = true; + gObjectSimpleNonIndexedProgram.mFeatures.hasLighting = true; + gObjectSimpleNonIndexedProgram.mFeatures.disableTextureIndex = true; + gObjectSimpleNonIndexedProgram.mShaderFiles.clear(); + gObjectSimpleNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectSimpleNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectSimpleNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectSimpleNonIndexedProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectSimpleNonIndexedWaterProgram.mName = "Non indexed Water Shader"; + gObjectSimpleNonIndexedWaterProgram.mFeatures.calculatesLighting = true; + gObjectSimpleNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectSimpleNonIndexedWaterProgram.mFeatures.hasWaterFog = true; + gObjectSimpleNonIndexedWaterProgram.mFeatures.hasAtmospherics = true; + gObjectSimpleNonIndexedWaterProgram.mFeatures.hasLighting = true; + gObjectSimpleNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; + gObjectSimpleNonIndexedWaterProgram.mShaderFiles.clear(); + gObjectSimpleNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectSimpleNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectSimpleNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectSimpleNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectSimpleNonIndexedWaterProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectFullbrightNonIndexedProgram.mName = "Non Indexed Fullbright Shader"; + gObjectFullbrightNonIndexedProgram.mFeatures.calculatesAtmospherics = true; + gObjectFullbrightNonIndexedProgram.mFeatures.hasGamma = true; + gObjectFullbrightNonIndexedProgram.mFeatures.hasTransport = true; + gObjectFullbrightNonIndexedProgram.mFeatures.isFullbright = true; + gObjectFullbrightNonIndexedProgram.mFeatures.disableTextureIndex = true; + gObjectFullbrightNonIndexedProgram.mShaderFiles.clear(); + gObjectFullbrightNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectFullbrightNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectFullbrightNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectFullbrightNonIndexedProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectFullbrightNonIndexedWaterProgram.mName = "Non Indexed Fullbright Water Shader"; + gObjectFullbrightNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectFullbrightNonIndexedWaterProgram.mFeatures.isFullbright = true; + gObjectFullbrightNonIndexedWaterProgram.mFeatures.hasWaterFog = true; + gObjectFullbrightNonIndexedWaterProgram.mFeatures.hasTransport = true; + gObjectFullbrightNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; + gObjectFullbrightNonIndexedWaterProgram.mShaderFiles.clear(); + gObjectFullbrightNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectFullbrightNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectFullbrightNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectFullbrightNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectFullbrightNonIndexedWaterProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectShinyNonIndexedProgram.mName = "Non Indexed Shiny Shader"; + gObjectShinyNonIndexedProgram.mFeatures.calculatesAtmospherics = true; + gObjectShinyNonIndexedProgram.mFeatures.calculatesLighting = true; + gObjectShinyNonIndexedProgram.mFeatures.hasGamma = true; + gObjectShinyNonIndexedProgram.mFeatures.hasAtmospherics = true; + gObjectShinyNonIndexedProgram.mFeatures.isShiny = true; + gObjectShinyNonIndexedProgram.mFeatures.disableTextureIndex = true; + gObjectShinyNonIndexedProgram.mShaderFiles.clear(); + gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectShinyNonIndexedProgram.createShader(NULL, &mShinyUniforms); + } + + if (success) + { + gObjectShinyNonIndexedWaterProgram.mName = "Non Indexed Shiny Water Shader"; + gObjectShinyNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectShinyNonIndexedWaterProgram.mFeatures.calculatesLighting = true; + gObjectShinyNonIndexedWaterProgram.mFeatures.isShiny = true; + gObjectShinyNonIndexedWaterProgram.mFeatures.hasWaterFog = true; + gObjectShinyNonIndexedWaterProgram.mFeatures.hasAtmospherics = true; + gObjectShinyNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; + gObjectShinyNonIndexedWaterProgram.mShaderFiles.clear(); + gObjectShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectShinyNonIndexedWaterProgram.createShader(NULL, &mShinyUniforms); + } + + if (success) + { + gObjectFullbrightShinyNonIndexedProgram.mName = "Non Indexed Fullbright Shiny Shader"; + gObjectFullbrightShinyNonIndexedProgram.mFeatures.calculatesAtmospherics = true; + gObjectFullbrightShinyNonIndexedProgram.mFeatures.isFullbright = true; + gObjectFullbrightShinyNonIndexedProgram.mFeatures.isShiny = true; + gObjectFullbrightShinyNonIndexedProgram.mFeatures.hasGamma = true; + gObjectFullbrightShinyNonIndexedProgram.mFeatures.hasTransport = true; + gObjectFullbrightShinyNonIndexedProgram.mFeatures.disableTextureIndex = true; + gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.clear(); + gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectFullbrightShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectFullbrightShinyNonIndexedProgram.createShader(NULL, &mShinyUniforms); + } + + if (success) + { + gObjectFullbrightShinyNonIndexedWaterProgram.mName = "Non Indexed Fullbright Shiny Water Shader"; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.isFullbright = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.isShiny = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.hasGamma = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.hasTransport = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.hasWaterFog = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; + gObjectFullbrightShinyNonIndexedWaterProgram.mShaderFiles.clear(); + gObjectFullbrightShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectFullbrightShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectFullbrightShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectFullbrightShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectFullbrightShinyNonIndexedWaterProgram.createShader(NULL, &mShinyUniforms); + } + if (success) { gObjectSimpleProgram.mName = "Simple Shader"; @@ -1551,6 +1782,11 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectSimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectSimpleProgram.createShader(NULL, NULL); + + if (success && batch_textures) + { + setup_indexed_texture(gObjectSimpleProgram); + } } if (success) @@ -1567,6 +1803,11 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectSimpleWaterProgram.createShader(NULL, NULL); + + if (success && batch_textures) + { + setup_indexed_texture(gObjectSimpleWaterProgram); + } } if (success) @@ -1581,6 +1822,10 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectFullbrightProgram.createShader(NULL, NULL); + if (success && batch_textures) + { + setup_indexed_texture(gObjectFullbrightProgram); + } } if (success) @@ -1596,6 +1841,10 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectFullbrightWaterProgram.createShader(NULL, NULL); + if (success && batch_textures) + { + setup_indexed_texture(gObjectFullbrightWaterProgram); + } } if (success) @@ -1611,6 +1860,10 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectShinyProgram.createShader(NULL, &mShinyUniforms); + if (success && batch_textures) + { + setup_indexed_texture_with_cubemap(gObjectShinyProgram); + } } if (success) @@ -1627,6 +1880,10 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectShinyWaterProgram.createShader(NULL, &mShinyUniforms); + if (success && batch_textures) + { + setup_indexed_texture_with_cubemap(gObjectShinyWaterProgram); + } } if (success) @@ -1642,6 +1899,10 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms); + if (success && batch_textures) + { + setup_indexed_texture_with_cubemap(gObjectFullbrightShinyProgram); + } } if (success) @@ -1659,6 +1920,10 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectFullbrightShinyWaterProgram.createShader(NULL, &mShinyUniforms); + if (success && batch_textures) + { + setup_indexed_texture_with_cubemap(gObjectFullbrightShinyWaterProgram); + } } if (mVertexShaderLevel[SHADER_AVATAR] > 0) @@ -1672,6 +1937,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectSimpleProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectSimpleProgram.mFeatures.hasLighting = true; gSkinnedObjectSimpleProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectSimpleProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectSimpleProgram.mShaderFiles.clear(); gSkinnedObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1687,6 +1953,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightProgram.mFeatures.hasTransport = true; gSkinnedObjectFullbrightProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1703,6 +1970,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyProgram.mFeatures.isShiny = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightShinyProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightShinyProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1719,6 +1987,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectShinySimpleProgram.mFeatures.hasObjectSkinning = true; gSkinnedObjectShinySimpleProgram.mFeatures.isShiny = true; + gSkinnedObjectShinySimpleProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectShinySimpleProgram.mShaderFiles.clear(); gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1734,9 +2003,11 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectSimpleWaterProgram.mFeatures.hasGamma = true; gSkinnedObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectSimpleWaterProgram.mFeatures.hasLighting = true; + gSkinnedObjectSimpleWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectSimpleWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gSkinnedObjectSimpleWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectSimpleWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectSimpleWaterProgram.mShaderFiles.clear(); gSkinnedObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1753,6 +2024,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.hasObjectSkinning = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true; + gSkinnedObjectFullbrightWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gSkinnedObjectFullbrightWaterProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -1771,6 +2043,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasObjectSkinning = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true; + gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -1789,6 +2062,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasObjectSkinning = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.isShiny = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasWaterFog = true; + gSkinnedObjectShinySimpleWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectShinySimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.clear(); gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index f5371f0619..6ecba65470 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -298,16 +298,25 @@ extern LLVector4 gShinyOrigin; //object shaders extern LLGLSLShader gObjectSimpleProgram; extern LLGLSLShader gObjectSimpleWaterProgram; +extern LLGLSLShader gObjectSimpleNonIndexedProgram; +extern LLGLSLShader gObjectSimpleNonIndexedWaterProgram; extern LLGLSLShader gObjectFullbrightProgram; extern LLGLSLShader gObjectFullbrightWaterProgram; +extern LLGLSLShader gObjectFullbrightNonIndexedProgram; +extern LLGLSLShader gObjectFullbrightNonIndexedWaterProgram; extern LLGLSLShader gObjectSimpleLODProgram; extern LLGLSLShader gObjectFullbrightLODProgram; extern LLGLSLShader gObjectFullbrightShinyProgram; extern LLGLSLShader gObjectFullbrightShinyWaterProgram; +extern LLGLSLShader gObjectFullbrightShinyNonIndexedProgram; +extern LLGLSLShader gObjectFullbrightShinyNonIndexedWaterProgram; + extern LLGLSLShader gObjectShinyProgram; extern LLGLSLShader gObjectShinyWaterProgram; +extern LLGLSLShader gObjectShinyNonIndexedProgram; +extern LLGLSLShader gObjectShinyNonIndexedWaterProgram; extern LLGLSLShader gSkinnedObjectSimpleProgram; extern LLGLSLShader gSkinnedObjectFullbrightProgram; @@ -349,6 +358,7 @@ extern LLGLSLShader gDeferredImpostorProgram; extern LLGLSLShader gDeferredEdgeProgram; extern LLGLSLShader gDeferredWaterProgram; extern LLGLSLShader gDeferredDiffuseProgram; +extern LLGLSLShader gDeferredNonIndexedDiffuseProgram; extern LLGLSLShader gDeferredSkinnedDiffuseProgram; extern LLGLSLShader gDeferredSkinnedBumpProgram; extern LLGLSLShader gDeferredSkinnedAlphaProgram; @@ -373,6 +383,7 @@ extern LLGLSLShader gDeferredAvatarShadowProgram; extern LLGLSLShader gDeferredAttachmentShadowProgram; extern LLGLSLShader gDeferredAlphaProgram; extern LLGLSLShader gDeferredFullbrightProgram; +extern LLGLSLShader gDeferredAvatarEyesProgram; extern LLGLSLShader gDeferredAvatarAlphaProgram; extern LLGLSLShader gDeferredWLSkyProgram; extern LLGLSLShader gDeferredWLCloudProgram; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 85b740d819..a4b0910c92 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -324,10 +324,18 @@ void LLVOPartGroup::getGeometry(S32 idx, LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis(); - + + //HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should) + // this works because there is actually a 4th float stored after the vertex position which is used as a texture index + // also, somebody please VECTORIZE THIS + + verticesp->mV[3] = 0.f; *verticesp++ = part_pos_agent + up - right; + verticesp->mV[3] = 0.f; *verticesp++ = part_pos_agent - up - right; + verticesp->mV[3] = 0.f; *verticesp++ = part_pos_agent + up + right; + verticesp->mV[3] = 0.f; *verticesp++ = part_pos_agent - up + right; *colorsp++ = part.mColor; @@ -360,7 +368,7 @@ U32 LLVOPartGroup::getPartitionType() const } LLParticlePartition::LLParticlePartition() -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK, TRUE, GL_STREAM_DRAW_ARB) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB) { mRenderPass = LLRenderPass::PASS_ALPHA; mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 6396bc042d..800af26b69 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1483,6 +1483,8 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons facep->setVertexBuffer(buff); } + llassert(facep->getVertexBuffer()->getNumIndices() == 6); + index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp); if (-1 == index_offset) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 87de064ad1..713724cf46 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -73,6 +73,7 @@ #include "llagent.h" #include "llviewermediafocus.h" #include "lldatapacker.h" +#include "llviewershadermgr.h" #include "llvoavatar.h" #include "llvocache.h" @@ -4295,20 +4296,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; - if (LLPipeline::sRenderDeferred) + bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; + + if (batch_textures) { bump_mask |= LLVertexBuffer::MAP_BINORMAL; genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, TRUE); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, TRUE); genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, TRUE); + genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, TRUE); } else { genDrawInfo(group, simple_mask, simple_faces); genDrawInfo(group, fullbright_mask, fullbright_faces); genDrawInfo(group, bump_mask, bump_faces, FALSE, TRUE); + genDrawInfo(group, alpha_mask, alpha_faces, TRUE); } - genDrawInfo(group, alpha_mask, alpha_faces, TRUE); + if (!LLPipeline::sDelayVBUpdate) { @@ -4482,25 +4487,60 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: std::vector texture_list; - if (!distance_sort && batch_textures) + if (batch_textures) { U8 cur_tex = 0; facep->setTextureIndex(cur_tex); texture_list.push_back(tex); - if (can_batch_texture(facep)) + //if (can_batch_texture(facep)) { while (i != faces.end()) { facep = *i; if (facep->getTexture() != tex) { - cur_tex++; + if (distance_sort) + { //textures might be out of order, see if texture exists in current batch + bool found = false; + for (U32 tex_idx = 0; tex_idx < texture_list.size(); ++tex_idx) + { + if (facep->getTexture() == texture_list[tex_idx]) + { + cur_tex = tex_idx; + found = true; + break; + } + } + + if (!found) + { + cur_tex = texture_list.size(); + } + } + else + { + cur_tex++; + + if (cur_tex >= 7 && facep->getTextureEntry()->getShiny()) + { //entry 7 is reserved for the environment map for shiny faces + break; + } + } + + if (!can_batch_texture(facep)) + { //face is bump mapped or has an animated texture matrix -- can't + //batch more than 1 texture at a time + break; + } + if (cur_tex >= 8) { //cut batches on every 8 textures break; } + tex = facep->getTexture(); + texture_list.push_back(tex); } @@ -4509,11 +4549,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: break; } - if (!can_batch_texture(facep)) - { //cut batches on things that require single texture rendering (animated texture, bump maps) - break; - } - ++i; index_count += facep->getIndicesCount(); geom_count += facep->getGeomCount(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fadae7c71e..1489c033e2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3606,7 +3606,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) if (gDebugGL) { check_stack_depth(stack_depth); - std::string msg = llformat("%s pass %d", gPoolNames[cur_type].c_str(), i); + std::string msg = llformat("pass %d", i); LLGLState::checkStates(msg); LLGLState::checkTextureChannels(msg); LLGLState::checkClientArrays(msg); @@ -6568,8 +6568,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen noise_map = mNoiseMap; } - LLGLState::checkTextureChannels(); - shader.bind(); S32 channel = 0; channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); @@ -7852,8 +7850,6 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->activate(); shader.unbind(); - - LLGLState::checkTextureChannels(); } inline float sgn(float a) -- cgit v1.2.3 From 504e0a2522ec2fbe1ce17f9d29c42c1936cb0e79 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 30 May 2011 01:53:56 -0500 Subject: unused variable --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 713724cf46..ed6edbb65b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1223,7 +1223,7 @@ BOOL LLVOVolume::calcLOD() } //hold onto unmodified distance for debugging - F32 debug_distance = distance; + //F32 debug_distance = distance; distance *= sDistanceFactor; -- cgit v1.2.3 From 522a28d12721e1cc2e7f726882baa79be97d55fa Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 30 May 2011 02:22:01 -0500 Subject: Fix for classic clouds being busted. --- indra/newview/llvoclouds.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp index 78aa6e6ab8..478708cd78 100644 --- a/indra/newview/llvoclouds.cpp +++ b/indra/newview/llvoclouds.cpp @@ -244,9 +244,13 @@ void LLVOClouds::getGeometry(S32 te, vtx[2] = puff_pos_agent + right + up; vtx[3] = puff_pos_agent + right - up; + verticesp->mV[3] = 0.f; *verticesp++ = vtx[0]; + verticesp->mV[3] = 0.f; *verticesp++ = vtx[1]; + verticesp->mV[3] = 0.f; *verticesp++ = vtx[2]; + verticesp->mV[3] = 0.f; *verticesp++ = vtx[3]; *texcoordsp++ = uvs[0]; -- cgit v1.2.3 From 69391625ebf53a8ee797b268ee6aef7303bea6af Mon Sep 17 00:00:00 2001 From: Seraph Linden Date: Mon, 30 May 2011 13:53:49 -0400 Subject: SH-1677 FIXED [REGRESSION] Bulk uploads do not adhere to default permissions no idea how this ever worked before, as the code since 1.23 has been using the wrong keyword ("everyone_mask" instead of "new_everyone_mask"). I suspect something changed on the sim side? --- indra/newview/llassetuploadresponders.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index c08771c5e7..d7ba4ea470 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -384,18 +384,18 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) // Continuing the horrible hack above, we need to extract the originally requested permissions data, if any, // and use them for each next file to be uploaded. Note the requested perms are not the same as the U32 everyone_perms = - content.has("everyone_mask") ? - content["everyone_mask"].asInteger() : + content.has("new_everyone_mask") ? + content["new_everyone_mask"].asInteger() : PERM_NONE; U32 group_perms = - content.has("group_mask") ? - content["group_mask"].asInteger() : + content.has("new_group_mask") ? + content["new_group_mask"].asInteger() : PERM_NONE; U32 next_owner_perms = - content.has("next_owner_mask") ? - content["next_owner_mask"].asInteger() : + content.has("new_next_owner_mask") ? + content["new_next_owner_mask"].asInteger() : PERM_NONE; std::string display_name = LLStringUtil::null; -- cgit v1.2.3 From fa76b8992c6c636303d398bd25d34c39ae23419e Mon Sep 17 00:00:00 2001 From: Seraph Linden Date: Mon, 30 May 2011 16:49:43 -0400 Subject: SH-1592 FIXED Advanced model uploader needs an IP checkbox like the wizard uploader has --- indra/newview/llfloatermodelpreview.cpp | 15 +++++++++++---- .../skins/default/xui/en/floater_model_preview.xml | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3bddd020e1..8be5c427fe 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -320,9 +320,11 @@ BOOL LLFloaterModelPreview::postBuild() childDisable("upload_skin"); childDisable("upload_joints"); - + childDisable("ok_btn"); + childSetCommitCallback("confirm_checkbox", refresh, this); + mViewOptionMenuButton = getChild("options_gear_btn"); mCommitCallbackRegistrar.add("ModelImport.ViewOption.Action", boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _2)); @@ -2701,7 +2703,8 @@ U32 LLModelPreview::calcResourceCost() if (mFMP && mModelLoader) { - if ( getLoadState() < LLModelLoader::ERROR_PARSING ) + const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); + if ( getLoadState() < LLModelLoader::ERROR_PARSING && confirmed_checkbox ) { mFMP->childEnable("ok_btn"); } @@ -2843,7 +2846,8 @@ void LLModelPreview::rebuildUploadData() F32 max_scale = 0.f; - if ( mBaseScene.size() > 0 ) + const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); + if ( mBaseScene.size() > 0 && confirmed_checkbox ) { mFMP->childEnable("ok_btn"); } @@ -3247,6 +3251,8 @@ void LLModelPreview::loadModelCallback(S32 lod) } mLoading = false; + if (mFMP) + mFMP->getChild("confirm_checkbox")->set(FALSE); refresh(); mModelLoadedSignal(); @@ -3902,7 +3908,8 @@ void LLModelPreview::updateStatusMessages() } } - if ( upload_ok && !errorStateFromLoader && skinAndRigOk ) + const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); + if ( upload_ok && !errorStateFromLoader && skinAndRigOk && confirmed_checkbox) { mFMP->childEnable("ok_btn"); } diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index dce55dae12..4677d014b8 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -83,6 +83,20 @@ + + + I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] [STATUS] -- cgit v1.2.3 From ece32418e7c1828a65c88e526a5afcb635c5453a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 31 May 2011 14:35:59 -0500 Subject: SH-1682 Dynamically adjust the number of texture channels to use for indexed texture rendering based on available hardware. --- indra/llrender/llgl.cpp | 3 +- indra/llrender/llglslshader.cpp | 40 ++++- indra/llrender/llglslshader.h | 1 + indra/llrender/llrender.cpp | 2 +- indra/llrender/llshadermgr.cpp | 129 +++++++++++++--- indra/llrender/llshadermgr.h | 2 +- indra/newview/app_settings/settings.xml | 4 +- .../shaders/class1/avatar/avatarF.glsl | 2 +- .../shaders/class1/avatar/avatarSkinV.glsl | 2 +- .../shaders/class1/avatar/avatarV.glsl | 2 +- .../shaders/class1/avatar/eyeballF.glsl | 2 +- .../shaders/class1/avatar/eyeballV.glsl | 2 +- .../shaders/class1/avatar/objectSkinV.glsl | 2 +- .../shaders/class1/avatar/pickAvatarF.glsl | 2 +- .../shaders/class1/avatar/pickAvatarV.glsl | 2 +- .../shaders/class1/deferred/alphaF.glsl | 2 +- .../shaders/class1/deferred/alphaNonIndexedF.glsl | 67 +++++++++ .../shaders/class1/deferred/alphaSkinnedV.glsl | 2 +- .../shaders/class1/deferred/alphaV.glsl | 2 +- .../shaders/class1/deferred/attachmentShadowF.glsl | 2 +- .../shaders/class1/deferred/attachmentShadowV.glsl | 2 +- .../shaders/class1/deferred/avatarAlphaV.glsl | 2 +- .../shaders/class1/deferred/avatarEyesV.glsl | 2 +- .../shaders/class1/deferred/avatarF.glsl | 2 +- .../shaders/class1/deferred/avatarShadowF.glsl | 2 +- .../shaders/class1/deferred/avatarShadowV.glsl | 2 +- .../shaders/class1/deferred/avatarV.glsl | 2 +- .../shaders/class1/deferred/blurLightF.glsl | 2 +- .../shaders/class1/deferred/blurLightMSF.glsl | 2 +- .../shaders/class1/deferred/blurLightV.glsl | 2 +- .../shaders/class1/deferred/bumpF.glsl | 2 +- .../shaders/class1/deferred/bumpSkinnedV.glsl | 2 +- .../shaders/class1/deferred/bumpV.glsl | 2 +- .../shaders/class1/deferred/cloudsF.glsl | 2 +- .../shaders/class1/deferred/cloudsV.glsl | 2 +- .../shaders/class1/deferred/diffuseF.glsl | 2 +- .../shaders/class1/deferred/diffuseIndexedF.glsl | 31 ---- .../shaders/class1/deferred/diffuseSkinnedV.glsl | 2 +- .../shaders/class1/deferred/diffuseV.glsl | 2 +- .../shaders/class1/deferred/fullbrightF.glsl | 2 +- .../shaders/class1/deferred/fullbrightV.glsl | 2 +- .../app_settings/shaders/class1/deferred/giF.glsl | 2 +- .../app_settings/shaders/class1/deferred/giV.glsl | 2 +- .../shaders/class1/deferred/impostorF.glsl | 2 +- .../shaders/class1/deferred/impostorV.glsl | 2 +- .../shaders/class1/deferred/luminanceF.glsl | 2 +- .../shaders/class1/deferred/luminanceV.glsl | 2 +- .../shaders/class1/deferred/multiPointLightF.glsl | 2 +- .../class1/deferred/multiPointLightMSF.glsl | 2 +- .../shaders/class1/deferred/multiPointLightV.glsl | 2 +- .../shaders/class1/deferred/multiSpotLightF.glsl | 2 +- .../shaders/class1/deferred/multiSpotLightMSF.glsl | 2 +- .../shaders/class1/deferred/pointLightF.glsl | 2 +- .../shaders/class1/deferred/pointLightMSF.glsl | 2 +- .../shaders/class1/deferred/pointLightV.glsl | 2 +- .../shaders/class1/deferred/postDeferredF.glsl | 2 +- .../shaders/class1/deferred/postDeferredMSF.glsl | 2 +- .../class1/deferred/postDeferredNoDoFF.glsl | 2 +- .../class1/deferred/postDeferredNoDoFMSF.glsl | 2 +- .../shaders/class1/deferred/postDeferredV.glsl | 2 +- .../shaders/class1/deferred/postgiF.glsl | 2 +- .../shaders/class1/deferred/postgiV.glsl | 2 +- .../shaders/class1/deferred/shadowF.glsl | 2 +- .../shaders/class1/deferred/shadowV.glsl | 2 +- .../app_settings/shaders/class1/deferred/skyF.glsl | 2 +- .../app_settings/shaders/class1/deferred/skyV.glsl | 2 +- .../shaders/class1/deferred/softenLightF.glsl | 2 +- .../shaders/class1/deferred/softenLightMSF.glsl | 2 +- .../shaders/class1/deferred/softenLightV.glsl | 2 +- .../shaders/class1/deferred/spotLightF.glsl | 2 +- .../shaders/class1/deferred/spotLightMSF.glsl | 2 +- .../shaders/class1/deferred/starsF.glsl | 2 +- .../shaders/class1/deferred/starsV.glsl | 2 +- .../shaders/class1/deferred/sunLightF.glsl | 2 +- .../shaders/class1/deferred/sunLightMSF.glsl | 2 +- .../shaders/class1/deferred/sunLightSSAOF.glsl | 2 +- .../shaders/class1/deferred/sunLightSSAOMSF.glsl | 2 +- .../shaders/class1/deferred/sunLightV.glsl | 2 +- .../shaders/class1/deferred/terrainF.glsl | 2 +- .../shaders/class1/deferred/terrainV.glsl | 2 +- .../shaders/class1/deferred/treeF.glsl | 2 +- .../shaders/class1/deferred/treeV.glsl | 2 +- .../shaders/class1/deferred/waterF.glsl | 2 +- .../shaders/class1/deferred/waterV.glsl | 2 +- .../shaders/class1/effects/glowExtractF.glsl | 2 +- .../shaders/class1/effects/glowExtractMSF.glsl | 2 +- .../shaders/class1/effects/glowExtractV.glsl | 2 +- .../app_settings/shaders/class1/effects/glowF.glsl | 2 +- .../app_settings/shaders/class1/effects/glowV.glsl | 2 +- .../shaders/class1/environment/terrainF.glsl | 2 +- .../shaders/class1/environment/terrainV.glsl | 2 +- .../shaders/class1/environment/terrainWaterF.glsl | 2 +- .../shaders/class1/environment/underWaterF.glsl | 2 +- .../shaders/class1/environment/waterF.glsl | 2 +- .../shaders/class1/environment/waterFogF.glsl | 2 +- .../shaders/class1/environment/waterV.glsl | 2 +- .../shaders/class1/interface/highlightF.glsl | 2 +- .../shaders/class1/interface/highlightV.glsl | 2 +- .../shaders/class1/lighting/lightF.glsl | 2 +- .../shaders/class1/lighting/lightFullbrightF.glsl | 2 +- .../class1/lighting/lightFullbrightShinyF.glsl | 2 +- .../lighting/lightFullbrightShinyWaterF.glsl | 2 +- .../class1/lighting/lightFullbrightWaterF.glsl | 2 +- .../class1/lighting/lightFuncSpecularV.glsl | 2 +- .../shaders/class1/lighting/lightFuncV.glsl | 2 +- .../shaders/class1/lighting/lightShinyF.glsl | 2 +- .../shaders/class1/lighting/lightShinyWaterF.glsl | 2 +- .../shaders/class1/lighting/lightSpecularV.glsl | 2 +- .../shaders/class1/lighting/lightV.glsl | 2 +- .../shaders/class1/lighting/lightWaterF.glsl | 2 +- .../class1/lighting/sumLightsSpecularV.glsl | 2 +- .../shaders/class1/lighting/sumLightsV.glsl | 2 +- .../shaders/class1/objects/fullbrightF.glsl | 2 +- .../shaders/class1/objects/fullbrightShinyF.glsl | 2 +- .../class1/objects/fullbrightShinySkinnedV.glsl | 2 +- .../shaders/class1/objects/fullbrightShinyV.glsl | 2 +- .../class1/objects/fullbrightShinyWaterF.glsl | 2 +- .../shaders/class1/objects/fullbrightSkinnedV.glsl | 2 +- .../shaders/class1/objects/fullbrightV.glsl | 2 +- .../shaders/class1/objects/fullbrightWaterF.glsl | 2 +- .../shaders/class1/objects/shinyF.glsl | 2 +- .../class1/objects/shinySimpleSkinnedV.glsl | 2 +- .../shaders/class1/objects/shinyV.glsl | 2 +- .../shaders/class1/objects/shinyWaterF.glsl | 2 +- .../shaders/class1/objects/simpleF.glsl | 2 - .../shaders/class1/objects/simpleSkinnedV.glsl | 2 +- .../shaders/class1/objects/simpleV.glsl | 2 +- .../shaders/class1/objects/simpleWaterF.glsl | 2 +- .../shaders/class1/windlight/atmosphericsF.glsl | 2 +- .../class1/windlight/atmosphericsHelpersV.glsl | 2 +- .../shaders/class1/windlight/atmosphericsV.glsl | 2 +- .../class1/windlight/atmosphericsVarsF.glsl | 2 +- .../class1/windlight/atmosphericsVarsV.glsl | 2 +- .../shaders/class1/windlight/gammaF.glsl | 2 +- .../shaders/class1/windlight/transportF.glsl | 2 +- .../shaders/class2/avatar/eyeballV.glsl | 2 +- .../shaders/class2/deferred/alphaF.glsl | 4 +- .../shaders/class2/deferred/alphaNonIndexedF.glsl | 125 ++++++++++++++++ .../shaders/class2/deferred/alphaSkinnedV.glsl | 2 +- .../shaders/class2/deferred/alphaV.glsl | 2 +- .../shaders/class2/deferred/avatarAlphaV.glsl | 2 +- .../shaders/class2/deferred/edgeF.glsl | 2 +- .../shaders/class2/deferred/edgeMSF.glsl | 2 +- .../shaders/class2/deferred/edgeV.glsl | 2 +- .../shaders/class2/deferred/multiSpotLightF.glsl | 2 +- .../shaders/class2/deferred/multiSpotLightMSF.glsl | 2 +- .../shaders/class2/deferred/softenLightF.glsl | 2 +- .../shaders/class2/deferred/softenLightMSF.glsl | 2 +- .../shaders/class2/deferred/softenLightV.glsl | 2 +- .../shaders/class2/deferred/spotLightF.glsl | 2 +- .../shaders/class2/deferred/spotLightMSF.glsl | 2 +- .../shaders/class2/deferred/sunLightF.glsl | 2 +- .../shaders/class2/deferred/sunLightMSF.glsl | 2 +- .../shaders/class2/deferred/sunLightSSAOF.glsl | 2 +- .../shaders/class2/deferred/sunLightSSAOMSF.glsl | 2 +- .../shaders/class2/deferred/sunLightV.glsl | 2 +- .../app_settings/shaders/class2/effects/blurF.glsl | 2 +- .../app_settings/shaders/class2/effects/blurV.glsl | 2 +- .../shaders/class2/effects/colorFilterF.glsl | 2 +- .../shaders/class2/effects/drawQuadV.glsl | 2 +- .../shaders/class2/effects/extractF.glsl | 2 +- .../shaders/class2/effects/nightVisionF.glsl | 2 +- .../shaders/class2/effects/simpleF.glsl | 2 +- .../shaders/class2/environment/terrainF.glsl | 2 +- .../shaders/class2/environment/terrainV.glsl | 2 +- .../shaders/class2/environment/terrainWaterF.glsl | 2 +- .../shaders/class2/environment/underWaterF.glsl | 2 +- .../shaders/class2/environment/waterF.glsl | 2 +- .../shaders/class2/environment/waterFogF.glsl | 2 +- .../shaders/class2/lighting/lightF.glsl | 28 ---- .../shaders/class2/lighting/lightFullbrightF.glsl | 30 +--- .../lighting/lightFullbrightNonIndexedF.glsl | 2 +- .../class2/lighting/lightFullbrightShinyF.glsl | 29 +--- .../lighting/lightFullbrightShinyNonIndexedF.glsl | 2 +- .../lighting/lightFullbrightShinyWaterF.glsl | 27 +--- .../lightFullbrightShinyWaterNonIndexedF.glsl | 2 +- .../class2/lighting/lightFullbrightWaterF.glsl | 28 +--- .../lighting/lightFullbrightWaterNonIndexedF.glsl | 2 +- .../shaders/class2/lighting/lightNonIndexedF.glsl | 2 +- .../shaders/class2/lighting/lightShinyF.glsl | 27 +--- .../class2/lighting/lightShinyNonIndexedF.glsl | 2 +- .../shaders/class2/lighting/lightShinyWaterF.glsl | 27 +--- .../lighting/lightShinyWaterNonIndexedF.glsl | 2 +- .../shaders/class2/lighting/lightSpecularV.glsl | 2 +- .../shaders/class2/lighting/lightV.glsl | 2 +- .../shaders/class2/lighting/lightWaterF.glsl | 28 ---- .../class2/lighting/lightWaterNonIndexedF.glsl | 2 +- .../class2/lighting/sumLightsSpecularV.glsl | 2 +- .../shaders/class2/lighting/sumLightsV.glsl | 2 +- .../shaders/class2/objects/fullbrightShinyV.glsl | 2 +- .../shaders/class2/objects/fullbrightV.glsl | 2 +- .../shaders/class2/objects/shinyV.glsl | 2 +- .../shaders/class2/objects/simpleV.glsl | 2 +- .../shaders/class2/windlight/atmosphericsF.glsl | 2 +- .../class2/windlight/atmosphericsHelpersV.glsl | 2 +- .../shaders/class2/windlight/atmosphericsV.glsl | 2 +- .../class2/windlight/atmosphericsVarsF.glsl | 2 +- .../class2/windlight/atmosphericsVarsV.glsl | 2 +- .../shaders/class2/windlight/cloudsF.glsl | 2 +- .../shaders/class2/windlight/cloudsV.glsl | 2 +- .../shaders/class2/windlight/gammaF.glsl | 2 +- .../shaders/class2/windlight/skyF.glsl | 2 +- .../shaders/class2/windlight/skyV.glsl | 2 +- .../shaders/class2/windlight/transportF.glsl | 2 - .../shaders/class3/avatar/avatarV.glsl | 2 +- .../shaders/class3/deferred/giDownsampleF.glsl | 2 +- .../shaders/class3/deferred/giDownsampleV.glsl | 2 +- .../app_settings/shaders/class3/deferred/giF.glsl | 2 +- .../shaders/class3/deferred/giFinalF.glsl | 2 +- .../shaders/class3/deferred/giFinalV.glsl | 2 +- .../app_settings/shaders/class3/deferred/giV.glsl | 2 +- .../shaders/class3/deferred/luminanceF.glsl | 2 +- .../shaders/class3/deferred/luminanceV.glsl | 2 +- .../shaders/class3/deferred/postDeferredF.glsl | 2 +- .../shaders/class3/deferred/postDeferredV.glsl | 2 +- .../shaders/class3/deferred/postgiF.glsl | 2 +- .../shaders/class3/deferred/postgiV.glsl | 2 +- .../shaders/class3/deferred/softenLightF.glsl | 2 +- .../shaders/class3/deferred/softenLightV.glsl | 2 +- .../shaders/class3/deferred/treeF.glsl | 2 +- .../class3/lighting/sumLightsSpecularV.glsl | 2 +- .../shaders/class3/lighting/sumLightsV.glsl | 2 +- indra/newview/lldrawpool.cpp | 5 +- indra/newview/lldrawpoolsimple.cpp | 3 +- indra/newview/llviewershadermgr.cpp | 166 +++++++-------------- indra/newview/llvovolume.cpp | 17 ++- 226 files changed, 620 insertions(+), 609 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 96b1838158..a8d7df3bc8 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -551,7 +551,7 @@ bool LLGLManager::initGL() { GLint num_tex_image_units; glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units); - mNumTextureImageUnits = num_tex_image_units; + mNumTextureImageUnits = llmin(num_tex_image_units, 32); } if (mHasTextureMultisample) @@ -1516,6 +1516,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) } } + stop_glerror(); gGL.getTexUnit(0)->activate(); glClientActiveTextureARB(GL_TEXTURE0_ARB); stop_glerror(); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 71d24bcf13..2dab757828 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -56,7 +56,7 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) LLShaderFeatures::LLShaderFeatures() : calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false), hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false), -hasGamma(false), hasLighting(false), calculatesAtmospherics(false), disableTextureIndex(false) +hasGamma(false), hasLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false) { } @@ -107,16 +107,11 @@ BOOL LLGLSLShader::createShader(vector * attributes, // Create program mProgramObject = glCreateProgramObjectARB(); - // Attach existing objects - if (!LLShaderMgr::instance()->attachShaderFeatures(this)) - { - return FALSE; - } - + //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) { - GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second); + GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, mFeatures.mIndexedTextureChannels); LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL; if (shaderhandle > 0) { @@ -128,6 +123,12 @@ BOOL LLGLSLShader::createShader(vector * attributes, } } + // Attach existing objects + if (!LLShaderMgr::instance()->attachShaderFeatures(this)) + { + return FALSE; + } + // Map attributes and uniforms if (success) { @@ -149,6 +150,29 @@ BOOL LLGLSLShader::createShader(vector * attributes, return createShader(attributes,uniforms); } } + else if (mFeatures.mIndexedTextureChannels > 0) + { //override texture channels for indexed texture rendering + bind(); + S32 channel_count = mFeatures.mIndexedTextureChannels; + + for (S32 i = 0; i < channel_count; i++) + { + uniform1i(llformat("tex%d", i), i); + } + + S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten + for (U32 i = 0; i < mTexture.size(); i++) + { + if (mTexture[i] > -1 && mTexture[i] < channel_count) + { + llassert(cur_tex < gGLManager.mNumTextureImageUnits); + uniform1i(i, cur_tex); + mTexture[i] = cur_tex++; + } + } + unbind(); + } + return success; } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 392688bba3..51be56b295 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -45,6 +45,7 @@ public: bool hasObjectSkinning; bool hasAtmospherics; bool hasGamma; + S32 mIndexedTextureChannels; bool disableTextureIndex; // char numLights; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 0532510996..fdfcfe7fab 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -46,7 +46,7 @@ S32 gGLViewport[4]; U32 LLRender::sUICalls = 0; U32 LLRender::sUIVerts = 0; -static const U32 LL_NUM_TEXTURE_LAYERS = 16; +static const U32 LL_NUM_TEXTURE_LAYERS = 32; static const U32 LL_NUM_LIGHT_UNITS = 8; static GLenum sGLTextureType[] = diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 6fb1e6e437..e51ef8cfe7 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -216,9 +216,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightWaterF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightWaterF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } @@ -231,9 +235,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } } @@ -251,9 +259,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightFullbrightShinyWaterF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightFullbrightShinyWaterF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } else if (features->hasWaterFog) @@ -265,9 +277,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } @@ -280,9 +296,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightFullbrightShinyF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightFullbrightShinyF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } @@ -295,9 +315,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightFullbrightF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightFullbrightF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } } @@ -315,9 +339,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightShinyWaterF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightShinyWaterF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } @@ -330,9 +358,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - else if (!shader->attachObject("lighting/lightShinyF.glsl")) + else { - return FALSE; + if (!shader->attachObject("lighting/lightShinyF.glsl")) + { + return FALSE; + } + shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; } } } @@ -376,7 +408,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns) } } -GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type) +GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels) { GLenum error = GL_NO_ERROR; if (gDebugGL) @@ -430,6 +462,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade GLcharARB* text[1024]; GLuint count = 0; + //set version to 1.20 + text[count++] = strdup("#version 120\n"); + //copy preprocessor definitions into buffer for (std::map::iterator iter = mDefinitions.begin(); iter != mDefinitions.end(); ++iter) { @@ -437,6 +472,64 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = (GLcharARB *) strdup(define.c_str()); } + if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB) + { + //use specified number of texture channels for indexed texture rendering + + /* prepend shader code that looks like this: + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform sampler2D tex2; + . + . + . + uniform sampler2D texN; + + varying float vary_texture_index; + + vec4 diffuseLookup(vec2 texcoord) + { + switch (int(vary_texture_index+0.25)) + { + case 0: return texture2D(tex0, texcoord); + case 1: return texture2D(tex1, texcoord); + case 2: return texture2D(tex2, texcoord); + . + . + . + case N: return texture2D(texN, texcoord); + } + + return vec4(0,0,0,0); + } + */ + + //uniform declartion + for (S32 i = 0; i < texture_index_channels; ++i) + { + std::string decl = llformat("uniform sampler2D tex%d;\n", i); + text[count++] = strdup(decl.c_str()); + } + + text[count++] = strdup("varying float vary_texture_index;\n"); + text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); + text[count++] = strdup("{\n"); + text[count++] = strdup("\tswitch (int(vary_texture_index+0.25))\n"); + text[count++] = strdup("\t{\n"); + + //switch body + for (S32 i = 0; i < texture_index_channels; ++i) + { + std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i); + text[count++] = strdup(case_str.c_str()); + } + + text[count++] = strdup("\t}\n"); + text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("}\n"); + } + //copy file into memory while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(buff) ) { @@ -519,7 +612,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (shader_level > 1) { shader_level--; - return loadShaderFile(filename,shader_level,type); + return loadShaderFile(filename,shader_level,type,texture_index_channels); } LL_WARNS("ShaderLoading") << "Failed to load " << filename << LL_ENDL; } diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 9ee11b98c8..2f30103811 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -43,7 +43,7 @@ public: void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE); BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); BOOL validateProgramObject(GLhandleARB obj); - GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type); + GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2c6d75e3c9..bed7e4705e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7113,7 +7113,7 @@ Type S32 Value - 1 + 4 OctreeAlphaDistanceFactor @@ -7154,7 +7154,7 @@ Vector3 Value - 0.05 + 0.25 0.0 0.0 diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl index 3f6b8b3323..b0fa0ddd3e 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void default_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl index 1ad87badfe..d9f29ced4f 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + attribute vec4 weight; //1 diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index a15846f192..2796222c68 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl index 05fe100372..d86ef19a04 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void default_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 4b8a7604a1..2eb814bd91 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index ef823c28b1..7613e50dca 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + attribute vec4 object_weight; diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl index 27ac59a840..2638351e96 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl index f1aa549a47..86b189b282 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index f6b7f42c22..4a0815a163 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl new file mode 100644 index 0000000000..b0d029dbf4 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -0,0 +1,67 @@ +/** + * @file alphaF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect depthMap; +uniform sampler2D diffuseMap; + + +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform vec2 screen_res; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_fragcoord; +varying vec3 vary_position; +varying vec3 vary_pointlight_col; + +uniform mat4 inv_proj; + +vec4 getPosition(vec2 pos_screen) +{ + float depth = texture2DRect(depthMap, pos_screen.xy).a; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; + frag *= screen_res; + + vec4 pos = vec4(vary_position, 1.0); + + vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy); + + vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); + vec4 color = diff * col; + + color.rgb = atmosLighting(color.rgb); + + color.rgb = scaleSoftClip(color.rgb); + + color.rgb += diff.rgb * vary_pointlight_col.rgb; + + gl_FragColor = color; + //gl_FragColor = vec4(1,0,1,1); + //gl_FragColor = vec4(1,0,1,1)*shadow; + +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 65d9209983..ac3f7189c2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getObjectSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 5890c30d8f..44cb78e914 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl index 164322c3a7..870d593311 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl index 5ae41cb730..c7a4f86727 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + mat4 getObjectSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index a012cb5030..68e4055cf2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl index 536bacd23c..7bc78fe407 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_normal; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index 9748727147..3268618093 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 3d0884bbe8..78986ab12e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 3460f40657..f177fcd8f1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 69c93799b5..7eac11287a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 98d034c2b5..8c75c8045a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl index edec83ea07..6ca51377c1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index c2d05c601a..862f809de5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 37bfaac32c..75b4dc624a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; uniform sampler2D bumpMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl index d884f2e4a5..dc69519a85 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + varying vec3 vary_mat0; varying vec3 vary_mat1; diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 9b109b2db6..5b6726488b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_mat0; varying vec3 vary_mat1; diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index 9e551fa976..ef300d5631 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 267ef36d4d..3eac63076c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index f71d9f0b49..43af480c50 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl index 1bbaeb44ff..e7b5dcce7f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -5,43 +5,12 @@ * $/LicenseInfo$ */ -#version 120 - -varying float vary_texture_index; varying vec3 vary_normal; -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; -uniform sampler2D tex7; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - case 7: return texture2D(tex7, texcoord); - } - - return vec4(0,0,0,0); -} - void main() { vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb; - //col = vec3(vary_texture_index*0.25, 0, 0); - gl_FragData[0] = vec4(col, 0.0); gl_FragData[1] = gl_Color.aaaa; // spec //gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl index 9a45c03237..2c4caea109 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + varying vec3 vary_normal; diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index b8de629fc8..b56d1493c3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_normal; varying float vary_texture_index; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 30231039b0..029f282d7c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 6890360c56..2eed044b7c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl index 75b555e8ae..41c149e774 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl index 8dc1410ea5..e86f2896da 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index e3c15a2ab2..fa811f0d55 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; uniform sampler2D normalMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl index 37148b3f1a..723777bd3a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index 78df54d5dc..25e93ae266 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl index 0c820bfc6c..4baf1fc65a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index e10fb105e8..3c5c780d94 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl index 66c7a5cb4a..6c43679acf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index 2e3e84dd15..434fb6f534 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec4 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index a9f03f7615..0d25d7792d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + //class 1 -- no shadows diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl index b450ff1ca2..c80a54346e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + //class 1 -- no shadows diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 0d771109fb..5efa3200d4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - #version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl index 7521c3310c..feaf38115d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - #version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index 2377947e7f..c510d8ad77 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec4 vary_light; varying vec4 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index d389add03b..f6b0402bb9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl index 711c6dc96d..62ae5f917a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index ab48d08bbb..bf829bfc56 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl index 359b26b7d4..bf35dfe11c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index 12983baa94..876f65ee3a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl index 63b3c9f205..fa3f04bcc8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect depthMap; uniform sampler2DRect normalMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl index ae57227fe5..eebe930666 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index 6674c4a5aa..e0c5406483 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index db3bddc6be..9271a5115c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec4 post_pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 91143943b6..820c82ffd7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 03bca8f27e..1ea00f723a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index c1147feff6..60082f40d6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl index fcba4f57e6..9dfacfb520 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index 8f0bcca76b..745cc01992 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 29fac46bfe..9aaffc15bf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl index 6702bd5014..4bb9bad275 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + //class 1 -- no shadows diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index b1c25b7fd3..2cf7d194cc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl index 1f0376ce6b..c43125dad9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void main() diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl index 00093836a2..f20886565a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + //class 1, no shadow, no SSAO, should never be called diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl index 00093836a2..f20886565a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + //class 1, no shadow, no SSAO, should never be called diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index d1e8359742..665d8126a0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl index ce0ebc54f8..32d1b2149a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index 9beb513ad8..814deb3677 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec4 vary_light; varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 0edae47918..d005f67bf6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D detail_0; uniform sampler2D detail_1; diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index a6163063be..3038fd2966 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_normal; diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index c54d9a1e3e..de7e038402 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 29689ecbaf..a9bef4292d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_normal; diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index e76f598d09..2710422d32 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index 649e392630..5397290b11 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index f2023fa5ea..32f5f5f236 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl index c03a0c61bd..9267a8585d 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl index 0ca0608b45..76736fed53 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void main() { diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl index 65fc2e9f99..d3225546b3 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; uniform float glowStrength; diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl index 0bd44cec90..9bb41626ae 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec2 glowDelta; diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index ac00f15b35..cdc2ca3da2 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D detail0; uniform sampler2D detail1; diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 1e19ee7699..8af981915b 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl index 34f78565a5..d94d986581 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // this class1 shader is just a copy of terrainF diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl index 0dfac84a6e..06854fcc0a 100644 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; uniform sampler2D bumpMap; diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 4e9c09b1ea..0f24e3c35a 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec3 scaleSoftClip(vec3 inColor); vec3 atmosTransport(vec3 inColor); diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index a34cf23790..630459b324 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 applyWaterFog(vec4 color) { diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index 161c794c68..831d6a761c 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl index 6f821f893d..f6c6d945de 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl index d1c98bf70c..f114f766bf 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void main() { diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl index 9c59e8c3ad..1796730c92 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl index 1fee99c446..bfe0be9fdf 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index fb5da21c72..6f1fe91007 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl index 1bdaccf9b8..19072cd052 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl @@ -6,7 +6,7 @@ */ -#version 120 + uniform sampler2D diffuseMap; uniform samplerCube environmentMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl index 2e94d3bbf1..0ae6dc89e2 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl @@ -6,7 +6,7 @@ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl index 714f9a2551..5d4bf2c33e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l) { diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl index 65b45f8081..574252af12 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l) diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl index 7f65ea76f7..29f575b7e5 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl index 8f13e6dc04..65da5a6825 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl index 56f31f6a79..d491f1102e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl index 64d549ff52..ef38ee9699 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl index c5d084c132..286c92326b 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl index 732d246471..772a420e33 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); vec3 atmosAmbient(vec3 light); diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl index 73e1a1ec26..da60a3ddf5 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl index afc3dc89bf..c0b72115dd 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void fullbright_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl index 3dc4294f67..391c06edc8 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void fullbright_shiny_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index f0baeeeee5..f44a5ce32e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index 02367b9439..31e0f0a429 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl index 5daf66fb31..8ffb252f57 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + void fullbright_shiny_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index 02ff3cc2a9..e5dafa8c78 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index 38e07dbd80..3382384c99 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl index afaac4f69c..220f26614f 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void fullbright_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl index 2cf7a69baa..d079de5377 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void shiny_lighting(); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl index 4146646058..cd655f3bb5 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index 6ea83b721d..68a086dbc1 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl index e3babe2210..4649d1c47c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void shiny_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl index d449d37c0c..b4e4dcfbbf 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl @@ -5,8 +5,6 @@ * $/LicenseInfo$ */ -#version 120 - void default_lighting(); void main() diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index be38a14d52..900448035c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index 0d8e14e2e3..b493f76fcc 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl index 68bd81e029..4ec5ee43b4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void default_lighting_water(); diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl index f337bde329..3d05850ab3 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec3 atmosLighting(vec3 light) { diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 4b402a7028..f1a0af21af 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec3 atmosAmbient(vec3 light) { diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl index 20948b1e46..73bbd57315 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void setPositionEye(vec3 v); diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index 8a2c2a7186..e0eb7b3767 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index a1dd4ed5fe..a251213ff5 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl index 7aed1fd3b5..4958cb2f72 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec4 gamma; diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl index 6780dc4d3e..75929bc609 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec3 atmosTransport(vec3 light) { diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 172c2ca078..3e8b719f93 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index bd4875f3ff..681e52de2a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable @@ -15,8 +15,6 @@ uniform sampler2DRectShadow shadowMap2; uniform sampler2DRectShadow shadowMap3; uniform sampler2DRect depthMap; -vec4 diffuseLookup(vec2 texcoord); - uniform mat4 shadow_matrix[6]; uniform vec4 shadow_clip; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl new file mode 100644 index 0000000000..5350359f75 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl @@ -0,0 +1,125 @@ +/** + * @file alphaF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRectShadow shadowMap0; +uniform sampler2DRectShadow shadowMap1; +uniform sampler2DRectShadow shadowMap2; +uniform sampler2DRectShadow shadowMap3; +uniform sampler2DRect depthMap; +uniform sampler2D diffuseMap; + +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform vec2 screen_res; +uniform vec2 shadow_res; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_fragcoord; +varying vec3 vary_position; +varying vec3 vary_pointlight_col; + +uniform float shadow_bias; + +uniform mat4 inv_proj; + +vec4 getPosition(vec2 pos_screen) +{ + float depth = texture2DRect(depthMap, pos_screen.xy).a; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos.xyz /= pos.w; + pos.w = 1.0; + return pos; +} + +float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) +{ + stc.xyz /= stc.w; + stc.z += shadow_bias; + + float cs = shadow2DRect(shadowMap, stc.xyz).x; + float shadow = cs; + + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs); + + return shadow/5.0; +} + + +void main() +{ + vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; + frag *= screen_res; + + float shadow = 1.0; + vec4 pos = vec4(vary_position, 1.0); + + vec4 spos = pos; + + if (spos.z > -shadow_clip.w) + { + vec4 lpos; + + if (spos.z < -shadow_clip.z) + { + lpos = shadow_matrix[3]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap3, lpos, 1.5); + shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); + } + else if (spos.z < -shadow_clip.y) + { + lpos = shadow_matrix[2]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap2, lpos, 1.5); + } + else if (spos.z < -shadow_clip.x) + { + lpos = shadow_matrix[1]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap1, lpos, 1.5); + } + else + { + lpos = shadow_matrix[0]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap0, lpos, 1.5); + } + } + + vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy); + + vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); + vec4 color = diff * col; + + color.rgb = atmosLighting(color.rgb); + + color.rgb = scaleSoftClip(color.rgb); + + color.rgb += diff.rgb * vary_pointlight_col.rgb; + + //gl_FragColor = gl_Color; + gl_FragColor = color; + //gl_FragColor.r = 0.0; + //gl_FragColor = vec4(1,shadow,1,1); + +} + diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index dfb36980b0..948a52da5b 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index c6c0b0f32a..f616ecc872 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 0ae09df0c6..01e40afc4f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl index 30e1702e9f..729e4b5543 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl index 38100d1523..b22bc5b288 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl index b3413c301f..393084a3db 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index de987b1233..f54186ffca 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl index d0f9101774..fee32be3e3 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index dfa1964142..66a1a8515f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl index cb09fe9895..0bae10ca7d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl index 8f0bcca76b..745cc01992 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 50b9ef276e..cd3828fbd4 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl index 8d6ffd79c5..ec9b547a47 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index b724c134b9..315139b415 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl index dd6fa958c9..63d13c996d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 68e18162f6..6dbcc479e1 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl index d28741f945..a2a76eed9f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl index 9beb513ad8..814deb3677 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec4 vary_light; varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl index a4ad0bfa15..dff4d4a68f 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect RenderTexture; uniform float bloomStrength; diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl index d471a6c5e5..de469542f9 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec2 texelSize; uniform vec2 blurDirection; diff --git a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl index 66880b958e..8871bb3fc7 100644 --- a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect RenderTexture; uniform float brightness; diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl index c35c500d62..9c52b8dd5d 100644 --- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void main(void) { diff --git a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl index e77baa5bee..713f8021de 100644 --- a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect RenderTexture; uniform float extractLow; diff --git a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl index 8e0eec6f5e..fd94b2e95f 100644 --- a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect RenderTexture; uniform sampler2D NoiseTexture; diff --git a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl index 98a50e22fc..a1a9c9716c 100644 --- a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect RenderTexture; diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl index bbb8951f3a..9527dc469b 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D detail_0; uniform sampler2D detail_1; diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl index 84906c16bf..2658bee88d 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl index 7590c542ef..974e227b77 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D detail_0; uniform sampler2D detail_1; diff --git a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl index 900f1a6cb8..702e0881ac 100644 --- a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; uniform sampler2D bumpMap; diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl index f4f6b6e90f..c4e4bc08c5 100644 --- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec3 scaleSoftClip(vec3 inColor); vec3 atmosTransport(vec3 inColor); diff --git a/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl index 9f3328cbf0..b66b72b401 100644 --- a/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/waterFogF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec4 lightnorm; uniform vec4 waterPlane; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl index d5775f4506..4c31602736 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl @@ -5,35 +5,7 @@ * $/LicenseInfo$ */ -#version 120 -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; -uniform sampler2D tex7; - -varying float vary_texture_index; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - case 7: return texture2D(tex7, texcoord); - } - - return vec4(0,0,0,0); -} vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl index e64b089dca..95bd052b5d 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl @@ -5,39 +5,11 @@ * $/LicenseInfo$ */ -#version 120 + vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; -uniform sampler2D tex7; - -varying float vary_texture_index; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - case 7: return texture2D(tex7, texcoord); - } - - return vec4(0,0,0,0); -} - void fullbright_lighting() { vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl index 811a919d52..b1e61e1a33 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl index f4ac789a74..26f0ea84e0 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl @@ -5,36 +5,9 @@ * $/LicenseInfo$ */ -#version 120 - -uniform samplerCube environmentMap; -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; - -varying float vary_texture_index; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - } - - return vec4(0,0,0,0); -} +uniform samplerCube environmentMap; vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl index 51a7ddb89a..953298da0d 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform samplerCube environmentMap; uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl index 277170e8af..a6e10a249d 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl @@ -5,35 +5,10 @@ * $License$ */ -#version 120 -uniform samplerCube environmentMap; -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; - -varying float vary_texture_index; -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - } - - return vec4(0,0,0,0); -} +uniform samplerCube environmentMap; vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl index a9a95940e6..b4bb665a2b 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl @@ -5,7 +5,7 @@ * $License$ */ -#version 120 + uniform samplerCube environmentMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl index 37e33059a6..887d4130e7 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl @@ -5,35 +5,9 @@ * $/LicenseInfo$ */ -#version 120 -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; -uniform sampler2D tex7; -varying float vary_texture_index; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - case 7: return texture2D(tex7, texcoord); - } - - return vec4(0,0,0,0); -} +vec4 diffuseLookup(vec2 texcoord); vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl index 3d46c8d874..1234682ae9 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl index 787eeb7af6..149cf791f5 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl index 9f438f513f..300fcac092 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl @@ -5,35 +5,10 @@ * $/LicenseInfo$ */ -#version 120 -uniform samplerCube environmentMap; -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; - -varying float vary_texture_index; -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - } - - return vec4(0,0,0,0); -} +uniform samplerCube environmentMap; vec3 scaleSoftClip(vec3 light); vec3 atmosLighting(vec3 light); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl index 212eacd6ea..e877c0abb1 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform samplerCube environmentMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl index 5e11f6585c..07572fa915 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl @@ -5,35 +5,10 @@ * $/LicenseInfo$ */ -#version 120 -uniform samplerCube environmentMap; -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; - -varying float vary_texture_index; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - } - return vec4(0,0,0,0); -} +uniform samplerCube environmentMap; vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl index cb8a24da60..3904179427 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl index ad1dc4da77..3384f64d07 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightSpecularV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // All lights, no specular highlights diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl index a0f6e019ef..10c770fcc2 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // All lights, no specular highlights diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl index 022544a917..61341a9f1f 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl @@ -5,35 +5,7 @@ * $/LicenseInfo$ */ -#version 120 -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; -uniform sampler2D tex7; - -varying float vary_texture_index; - -vec4 diffuseLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - case 7: return texture2D(tex7, texcoord); - } - - return vec4(0,0,0,0); -} vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl index dc16f2d5cd..ba850b61d0 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl index fde32ed035..8df2e6f222 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl index 8fe49e3be0..3d43a1813a 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l); float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl index e2145e1956..f49e74406f 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl index c4a3611a29..3076fa3260 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 436c193c5d..49992d3535 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl index 50d2beee57..5e02391767 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 77d15fba9a..21a0812c1b 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ////////////////////////////////////////////////////////// // The fragment shader for the terrain atmospherics diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index 8c5b864cbe..ab4cf4806d 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // Output variables vec3 getSunlitColor(); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index 8d365c15ca..b61b0bb396 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // varying param funcs void setSunlitColor(vec3 v); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index cf9ef30632..3a6585bb33 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 398f1556a0..0f6e231ca6 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 13207997b2..20f907a006 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 267ef36d4d..3eac63076c 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index a658edd21f..6570dcb608 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec4 gamma; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index 77ca4868a6..d14c638130 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 03bca8f27e..1ea00f723a 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 7f1ad4d5b4..28381482c1 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -5,8 +5,6 @@ * $/LicenseInfo$ */ -#version 120 - ////////////////////////////////////////////////////////// // The fragment shader for the terrain atmospherics ////////////////////////////////////////////////////////// diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index a003e2a1f1..3d970d252c 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl index fc370ef367..498fee7c66 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2DRect giLightMap; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl index ae57227fe5..eebe930666 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl index 951e3e97ae..9896f8dafe 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl index b2f8b2c633..df4c6b3e0a 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl index 19c4e07b8b..7e20d71529 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl index 8dc1410ea5..e86f2896da 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl index 5f3bf68b24..980def6443 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl index a24eda35dc..9afeac6ddf 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl index ab99a88971..6d4c20f68c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl index 12983baa94..876f65ee3a 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl index f037754708..fc65881680 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl index ae57227fe5..eebe930666 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index ce32f66000..d38d33cc21 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + #extension GL_ARB_texture_rectangle : enable diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl index 8f0bcca76b..745cc01992 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl index c54d9a1e3e..de7e038402 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + uniform sampler2D diffuseMap; diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl index 04533fdce1..92347a5b4a 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl index 73bc18b866..24bbc0a1a1 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ -#version 120 + float calcDirectionalLight(vec3 n, vec3 l); float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index b8b12018d2..d92d9e92a1 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -191,7 +191,7 @@ void LLDrawPool::renderPostDeferred(S32 pass) //virtual void LLDrawPool::endRenderPass( S32 pass ) { - for (U32 i = 1; i < 8; i++) + for (U32 i = 1; i < gGLManager.mNumTextureImageUnits; i++) { //dummy cleanup of any currently bound textures if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) { @@ -199,6 +199,8 @@ void LLDrawPool::endRenderPass( S32 pass ) gGL.getTexUnit(i)->disable(); } } + + gGL.getTexUnit(0)->activate(); } //virtual @@ -491,6 +493,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba if (params.mTextureMatrix) { tex_setup = true; + gGL.getTexUnit(0)->activate(); glMatrixMode(GL_TEXTURE); glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 9b73b2f9b6..6963fea26b 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -171,8 +171,9 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) void LLDrawPoolSimple::endRenderPass(S32 pass) { LLFastTimer t(FTM_RENDER_SIMPLE); + stop_glerror(); LLRenderPass::endRenderPass(pass); - + stop_glerror(); if (mVertexShaderLevel > 0) { simple_shader->unbind(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index e60b3f4543..fb92fabaeb 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -720,32 +720,35 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.clear(); shaders.reserve(13); - shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); - shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) ); - shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); - shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); - shaders.push_back( make_pair( "environment/waterFogF.glsl", mVertexShaderLevel[SHADER_WATER] ) ); - shaders.push_back( make_pair( "lighting/lightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + S32 ch = gGLManager.mNumTextureImageUnits-1; + + std::vector index_channels; + index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mVertexShaderLevel[SHADER_WATER] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); + index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); for (U32 i = 0; i < shaders.size(); i++) { // Note usage of GL_FRAGMENT_SHADER_ARB - if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB) == 0) + if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB, index_channels[i]) == 0) { return FALSE; } @@ -976,46 +979,6 @@ BOOL LLViewerShaderMgr::loadShadersEffects() } -void setup_indexed_texture(LLGLSLShader& shader) -{ - shader.bind(); - shader.uniform1i("tex0", 0); - shader.uniform1i("tex1", 1); - shader.uniform1i("tex2", 2); - shader.uniform1i("tex3", 3); - shader.uniform1i("tex4", 4); - shader.uniform1i("tex5", 5); - shader.uniform1i("tex6", 6); - shader.uniform1i("tex7", 7); - - S32 cur_tex = 8; //adjust any texture channels that might have been overwritten - for (U32 i = 0; i < shader.mTexture.size(); i++) - { - if (shader.mTexture[i] > -1 && shader.mTexture[i] < 7) - { - shader.uniform1i(i, cur_tex); - shader.mTexture[i] = cur_tex++; - } - } - shader.unbind(); -} - -void setup_indexed_texture_with_cubemap(LLGLSLShader& shader) -{ - shader.bind(); - shader.uniform1i("tex0", 0); - shader.uniform1i("tex1", 1); - shader.uniform1i("tex2", 2); - shader.uniform1i("tex3", 3); - shader.uniform1i("tex4", 4); - shader.uniform1i("tex5", 5); - shader.uniform1i("tex6", 6); - shader.uniform1i("environmentMap", 7); - shader.mTexture[LLViewerShaderMgr::ENVIRONMENT_MAP] = 7; - shader.mTexture[LLViewerShaderMgr::DIFFUSE_MAP] = 0; - shader.unbind(); -} - BOOL LLViewerShaderMgr::loadShadersDeferred() { if (mVertexShaderLevel[SHADER_DEFERRED] == 0) @@ -1070,13 +1033,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseProgram.mShaderFiles.clear(); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredDiffuseProgram.createShader(NULL, NULL); - - if (success) - { //force tex0-7 to appropriate texture channels - setup_indexed_texture(gDeferredDiffuseProgram); - } } if (success) @@ -1121,9 +1080,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedAlphaProgram.mFeatures.hasGamma = true; gDeferredSkinnedAlphaProgram.mFeatures.hasAtmospherics = true; gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true; + gDeferredSkinnedAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredSkinnedAlphaProgram.mShaderFiles.clear(); gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL); } @@ -1305,15 +1265,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.mFeatures.hasGamma = true; gDeferredAlphaProgram.mFeatures.hasAtmospherics = true; gDeferredAlphaProgram.mFeatures.hasLighting = true; + gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels + if (mVertexShaderLevel[SHADER_DEFERRED] < 1) + { + gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + } + else + { //shave off some texture units for shadow maps + gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits - 6; + } + gDeferredAlphaProgram.mShaderFiles.clear(); gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredAlphaProgram.createShader(NULL, NULL); - if (success) - { - setup_indexed_texture(gDeferredAlphaProgram); - } } if (success) @@ -1323,6 +1289,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarEyesProgram.mFeatures.hasGamma = true; gDeferredAvatarEyesProgram.mFeatures.hasTransport = true; gDeferredAvatarEyesProgram.mFeatures.isFullbright = true; + gDeferredAvatarEyesProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarEyesProgram.mShaderFiles.clear(); gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1337,16 +1304,12 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mFeatures.hasGamma = true; gDeferredFullbrightProgram.mFeatures.hasTransport = true; gDeferredFullbrightProgram.mFeatures.isFullbright = true; + gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = 0; gDeferredFullbrightProgram.mShaderFiles.clear(); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredFullbrightProgram.createShader(NULL, NULL); - - if (success) - { - setup_indexed_texture(gDeferredFullbrightProgram); - } } if (success) @@ -1453,9 +1416,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.hasGamma = true; gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true; gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true; + gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarAlphaProgram.mShaderFiles.clear(); gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); } @@ -1777,16 +1741,12 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectSimpleProgram.mFeatures.hasGamma = true; gObjectSimpleProgram.mFeatures.hasAtmospherics = true; gObjectSimpleProgram.mFeatures.hasLighting = true; + gObjectSimpleProgram.mFeatures.mIndexedTextureChannels = 0; gObjectSimpleProgram.mShaderFiles.clear(); gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectSimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectSimpleProgram.createShader(NULL, NULL); - - if (success && batch_textures) - { - setup_indexed_texture(gObjectSimpleProgram); - } } if (success) @@ -1797,17 +1757,13 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true; gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true; gObjectSimpleWaterProgram.mFeatures.hasLighting = true; + gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0; gObjectSimpleWaterProgram.mShaderFiles.clear(); gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectSimpleWaterProgram.createShader(NULL, NULL); - - if (success && batch_textures) - { - setup_indexed_texture(gObjectSimpleWaterProgram); - } } if (success) @@ -1817,15 +1773,12 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightProgram.mFeatures.hasGamma = true; gObjectFullbrightProgram.mFeatures.hasTransport = true; gObjectFullbrightProgram.mFeatures.isFullbright = true; + gObjectFullbrightProgram.mFeatures.mIndexedTextureChannels = 0; gObjectFullbrightProgram.mShaderFiles.clear(); gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectFullbrightProgram.createShader(NULL, NULL); - if (success && batch_textures) - { - setup_indexed_texture(gObjectFullbrightProgram); - } } if (success) @@ -1835,16 +1788,13 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightWaterProgram.mFeatures.isFullbright = true; gObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true; gObjectFullbrightWaterProgram.mFeatures.hasTransport = true; + gObjectFullbrightWaterProgram.mFeatures.mIndexedTextureChannels = 0; gObjectFullbrightWaterProgram.mShaderFiles.clear(); gObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); gObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectFullbrightWaterProgram.createShader(NULL, NULL); - if (success && batch_textures) - { - setup_indexed_texture(gObjectFullbrightWaterProgram); - } } if (success) @@ -1855,15 +1805,12 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyProgram.mFeatures.hasGamma = true; gObjectShinyProgram.mFeatures.hasAtmospherics = true; gObjectShinyProgram.mFeatures.isShiny = true; + gObjectShinyProgram.mFeatures.mIndexedTextureChannels = 0; gObjectShinyProgram.mShaderFiles.clear(); gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectShinyProgram.createShader(NULL, &mShinyUniforms); - if (success && batch_textures) - { - setup_indexed_texture_with_cubemap(gObjectShinyProgram); - } } if (success) @@ -1874,16 +1821,13 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyWaterProgram.mFeatures.isShiny = true; gObjectShinyWaterProgram.mFeatures.hasWaterFog = true; gObjectShinyWaterProgram.mFeatures.hasAtmospherics = true; + gObjectShinyWaterProgram.mFeatures.mIndexedTextureChannels = 0; gObjectShinyWaterProgram.mShaderFiles.clear(); gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectShinyWaterProgram.createShader(NULL, &mShinyUniforms); - if (success && batch_textures) - { - setup_indexed_texture_with_cubemap(gObjectShinyWaterProgram); - } } if (success) @@ -1894,15 +1838,12 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyProgram.mFeatures.isShiny = true; gObjectFullbrightShinyProgram.mFeatures.hasGamma = true; gObjectFullbrightShinyProgram.mFeatures.hasTransport = true; + gObjectFullbrightShinyProgram.mFeatures.mIndexedTextureChannels = 0; gObjectFullbrightShinyProgram.mShaderFiles.clear(); gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms); - if (success && batch_textures) - { - setup_indexed_texture_with_cubemap(gObjectFullbrightShinyProgram); - } } if (success) @@ -1914,16 +1855,13 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyWaterProgram.mFeatures.hasGamma = true; gObjectFullbrightShinyWaterProgram.mFeatures.hasTransport = true; gObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true; + gObjectFullbrightShinyWaterProgram.mFeatures.mIndexedTextureChannels = 0; gObjectFullbrightShinyWaterProgram.mShaderFiles.clear(); gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectFullbrightShinyWaterProgram.createShader(NULL, &mShinyUniforms); - if (success && batch_textures) - { - setup_indexed_texture_with_cubemap(gObjectFullbrightShinyWaterProgram); - } } if (mVertexShaderLevel[SHADER_AVATAR] > 0) @@ -2103,6 +2041,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarProgram.mFeatures.hasGamma = true; gAvatarProgram.mFeatures.hasAtmospherics = true; gAvatarProgram.mFeatures.hasLighting = true; + gAvatarProgram.mFeatures.disableTextureIndex = true; gAvatarProgram.mShaderFiles.clear(); gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -2118,6 +2057,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarWaterProgram.mFeatures.hasWaterFog = true; gAvatarWaterProgram.mFeatures.hasAtmospherics = true; gAvatarWaterProgram.mFeatures.hasLighting = true; + gAvatarWaterProgram.mFeatures.disableTextureIndex = true; gAvatarWaterProgram.mShaderFiles.clear(); gAvatarWaterProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -2138,6 +2078,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() { gAvatarPickProgram.mName = "Avatar Pick Shader"; gAvatarPickProgram.mFeatures.hasSkinning = true; + gAvatarPickProgram.mFeatures.disableTextureIndex = true; gAvatarPickProgram.mShaderFiles.clear(); gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -2154,6 +2095,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarEyeballProgram.mFeatures.hasGamma = true; gAvatarEyeballProgram.mFeatures.hasAtmospherics = true; gAvatarEyeballProgram.mFeatures.hasLighting = true; + gAvatarEyeballProgram.mFeatures.disableTextureIndex = true; gAvatarEyeballProgram.mShaderFiles.clear(); gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballF.glsl", GL_FRAGMENT_SHADER_ARB)); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index ed6edbb65b..125283d474 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4455,6 +4455,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: buffer_index = -1; } + S32 texture_index_channels = gGLManager.mNumTextureImageUnits-1; //always reserve one for shiny for now just for simplicity + + if (LLPipeline::sRenderDeferred && distance_sort) + { + texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels; + } + + while (face_iter != faces.end()) { //pull off next face @@ -4521,11 +4529,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: else { cur_tex++; - - if (cur_tex >= 7 && facep->getTextureEntry()->getShiny()) - { //entry 7 is reserved for the environment map for shiny faces - break; - } } if (!can_batch_texture(facep)) @@ -4534,8 +4537,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: break; } - if (cur_tex >= 8) - { //cut batches on every 8 textures + if (cur_tex >= texture_index_channels) + { //cut batches when index channels are depleted break; } -- cgit v1.2.3 From e881ee54d0f6cbddcc08bfd30d09232ed891df08 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 31 May 2011 15:34:05 -0500 Subject: Unused variable. --- indra/newview/llviewershadermgr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index fb92fabaeb..a1cb6d4ea6 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1570,8 +1570,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() BOOL LLViewerShaderMgr::loadShadersObject() { BOOL success = TRUE; - bool batch_textures = mVertexShaderLevel[SHADER_OBJECT] > 1; - + if (mVertexShaderLevel[SHADER_OBJECT] == 0) { gObjectShinyProgram.unload(); -- cgit v1.2.3 From 244f1a3d01bb52bb679fd826faa15d90d7df3666 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 1 Jun 2011 12:09:40 -0600 Subject: fix for STORM-1298: Crash on startup of Second Life 2.7.1(231307) --- indra/newview/llappviewer.cpp | 21 ++++++++++++++------- indra/newview/lldrawpoolbump.cpp | 8 ++++++++ indra/newview/llviewertexturelist.cpp | 11 ++++------- indra/newview/llviewertexturelist.h | 1 - indra/newview/llviewerwindow.cpp | 1 + 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a0be252ab2..cbdaff5b46 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -695,6 +695,8 @@ bool LLAppViewer::init() if (!initConfiguration()) return false; + LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; + // write Google Breakpad minidump files to our log directory std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); logdir += gDirUtilp->getDirDelimiter(); @@ -721,6 +723,8 @@ bool LLAppViewer::init() // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. LLCurl::initClass(); + LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ; + LLMachineID::init(); { @@ -739,7 +743,7 @@ bool LLAppViewer::init() } initThreads(); - LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; ; + LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; writeSystemInfo(); @@ -767,10 +771,6 @@ bool LLAppViewer::init() LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL; LL_INFOS("InitInfo") << "libcurl version is: " << LLCurl::getVersionString() << LL_ENDL; - //Note: --bao - //allow to start texture fetching, must be called after initThreads(); - gTextureList.start() ; - // Get the single value from the crash settings file, if it exists std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); gCrashSettings.loadFromFile(crash_settings_filename); @@ -879,6 +879,7 @@ bool LLAppViewer::init() // Early out from user choice. return false; } + LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ; // Prepare for out-of-memory situations, during which we will crash on // purpose and save a dump. @@ -1047,6 +1048,8 @@ bool LLAppViewer::init() } LLViewerMedia::initClass(); + LL_INFOS("InitInfo") << "Viewer media initialized." << LL_ENDL ; + LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; //EXT-7013 - On windows for some locale (Japanese) standard @@ -2823,6 +2826,8 @@ bool LLAppViewer::initWindow() gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), gSavedSettings.getBOOL("WindowFullScreen"), ignorePixelDepth); + LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL; + // Need to load feature table before cheking to start watchdog. const S32 NEVER_SUBMIT_REPORT = 2; bool use_watchdog = false; @@ -2842,6 +2847,7 @@ bool LLAppViewer::initWindow() { LLWatchdog::getInstance()->init(watchdog_killer_callback); } + LL_INFOS("AppInit") << "watchdog setting is done." << LL_ENDL; LLNotificationsUI::LLNotificationManager::getInstance(); @@ -2864,7 +2870,8 @@ bool LLAppViewer::initWindow() gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); gPipeline.init(); - + LL_INFOS("AppInit") << "gPipeline Initialized" << LL_ENDL; + stop_glerror(); gViewerWindow->initGLDefaults(); @@ -2903,7 +2910,7 @@ bool LLAppViewer::initWindow() // show viewer window //gViewerWindow->mWindow->show(); - + LL_INFOS("AppInit") << "Window initialization done." << LL_ENDL; return true; } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 5f89d11391..2f76baaaf7 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -94,6 +94,13 @@ void LLStandardBumpmap::restoreGL() // static void LLStandardBumpmap::addstandard() { + if(!gTextureList.isInitialized()) + { + //Note: loading pre-configuration sometimes triggers this call. + //But it is safe to return here because bump images will be reloaded during initialization later. + return ; + } + // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps. //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); clear(); @@ -891,6 +898,7 @@ void LLBumpImageList::restoreGL() { if(!gTextureList.isInitialized()) { + //safe to return here because bump images will be reloaded during initialization later. return ; } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index a50361add2..3eeed55cd8 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -88,17 +88,14 @@ LLViewerTextureList::LLViewerTextureList() { } -void LLViewerTextureList::start() -{ +void LLViewerTextureList::init() +{ sRenderThreadID = LLThread::currentID() ; - mInitialized = TRUE ; sNumImages = 0; -} - -void LLViewerTextureList::init() -{ mUpdateStats = TRUE; + mMaxResidentTexMemInMegaBytes = 0; + mMaxTotalTextureMemInMegaBytes = 0 ; // Update how much texture RAM we're allowed to use. updateMaxResidentTexMem(0); // 0 = use current diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 772f533bbb..d02b6be6b5 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -78,7 +78,6 @@ public: LLViewerTextureList(); ~LLViewerTextureList(); - void start(); void init(); void shutdown(); void dump(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6fe79c2e85..34d15a597e 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1638,6 +1638,7 @@ LLViewerWindow::LLViewerWindow( gSavedSettings.setBOOL("RenderVBOEnable", FALSE); } LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable")); + LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ; if (LLFeatureManager::getInstance()->isSafe() || (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion()) -- cgit v1.2.3 From 6992dbc1e32e1d8b803291aa1b87862fd6640c2a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 1 Jun 2011 23:46:04 -0500 Subject: SH-1682 Use GL_ARB_map_buffer_range to mitigate impact of mapping larger vertex buffer objects. Limit number of textures per batch to 6 (prevents frame stalls on NVIDIA). --- indra/llrender/llgl.cpp | 116 +++++++---- indra/llrender/llgl.h | 1 + indra/llrender/llglheaders.h | 12 ++ indra/llrender/llglslshader.cpp | 6 +- indra/llrender/llglslshader.h | 2 + indra/llrender/llimagegl.cpp | 8 +- indra/llrender/llrender.cpp | 10 +- indra/llrender/llvertexbuffer.cpp | 345 ++++++++++++++++++++++++-------- indra/llrender/llvertexbuffer.h | 54 +++-- indra/newview/app_settings/settings.xml | 17 +- indra/newview/lldrawpool.cpp | 2 +- indra/newview/lldrawpoolsimple.cpp | 27 +-- indra/newview/llface.cpp | 112 ++++++----- indra/newview/llspatialpartition.h | 4 +- indra/newview/llviewercontrol.cpp | 1 + indra/newview/llvovolume.cpp | 43 +++- 16 files changed, 505 insertions(+), 255 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index a8d7df3bc8..a3aed4dd8a 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -127,6 +127,11 @@ PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL; PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL; PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL; +// GL_ARB_map_buffer_range +PFNGLMAPBUFFERRANGEPROC glMapBufferRange; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; + + // vertex object prototypes PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI = NULL; PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI = NULL; @@ -331,6 +336,7 @@ LLGLManager::LLGLManager() : mHasBlendFuncSeparate(FALSE), mHasVertexBufferObject(FALSE), + mHasMapBufferRange(FALSE), mHasPBuffer(FALSE), mHasShaderObjects(FALSE), mHasVertexShader(FALSE), @@ -761,6 +767,7 @@ void LLGLManager::initExtensions() mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts); mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); + mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts); mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts); // mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad #ifdef GL_ARB_framebuffer_object @@ -955,6 +962,11 @@ void LLGLManager::initExtensions() mHasVertexBufferObject = FALSE; } } + if (mHasMapBufferRange) + { + glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) GLH_EXT_GET_PROC_ADDRESS("glMapBufferRange"); + glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) GLH_EXT_GET_PROC_ADDRESS("glFlushMappedBufferRange"); + } if (mHasFramebufferObject) { llinfos << "initExtensions() FramebufferObject-related procs..." << llendl; @@ -1411,10 +1423,6 @@ void LLGLState::checkTextureChannels(const std::string& msg) } } - GLint maxTextureUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits); - stop_glerror(); - static const char* label[] = { "GL_TEXTURE_2D", @@ -1449,69 +1457,91 @@ void LLGLState::checkTextureChannels(const std::string& msg) glh::matrix4f identity; identity.identity(); - for (GLint i = 1; i < maxTextureUnits; i++) + for (GLint i = 1; i < gGLManager.mNumTextureUnits; i++) { gGL.getTexUnit(i)->activate(); - glClientActiveTextureARB(GL_TEXTURE0_ARB+i); - stop_glerror(); - glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &stackDepth); - stop_glerror(); - if (stackDepth != 1) + if (i < gGLManager.mNumTextureUnits) { - error = TRUE; - LL_WARNS("RenderState") << "Texture matrix stack corrupted." << LL_ENDL; + glClientActiveTextureARB(GL_TEXTURE0_ARB+i); + stop_glerror(); + glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &stackDepth); + stop_glerror(); - if (gDebugSession) + if (stackDepth != 1) { - gFailLog << "Texture matrix stack corrupted." << std::endl; + error = TRUE; + LL_WARNS("RenderState") << "Texture matrix stack corrupted." << LL_ENDL; + + if (gDebugSession) + { + gFailLog << "Texture matrix stack corrupted." << std::endl; + } } - } - glGetFloatv(GL_TEXTURE_MATRIX, (GLfloat*) mat.m); - stop_glerror(); + glGetFloatv(GL_TEXTURE_MATRIX, (GLfloat*) mat.m); + stop_glerror(); - if (mat != identity) - { - error = TRUE; - LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL; - if (gDebugSession) + if (mat != identity) { - gFailLog << "Texture matrix in channel " << i << " corrupt." << std::endl; + error = TRUE; + LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL; + if (gDebugSession) + { + gFailLog << "Texture matrix in channel " << i << " corrupt." << std::endl; + } } - } - for (S32 j = (i == 0 ? 1 : 0); - j < 9; j++) - { - if (j == 8 && !gGLManager.mHasTextureRectangle || - j == 9 && !gGLManager.mHasTextureMultisample) + for (S32 j = (i == 0 ? 1 : 0); + j < 9; j++) { - continue; - } + if (j == 8 && !gGLManager.mHasTextureRectangle || + j == 9 && !gGLManager.mHasTextureMultisample) + { + continue; + } - if (glIsEnabled(value[j])) + if (glIsEnabled(value[j])) + { + error = TRUE; + LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL; + if (gDebugSession) + { + gFailLog << "Texture channel " << i << " still has " << label[j] << " enabled." << std::endl; + } + } + stop_glerror(); + } + + glGetFloatv(GL_TEXTURE_MATRIX, mat.m); + stop_glerror(); + + if (mat != identity) { error = TRUE; - LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL; + LL_WARNS("RenderState") << "Texture matrix " << i << " is not identity." << LL_ENDL; if (gDebugSession) { - gFailLog << "Texture channel " << i << " still has " << label[j] << " enabled." << std::endl; + gFailLog << "Texture matrix " << i << " is not identity." << std::endl; } } - stop_glerror(); } - glGetFloatv(GL_TEXTURE_MATRIX, mat.m); - stop_glerror(); - - if (mat != identity) { - error = TRUE; - LL_WARNS("RenderState") << "Texture matrix " << i << " is not identity." << LL_ENDL; - if (gDebugSession) + GLint tex = 0; + stop_glerror(); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex); + stop_glerror(); + + if (tex != 0) { - gFailLog << "Texture matrix " << i << " is not identity." << std::endl; + error = TRUE; + LL_WARNS("RenderState") << "Texture channel " << i << " still has texture " << tex << " bound." << llendl; + + if (gDebugSession) + { + gFailLog << "Texture channel " << i << " still has texture " << tex << " bound." << std::endl; + } } } } diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 420922cf06..d1bee00161 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -88,6 +88,7 @@ public: // ARB Extensions BOOL mHasVertexBufferObject; + BOOL mHasMapBufferRange; BOOL mHasPBuffer; BOOL mHasShaderObjects; BOOL mHasVertexShader; diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 825d304d35..94f7a08c92 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -68,6 +68,10 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; +// GL_ARB_map_buffer_range +extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange; +extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; + // GL_ATI_vertex_array_object extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; @@ -306,6 +310,10 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; +// GL_ARB_map_buffer_range +extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange; +extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; + // GL_ATI_vertex_array_object extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; @@ -511,6 +519,10 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; +// GL_ARB_map_buffer_range +extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange; +extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; + // GL_ATI_vertex_array_object extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 2dab757828..5473f23d86 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -48,6 +48,8 @@ using std::pair; using std::make_pair; using std::string; +U32 LLGLSLShader::sCurBoundShader = 0; + BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) { return v1 != v2; @@ -367,7 +369,7 @@ void LLGLSLShader::bind() if (gGLManager.mHasShaderObjects) { glUseProgramObjectARB(mProgramObject); - + sCurBoundShader = mProgramObject; if (mUniformsDirty) { LLShaderMgr::instance()->updateShaderUniforms(this); @@ -390,6 +392,7 @@ void LLGLSLShader::unbind() } } glUseProgramObjectARB(0); + sCurBoundShader = 0; stop_glerror(); } } @@ -397,6 +400,7 @@ void LLGLSLShader::unbind() void LLGLSLShader::bindNoShader(void) { glUseProgramObjectARB(0); + sCurBoundShader = 0; } S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 51be56b295..4922eb6d67 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -66,6 +66,8 @@ public: LLGLSLShader(); + static GLhandleARB sCurBoundShader; + void unload(); BOOL createShader(std::vector * attributes, std::vector * uniforms); diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 3a4139bace..60a5962234 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1418,11 +1418,13 @@ void LLImageGL::deleteDeadTextures() { GLuint tex = sDeadTextureList.front(); sDeadTextureList.pop_front(); - for (int i = 0; i < gGLManager.mNumTextureUnits; i++) + for (int i = 0; i < gGLManager.mNumTextureImageUnits; i++) { - if (sCurrentBoundTextures[i] == tex) + LLTexUnit* tex_unit = gGL.getTexUnit(i); + + if (tex_unit->getCurrTexture() == tex) { - gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); + tex_unit->unbind(tex_unit->getCurrType()); stop_glerror(); } } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index fdfcfe7fab..e91ceb873e 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -30,6 +30,7 @@ #include "llvertexbuffer.h" #include "llcubemap.h" +#include "llglslshader.h" #include "llimagegl.h" #include "llrendertarget.h" #include "lltexture.h" @@ -183,7 +184,8 @@ void LLTexUnit::enable(eTextureType type) mCurrTexType = type; gGL.flush(); - if (type != LLTexUnit::TT_MULTISAMPLE_TEXTURE && + if (LLGLSLShader::sCurBoundShader == 0 && + type != LLTexUnit::TT_MULTISAMPLE_TEXTURE && mIndex < gGLManager.mNumTextureUnits) { glEnable(sGLTextureType[type]); @@ -200,12 +202,10 @@ void LLTexUnit::disable(void) activate(); unbind(mCurrTexType); gGL.flush(); - if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE && + if (LLGLSLShader::sCurBoundShader == 0 && mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE && mIndex < gGLManager.mNumTextureUnits) { - stop_glerror(); glDisable(sGLTextureType[mCurrTexType]); - stop_glerror(); } mCurrTexType = TT_NONE; @@ -295,7 +295,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture); texture->updateBindStats(texture->mTextureMemory); mHasMipMaps = texture->mHasMipMaps; - if (texture->mTexOptionsDirty) + if (mIndex == 0 && texture->mTexOptionsDirty) { texture->mTexOptionsDirty = false; setTextureAddressMode(texture->mAddressMode); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index f715a8e9ba..27cc88462a 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -934,8 +934,26 @@ void LLVertexBuffer::allocateClientIndexBuffer() } } +bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count) +{ + S32 end = index+count; + S32 region_end = region.mIndex+region.mCount; + + if (end < region.mIndex || + index > region_end) + { //gap exists, do not merge + return false; + } + + S32 new_end = llmax(end, region_end); + S32 new_index = llmin(index, region.mIndex); + region.mIndex = new_index; + region.mCount = new_end-new_index; + return true; +} + // Map for data access -U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 access) +U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range) { LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER); if (mFinal) @@ -947,8 +965,44 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 access) llerrs << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << llendl; } - if (!mVertexLocked && useVBOs()) + if (useVBOs()) { + + if (!sDisableVBOMapping && gGLManager.mHasMapBufferRange) + { + if (count == -1) + { + count = mNumVerts; + } + + bool mapped = false; + //see if range is already mapped + for (U32 i = 0; i < mMappedVertexRegions.size(); ++i) + { + MappedRegion& region = mMappedVertexRegions[i]; + if (region.mType == type) + { + if (expand_region(region, index, count)) + { + mapped = true; + } + } + } + + if (!mapped) + { + //not already mapped, map new region + MappedRegion region(type, map_range ? -1 : index, count); + mMappedVertexRegions.push_back(region); + } + } + + if (mVertexLocked && map_range) + { + llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl; + } + + if (!mVertexLocked) { LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_VERTICES); setBuffer(0, type); @@ -957,61 +1011,91 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 access) if(sDisableVBOMapping) { + map_range = false; allocateClientVertexBuffer() ; } else { - U8* src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + U8* src = NULL; + if (gGLManager.mHasMapBufferRange) + { + if (map_range) + { + S32 offset = mOffsets[type] + sTypeSize[type]*index; + S32 length = (sTypeSize[type]*count+0xF) & ~0xF; + src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT); + } + else + { + src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); + } + } + else + { + map_range = false; + src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + } + mMappedData = LL_NEXT_ALIGNED_ADDRESS(src); mAlignedOffset = mMappedData - src; stop_glerror(); } - } - - - if (!mMappedData) - { - log_glerror(); - - //check the availability of memory - U32 avail_phy_mem, avail_vir_mem; - LLMemoryInfo::getAvailableMemoryKB(avail_phy_mem, avail_vir_mem) ; - llinfos << "Available physical mwmory(KB): " << avail_phy_mem << llendl ; - llinfos << "Available virtual memory(KB): " << avail_vir_mem << llendl; - - if(!sDisableVBOMapping) - { - //-------------------- - //print out more debug info before crash - llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ; - GLint size ; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ; - llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ; - //-------------------- + + if (!mMappedData) + { + log_glerror(); + + //check the availability of memory + U32 avail_phy_mem, avail_vir_mem; + LLMemoryInfo::getAvailableMemoryKB(avail_phy_mem, avail_vir_mem) ; + llinfos << "Available physical mwmory(KB): " << avail_phy_mem << llendl ; + llinfos << "Available virtual memory(KB): " << avail_vir_mem << llendl; + + if(!sDisableVBOMapping) + { + //-------------------- + //print out more debug info before crash + llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ; + GLint size ; + glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ; + llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ; + //-------------------- + + GLint buff; + glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); + if ((GLuint)buff != mGLBuffer) + { + llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; + } - GLint buff; - glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); - if ((GLuint)buff != mGLBuffer) + + llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; + } + else { - llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; + llerrs << "memory allocation for vertex data failed." << llendl ; } - - - llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; - } - else - { - llerrs << "memory allocation for vertex data failed." << llendl ; } + sMappedCount++; } - sMappedCount++; + } + else + { + map_range = false; } - return mMappedData; + if (map_range) + { + return mMappedData; + } + else + { + return mMappedData+mOffsets[type]+sTypeSize[type]*index; + } } -U8* LLVertexBuffer::mapIndexBuffer(S32 access) +U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER); if (mFinal) @@ -1023,8 +1107,40 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 access) llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl; } - if (!mIndexLocked && useVBOs()) + if (useVBOs()) { + if (!sDisableVBOMapping && gGLManager.mHasMapBufferRange) + { + if (count == -1) + { + count = mNumIndices; + } + + bool mapped = false; + //see if range is already mapped + for (U32 i = 0; i < mMappedIndexRegions.size(); ++i) + { + MappedRegion& region = mMappedIndexRegions[i]; + if (expand_region(region, index, count)) + { + mapped = true; + } + } + + if (!mapped) + { + //not already mapped, map new region + MappedRegion region(TYPE_INDEX, map_range ? -1 : index, count); + mMappedIndexRegions.push_back(region); + } + } + + if (mIndexLocked && map_range) + { + llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl; + } + + if (!mIndexLocked) { LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES); @@ -1034,12 +1150,32 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 access) if(sDisableVBOMapping) { + map_range = false; allocateClientIndexBuffer() ; } else { - U8* src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); - mMappedIndexData = LL_NEXT_ALIGNED_ADDRESS(src); + U8* src = NULL; + if (gGLManager.mHasMapBufferRange) + { + if (map_range) + { + S32 offset = sizeof(U16)*index; + S32 length = sizeof(U16)*count; + src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT); + } + else + { + src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); + } + } + else + { + map_range = false; + src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + } + + mMappedIndexData = src; //LL_NEXT_ALIGNED_ADDRESS(src); mAlignedIndexOffset = mMappedIndexData - src; stop_glerror(); } @@ -1068,19 +1204,31 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 access) sMappedCount++; } + else + { + map_range = false; + } - return mMappedIndexData ; + if (map_range) + { + return mMappedIndexData; + } + else + { + return mMappedIndexData + sizeof(U16)*index; + } } void LLVertexBuffer::unmapBuffer(S32 type) { LLMemType mt2(LLMemType::MTYPE_VERTEX_UNMAP_BUFFER); - if (!useVBOs()) + if (!useVBOs() || type == -2) { return ; //nothing to unmap } bool updated_all = false ; + if (mMappedData && mVertexLocked && type != TYPE_INDEX) { updated_all = (mIndexLocked && type < 0) ; //both vertex and index buffers done updating @@ -1093,6 +1241,23 @@ void LLVertexBuffer::unmapBuffer(S32 type) } else { + if (gGLManager.mHasMapBufferRange) + { + if (!mMappedVertexRegions.empty()) + { + stop_glerror(); + for (U32 i = 0; i < mMappedVertexRegions.size(); ++i) + { + const MappedRegion& region = mMappedVertexRegions[i]; + S32 offset = region.mIndex >= 0 ? mOffsets[region.mType]+sTypeSize[region.mType]*region.mIndex : 0; + S32 length = sTypeSize[region.mType]*region.mCount; + glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length); + stop_glerror(); + } + + mMappedVertexRegions.clear(); + } + } stop_glerror(); glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); stop_glerror(); @@ -1103,8 +1268,8 @@ void LLVertexBuffer::unmapBuffer(S32 type) mVertexLocked = FALSE ; sMappedCount--; } - - if(mMappedIndexData && mIndexLocked && (type < 0 || type == TYPE_INDEX)) + + if (mMappedIndexData && mIndexLocked && (type < 0 || type == TYPE_INDEX)) { if(sDisableVBOMapping) { @@ -1114,6 +1279,23 @@ void LLVertexBuffer::unmapBuffer(S32 type) } else { + + if (gGLManager.mHasMapBufferRange) + { + if (!mMappedIndexRegions.empty()) + { + for (U32 i = 0; i < mMappedIndexRegions.size(); ++i) + { + const MappedRegion& region = mMappedIndexRegions[i]; + S32 offset = region.mIndex >= 0 ? sizeof(U16)*region.mIndex : 0; + S32 length = sizeof(U16)*region.mCount; + glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); + stop_glerror(); + } + + mMappedIndexRegions.clear(); + } + } stop_glerror(); glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); stop_glerror(); @@ -1152,19 +1334,21 @@ template struct VertexBufferStrider typedef LLStrider strider_t; static bool get(LLVertexBuffer& vbo, strider_t& strider, - S32 index) + S32 index, S32 count, bool map_range) { if (type == LLVertexBuffer::TYPE_INDEX) { S32 stride = sizeof(T); - if (vbo.mapIndexBuffer() == NULL) + U8* ptr = vbo.mapIndexBuffer(index, count, map_range); + + if (ptr == NULL) { llwarns << "mapIndexBuffer failed!" << llendl; return FALSE; } - strider = (T*)(vbo.getMappedIndices() + index*stride); + strider = (T*)ptr; strider.setStride(0); return TRUE; } @@ -1172,13 +1356,15 @@ template struct VertexBufferStrider { S32 stride = LLVertexBuffer::sTypeSize[type]; - if (vbo.mapVertexBuffer(type) == NULL) + U8* ptr = vbo.mapVertexBuffer(type, index, count, map_range); + + if (ptr == NULL) { llwarns << "mapVertexBuffer failed!" << llendl; return FALSE; } - strider = (T*)(vbo.getMappedData() + vbo.getOffset(type)+index*stride); + strider = (T*)ptr; strider.setStride(stride); return TRUE; } @@ -1190,55 +1376,48 @@ template struct VertexBufferStrider } }; -bool LLVertexBuffer::getVertexStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getVertexStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getIndexStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getIndexStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getTexCoord0Strider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getTexCoord0Strider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getTexCoord1Strider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getTexCoord1Strider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -/*bool LLVertexBuffer::getTexCoord2Strider(LLStrider& strider, S32 index) -{ - return VertexBufferStrider::get(*this, strider, index); -} -bool LLVertexBuffer::getTexCoord3Strider(LLStrider& strider, S32 index) -{ - return VertexBufferStrider::get(*this, strider, index); -}*/ -bool LLVertexBuffer::getNormalStrider(LLStrider& strider, S32 index) + +bool LLVertexBuffer::getNormalStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getBinormalStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getBinormalStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getColorStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getColorStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getWeightStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } //---------------------------------------------------------------------------- @@ -1510,11 +1689,3 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const llglassertok(); } -void LLVertexBuffer::markDirty(U32 vert_index, U32 vert_count, U32 indices_index, U32 indices_count) -{ - // TODO: use GL_APPLE_flush_buffer_range here - /*if (useVBOs() && !mFilthy) - { - - }*/ -} diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 0c4b241537..aa5df305a6 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -77,6 +77,18 @@ protected: class LLVertexBuffer : public LLRefCount { public: + class MappedRegion + { + public: + S32 mType; + S32 mIndex; + S32 mCount; + + MappedRegion(S32 type, S32 index, S32 count) + : mType(type), mIndex(index), mCount(count) + { } + }; + LLVertexBuffer(const LLVertexBuffer& rhs) { *this = rhs; @@ -177,8 +189,8 @@ public: LLVertexBuffer(U32 typemask, S32 usage); // map for data access - U8* mapVertexBuffer(S32 type = -1, S32 access = -1); - U8* mapIndexBuffer(S32 access = -1); + U8* mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range); + U8* mapIndexBuffer(S32 index, S32 count, bool map_range); // set for rendering virtual void setBuffer(U32 data_mask, S32 type = -1); // calls setupVertexBuffer() if data_mask is not 0 @@ -193,16 +205,16 @@ public: // vb->getNormalStrider(norms); // setVertsNorms(verts, norms); // vb->unmapBuffer(); - bool getVertexStrider(LLStrider& strider, S32 index=0); - bool getIndexStrider(LLStrider& strider, S32 index=0); - bool getTexCoord0Strider(LLStrider& strider, S32 index=0); - bool getTexCoord1Strider(LLStrider& strider, S32 index=0); - bool getNormalStrider(LLStrider& strider, S32 index=0); - bool getBinormalStrider(LLStrider& strider, S32 index=0); - bool getColorStrider(LLStrider& strider, S32 index=0); - bool getWeightStrider(LLStrider& strider, S32 index=0); - bool getWeight4Strider(LLStrider& strider, S32 index=0); - bool getClothWeightStrider(LLStrider& strider, S32 index=0); + bool getVertexStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getIndexStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getTexCoord0Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getTexCoord1Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getNormalStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getBinormalStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getColorStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); BOOL isEmpty() const { return mEmpty; } BOOL isLocked() const { return mVertexLocked || mIndexLocked; } @@ -222,8 +234,6 @@ public: S32 getOffset(S32 type) const { return mOffsets[type]; } S32 getUsage() const { return mUsage; } - void markDirty(U32 vert_index, U32 vert_count, U32 indices_index, U32 indices_count); - void draw(U32 mode, U32 count, U32 indices_offset) const; void drawArrays(U32 mode, U32 offset, U32 count) const; void drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const; @@ -257,20 +267,8 @@ protected: BOOL mDynamicSize; // if TRUE, buffer has been resized at least once (and should be padded) S32 mOffsets[TYPE_MAX]; - class DirtyRegion - { - public: - U32 mIndex; - U32 mCount; - U32 mIndicesIndex; - U32 mIndicesCount; - - DirtyRegion(U32 vi, U32 vc, U32 ii, U32 ic) - : mIndex(vi), mCount(vc), mIndicesIndex(ii), mIndicesCount(ic) - { } - }; - - std::vector mDirtyRegions; //vector of dirty regions to rebuild + std::vector mMappedVertexRegions; + std::vector mMappedIndexRegions; public: static S32 sCount; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bed7e4705e..b7ba9e3607 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7126,7 +7126,7 @@ Vector3 Value - 0.05 + 0.1 0.0 0.0 @@ -7154,7 +7154,7 @@ Vector3 Value - 0.25 + 0.01 0.0 0.0 @@ -7513,6 +7513,17 @@ Value 0 + RenderMaxTextureIndex + + Comment + Maximum texture index to use for indexed texture rendering. + Persist + 1 + Type + U32 + Value + 6 + RenderDebugTextureBind Comment @@ -9011,7 +9022,7 @@ Type Boolean Value - 1 + 0 RenderUseStreamVBO diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index d92d9e92a1..f5483d969d 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -191,7 +191,7 @@ void LLDrawPool::renderPostDeferred(S32 pass) //virtual void LLDrawPool::endRenderPass( S32 pass ) { - for (U32 i = 1; i < gGLManager.mNumTextureImageUnits; i++) + for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) { //dummy cleanup of any currently bound textures if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) { diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 6963fea26b..5dbb27cabb 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -71,14 +71,7 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass) void LLDrawPoolGlow::endPostDeferredPass(S32 pass) { gDeferredFullbrightProgram.unbind(); - for (U32 i = 0; i < 8; i++) - { - if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) - { - gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); - gGL.getTexUnit(i)->disable(); - } - } + LLRenderPass::endRenderPass(pass); } void LLDrawPoolGlow::render(S32 pass) @@ -225,15 +218,6 @@ void LLDrawPoolSimple::endDeferredPass(S32 pass) LLRenderPass::endRenderPass(pass); gDeferredDiffuseProgram.unbind(); - - for (U32 i = 0; i < 8; i++) - { - if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) - { - gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); - gGL.getTexUnit(i)->disable(); - } - } } void LLDrawPoolSimple::renderDeferred(S32 pass) @@ -368,14 +352,7 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass) void LLDrawPoolFullbright::endPostDeferredPass(S32 pass) { gDeferredFullbrightProgram.unbind(); - for (U32 i = 0; i < 8; i++) - { - if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) - { - gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); - gGL.getTexUnit(i)->disable(); - } - } + LLRenderPass::endRenderPass(pass); } void LLDrawPoolFullbright::beginRenderPass(S32 pass) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index e30522d380..540ed054e9 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -429,11 +429,11 @@ U16 LLFace::getGeometryAvatar( if (mVertexBuffer.notNull()) { - mVertexBuffer->getVertexStrider (vertices, mGeomIndex); - mVertexBuffer->getNormalStrider (normals, mGeomIndex); - mVertexBuffer->getTexCoord0Strider (tex_coords, mGeomIndex); - mVertexBuffer->getWeightStrider(vertex_weights, mGeomIndex); - mVertexBuffer->getClothWeightStrider(clothing_weights, mGeomIndex); + mVertexBuffer->getVertexStrider (vertices, mGeomIndex, mGeomCount); + mVertexBuffer->getNormalStrider (normals, mGeomIndex, mGeomCount); + mVertexBuffer->getTexCoord0Strider (tex_coords, mGeomIndex, mGeomCount); + mVertexBuffer->getWeightStrider(vertex_weights, mGeomIndex, mGeomCount); + mVertexBuffer->getClothWeightStrider(clothing_weights, mGeomIndex, mGeomCount); } return mGeomIndex; @@ -446,17 +446,17 @@ U16 LLFace::getGeometry(LLStrider &vertices, LLStrider &no if (mVertexBuffer.notNull()) { - mVertexBuffer->getVertexStrider(vertices, mGeomIndex); + mVertexBuffer->getVertexStrider(vertices, mGeomIndex, mGeomCount); if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL)) { - mVertexBuffer->getNormalStrider(normals, mGeomIndex); + mVertexBuffer->getNormalStrider(normals, mGeomIndex, mGeomCount); } if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD0)) { - mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex); + mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex, mGeomCount); } - mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); + mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount); } return mGeomIndex; @@ -1092,27 +1092,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, const LLTextureEntry *tep = mVObjp->getTE(f); const U8 bump_code = tep ? tep->getBumpmap() : 0; - if (rebuild_pos) - { - mVertexBuffer->getVertexStrider(vert, mGeomIndex); - vertices = (LLVector4a*) vert.get(); - } - if (rebuild_normal) - { - mVertexBuffer->getNormalStrider(norm, mGeomIndex); - normals = (LLVector4a*) norm.get(); - } - if (rebuild_binormal) - { - mVertexBuffer->getBinormalStrider(binorm, mGeomIndex); - binormals = (LLVector4a*) binorm.get(); - } - if (rebuild_weights) - { - mVertexBuffer->getWeight4Strider(wght, mGeomIndex); - weights = (LLVector4a*) wght.get(); - } - F32 tcoord_xoffset = 0.f ; F32 tcoord_yoffset = 0.f ; F32 tcoord_xscale = 1.f ; @@ -1121,12 +1100,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tcoord) { - mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex); - if (bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)) - { - mVertexBuffer->getTexCoord1Strider(tex_coords2, mGeomIndex); - } - in_atlas = isAtlasInUse() ; if(in_atlas) { @@ -1139,11 +1112,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, tcoord_yscale = tmp->mV[1] ; } } - if (rebuild_color) - { - mVertexBuffer->getColorStrider(colors, mGeomIndex); - } - + BOOL is_static = mDrawablep->isStatic(); BOOL is_global = is_static; @@ -1182,7 +1151,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, // INDICES if (full_rebuild) { - mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); + mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, true); + __m128i* dst = (__m128i*) indicesp.get(); __m128i* src = (__m128i*) vf.mIndices; __m128i offset = _mm_set1_epi16(index_offset); @@ -1199,6 +1169,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { indicesp[i] = vf.mIndices[i]+index_offset; } + + mVertexBuffer->setBuffer(0); } LLMatrix4a mat_normal; @@ -1344,6 +1316,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (!in_atlas && !do_bump) { //not in atlas or not bump mapped, might be able to do a cheap update + mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex, mGeomCount); + if (texgen != LLTextureEntry::TEX_GEN_PLANAR) { if (!do_tex_mat) @@ -1416,9 +1390,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } } + + mVertexBuffer->setBuffer(0); } else { //either bump mapped or in atlas, just do the whole expensive loop + mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex, mGeomCount, true); + + std::vector bump_tc; + for (S32 i = 0; i < num_vertices; i++) { LLVector2 tc(vf.mTexCoords[i]); @@ -1549,8 +1529,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, *tex_coords++ = tc; - - if (bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)) + if (do_bump) + { + bump_tc.push_back(tc); + } + } + + mVertexBuffer->setBuffer(0); + + + if (do_bump) + { + mVertexBuffer->getTexCoord1Strider(tex_coords2, mGeomIndex, mGeomCount, true); + + for (S32 i = 0; i < num_vertices; i++) { LLVector4a tangent; tangent.setCross3(vf.mBinormals[i], vf.mNormals[i]); @@ -1572,16 +1564,22 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } binormal.normalize3fast(); + LLVector2 tc = bump_tc[i]; tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() ); *tex_coords2++ = tc; - } + } + + mVertexBuffer->setBuffer(0); } } } if (rebuild_pos) { + mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, true); + vertices = (LLVector4a*) vert.get(); + LLMatrix4a mat_vert; mat_vert.loadu(mat_vert_in); @@ -1607,11 +1605,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, index_dst += 4; } while (index_dst < index_end); - + + mVertexBuffer->setBuffer(0); } if (rebuild_normal) { + mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, true); + normals = (LLVector4a*) norm.get(); + for (S32 i = 0; i < num_vertices; i++) { LLVector4a normal; @@ -1619,10 +1621,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, normal.normalize3fast(); normals[i] = normal; } + + mVertexBuffer->setBuffer(0); } if (rebuild_binormal) { + mVertexBuffer->getBinormalStrider(binorm, mGeomIndex, mGeomCount, true); + binormals = (LLVector4a*) binorm.get(); + for (S32 i = 0; i < num_vertices; i++) { LLVector4a binormal; @@ -1630,15 +1637,22 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, binormal.normalize3fast(); binormals[i] = binormal; } + + mVertexBuffer->setBuffer(0); } if (rebuild_weights && vf.mWeights) { + mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, true); + weights = (LLVector4a*) wght.get(); LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); + mVertexBuffer->setBuffer(0); } if (rebuild_color) { + mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount, true); + LLVector4a src; U32 vec[4]; @@ -1657,6 +1671,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { dst[i] = src; } + + mVertexBuffer->setBuffer(0); } if (rebuild_tcoord) @@ -2073,13 +2089,13 @@ S32 LLFace::getColors(LLStrider &colors) } // llassert(mGeomIndex >= 0); - mVertexBuffer->getColorStrider(colors, mGeomIndex); + mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount); return mGeomIndex; } S32 LLFace::getIndices(LLStrider &indicesp) { - mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); + mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount); llassert(indicesp[0] != indicesp[1]); return mIndicesIndex; } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index ae5d4fa463..db8a0c2992 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -209,7 +209,7 @@ public: typedef std::vector > drawmap_elem_t; typedef std::map draw_map_t; typedef std::vector > buffer_list_t; - typedef std::map, buffer_list_t> buffer_texture_map_t; + typedef std::map buffer_texture_map_t; typedef std::map buffer_map_t; typedef LLOctreeListener BaseType; @@ -401,7 +401,7 @@ protected: public: bridge_list_t mBridgeList; - buffer_map_t mBufferMap; //used by volume buffers to store unique buffers per texture + buffer_map_t mBufferMap; //used by volume buffers to attempt to reuse vertex buffers F32 mBuilt; OctreeNode* mOctreeNode; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 61200db2b9..87ca80260f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -591,6 +591,7 @@ void settings_setup_listeners() gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); + gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 125283d474..58e38ea9b1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4426,6 +4426,33 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) llassert(!group || !group->isState(LLSpatialGroup::NEW_DRAWINFO)); } +struct CompareBatchBreakerModified +{ + bool operator()(const LLFace* const& lhs, const LLFace* const& rhs) + { + const LLTextureEntry* lte = lhs->getTextureEntry(); + const LLTextureEntry* rte = rhs->getTextureEntry(); + + if (lte->getBumpmap() != rte->getBumpmap()) + { + return lte->getBumpmap() < rte->getBumpmap(); + } + else if (lte->getFullbright() != rte->getFullbright()) + { + return lte->getFullbright() < rte->getFullbright(); + } + else if (lte->getGlow() != rte->getGlow()) + { + return lte->getGlow() < rte->getGlow(); + } + else + { + return lhs->getTexture() < rhs->getTexture(); + } + + } +}; + void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort, BOOL batch_textures) { //calculate maximum number of vertices to store in a single buffer @@ -4435,7 +4462,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (!distance_sort) { //sort faces by things that break batches - std::sort(faces.begin(), faces.end(), LLFace::CompareBatchBreaker()); + std::sort(faces.begin(), faces.end(), CompareBatchBreakerModified()); } else { @@ -4462,6 +4489,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels; } + texture_index_channels = llmin(texture_index_channels, (S32) gSavedSettings.getU32("RenderMaxTextureIndex")); + while (face_iter != faces.end()) { @@ -4587,7 +4616,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: //create/delete/resize vertex buffer if needed LLVertexBuffer* buffer = NULL; - LLSpatialGroup::buffer_texture_map_t::iterator found_iter = group->mBufferMap[mask].find(tex); + LLSpatialGroup::buffer_texture_map_t::iterator found_iter = group->mBufferMap[mask].find(*face_iter); if (found_iter != group->mBufferMap[mask].end()) { @@ -4618,7 +4647,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } } - buffer_map[mask][tex].push_back(buffer); + buffer_map[mask][*face_iter].push_back(buffer); //add face geometry @@ -4649,12 +4678,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: U32 te_idx = facep->getTEOffset(); - if (facep->getGeometryVolume(*volume, te_idx, - vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset)) - { - buffer->markDirty(facep->getGeomIndex(), facep->getGeomCount(), - facep->getIndicesStart(), facep->getIndicesCount()); - } + facep->getGeometryVolume(*volume, te_idx, + vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset); } } -- cgit v1.2.3 From d78ecc6c283cfee568a08d739bc6f5eec3b9828f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 1 Jun 2011 23:54:49 -0500 Subject: SH-812 Fix for rigged meshes not showing up as rigged until LoD switch. --- indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/llmeshrepository.cpp | 20 +++++++++++++++++--- indra/newview/llmeshrepository.h | 5 +++-- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvovolume.cpp | 8 +++----- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 7c017f5694..870aec4eff 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1456,7 +1456,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) continue; } - const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id); + const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj); if (!skin) { continue; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index bef2a09e6c..12e0b26fed 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2630,6 +2630,20 @@ void LLMeshRepository::notifyLoadedMeshes() void LLMeshRepository::notifySkinInfoReceived(LLMeshSkinInfo& info) { mSkinMap[info.mMeshID] = info; + + skin_load_map::iterator iter = mLoadingSkins.find(info.mMeshID); + if (iter != mLoadingSkins.end()) + { + for (std::set::iterator obj_id = iter->second.begin(); obj_id != iter->second.end(); ++obj_id) + { + LLVOVolume* vobj = (LLVOVolume*) gObjectList.findObject(*obj_id); + if (vobj) + { + vobj->notifyMeshLoaded(); + } + } + } + mLoadingSkins.erase(info.mMeshID); } @@ -2745,7 +2759,7 @@ U32 LLMeshRepository::getResourceCost(const LLUUID& mesh_id) return mThread->getResourceCost(mesh_id); } -const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id) +const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj) { if (mesh_id.notNull()) { @@ -2759,12 +2773,12 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id) { LLMutexLock lock(mMeshMutex); //add volume to list of loading meshes - std::set::iterator iter = mLoadingSkins.find(mesh_id); + skin_load_map::iterator iter = mLoadingSkins.find(mesh_id); if (iter == mLoadingSkins.end()) { //no request pending for this skin info - mLoadingSkins.insert(mesh_id); mPendingSkinRequests.push(mesh_id); } + mLoadingSkins[mesh_id].insert(requesting_obj->getID()); } } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 0a6954bade..9b80fc02b3 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -475,7 +475,7 @@ public: static S32 getActualMeshLOD(LLSD& header, S32 lod); U32 calcResourceCost(LLSD& header); U32 getResourceCost(const LLUUID& mesh_params); - const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id); + const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj); LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id); void fetchPhysicsShape(const LLUUID& mesh_id); bool hasPhysicsShape(const LLUUID& mesh_id); @@ -504,7 +504,8 @@ public: std::vector mPendingRequests; //list of mesh ids awaiting skin info - std::set mLoadingSkins; + typedef std::map > skin_load_map; + skin_load_map mLoadingSkins; //list of mesh ids that need to send skin info fetch requests std::queue mPendingSkinRequests; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dc355362ce..77bbf994e9 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6004,7 +6004,7 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) LLVOVolume* pVObj = pVO->mDrawable->getVOVolume(); if ( pVObj ) { - const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( pVObj->getVolume()->getParams().getSculptID() ); + const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( pVObj->getVolume()->getParams().getSculptID(), pVObj ); if ( pSkinData ) { const int jointCnt = pSkinData->mJointNames.size(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 125283d474..6e84884dee 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1096,8 +1096,6 @@ void LLVOVolume::updateSculptTexture() } - - void LLVOVolume::notifyMeshLoaded() { mSculptChanged = TRUE; @@ -3534,7 +3532,7 @@ void LLVOVolume::updateRiggedVolume() LLVolume* volume = getVolume(); - const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(volume->getParams().getSculptID()); + const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(volume->getParams().getSculptID(), this); if (!skin) { @@ -3986,7 +3984,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bool rigged = vobj->isAttachment() && vobj->isMesh() && - gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID()); + gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); @@ -4028,7 +4026,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if ( pAvatarVO ) { LLUUID currentId = vobj->getVolume()->getParams().getSculptID(); - const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId ); + const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj ); if ( pSkinData ) { -- cgit v1.2.3 From faef58a9b91ecbbffd93fa90347f1b8bd5856902 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 2 Jun 2011 01:36:28 -0500 Subject: SH-1666 Remove "Mesh" stitching type from sculpt combo box. --- indra/newview/llpanelobject.cpp | 14 -------------- indra/newview/skins/default/xui/en/floater_tools.xml | 6 +----- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 34a92cd0ac..52917ff20b 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1740,25 +1740,11 @@ void LLPanelObject::refresh() mRootObject = NULL; } - bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") && - gAgent.getRegion() && - !gAgent.getRegion()->getCapability("GetMesh").empty(); - F32 max_scale = get_default_max_prim_scale(LLPickInfo::isFlora(mObject)); getChild("Scale X")->setMaxValue(max_scale); getChild("Scale Y")->setMaxValue(max_scale); getChild("Scale Z")->setMaxValue(max_scale); - - BOOL found = mCtrlSculptType->itemExists("Mesh"); - if (enable_mesh && !found) - { - mCtrlSculptType->add("Mesh"); - } - else if (!enable_mesh && found) - { - mCtrlSculptType->remove("Mesh"); - } } diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 40bf7bfed7..f5f6b990d1 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2098,11 +2098,7 @@ even though the user gets a free copy. label="Cylinder" name="Cylinder" value="Cylinder" /> - - + Date: Thu, 2 Jun 2011 17:03:51 +0300 Subject: Linux build fix. Unused local varible removed. --- indra/llrender/llvertexbuffer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 27cc88462a..74fd3bf197 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1338,8 +1338,6 @@ template struct VertexBufferStrider { if (type == LLVertexBuffer::TYPE_INDEX) { - S32 stride = sizeof(T); - U8* ptr = vbo.mapIndexBuffer(index, count, map_range); if (ptr == NULL) -- cgit v1.2.3 From 71658a024e03ef11b2531cfc7205c9ef7f72c99b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 2 Jun 2011 12:05:45 -0600 Subject: fix for SH-1691: [crashhunters] crash at LLVolumeImplFlexible::doFlexibleUpdate() [secondlife-bin llflexibleobject.cpp] --- indra/newview/llflexibleobject.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 3d1650d2f5..32a533570a 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -366,7 +366,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() LLFastTimer ftm(FTM_DO_FLEXIBLE_UPDATE); LLVolume* volume = mVO->getVolume(); LLPath *path = &volume->getPath(); - if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) // if its uninitialized but not visible, what then? - Nyx + if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) { mVO->markForUpdate(TRUE); if (!doIdleUpdate(gAgent, *LLWorld::getInstance(), 0.0)) @@ -375,7 +375,11 @@ void LLVolumeImplFlexible::doFlexibleUpdate() } } - llassert_always(mInitialized); + if(!mInitialized) + { + //the object is not visible + return ; + } S32 num_sections = 1 << mSimulateRes; -- cgit v1.2.3 From de5f93ca52f207380baca6895b499cb7fcffead8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 2 Jun 2011 22:58:57 -0500 Subject: SH-1732 Add streaming cost calculation for mesh objects. --- indra/llmath/llvolume.cpp | 273 +++++++++++++++++++++++++++++++++++++++++++ indra/llmath/llvolume.h | 8 ++ indra/newview/llvovolume.cpp | 20 +++- 3 files changed, 297 insertions(+), 4 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index fbda824179..fa94a7934e 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -416,6 +416,70 @@ LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BO return face; } +//static +S32 LLProfile::getNumNGonPoints(const LLProfileParams& params, S32 sides, F32 offset, F32 bevel, F32 ang_scale, S32 split) +{ // this is basically LLProfile::genNGon stripped down to only the operations that influence the number of points + LLMemType m1(LLMemType::MTYPE_VOLUME); + S32 np = 0; + + // Generate an n-sided "circular" path. + // 0 is (1,0), and we go counter-clockwise along a circular path from there. + F32 t, t_step, t_first, t_fraction; + + F32 begin = params.getBegin(); + F32 end = params.getEnd(); + + t_step = 1.0f / sides; + + t_first = floor(begin * sides) / (F32)sides; + + // pt1 is the first point on the fractional face. + // Starting t and ang values for the first face + t = t_first; + + // Increment to the next point. + // pt2 is the end point on the fractional face + t += t_step; + + t_fraction = (begin - t_first)*sides; + + // Only use if it's not almost exactly on an edge. + if (t_fraction < 0.9999f) + { + np++; + } + + // There's lots of potential here for floating point error to generate unneeded extra points - DJS 04/05/02 + while (t < end) + { + // Iterate through all the integer steps of t. + np++; + + t += t_step; + } + + t_fraction = (end - (t - t_step))*sides; + + // Find the fraction that we need to add to the end point. + t_fraction = (end - (t - t_step))*sides; + if (t_fraction > 0.0001f) + { + np++; + } + + // If we're sliced, the profile is open. + if ((end - begin)*ang_scale < 0.99f) + { + if (params.getHollow() <= 0) + { + // put center point if not hollow. + np++; + } + } + + return np; +} + // What is the bevel parameter used for? - DJS 04/05/02 // Bevel parameter is currently unused but presumedly would support // filleted and chamfered corners @@ -672,6 +736,122 @@ LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F3 return face; } +//static +S32 LLProfile::getNumPoints(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, + BOOL is_sculpted, S32 sculpt_size) +{ // this is basically LLProfile::generate stripped down to only operations that influence the number of points + LLMemType m1(LLMemType::MTYPE_VOLUME); + + if (detail < MIN_LOD) + { + detail = MIN_LOD; + } + + // Generate the face data + S32 i; + F32 begin = params.getBegin(); + F32 end = params.getEnd(); + F32 hollow = params.getHollow(); + + S32 face_num = 0; + + S32 np = 0; + + switch (params.getCurveType() & LL_PCODE_PROFILE_MASK) + { + case LL_PCODE_PROFILE_SQUARE: + { + np = getNumNGonPoints(params, 4,-0.375, 0, 1, split); + + if (hollow) + { + np *= 2; + } + } + break; + case LL_PCODE_PROFILE_ISOTRI: + case LL_PCODE_PROFILE_RIGHTTRI: + case LL_PCODE_PROFILE_EQUALTRI: + { + np = getNumNGonPoints(params, 3,0, 0, 1, split); + + if (hollow) + { + np *= 2; + } + } + break; + case LL_PCODE_PROFILE_CIRCLE: + { + // If this has a square hollow, we should adjust the + // number of faces a bit so that the geometry lines up. + U8 hole_type=0; + F32 circle_detail = MIN_DETAIL_FACES * detail; + if (hollow) + { + hole_type = params.getCurveType() & LL_PCODE_HOLE_MASK; + if (hole_type == LL_PCODE_HOLE_SQUARE) + { + // Snap to the next multiple of four sides, + // so that corners line up. + circle_detail = llceil(circle_detail / 4.0f) * 4.0f; + } + } + + S32 sides = (S32)circle_detail; + + if (is_sculpted) + sides = sculpt_size; + + np = getNumNGonPoints(params, sides); + + if (hollow) + { + np *= 2; + } + } + break; + case LL_PCODE_PROFILE_CIRCLE_HALF: + { + // If this has a square hollow, we should adjust the + // number of faces a bit so that the geometry lines up. + U8 hole_type=0; + // Number of faces is cut in half because it's only a half-circle. + F32 circle_detail = MIN_DETAIL_FACES * detail * 0.5f; + if (hollow) + { + hole_type = params.getCurveType() & LL_PCODE_HOLE_MASK; + if (hole_type == LL_PCODE_HOLE_SQUARE) + { + // Snap to the next multiple of four sides (div 2), + // so that corners line up. + circle_detail = llceil(circle_detail / 2.0f) * 2.0f; + } + } + np = getNumNGonPoints(params, llfloor(circle_detail), 0.5f, 0.f, 0.5f); + + if (hollow) + { + np *= 2; + } + + // Special case for openness of sphere + if ((params.getEnd() - params.getBegin()) < 1.f) + { + } + else if (!hollow) + { + np++; + } + } + break; + default: + break; + }; + + + return np; +} BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, @@ -1133,6 +1313,32 @@ LLPath::~LLPath() { } +S32 LLPath::getNumNGonPoints(const LLPathParams& params, S32 sides, F32 startOff, F32 end_scale, F32 twist_scale) +{ //this is basically LLPath::genNGon stripped down to only operations that influence the number of points added + S32 ret = 0; + + F32 step= 1.0f / sides; + F32 t = params.getBegin(); + ret = 1; + + t+=step; + + // Snap to a quantized parameter, so that cut does not + // affect most sample points. + t = ((S32)(t * sides)) / (F32)sides; + + // Run through the non-cut dependent points. + while (t < params.getEnd()) + { + ret++; + t+=step; + } + + ret++; + + return ret; +} + void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 end_scale, F32 twist_scale) { // Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane. @@ -1310,6 +1516,56 @@ const LLVector2 LLPathParams::getEndScale() const return end_scale; } +S32 LLPath::getNumPoints(const LLPathParams& params, F32 detail) +{ // this is basically LLPath::generate stripped down to only the operations that influence the number of points + LLMemType m1(LLMemType::MTYPE_VOLUME); + + if (detail < MIN_LOD) + { + detail = MIN_LOD; + } + + S32 np = 2; // hardcode for line + + // Is this 0xf0 mask really necessary? DK 03/02/05 + + switch (params.getCurveType() & 0xf0) + { + default: + case LL_PCODE_PATH_LINE: + { + // Take the begin/end twist into account for detail. + np = llfloor(fabs(params.getTwistBegin() - params.getTwist()) * 3.5f * (detail-0.5f)) + 2; + } + break; + + case LL_PCODE_PATH_CIRCLE: + { + // Increase the detail as the revolutions and twist increase. + F32 twist_mag = fabs(params.getTwistBegin() - params.getTwist()); + + S32 sides = (S32)llfloor(llfloor((MIN_DETAIL_FACES * detail + twist_mag * 3.5f * (detail-0.5f))) * params.getRevolutions()); + + np = sides; + } + break; + + case LL_PCODE_PATH_CIRCLE2: + { + //genNGon(params, llfloor(MIN_DETAIL_FACES * detail), 4.f, 0.f); + np = getNumNGonPoints(params, llfloor(MIN_DETAIL_FACES * detail)); + } + break; + + case LL_PCODE_PATH_TEST: + + np = 5; + break; + }; + + return np; +} + BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted, S32 sculpt_size) { @@ -4065,6 +4321,23 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const return index; } +void LLVolume::getLoDTriangleCounts(const LLVolumeParams& params, S32* counts) +{ //attempt to approximate the number of triangles that will result from generating a volume LoD set for the + //supplied LLVolumeParams -- inaccurate, but a close enough approximation for determining streaming cost + F32 detail[] = {1.f, 1.5f, 2.5f, 4.f}; + for (S32 i = 0; i < 4; i++) + { + S32 count = 0; + S32 path_points = LLPath::getNumPoints(params.getPathParams(), detail[i]); + S32 profile_points = LLProfile::getNumPoints(params.getProfileParams(), false, detail[i]); + + count = (profile_points-1)*2*(path_points-1); + count += profile_points*2; + + counts[i] = count; + } +} + S32 LLVolume::getNumTriangleIndices() const { BOOL profile_open = getProfile().isOpen(); diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 01bfbd858b..f67f8f644d 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -690,6 +690,9 @@ public: BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); } BOOL isOpen() const { return mOpen; } void setDirty() { mDirty = TRUE; } + + static S32 getNumPoints(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, + BOOL is_sculpted = FALSE, S32 sculpt_size = 0); BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, BOOL is_sculpted = FALSE, S32 sculpt_size = 0); BOOL isConcave() const { return mConcave; } @@ -714,6 +717,7 @@ public: protected: void genNormals(const LLProfileParams& params); + static S32 getNumNGonPoints(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0); void genNGon(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0); Face* addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0); @@ -756,6 +760,9 @@ public: virtual ~LLPath(); + static S32 getNumPoints(const LLPathParams& params, F32 detail); + static S32 getNumNGonPoints(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); + void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE, S32 sculpt_size = 0); @@ -981,6 +988,7 @@ public: // returns number of triangle indeces required for path/profile mesh S32 getNumTriangleIndices() const; + static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts); S32 getNumTriangles() const; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c917a5fd9d..39e555f781 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3096,16 +3096,28 @@ U32 LLVOVolume::getRenderCost(std::set &textures) const F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes) { + F32 radius = getScale().length(); + if (isMesh()) { LLSD& header = gMeshRepo.getMeshHeader(getVolume()->getParams().getSculptID()); - F32 radius = getScale().length(); - return LLMeshRepository::getStreamingCost(header, radius, bytes, visible_bytes, mLOD); } - - return 0.f; + else + { + LLVolume* volume = getVolume(); + S32 counts[4]; + LLVolume::getLoDTriangleCounts(volume->getParams(), counts); + + LLSD header; + header["lowest_lod"]["size"] = counts[0] * 10; + header["low_lod"]["size"] = counts[1] * 10; + header["medium_lod"]["size"] = counts[2] * 10; + header["high_lod"]["size"] = counts[3] * 10; + + return LLMeshRepository::getStreamingCost(header, radius); + } } U32 LLVOVolume::getTriangleCount() -- cgit v1.2.3 From b77e027fcc09937f1d87f02025866a42afa51e39 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 2 Jun 2011 23:46:26 -0500 Subject: Remove some unused variables. --- indra/llmath/llvolume.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index fa94a7934e..3c1de3a422 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -748,13 +748,8 @@ S32 LLProfile::getNumPoints(const LLProfileParams& params, BOOL path_open,F32 de } // Generate the face data - S32 i; - F32 begin = params.getBegin(); - F32 end = params.getEnd(); F32 hollow = params.getHollow(); - S32 face_num = 0; - S32 np = 0; switch (params.getCurveType() & LL_PCODE_PROFILE_MASK) -- cgit v1.2.3 From b0a04b08f7b3cf4040b9708125a548e646b990f7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Jun 2011 00:13:50 -0500 Subject: SH-1744 Add havok's degenerate triangle check to importer. Highlight degenerate triangles in physics mesh and block upload when degenerate triangles are present. --- indra/newview/llfloatermodelpreview.cpp | 160 +++++++++++++++++++++++++++++++- indra/newview/llmeshrepository.cpp | 6 +- 2 files changed, 161 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 2a3bd37129..b715f326a0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -178,6 +178,80 @@ std::string lod_label_name[NUM_LOD+1] = "I went off the end of the lod_label_name array. Me so smart." }; + +#define LL_DEGENERACY_TOLERANCE 1e-7f + +inline F32 dot3fpu(const LLVector4a& a, const LLVector4a& b) +{ + volatile F32 p0 = a[0] * b[0]; + volatile F32 p1 = a[1] * b[1]; + volatile F32 p2 = a[2] * b[2]; + return p0 + p1 + p2; +} + +bool ll_is_degenerate(const LLVector4a& a, const LLVector4a& b, const LLVector4a& c, F32 tolerance = LL_DEGENERACY_TOLERANCE) +{ + // small area check + { + LLVector4a edge1; edge1.setSub( a, b ); + LLVector4a edge2; edge2.setSub( a, c ); + ////////////////////////////////////////////////////////////////////////// + /// Linden Modified + ////////////////////////////////////////////////////////////////////////// + + // If no one edge is more than 10x longer than any other edge, we weaken + // the tolerance by a factor of 1e-4f. + + LLVector4a edge3; edge3.setSub( c, b ); + const F32 len1sq = edge1.dot3(edge1).getF32(); + const F32 len2sq = edge2.dot3(edge2).getF32(); + const F32 len3sq = edge3.dot3(edge3).getF32(); + bool abOK = (len1sq <= 100.f * len2sq) && (len1sq <= 100.f * len3sq); + bool acOK = (len2sq <= 100.f * len1sq) && (len1sq <= 100.f * len3sq); + bool cbOK = (len3sq <= 100.f * len1sq) && (len1sq <= 100.f * len2sq); + if ( abOK && acOK && cbOK ) + { + tolerance *= 1e-4f; + } + + ////////////////////////////////////////////////////////////////////////// + /// End Modified + ////////////////////////////////////////////////////////////////////////// + + LLVector4a cross; cross.setCross3( edge1, edge2 ); + + LLVector4a edge1b; edge1b.setSub( b, a ); + LLVector4a edge2b; edge2b.setSub( b, c ); + LLVector4a crossb; crossb.setCross3( edge1b, edge2b ); + + if ( ( cross.dot3(cross).getF32() < tolerance ) || ( crossb.dot3(crossb).getF32() < tolerance )) + { + return true; + } + } + + // point triangle distance check + { + LLVector4a Q; Q.setSub(a, b); + LLVector4a R; R.setSub(c, b); + + const F32 QQ = dot3fpu(Q, Q); + const F32 RR = dot3fpu(R, R); + const F32 QR = dot3fpu(R, Q); + + volatile F32 QQRR = QQ * RR; + volatile F32 QRQR = QR * QR; + F32 Det = (QQRR - QRQR); + + if( Det == 0.0f ) + { + return true; + } + } + + return false; +} + bool validate_face(const LLVolumeFace& face) { for (U32 i = 0; i < face.mNumIndices; ++i) @@ -189,6 +263,31 @@ bool validate_face(const LLVolumeFace& face) } } + if (face.mNumIndices % 3 != 0 || face.mNumIndices == 0) + { + llwarns << "Face has invalid number of indices." << llendl; + return false; + } + + /*const LLVector4a scale(0.5f); + + for (U32 i = 0; i < face.mNumIndices; i+=3) + { + U16 idx1 = face.mIndices[i]; + U16 idx2 = face.mIndices[i+1]; + U16 idx3 = face.mIndices[i+2]; + + LLVector4a v1; v1.setMul(face.mPositions[idx1], scale); + LLVector4a v2; v2.setMul(face.mPositions[idx2], scale); + LLVector4a v3; v3.setMul(face.mPositions[idx3], scale); + + if (ll_is_degenerate(v1,v2,v3)) + { + llwarns << "Degenerate face found!" << llendl; + return false; + } + }*/ + return true; } @@ -3752,7 +3851,35 @@ void LLModelPreview::updateStatusMessages() mMaxTriangleLimit = total_tris[LLModel::LOD_HIGH]; } + bool has_degenerate = false; + {//check for degenerate triangles in physics mesh + U32 lod = LLModel::LOD_PHYSICS; + const LLVector4a scale(0.5f); + for (U32 i = 0; i < mModel[lod].size() && !has_degenerate; ++i) + { //for each model in the lod + if (mModel[lod][i]->mPhysics.mHull.empty()) + { //no decomp exists + S32 cur_submeshes = mModel[lod][i]->getNumVolumeFaces(); + for (S32 j = 0; j < cur_submeshes && !has_degenerate; ++j) + { //for each submesh (face), add triangles and vertices to current total + const LLVolumeFace& face = mModel[lod][i]->getVolumeFace(j); + for (S32 k = 0; k < face.mNumIndices && !has_degenerate; ) + { + LLVector4a v1; v1.setMul(face.mPositions[face.mIndices[k++]], scale); + LLVector4a v2; v2.setMul(face.mPositions[face.mIndices[k++]], scale); + LLVector4a v3; v3.setMul(face.mPositions[face.mIndices[k++]], scale); + + if (ll_is_degenerate(v1,v2,v3)) + { + has_degenerate = true; + } + } + } + } + } + } + mFMP->childSetTextArg("submeshes_info", "[SUBMESHES]", llformat("%d", total_submeshes[LLModel::LOD_HIGH])); std::string mesh_status_na = mFMP->getString("mesh_status_na"); @@ -3853,7 +3980,10 @@ void LLModelPreview::updateStatusMessages() for (U32 j = 0; upload_ok && j < mdl->mPhysics.mHull.size(); ++j) { - upload_ok = upload_ok && mdl->mPhysics.mHull[i].size() <= 256; + if (mdl->mPhysics.mHull[j].size() > 256) + { + upload_ok = false; + } } } @@ -3876,7 +4006,7 @@ void LLModelPreview::updateStatusMessages() } } - if ( upload_ok && !errorStateFromLoader && skinAndRigOk ) + if ( upload_ok && !errorStateFromLoader && skinAndRigOk && !has_degenerate) { mFMP->childEnable("ok_btn"); } @@ -4666,6 +4796,32 @@ BOOL LLModelPreview::render() glLineWidth(3.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); + + { //show degenerate triangles + LLStrider pos_strider; + buffer->getVertexStrider(pos_strider, 0); + LLVector4a* pos = (LLVector4a*) pos_strider.get(); + + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); + LLGLDisable cull(GL_CULL_FACE); + LLStrider idx; + buffer->getIndexStrider(idx, 0); + + glColor4f(1.f,0.f,0.f,1.f); + const LLVector4a scale(0.5f); + for (U32 i = 0; i < buffer->getNumIndices(); i += 3) + { + LLVector4a v1; v1.setMul(pos[*idx++], scale); + LLVector4a v2; v2.setMul(pos[*idx++], scale); + LLVector4a v3; v3.setMul(pos[*idx++], scale); + + if (ll_is_degenerate(v1,v2,v3)) + { + buffer->draw(LLRender::TRIANGLES, 3, i); + } + } + } + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glLineWidth(1.f); } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4464d299ed..4a8c644dbc 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1399,14 +1399,14 @@ BOOL LLMeshUploadThread::isDiscarded() void LLMeshUploadThread::run() { - if (gSavedSettings.getBOOL("MeshUseWholeModelUpload")) + //if (gSavedSettings.getBOOL("MeshUseWholeModelUpload")) { doWholeModelUpload(); } - else + /*else { doIterativeUpload(); - } + }*/ } void dumpLLSDToFile(const LLSD& content, std::string filename) -- cgit v1.2.3 From 75bdb77c245109f7d72bb8fb034184b4d26cff50 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 3 Jun 2011 10:55:28 -0600 Subject: more fix for STORM-1298: Crash on startup of Second Life 2.7.1(231307) --- indra/newview/llviewertexturelist.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 1ffae7ce83..a1d9434d44 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -281,6 +281,8 @@ void LLViewerTextureList::shutdown() mUUIDMap.clear(); mImageList.clear(); + + mInitialized = FALSE ; //prevent loading textures again. } void LLViewerTextureList::dump() @@ -328,6 +330,11 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& LLGLenum primary_format, const LLUUID& force_id) { + if(!mInitialized) + { + return NULL ; + } + std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename); if (full_path.empty()) { @@ -348,6 +355,11 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& LLGLenum primary_format, const LLUUID& force_id) { + if(!mInitialized) + { + return NULL ; + } + // generate UUID based on hash of filename LLUUID new_id; if (force_id.notNull()) @@ -407,6 +419,11 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, LLGLenum primary_format, LLHost request_from_host) { + if(!mInitialized) + { + return NULL ; + } + // Return the image with ID image_id // If the image is not found, creates new image and // enqueues a request for transmission -- cgit v1.2.3 From cc7a041bfe908faa1a256d13d35cb1ad17358f60 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 3 Jun 2011 14:41:08 -0400 Subject: Fix for Storm-956 crashes viewer when connected to non-LL grids --- doc/contributions.txt | 1 + indra/newview/llviewermessage.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index dfbccb5a6c..94c73a2f52 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -440,6 +440,7 @@ Jonathan Yap STORM-1095 STORM-1236 STORM-1259 + STORM-1313 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3832be727f..49188e46c6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6483,10 +6483,14 @@ void process_script_dialog(LLMessageSystem* msg, void**) LLSD payload; LLUUID object_id; - LLUUID owner_id; - msg->getUUID("Data", "ObjectID", object_id); - msg->getUUID("OwnerData", "OwnerID", owner_id); + +// For compability with OS grids first check for presence of extended packet before fetching data. + LLUUID owner_id; + if (gMessageSystem->getNumberOfBlocks("OwnerData") > 0) + { + msg->getUUID("OwnerData", "OwnerID", owner_id); + } if (LLMuteList::getInstance()->isMuted(object_id) || LLMuteList::getInstance()->isMuted(owner_id)) { -- cgit v1.2.3 From 357062a196e69a41f12afc156c3be225438f7a85 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 3 Jun 2011 19:46:34 +0000 Subject: Added build params for mesh-asset-deprecation --- BuildParams | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BuildParams b/BuildParams index 0a193803da..2fb372033e 100644 --- a/BuildParams +++ b/BuildParams @@ -102,6 +102,16 @@ mesh-development.build_debug_release_separately = true mesh-development.build_CYGWIN_Debug = false mesh-development.build_viewer_update_version_manager = false +# ======================================== +# mesh-asset-deprecation +# ======================================== +mesh-asset-deprecation.viewer_channel = "Project Viewer - Mesh Asset Deprecation" +mesh-asset-deprecation.login_channel = "Project Viewer - Mesh Asset Deprecation" +mesh-asset-deprecation.viewer_grid = aditi +mesh-asset-deprecation.build_debug_release_separately = true +mesh-asset-deprecation.build_CYGWIN_Debug = false +mesh-asset-deprecation.build_viewer_update_version_manager = false + # ======================================== # viewer-mesh # ======================================== -- cgit v1.2.3 From ffab1eef57813625cae51bffd8dd830371b2e203 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 3 Jun 2011 16:24:07 -0700 Subject: Mac build fixes. Reviewed by davep. --- indra/llrender/llglheaders.h | 44 ++++++++++++++++++++++++++++++++++++++- indra/llrender/llglslshader.cpp | 2 +- indra/llrender/llrendertarget.cpp | 8 +++++++ indra/llrender/llvertexbuffer.cpp | 17 ++++++++++++++- 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 94f7a08c92..f35f329f00 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -736,13 +736,55 @@ extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_A #ifndef GL_ARB_framebuffer_object #define glGenerateMipmap glGenerateMipmapEXT +#define GL_MAX_SAMPLES 0x8D57 #endif + // GL_ARB_draw_buffers extern void glDrawBuffersARB(GLsizei n, const GLenum* bufs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; #ifdef __cplusplus extern "C" { #endif + +// +// Define map buffer range headers on Mac +// +#ifndef GL_ARB_map_buffer_range +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#endif + +// +// Define multisample headers on Mac +// +#ifndef GL_ARB_texture_multisample +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#endif + // // Define vertex buffer object headers on Mac // @@ -779,7 +821,7 @@ extern "C" { #define GL_DYNAMIC_READ_ARB 0x88E9 #define GL_DYNAMIC_COPY_ARB 0x88EA #endif - + #ifndef GL_ARB_vertex_buffer_object diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 5473f23d86..8e99f62de6 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -48,7 +48,7 @@ using std::pair; using std::make_pair; using std::string; -U32 LLGLSLShader::sCurBoundShader = 0; +GLhandleARB LLGLSLShader::sCurBoundShader = 0; BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) { diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 715f466314..e773a639b0 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -154,11 +154,15 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt) stop_glerror(); +#ifdef GL_ARB_texture_multisample if (mSamples > 1) { glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, color_fmt, mResX, mResY, GL_TRUE); } else +#else + llassert_always(mSamples <= 1); +#endif { LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL); } @@ -234,10 +238,14 @@ void LLRenderTarget::allocateDepth() gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); } +#ifdef GL_ARB_texture_multisample else { glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, GL_DEPTH_COMPONENT32, mResX, mResY, GL_TRUE); } +#else + llassert_always(mSamples <= 1); +#endif } } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 74fd3bf197..3197866fa9 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1017,6 +1017,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran else { U8* src = NULL; +#ifdef GL_ARB_map_buffer_range if (gGLManager.mHasMapBufferRange) { if (map_range) @@ -1031,6 +1032,9 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran } } else +#else + llassert_always(!gGLManager.mHasMapBufferRange); +#endif { map_range = false; src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); @@ -1156,6 +1160,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) else { U8* src = NULL; +#ifdef GL_ARB_map_buffer_range if (gGLManager.mHasMapBufferRange) { if (map_range) @@ -1170,6 +1175,9 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) } } else +#else + llassert_always(!gGLManager.mHasMapBufferRange); +#endif { map_range = false; src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); @@ -1241,6 +1249,7 @@ void LLVertexBuffer::unmapBuffer(S32 type) } else { +#ifdef GL_ARB_map_buffer_range if (gGLManager.mHasMapBufferRange) { if (!mMappedVertexRegions.empty()) @@ -1258,6 +1267,9 @@ void LLVertexBuffer::unmapBuffer(S32 type) mMappedVertexRegions.clear(); } } +#else + llassert_always(!gGLManager.mHasMapBufferRange); +#endif stop_glerror(); glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); stop_glerror(); @@ -1279,7 +1291,7 @@ void LLVertexBuffer::unmapBuffer(S32 type) } else { - +#ifdef GL_ARB_map_buffer_range if (gGLManager.mHasMapBufferRange) { if (!mMappedIndexRegions.empty()) @@ -1296,6 +1308,9 @@ void LLVertexBuffer::unmapBuffer(S32 type) mMappedIndexRegions.clear(); } } +#else + llassert_always(!gGLManager.mHasMapBufferRange); +#endif stop_glerror(); glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); stop_glerror(); -- cgit v1.2.3 From 70f959f01e845b3a7b6211f82c20d0cbd6641c39 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 Jun 2011 02:41:09 -0500 Subject: SH-1738 Fix for broken UI text when deferred rendering enabled. --- indra/llrender/llrender.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index e91ceb873e..6a3f186531 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -184,8 +184,7 @@ void LLTexUnit::enable(eTextureType type) mCurrTexType = type; gGL.flush(); - if (LLGLSLShader::sCurBoundShader == 0 && - type != LLTexUnit::TT_MULTISAMPLE_TEXTURE && + if (type != LLTexUnit::TT_MULTISAMPLE_TEXTURE && mIndex < gGLManager.mNumTextureUnits) { glEnable(sGLTextureType[type]); @@ -202,7 +201,7 @@ void LLTexUnit::disable(void) activate(); unbind(mCurrTexType); gGL.flush(); - if (LLGLSLShader::sCurBoundShader == 0 && mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE && + if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE && mIndex < gGLManager.mNumTextureUnits) { glDisable(sGLTextureType[mCurrTexType]); -- cgit v1.2.3 From 325c2b216907b84b02b425103b011a556222b474 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 6 Jun 2011 21:27:29 +0000 Subject: Removed the old mesh asset upload pipeline. Fixed a problem with spamming MissingString MacLocale warnings. Reviewed by Dave --- indra/llui/llresmgr.cpp | 2 +- indra/newview/llfloatermodelpreview.cpp | 2 +- indra/newview/llmeshrepository.cpp | 265 +------------------------------- indra/newview/llmeshrepository.h | 5 - indra/newview/llviewermenufile.cpp | 73 +-------- indra/newview/llviewermenufile.h | 17 -- indra/newview/llviewerregion.cpp | 4 +- 7 files changed, 6 insertions(+), 362 deletions(-) diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 39385786bc..820e7cb26a 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -337,7 +337,7 @@ LLLocale::LLLocale(const std::string& locale_string) char* new_locale_string = setlocale( LC_ALL, locale_string.c_str()); if ( new_locale_string == NULL) { - llwarns << "Failed to set locale " << locale_string << llendl; + LL_WARNS_ONCE("LLLocale") << "Failed to set locale " << locale_string << LL_ENDL; setlocale(LC_ALL, SYSTEM_LOCALE.c_str()); } //else diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index f21d60dd03..675edd7643 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1399,7 +1399,7 @@ bool LLModelLoader::doLoadModel() if(model->getStatus() != LLModel::NO_ERRORS) { setLoadState(ERROR_PARSING + model->getStatus()) ; - return true ; //abort + return false; //abort } if (model.notNull() && validate_model(model)) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d8024b362e..a4dcd3cd52 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -507,6 +507,7 @@ public: llinfos << "completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num)); + llinfos << "LLWholeModelFeeResponder content: " << content << llendl; if (isGoodStatus(status)) { mThread->mWholeModelUploadURL = content["uploader"].asString(); @@ -1302,8 +1303,6 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mOrigin = gAgent.getPositionAgent(); mHost = gAgent.getRegionHost(); - mUploadObjectAssetCapability = gAgent.getRegion()->getCapability("UploadObjectAsset"); - mNewInventoryCapability = gAgent.getRegion()->getCapability("NewFileAgentInventoryVariablePrice"); mWholeModelFeeCapability = gAgent.getRegion()->getCapability("NewFileAgentInventory"); mOrigin += gAgent.getAtAxis() * scale.magVec(); @@ -1393,14 +1392,7 @@ BOOL LLMeshUploadThread::isDiscarded() void LLMeshUploadThread::run() { - //if (gSavedSettings.getBOOL("MeshUseWholeModelUpload")) - { - doWholeModelUpload(); - } - /*else - { - doIterativeUpload(); - }*/ + doWholeModelUpload(); } void dumpLLSDToFile(const LLSD& content, std::string filename) @@ -1670,163 +1662,6 @@ void LLMeshUploadThread::doWholeModelUpload() mFinished = true; } -void LLMeshUploadThread::doIterativeUpload() -{ - if(isDiscarded()) - { - mFinished = true; - return ; - } - - mCurlRequest = new LLCurlRequest(); - - std::set textures; - - //populate upload queue with relevant models - for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) - { - LLMeshUploadData data; - data.mBaseModel = iter->first; - - LLModelInstance& instance = *(iter->second.begin()); - - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = instance.mLOD[i]; - } - - uploadModel(data); - - if (mUploadTextures) - { - for (std::vector::iterator material_iter = instance.mMaterial.begin(); - material_iter != instance.mMaterial.end(); ++material_iter) - { - - if (textures.find(material_iter->mDiffuseMap.get()) == textures.end()) - { - textures.insert(material_iter->mDiffuseMap.get()); - - LLTextureUploadData data(material_iter->mDiffuseMap.get(), material_iter->mDiffuseMapLabel); - uploadTexture(data); - } - } - } - - //queue up models for hull generation - LLModel* physics = data.mModel[LLModel::LOD_PHYSICS]; - if (physics == NULL) - { //no physics model available, use high lod - physics = data.mModel[LLModel::LOD_HIGH]; - } - - DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); - gMeshRepo.mDecompThread->submitRequest(request); - } - - while (!mPhysicsComplete) - { - apr_sleep(100); - } - - //upload textures - bool done = false; - do - { - if (!mTextureQ.empty()) - { - sendCostRequest(mTextureQ.front()); - mTextureQ.pop(); - } - - if (!mConfirmedTextureQ.empty()) - { - doUploadTexture(mConfirmedTextureQ.front()); - mConfirmedTextureQ.pop(); - } - - mCurlRequest->process(); - - done = mTextureQ.empty() && mConfirmedTextureQ.empty(); - } - while (!done || mCurlRequest->getQueued() > 0); - - LLSD object_asset; - object_asset["objects"] = LLSD::emptyArray(); - - done = false; - do - { - static S32 count = 0; - static F32 last_hundred = gFrameTimeSeconds; - if (gFrameTimeSeconds - last_hundred > 1.f) - { - last_hundred = gFrameTimeSeconds; - count = 0; - } - - //how many requests to push before calling process - const S32 PUSH_PER_PROCESS = 32; - - S32 tcount = llmin(count+PUSH_PER_PROCESS, 100); - - while (!mUploadQ.empty() && count < tcount) - { //send any pending upload requests - mMutex->lock(); - LLMeshUploadData data = mUploadQ.front(); - mUploadQ.pop(); - mMutex->unlock(); - sendCostRequest(data); - count++; - } - - tcount = llmin(count+PUSH_PER_PROCESS, 100); - - while (!mConfirmedQ.empty() && count < tcount) - { //process any meshes that have been confirmed for upload - LLMeshUploadData& data = mConfirmedQ.front(); - doUploadModel(data); - mConfirmedQ.pop(); - count++; - } - - tcount = llmin(count+PUSH_PER_PROCESS, 100); - - while (!mInstanceQ.empty() && count < tcount && !isDiscarded()) - { //create any objects waiting for upload - count++; - object_asset["objects"].append(createObject(mInstanceQ.front())); - mInstanceQ.pop(); - } - - mCurlRequest->process(); - - done = isDiscarded() || (mInstanceQ.empty() && mConfirmedQ.empty() && mUploadQ.empty()); - } - while (!done || mCurlRequest->getQueued() > 0); - - delete mCurlRequest; - mCurlRequest = NULL; - - // now upload the object asset - std::string url = mUploadObjectAssetCapability; - - if (object_asset["objects"][0].has("permissions")) - { //copy permissions from first available object to be used for coalesced object - object_asset["permissions"] = object_asset["objects"][0]["permissions"]; - } - - if(!isDiscarded()) - { - mPendingUploads++; - LLHTTPClient::post(url, object_asset, new LLModelObjectUploadResponder(this,object_asset)); - } - else - { - mFinished = true; - } -} - void LLMeshUploadThread::uploadModel(LLMeshUploadData& data) { //called from arbitrary thread { @@ -2937,102 +2772,6 @@ S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod) } -void LLMeshUploadThread::sendCostRequest(LLMeshUploadData& data) -{ - if(isDiscarded()) - { - return ; - } - - //write model file to memory buffer - std::stringstream ostr; - - LLModel::Decomposition& decomp = - data.mModel[LLModel::LOD_PHYSICS].notNull() ? - data.mModel[LLModel::LOD_PHYSICS]->mPhysics : - data.mBaseModel->mPhysics; - - LLSD header = LLModel::writeModel( - ostr, - data.mModel[LLModel::LOD_PHYSICS], - data.mModel[LLModel::LOD_HIGH], - data.mModel[LLModel::LOD_MEDIUM], - data.mModel[LLModel::LOD_LOW], - data.mModel[LLModel::LOD_IMPOSTOR], - decomp, - mUploadSkin, - mUploadJoints, - true); - - std::string desc = data.mBaseModel->mLabel; - - // Grab the total vertex count of the model - // along with other information for the "asset_resources" map - // to send to the server. - LLSD asset_resources = LLSD::emptyMap(); - - - std::string url = mNewInventoryCapability; - - if (!url.empty()) - { - LLSD body = generate_new_resource_upload_capability_body( - LLAssetType::AT_MESH, - desc, - desc, - LLFolderType::FT_MESH, - LLInventoryType::IT_MESH, - LLFloaterPerms::getNextOwnerPerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getEveryonePerms()); - - body["asset_resources"] = asset_resources; - - mPendingConfirmations++; - LLCurlRequest::headers_t headers; - - data.mPostData = body; - - mCurlRequest->post(url, headers, body, new LLMeshCostResponder(data, this)); - } -} - -void LLMeshUploadThread::sendCostRequest(LLTextureUploadData& data) -{ - if(isDiscarded()) - { - return ; - } - - if (data.mTexture && data.mTexture->getDiscardLevel() >= 0) - { - LLSD asset_resources = LLSD::emptyMap(); - - std::string url = mNewInventoryCapability; - - if (!url.empty()) - { - LLSD body = generate_new_resource_upload_capability_body( - LLAssetType::AT_TEXTURE, - data.mLabel, - data.mLabel, - LLFolderType::FT_TEXTURE, - LLInventoryType::IT_TEXTURE, - LLFloaterPerms::getNextOwnerPerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getEveryonePerms()); - - body["asset_resources"] = asset_resources; - - mPendingConfirmations++; - LLCurlRequest::headers_t headers; - - data.mPostData = body; - mCurlRequest->post(url, headers, body, new LLTextureCostResponder(data, this)); - } - } -} - void LLMeshUploadThread::doUploadModel(LLMeshUploadData& data) { diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 9b80fc02b3..a0c3989cf5 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -393,8 +393,6 @@ public: BOOL mDiscarded ; LLHost mHost; - std::string mUploadObjectAssetCapability; - std::string mNewInventoryCapability; std::string mWholeModelFeeCapability; std::string mWholeModelUploadURL; @@ -413,12 +411,10 @@ public: void uploadTexture(LLTextureUploadData& data); void doUploadTexture(LLTextureUploadData& data); - void sendCostRequest(LLTextureUploadData& data); void priceResult(LLTextureUploadData& data, const LLSD& content); void onTextureUploaded(LLTextureUploadData& data); void uploadModel(LLMeshUploadData& data); - void sendCostRequest(LLMeshUploadData& data); void doUploadModel(LLMeshUploadData& data); void onModelUploaded(LLMeshUploadData& data); void createObjects(LLMeshUploadData& data); @@ -432,7 +428,6 @@ public: BOOL isDiscarded(); void doWholeModelUpload(); - void doIterativeUpload(); void wholeModelToLLSD(LLSD& dest, bool include_textures); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 37640ad0d4..b424f4952d 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -109,6 +109,7 @@ class LLMeshUploadVisible : public view_listener_t { return gSavedSettings.getBOOL("MeshEnabled") && LLViewerParcelMgr::getInstance()->allowAgentBuild() && + // mesh *TODO: Use SimulatorFeatures cap to get this info instead. !gAgent.getRegion()->getCapability("ObjectAdd").empty(); } }; @@ -1203,78 +1204,6 @@ void upload_new_resource( } } -BOOL upload_new_variable_price_resource( - const LLTransactionID &tid, - LLAssetType::EType asset_type, - std::string name, - std::string desc, - LLFolderType::EType destination_folder_type, - LLInventoryType::EType inv_type, - U32 next_owner_perms, - U32 group_perms, - U32 everyone_perms, - const std::string& display_name, - const LLSD& asset_resources) -{ - LLAssetID uuid = - upload_new_resource_prep( - tid, - asset_type, - inv_type, - name, - display_name, - desc); - - llinfos << "*** Uploading: " << llendl; - llinfos << "Type: " << LLAssetType::lookup(asset_type) << llendl; - llinfos << "UUID: " << uuid << llendl; - llinfos << "Name: " << name << llendl; - llinfos << "Desc: " << desc << llendl; - lldebugs << "Folder: " - << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? (LLFolderType::EType)asset_type : destination_folder_type) << llendl; - lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; - - std::string url = gAgent.getRegion()->getCapability( - "NewFileAgentInventoryVariablePrice"); - - if ( !url.empty() ) - { - lldebugs - << "New Agent Inventory variable price upload" << llendl; - - // Each of the two capabilities has similar data, so - // let's reuse that code - - LLSD body; - - body = generate_new_resource_upload_capability_body( - asset_type, - name, - desc, - destination_folder_type, - inv_type, - next_owner_perms, - group_perms, - everyone_perms); - - body["asset_resources"] = asset_resources; - - LLHTTPClient::post( - url, - body, - new LLNewAgentInventoryVariablePriceResponder( - uuid, - asset_type, - body)); - - return TRUE; - } - else - { - return FALSE; - } -} - LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid) { if ( gDisconnected ) diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 1597821504..3136358b83 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -68,23 +68,6 @@ void upload_new_resource( S32 expected_upload_cost, void *userdata); -// TODO* : Move all uploads to use this new function -// since at some point, that upload path will be deprecated and no longer -// used - -// We make a new function here to ensure that previous code is not broken -BOOL upload_new_variable_price_resource( - const LLTransactionID& tid, - LLAssetType::EType type, - std::string name, - std::string desc, - LLFolderType::EType destination_folder_type, - LLInventoryType::EType inv_type, - U32 next_owner_perms, - U32 group_perms, - U32 everyone_perms, - const std::string& display_name, - const LLSD& asset_resources); LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid); void increase_new_upload_stats(LLAssetType::EType asset_type); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c4ca5d37ce..b0ec5811a5 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1510,9 +1510,8 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("LandResources"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); - capabilityNames.append("NewAccountingEnabled"); capabilityNames.append("NewFileAgentInventory"); - capabilityNames.append("NewFileAgentInventoryVariablePrice"); + // mesh *TODO: Use SimulatorFeatures cap to get this info instead. capabilityNames.append("ObjectAdd"); capabilityNames.append("ParcelPropertiesUpdate"); capabilityNames.append("ParcelMediaURLFilterList"); @@ -1544,7 +1543,6 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("UpdateNotecardTaskInventory"); capabilityNames.append("UpdateScriptTask"); capabilityNames.append("UploadBakedTexture"); - capabilityNames.append("UploadObjectAsset"); capabilityNames.append("ViewerMetrics"); capabilityNames.append("ViewerStartAuction"); capabilityNames.append("ViewerStats"); -- cgit v1.2.3 From 9793f6c51d3eb4fd9752e2c74b283d748bbe0bd2 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 Jun 2011 16:54:15 -0500 Subject: Add "NoGeometry" identifier support to viewer. --- indra/llprimitive/llmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 5acf93cfc4..337fa59f76 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1419,8 +1419,9 @@ LLSD LLModel::writeModel( for (S32 i = 0; i < model[idx]->getNumVolumeFaces(); ++i) { //for each face const LLVolumeFace& face = model[idx]->getVolumeFace(i); - if (!face.mNumVertices) + if (face.mNumVertices < 3) { //don't export an empty face + mdl[model_names[idx]][i]["NoGeometry"] = true; continue; } LLSD::Binary verts(face.mNumVertices*3*2); -- cgit v1.2.3 From aa21ad59aa1540be1839f0403b5a1291b86a74b3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 Jun 2011 18:20:07 -0500 Subject: Fix for crash when viewing asset with "NoGeometry" --- indra/llmath/llvolume.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 3c1de3a422..f473a708cd 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2419,12 +2419,25 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) for (U32 i = 0; i < face_count; ++i) { + LLVolumeFace& face = mVolumeFaces[i]; + + if (mdl[i].has("NoGeometry")) + { //face has no geometry, continue + face.resizeIndices(3); + face.resizeVertices(1); + memset(face.mPositions, 0, sizeof(LLVector4a)); + memset(face.mNormals, 0, sizeof(LLVector4a)); + memset(face.mTexCoords, 0, sizeof(LLVector2)); + memset(face.mIndices, 0, sizeof(U16)*3); + continue; + } + LLSD::Binary pos = mdl[i]["Position"]; LLSD::Binary norm = mdl[i]["Normal"]; LLSD::Binary tc = mdl[i]["TexCoord0"]; LLSD::Binary idx = mdl[i]["TriangleList"]; - LLVolumeFace& face = mVolumeFaces[i]; + //copy out indices face.resizeIndices(idx.size()/2); -- cgit v1.2.3 From b3fbb12f155ae1acc6b4d258d1c383d5d8e47964 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 Jun 2011 19:12:52 -0500 Subject: SH-1589 Fix for some meshes showing up in non mesh enabled regions. --- indra/newview/lldrawpoolavatar.cpp | 10 +--------- indra/newview/llmeshrepository.cpp | 11 ++--------- indra/newview/llviewerregion.cpp | 12 ++++++++++++ indra/newview/llviewerregion.h | 3 +++ indra/newview/llvovolume.cpp | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 870aec4eff..9f790d03fe 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -459,14 +459,6 @@ S32 LLDrawPoolAvatar::getNumPasses() { return 10; } - if (LLPipeline::sImpostorRender) - { - return 1; - } - else - { - return 3; - } } @@ -1419,7 +1411,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) { - if (avatar->isSelf() && !gAgent.needsRenderAvatar()) + if (avatar->isSelf() && !gAgent.needsRenderAvatar() || !gMeshRepo.meshRezEnabled()) { return; } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index ff9f0e1663..bfaddf9cde 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2379,7 +2379,6 @@ void LLMeshRepository::notifyLoadedMeshes() if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived()) { region_name = gAgent.getRegion()->getName(); - mGetMeshCapability = gAgent.getRegion()->getCapability("GetMesh"); } } @@ -3725,10 +3724,7 @@ bool LLMeshRepository::meshUploadEnabled() LLViewerParcelMgr::getInstance()->allowAgentBuild() && region) { - LLSD sim_features; - region->getSimulatorFeatures(sim_features); - return (sim_features.has("MeshUploadEnabled") && - sim_features["MeshUploadEnabled"].asBoolean()); + return region->meshUploadEnabled(); } return false; } @@ -3739,10 +3735,7 @@ bool LLMeshRepository::meshRezEnabled() if(gSavedSettings.getBOOL("MeshEnabled") && region) { - LLSD sim_features; - region->getSimulatorFeatures(sim_features); - return (sim_features.has("MeshRezEnabled") && - sim_features["MeshRezEnabled"].asBoolean()); + return region->meshRezEnabled(); } return false; } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 80207d6568..a370e83410 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1716,4 +1716,16 @@ std::string LLViewerRegion::getDescription() const return stringize(*this); } +bool LLViewerRegion::meshUploadEnabled() const +{ + return (mSimulatorFeatures.has("MeshUploadEnabled") && + mSimulatorFeatures["MeshUploadEnabled"].asBoolean()); +} + +bool LLViewerRegion::meshRezEnabled() const +{ + return (mSimulatorFeatures.has("MeshRezEnabled") && + mSimulatorFeatures["MeshRezEnabled"].asBoolean()); +} + diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index d936277231..3811b989e7 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -276,6 +276,9 @@ public: void getInfo(LLSD& info); + bool meshRezEnabled() const; + bool meshUploadEnabled() const; + void getSimulatorFeatures(LLSD& info); void setSimulatorFeatures(const LLSD& info); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 39e555f781..d978167f50 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3983,7 +3983,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLVOVolume* vobj = drawablep->getVOVolume(); - if (vobj->getVolume() && vobj->getVolume()->isTetrahedron()) + if (vobj->getVolume() && vobj->getVolume()->isTetrahedron() || (vobj->isMesh() && !gMeshRepo.meshRezEnabled())) { continue; } -- cgit v1.2.3 From a58e70261ef1584e243f813e858d22164ab00fd8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 Jun 2011 19:27:47 -0500 Subject: SH-101 Fix for asset when uploading some models. --- indra/llprimitive/llmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 337fa59f76..cee6927d20 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2237,7 +2237,7 @@ LLSD LLModel::Decomposition::asLLSD() const { for (U32 k = 0; k < 3; k++) { - llassert(mBaseHull[j].mV[k] <= 0.50001f && mBaseHull[j].mV[k] >= -0.50001f); + llassert(mBaseHull[j].mV[k] <= 0.501f && mBaseHull[j].mV[k] >= -0.501f); //convert to 16-bit normalized across domain U16 val = (U16) (((mBaseHull[j].mV[k]-min.mV[k])/range.mV[k])*65535); -- cgit v1.2.3 From a3842d963764d0231c0fb7b1777e05fb776af358 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 6 Jun 2011 23:04:48 -0600 Subject: fix for SH-588: Uploading a mesh crashes viewer --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 2c8a254a75..45c05d19ad 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -18,9 +18,9 @@ archive hash - 930bdd987a321eda1838caba8cd6098f + 3ecad1f19fb884e4ce0c27f6407cb5d9 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/230348/arch/Darwin/installer/glod-1.0pre4-darwin-20110519.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232171/arch/Darwin/installer/glod-1.0pre4-darwin-20110606.tar.bz2 name darwin @@ -30,9 +30,9 @@ archive hash - fb33b6cac2e6b98f93c5efa2af2e5a00 + f1f73a9ca1d2dfa68570c7379ebabcce url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/230348/arch/Linux/installer/glod-1.0pre4-linux-20110519.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232171/arch/Linux/installer/glod-1.0pre4-linux-20110607.tar.bz2 name linux @@ -42,9 +42,9 @@ archive hash - 388cf0e292f756b4bb37696622f0bbc5 + afcf9be19bebee7713ca5188b645d2b0 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/230348/arch/CYGWIN/installer/glod-1.0pre4-windows-20110519.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232171/arch/CYGWIN/installer/glod-1.0pre4-windows-20110606.tar.bz2 name windows -- cgit v1.2.3 From faf9693be3f34cd1ef28e21ae1bd2bc466221c4e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Jun 2011 00:10:24 -0500 Subject: Make basehull assert even more forgiving (only error out on 10% over bounds). --- indra/llprimitive/llmodel.cpp | 2 +- indra/newview/llviewerregion.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index cee6927d20..e3b68156ca 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2237,7 +2237,7 @@ LLSD LLModel::Decomposition::asLLSD() const { for (U32 k = 0; k < 3; k++) { - llassert(mBaseHull[j].mV[k] <= 0.501f && mBaseHull[j].mV[k] >= -0.501f); + llassert(mBaseHull[j].mV[k] <= 0.51f && mBaseHull[j].mV[k] >= -0.51f); //convert to 16-bit normalized across domain U16 val = (U16) (((mBaseHull[j].mV[k]-min.mV[k])/range.mV[k])*65535); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a370e83410..1dd92cd926 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1716,16 +1716,16 @@ std::string LLViewerRegion::getDescription() const return stringize(*this); } -bool LLViewerRegion::meshUploadEnabled() const -{ - return (mSimulatorFeatures.has("MeshUploadEnabled") && - mSimulatorFeatures["MeshUploadEnabled"].asBoolean()); -} - -bool LLViewerRegion::meshRezEnabled() const -{ - return (mSimulatorFeatures.has("MeshRezEnabled") && - mSimulatorFeatures["MeshRezEnabled"].asBoolean()); -} +bool LLViewerRegion::meshUploadEnabled() const +{ + return (mSimulatorFeatures.has("MeshUploadEnabled") && + mSimulatorFeatures["MeshUploadEnabled"].asBoolean()); +} + +bool LLViewerRegion::meshRezEnabled() const +{ + return (mSimulatorFeatures.has("MeshRezEnabled") && + mSimulatorFeatures["MeshRezEnabled"].asBoolean()); +} -- cgit v1.2.3 From 81af06c95490a54e69b6bbf01ae2ef98adb66a02 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Jun 2011 00:22:49 -0500 Subject: Fix for crash on clicking cancel while a model is still loading. --- indra/newview/llfloatermodelpreview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 675edd7643..1f6199ffb2 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2787,7 +2787,7 @@ LLModelPreview::~LLModelPreview() { if (mModelLoader) { - delete mModelLoader; + mModelLoader->mPreview = NULL; mModelLoader = NULL; } //*HACK : *TODO : turn this back on when we understand why this crashes -- cgit v1.2.3 From e135d4d62973ce94b36d19421a69061824543c22 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Jun 2011 15:28:05 -0500 Subject: SH-1767 Fix for crash when viewing assets uploaded by mesh-asset-deprecation viewers --- indra/llmath/llvolume.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 3c1de3a422..53f73d8637 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6010,6 +6010,11 @@ void LLVolumeFace::cacheOptimize() LLVCacheLRU cache; + if (mNumVertices < 3) + { //nothing to do + return; + } + //mapping of vertices to triangles and indices std::vector vertex_data; -- cgit v1.2.3 From eb85820797cb4321657a0ce0b160af806e15b05a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Jun 2011 15:28:49 -0500 Subject: SH-1595 Make rigged attachment selection more reliable (never selectable when not in edit mode, always accurately selectable while in edit mode). --- indra/newview/llspatialpartition.cpp | 25 +++++++++++- indra/newview/llvoavatar.cpp | 79 ++++++++++++++++++++++++++++++++++++ indra/newview/llvoavatar.h | 8 ++++ indra/newview/llvovolume.cpp | 3 +- 4 files changed, 113 insertions(+), 2 deletions(-) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 7f91f9a952..d96fa087b1 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -35,6 +35,7 @@ #include "llvolumeoctree.h" #include "llviewercamera.h" #include "llface.h" +#include "llfloatertools.h" #include "llviewercontrol.h" #include "llviewerregion.h" #include "llcamera.h" @@ -4272,7 +4273,29 @@ public: if (vobj) { LLVector3 intersection; - if (vobj->lineSegmentIntersect(mStart, mEnd, -1, mPickTransparent, mFaceHit, &intersection, mTexCoord, mNormal, mBinormal)) + bool skip_check = false; + if (vobj->isAvatar()) + { + LLVOAvatar* avatar = (LLVOAvatar*) vobj; + if (avatar->isSelf() && LLFloater::isVisible(gFloaterTools)) + { + LLViewerObject* hit = avatar->lineSegmentIntersectRiggedAttachments(mStart, mEnd, -1, mPickTransparent, mFaceHit, &intersection, mTexCoord, mNormal, mBinormal); + if (hit) + { + mEnd = intersection; + if (mIntersection) + { + *mIntersection = intersection; + } + + mHit = hit->mDrawable; + skip_check = true; + } + + } + } + + if (!skip_check && vobj->lineSegmentIntersect(mStart, mEnd, -1, mPickTransparent, mFaceHit, &intersection, mTexCoord, mNormal, mBinormal)) { mEnd = intersection; // shorten ray so we only find CLOSER hits if (mIntersection) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 77bbf994e9..1b53348b43 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -56,6 +56,7 @@ #include "lleditingmotion.h" #include "llemote.h" //#include "llfirstuse.h" +#include "llfloatertools.h" #include "llheadrotmotion.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" @@ -1541,7 +1542,35 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e return TRUE; } } + + if (isSelf()) + { + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + + if (attached_object && !attached_object->isDead() && attachment->getValid()) + { + LLDrawable* drawable = attached_object->mDrawable; + if (drawable->isState(LLDrawable::RIGGED)) + { //regenerate octree for rigged attachment + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_RIGGED, TRUE); + } + } + } + } + } } + + LLVector3 position; if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position)) @@ -1557,6 +1586,56 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e return FALSE; } +LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector3& start, const LLVector3& end, + S32 face, + BOOL pick_transparent, + S32* face_hit, + LLVector3* intersection, + LLVector2* tex_coord, + LLVector3* normal, + LLVector3* bi_normal) +{ + if (isSelf() && !gAgent.needsRenderAvatar()) + { + return NULL; + } + + LLViewerObject* hit = NULL; + + if (lineSegmentBoundingBox(start, end)) + { + LLVector3 local_end = end; + LLVector3 local_intersection; + + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + + if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, face_hit, &local_intersection, tex_coord, normal, bi_normal)) + { + local_end = local_intersection; + if (intersection) + { + *intersection = local_intersection; + } + + hit = attached_object; + } + } + } + } + + return hit; +} + //----------------------------------------------------------------------------- // parseSkeletonFile() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 295799fd24..03c0498a2a 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -145,6 +145,14 @@ public: LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point LLVector3* normal = NULL, // return the surface normal at the intersection point LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point + LLViewerObject* lineSegmentIntersectRiggedAttachments(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point //-------------------------------------------------------------------- // LLCharacter interface and related diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 39e555f781..6de334eb82 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3365,7 +3365,8 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e { if (LLFloater::isVisible(gFloaterTools) && getAvatar()->isSelf()) { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_RIGGED, TRUE); + updateRiggedVolume(); + genBBoxes(FALSE); volume = mRiggedVolume; transform = false; } -- cgit v1.2.3 From 9134ec0197cd53ad6a0690c2cbfda406c7d9dbcb Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 7 Jun 2011 16:43:38 -0400 Subject: STORM-899 'No attachments worn' text on blank 'Attachments' accordion remains in English for all locales --- indra/newview/llcofwearables.cpp | 8 +++++--- indra/newview/llcofwearables.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 9a30979b9b..254c0adef1 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -296,7 +296,7 @@ LLCOFWearables::~LLCOFWearables() // virtual BOOL LLCOFWearables::postBuild() { - mAttachments = getChild("list_attachments"); + mAttachments = getChild("list_attachments"); mClothing = getChild("list_clothing"); mBodyParts = getChild("list_body_parts"); @@ -317,8 +317,6 @@ BOOL LLCOFWearables::postBuild() mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR); mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR); - mAttachments->setNoItemsMsg(getString("no_attachments")); - mClothingTab = getChild("tab_clothing"); mClothingTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); @@ -500,6 +498,10 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel mAttachments->sort(); mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false) } + else + { + mAttachments->setNoItemsCommentText(LLTrans::getString("no_attachments")); + } if (mBodyParts->size()) { diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 271e36e87d..1f8d6d0c94 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -106,7 +106,7 @@ protected: void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu); - LLFlatListViewEx* mAttachments; + LLFlatListView* mAttachments; LLFlatListView* mClothing; LLFlatListView* mBodyParts; -- cgit v1.2.3 From dbd619508ba45292c2cebe096494c28e74941643 Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 7 Jun 2011 16:53:29 -0400 Subject: Fix for importer crashes, sh-1698. Added checks for handling bad elements in the dae. --- indra/llprimitive/llmodel.cpp | 48 +++++++++++++++++----- indra/llprimitive/llmodel.h | 1 + indra/newview/llfloatermodelpreview.h | 3 -- .../skins/default/xui/en/floater_model_preview.xml | 1 + .../skins/default/xui/en/floater_model_wizard.xml | 3 +- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 3439cf3310..9ae1bbacf1 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -149,9 +149,10 @@ void load_face_from_dom_inputs(LLVolumeFace& face, const domInputLocalOffset_Arr } } -void get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride, +bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride, domSource* &pos_source, domSource* &tc_source, domSource* &norm_source) { + idx_stride = 0; for (U32 j = 0; j < inputs.getCount(); ++j) @@ -163,7 +164,11 @@ void get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S const domURIFragmentType& uri = inputs[j]->getSource(); daeElementRef elem = uri.getElement(); domVertices* vertices = (domVertices*) elem.cast(); - + if ( !vertices ) + { + return false; + } + domInputLocal_Array& v_inp = vertices->getInput_array(); @@ -207,6 +212,8 @@ void get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S } idx_stride += 1; + + return true; } LLModel::EModelStatus load_face_from_dom_triangles(std::vector& face_list, std::vector& materials, domTrianglesRef& tri) @@ -227,8 +234,12 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa S32 idx_stride = 0; - get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source); + if ( !get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source) || !pos_source ) + { + return LLModel::BAD_ELEMENT; + } + domPRef p = tri->getP(); domListOfUInts& idx = p->getValue(); @@ -367,7 +378,10 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector& fac S32 idx_stride = 0; - get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source); + if (!get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source)) + { + return LLModel::BAD_ELEMENT; + } LLVolumeFace face; @@ -564,7 +578,10 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac const domURIFragmentType& uri = inputs[i]->getSource(); daeElementRef elem = uri.getElement(); domVertices* vertices = (domVertices*) elem.cast(); - + if (!vertices) + { + return LLModel::BAD_ELEMENT; + } domInputLocal_Array& v_inp = vertices->getInput_array(); for (U32 k = 0; k < v_inp.getCount(); ++k) @@ -574,6 +591,10 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac const domURIFragmentType& uri = v_inp[k]->getSource(); daeElementRef elem = uri.getElement(); domSource* src = (domSource*) elem.cast(); + if (!src) + { + return LLModel::BAD_ELEMENT; + } v = &(src->getFloat_array()->getValue()); } } @@ -585,6 +606,10 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac const domURIFragmentType& uri = inputs[i]->getSource(); daeElementRef elem = uri.getElement(); domSource* src = (domSource*) elem.cast(); + if (!src) + { + return LLModel::BAD_ELEMENT; + } n = &(src->getFloat_array()->getValue()); } else if (strcmp(COMMON_PROFILE_INPUT_TEXCOORD, inputs[i]->getSemantic()) == 0 && inputs[i]->getSet() == 0) @@ -593,6 +618,10 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac const domURIFragmentType& uri = inputs[i]->getSource(); daeElementRef elem = uri.getElement(); domSource* src = (domSource*) elem.cast(); + if (!src) + { + return LLModel::BAD_ELEMENT; + } t = &(src->getFloat_array()->getValue()); } } @@ -712,7 +741,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac //static std::string LLModel::getStatusString(U32 status) { - const static std::string status_strings[(S32)INVALID_STATUS] = {"status_no_error", "status_vertex_number_overflow"}; + const static std::string status_strings[(S32)INVALID_STATUS] = {"status_no_error", "status_vertex_number_overflow","bad_element"}; if(status < INVALID_STATUS) { @@ -750,7 +779,6 @@ void LLModel::addVolumeFacesFromDomMesh(domMesh* mesh) for (U32 i = 0; i < polys.getCount(); ++i) { domPolylistRef& poly = polys.get(i); - mStatus = load_face_from_dom_polylist(mVolumeFaces, mMaterialList, poly); if(mStatus != NO_ERRORS) @@ -760,12 +788,12 @@ void LLModel::addVolumeFacesFromDomMesh(domMesh* mesh) return ; //abort } } - + domPolygons_Array& polygons = mesh->getPolygons_array(); + for (U32 i = 0; i < polygons.getCount(); ++i) { domPolygonsRef& poly = polygons.get(i); - mStatus = load_face_from_dom_polygons(mVolumeFaces, mMaterialList, poly); if(mStatus != NO_ERRORS) @@ -775,7 +803,7 @@ void LLModel::addVolumeFacesFromDomMesh(domMesh* mesh) return ; //abort } } - + } BOOL LLModel::createVolumeFacesFromDomMesh(domMesh* mesh) diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index ebca1f9d9d..cd9f76fcb7 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -73,6 +73,7 @@ public: { NO_ERRORS = 0, VERTEX_NUMBER_OVERFLOW, //vertex number is >= 65535. + BAD_ELEMENT, INVALID_STATUS } ; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index ed7cbe6d1e..7d7464577a 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -311,9 +311,6 @@ public: void setHasPivot( bool val ) { mHasPivot = val; } void setModelPivot( const LLVector3& pivot ) { mModelPivot = pivot; } - //Sets the current avatars joints to new positions - //Makes in world go to shit, however - void changeAvatarsJointPositions( LLModel* pModel ); //Determines the viability of an asset to be used as an avatar rig (w or w/o joint upload caps) void critiqueRigForUploadApplicability( const std::vector &jointListFromAsset ); void critiqueJointToNodeMappingFromScene( void ); diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index 4677d014b8..9d46e1eec5 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -7,6 +7,7 @@ Loading... Generating Meshes... Error: Vertex number is more than 65534, aborted! + Error: element is invalid High Medium Low diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 47b2e5fd79..3dd16f8eb1 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -1021,7 +1021,8 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se Idle Loading... Generating Meshes... - Error: Vertex number is more than 65534, aborted! + Error: Vertex number is more than 65534, aborted! + Error: element is invalid High Medium Low -- cgit v1.2.3 From dfdf6aed23272a4e960bed085bced3ec74108125 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 7 Jun 2011 18:22:09 -0600 Subject: fix for SH-1765: palm tree model fails to load in viewer --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 45c05d19ad..1548a9678d 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -18,9 +18,9 @@ archive hash - 3ecad1f19fb884e4ce0c27f6407cb5d9 + 76827e62b9af4756caa1d3d8da0bafc3 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232171/arch/Darwin/installer/glod-1.0pre4-darwin-20110606.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232275/arch/Darwin/installer/glod-1.0pre4-darwin-20110607.tar.bz2 name darwin @@ -30,9 +30,9 @@ archive hash - f1f73a9ca1d2dfa68570c7379ebabcce + 7841a681db47017ccc6527b52876bacb url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232171/arch/Linux/installer/glod-1.0pre4-linux-20110607.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232275/arch/Linux/installer/glod-1.0pre4-linux-20110607.tar.bz2 name linux @@ -42,9 +42,9 @@ archive hash - afcf9be19bebee7713ca5188b645d2b0 + cca713fe7395260d91aaef2f2b5d820a url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232171/arch/CYGWIN/installer/glod-1.0pre4-windows-20110606.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232275/arch/CYGWIN/installer/glod-1.0pre4-windows-20110607.tar.bz2 name windows -- cgit v1.2.3 From d6730fddf6d8e711ca5af6e72a92734a70f86209 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 00:16:02 -0500 Subject: don't use quota accounting manager --- indra/newview/llfloatertools.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 0f11d05175..0d798afdcc 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -424,6 +424,7 @@ void LLFloaterTools::refresh() // Refresh object and prim count labels LLLocale locale(LLLocale::USER_LOCALE); +#if 0 if (gMeshRepo.meshRezEnabled()) { std::string obj_count_string; @@ -448,6 +449,7 @@ void LLFloaterTools::refresh() getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost); } else +#endif { // Get the number of objects selected std::string root_object_count_string; -- cgit v1.2.3 From edc6ca726be6862d9e070b4ee1bfd706f8040b16 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 00:35:14 -0500 Subject: SH-1648 Fix for spot shadows being offset by sunlight vector when SSAO enabled. --- indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 6dbcc479e1..d53850b489 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -234,7 +234,7 @@ void main() gl_FragColor[0] = shadow; gl_FragColor[1] = calcAmbientOcclusion(pos, norm); - spos.xyz = shadow_pos+offset*spot_shadow_offset; + spos.xyz = shadow_pos+norm*spot_shadow_offset; //spotlight shadow 1 vec4 lpos = shadow_matrix[4]*spos; -- cgit v1.2.3 From 9b1c284d4cb678c0a7800505ac5fa3ab3e6ba095 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 01:08:09 -0500 Subject: SH-1678 Fix for busted fullbright shiny. --- .../shaders/class1/deferred/fullbrightF.glsl | 33 ++-------------------- indra/newview/lldrawpoolbump.cpp | 6 ++++ indra/newview/llviewershadermgr.cpp | 3 +- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 029f282d7c..5e6c5ebec8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -9,34 +9,6 @@ #extension GL_ARB_texture_rectangle : enable -varying float vary_texture_index; - -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform sampler2D tex3; -uniform sampler2D tex4; -uniform sampler2D tex5; -uniform sampler2D tex6; -uniform sampler2D tex7; - -vec4 textureLookup(vec2 texcoord) -{ - switch (int(vary_texture_index+0.25)) - { - case 0: return texture2D(tex0, texcoord); - case 1: return texture2D(tex1, texcoord); - case 2: return texture2D(tex2, texcoord); - case 3: return texture2D(tex3, texcoord); - case 4: return texture2D(tex4, texcoord); - case 5: return texture2D(tex5, texcoord); - case 6: return texture2D(tex6, texcoord); - case 7: return texture2D(tex7, texcoord); - } - - return vec4(0,0,0,0); -} - vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -45,12 +17,13 @@ void main() { float shadow = 1.0; - vec4 color = textureLookup(gl_TexCoord[0].xy)*gl_Color; + vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color; color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - gl_FragColor = color; + //gl_FragColor = color; + gl_FragColor = vec4(1,0,1,1); } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 8985d3680e..813b3820ee 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -537,6 +537,12 @@ void LLDrawPoolBump::beginFullbrightShiny() gGL.getTexUnit(cube_channel)->bind(cube_map); gGL.getTexUnit(0)->activate(); } + + if (mVertexShaderLevel > 1) + { //indexed texture rendering, channel 0 is always diffuse + diffuse_channel = 0; + } + mShiny = TRUE; } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index a1cb6d4ea6..e3ed2d0649 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1303,8 +1303,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true; gDeferredFullbrightProgram.mFeatures.hasGamma = true; gDeferredFullbrightProgram.mFeatures.hasTransport = true; - gDeferredFullbrightProgram.mFeatures.isFullbright = true; - gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = 0; + gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; gDeferredFullbrightProgram.mShaderFiles.clear(); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); -- cgit v1.2.3 From 280caa290253d92cc8f5f283c340d79639a9b178 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 02:06:51 -0500 Subject: SH-1679 Fix for anti-aliasing not being on by default for appropriate cards. --- indra/newview/featuretable.txt | 7 ++++++- indra/newview/featuretable_linux.txt | 7 ++++++- indra/newview/featuretable_mac.txt | 7 ++++++- indra/newview/featuretable_xp.txt | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 25dd2ffe78..1d29c5b597 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 27 +version 28 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -64,6 +64,7 @@ RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 WatchdogDisabled 1 1 RenderUseStreamVBO 1 1 +RenderFSAASamples 1 16 // // Low Graphics Settings @@ -95,6 +96,7 @@ SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // Mid Graphics Settings @@ -124,6 +126,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // High Graphics Settings (purty) @@ -153,6 +156,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 4 // // Ultra graphics (REALLY PURTY!) @@ -181,6 +185,7 @@ WLSkyDetail 1 128 RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 +RenderFSAASamples 1 8 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 058bdcc730..9daa5a5b29 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -1,4 +1,4 @@ -version 23 +version 24 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -62,6 +62,7 @@ RenderShaderLightingMaxLevel 1 3 RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 +RenderFSAASamples 1 16 // // Low Graphics Settings @@ -93,6 +94,7 @@ SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // Mid Graphics Settings @@ -122,6 +124,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // High Graphics Settings (purty) @@ -151,6 +154,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 4 // // Ultra graphics (REALLY PURTY!) @@ -180,6 +184,7 @@ WLSkyDetail 1 128 RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 +RenderFSAASamples 1 8 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 8b8340bd71..d7b4128ca2 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 24 +version 25 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -64,6 +64,7 @@ RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 WatchdogDisabled 1 1 RenderUseStreamVBO 1 1 +RenderFSAASamples 1 16 // // Low Graphics Settings @@ -95,6 +96,7 @@ SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // Mid Graphics Settings @@ -124,6 +126,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // High Graphics Settings (purty) @@ -153,6 +156,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 2 +RenderFSAASamples 1 4 // // Ultra graphics (REALLY PURTY!) @@ -182,6 +186,7 @@ WLSkyDetail 1 128 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 2 +RenderFSAASamples 1 8 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index 65a6f59bbe..0a23b4d6a6 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -1,4 +1,4 @@ -version 27 +version 28 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -64,6 +64,7 @@ RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 WatchdogDisabled 1 1 RenderUseStreamVBO 1 1 +RenderFSAASamples 1 16 // // Low Graphics Settings @@ -95,6 +96,7 @@ SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // Mid Graphics Settings @@ -124,6 +126,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 +RenderFSAASamples 1 0 // // High Graphics Settings (purty) @@ -153,6 +156,7 @@ WLSkyDetail 1 48 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 2 +RenderFSAASamples 1 4 // // Ultra graphics (REALLY PURTY!) @@ -182,6 +186,7 @@ WLSkyDetail 1 128 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 2 +RenderFSAASamples 1 8 // // Class Unknown Hardware (unknown) -- cgit v1.2.3 From 0c3de98056bde49a18c40469b3d3e3a43be3d209 Mon Sep 17 00:00:00 2001 From: paul_productengine Date: Wed, 8 Jun 2011 18:23:31 +0300 Subject: SH-1588 FIXED (Build tools does not specify units for prim density value) - Changed label of the Density spinner - Added ability to LLSpinCtrl to set wrap property form XML --- indra/llui/llspinctrl.cpp | 2 ++ indra/llui/llspinctrl.h | 1 + indra/newview/skins/default/xui/en/floater_tools.xml | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 6b4e9cf923..15a7438ec9 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -52,6 +52,7 @@ LLSpinCtrl::Params::Params() : label_width("label_width"), decimal_digits("decimal_digits"), allow_text_entry("allow_text_entry", true), + label_wrap("label_wrap", false), text_enabled_color("text_enabled_color"), text_disabled_color("text_disabled_color"), up_button("up_button"), @@ -80,6 +81,7 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) { LLRect label_rect( 0, centered_top, label_width, centered_bottom ); LLTextBox::Params params; + params.wrap(p.label_wrap); params.name("SpinCtrl Label"); params.rect(label_rect); params.initial_value(p.label()); diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 8960971594..d197084e38 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -44,6 +44,7 @@ public: Optional label_width; Optional decimal_digits; Optional allow_text_entry; + Optional label_wrap; Optional text_enabled_color; Optional text_disabled_color; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index f5f6b990d1..7441b2cd9c 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2457,8 +2457,9 @@ even though the user gets a free copy. height="19" increment="0.1" initial_value="0" - label="Density" + label="Density in 100 kg/m^3" label_width="70" + label_wrap="true" layout="topleft" left_delta="0" max_val="22587" @@ -2479,7 +2480,7 @@ even though the user gets a free copy. max_val="1" min_val="0" name="Physics Restitution" - top_pad="4" + top_pad="8" width="132" /> Date: Wed, 8 Jun 2011 15:29:52 -0400 Subject: Fix for sh-815: Added support for verifying a controllers skin weight count against the geometries vertex count --- indra/newview/llfloatermodelpreview.cpp | 106 +++ indra/newview/llfloatermodelpreview.h | 868 +++++++++++---------- .../skins/default/xui/en/floater_model_preview.xml | 1 + .../skins/default/xui/en/floater_model_wizard.xml | 1 + 4 files changed, 546 insertions(+), 430 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 8be5c427fe..75fa7b9d1f 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -598,6 +598,11 @@ void LLFloaterModelPreview::draw() childSetTextArg("status", "[STATUS]", getString(LLModel::getStatusString(mModelPreview->getLoadState() - LLModelLoader::ERROR_PARSING))); } else + if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_PARSING ) + { + childSetTextArg("status", "[STATUS]", getString("status_parse_error")); + } + else { childSetTextArg("status", "[STATUS]", getString("status_idle")); } @@ -1250,6 +1255,23 @@ bool LLModelLoader::doLoadModel() return false; } + //Verify some basic properties of the dae + //1. Basic validity check on controller + U32 controllerCount = (int) db->getElementCount( NULL, "controller" ); + bool result = false; + for ( int i=0; igetElement( (daeElement**) &pController, i , NULL, "controller" ); + result = mPreview->verifyController( pController ); + if (!result) + { + setLoadState( ERROR_PARSING ); + return true; + } + } + + //get unit scale mTransform.setIdentity(); @@ -2178,6 +2200,90 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode ) return false; } +//----------------------------------------------------------------------------- +// verifyCount +//----------------------------------------------------------------------------- +bool LLModelPreview::verifyCount( int expected, int result ) +{ + if ( expected != result ) + { + llinfos<< "Error: (expected/got)"<getSkin(); + + if ( pSkin ) + { + xsAnyURI & uri = pSkin->getSource(); + domElement* pElement = uri.getElement(); + + if ( !pElement ) + { + llinfos<<"Can't resolve skin source"<getTypeName(); + if ( stricmp(type_str, "geometry") == 0 ) + { + //Skin is reference directly by geometry and get the vertex count from skin + domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights(); + U32 vertexWeightsCount = pVertexWeights->getCount(); + domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement(); + domMesh* pMesh = pGeometry->getMesh(); + + if ( pMesh ) + { + //Get vertex count from geometry + domVertices* pVertices = pMesh->getVertices(); + if ( !pVertices ) + { + llinfos<<"No vertices!"<getInput_array()[0]->getSource(); + domSource* pSource = (domSource*) (domElement*) src.getElement(); + U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount(); + result = verifyCount( verticesCount, vertexWeightsCount ); + if ( !result ) + { + return result; + } + } + } + + U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount(); + result = verifyCount( vcountCount, vertexWeightsCount ); + if ( !result ) + { + return result; + } + + domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array(); + U32 sum = 0; + for (size_t i=0; igetVcount()->getValue()[i]; + } + result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); + } + } + + return result; +} //----------------------------------------------------------------------------- // extractTranslation() diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 7d7464577a..a328bfb4dd 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -1,430 +1,438 @@ -/** - * @file llfloatermodelpreview.h - * @brief LLFloaterModelPreview class definition - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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$ - */ - -#ifndef LL_LLFLOATERMODELPREVIEW_H -#define LL_LLFLOATERMODELPREVIEW_H - -#include "llfloaternamedesc.h" - -#include "lldynamictexture.h" -#include "llfloatermodelwizard.h" -#include "llquaternion.h" -#include "llmeshrepository.h" -#include "llmodel.h" -#include "llthread.h" -#include "llviewermenufile.h" - -class LLComboBox; -class LLJoint; -class LLViewerJointMesh; -class LLVOAvatar; -class LLTextBox; -class LLVertexBuffer; -class LLModelPreview; -class LLFloaterModelPreview; -class daeElement; -class domProfile_COMMON; -class domInstance_geometry; -class domNode; -class domTranslate; -class LLMenuButton; -class LLToggleableMenu; - -typedef std::map JointTransformMap; -typedef std::map:: iterator JointTransformMapIt; - -const S32 NUM_LOD = 4; - -class LLModelLoader : public LLThread -{ -public: - typedef enum - { - STARTING = 0, - READING_FILE, - CREATING_FACES, - GENERATING_VERTEX_BUFFERS, - GENERATING_LOD, - DONE, - ERROR_PARSING //basically loading failed - } eLoadState; - - U32 mState; - std::string mFilename; - S32 mLod; - LLModelPreview* mPreview; - LLMatrix4 mTransform; - BOOL mFirstTransform; - LLVector3 mExtents[2]; - bool mTrySLM; - - std::map > mModel; - - typedef std::vector > model_list; - model_list mModelList; - - typedef std::vector model_instance_list; - - typedef std::map scene; - - scene mScene; - - typedef std::queue > model_queue; - - //queue of models that need a physics rep - model_queue mPhysicsQ; - - LLModelLoader( std::string filename, S32 lod, LLModelPreview* preview, JointTransformMap& jointMap, - std::deque& jointsFromNodes ); - ~LLModelLoader() ; - - virtual void run(); - bool doLoadModel(); - bool loadFromSLM(const std::string& filename); - void loadModelCallback(); - - void loadTextures() ; //called in the main thread. - void processElement(daeElement* element); - std::vector getMaterials(LLModel* model, domInstance_geometry* instance_geo); - LLImportMaterial profileToMaterial(domProfile_COMMON* material); - std::string getElementLabel(daeElement *element); - LLColor4 getDaeColor(daeElement* element); - - daeElement* getChildFromElement( daeElement* pElement, std::string const & name ); - - bool isNodeAJoint( domNode* pNode ); - void processJointNode( domNode* pNode, std::map& jointTransforms ); - void extractTranslation( domTranslate* pTranslate, LLMatrix4& transform ); - void extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform ); - - void setLoadState(U32 state); - - void buildJointToNodeMappingFromScene( daeElement* pRoot ); - void processJointToNodeMapping( domNode* pNode ); - - - //map of avatar joints as named in COLLADA assets to internal joint names - std::map mJointMap; - JointTransformMap& mJointList; - std::deque& mJointsFromNode; - -private: - static std::list sActiveLoaderList; - static bool isAlive(LLModelLoader* loader) ; -}; - -class LLFloaterModelPreview : public LLFloater -{ -public: - - class DecompRequest : public LLPhysicsDecomp::Request - { - public: - S32 mContinue; - LLPointer mModel; - - DecompRequest(const std::string& stage, LLModel* mdl); - virtual S32 statusCallback(const char* status, S32 p1, S32 p2); - virtual void completed(); - - }; - static LLFloaterModelPreview* sInstance; - - LLFloaterModelPreview(const LLSD& key); - virtual ~LLFloaterModelPreview(); - - virtual BOOL postBuild(); - - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleMouseUp(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - - static void onMouseCaptureLostModelPreview(LLMouseHandler*); - static void setUploadAmount(S32 amount) { sUploadAmount = amount; } - - void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); - - static void onBrowseLOD(void* data); - - static void onReset(void* data); - - static void onUpload(void* data); - - static void onClearMaterials(void* data); - - static void refresh(LLUICtrl* ctrl, void* data); - - void updateResourceCost(); - - void loadModel(S32 lod); - - void onViewOptionChecked(const LLSD& userdata); - bool isViewOptionChecked(const LLSD& userdata); - bool isViewOptionEnabled(const LLSD& userdata); - void setViewOptionEnabled(const std::string& option, bool enabled); - void enableViewOption(const std::string& option); - void disableViewOption(const std::string& option); - -protected: - friend class LLModelPreview; - friend class LLMeshFilePicker; - friend class LLPhysicsDecomp; - - static void onImportScaleCommit(LLUICtrl*, void*); - static void onPelvisOffsetCommit(LLUICtrl*, void*); - static void onUploadJointsCommit(LLUICtrl*,void*); - static void onUploadSkinCommit(LLUICtrl*,void*); - - static void onPhysicsLoadRadioCommit(LLUICtrl*,void *data); - - static void onPreviewLODCommit(LLUICtrl*,void*); - - static void onGenerateNormalsCommit(LLUICtrl*,void*); - - static void onAutoFillCommit(LLUICtrl*,void*); - static void onLODParamCommit(LLUICtrl*,void*); - static void onLODParamCommitTriangleLimit(LLUICtrl*,void*); - - static void onExplodeCommit(LLUICtrl*, void*); - - static void onPhysicsParamCommit(LLUICtrl* ctrl, void* userdata); - static void onPhysicsStageExecute(LLUICtrl* ctrl, void* userdata); - static void onCancel(LLUICtrl* ctrl, void* userdata); - static void onPhysicsStageCancel(LLUICtrl* ctrl, void* userdata); - - static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata); - static void onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata); - static void onPhysicsOptimize(LLUICtrl* ctrl, void* userdata); - static void onPhysicsDecomposeBack(LLUICtrl* ctrl, void* userdata); - static void onPhysicsSimplifyBack(LLUICtrl* ctrl, void* userdata); - - void draw(); - - void initDecompControls(); - - void setStatusMessage(const std::string& msg); - - LLModelPreview* mModelPreview; - - LLPhysicsDecomp::decomp_params mDecompParams; - - S32 mLastMouseX; - S32 mLastMouseY; - LLRect mPreviewRect; - U32 mGLName; - static S32 sUploadAmount; - - std::set > mCurRequest; - std::string mStatusMessage; - - //use "disabled" as false by default - std::map mViewOptionDisabled; - - //store which lod mode each LOD is using - // 0 - load from file - // 1 - auto generate - // 2 - None - S32 mLODMode[4]; - - LLMenuButton* mViewOptionMenuButton; - LLToggleableMenu* mViewOptionMenu; - LLMutex* mStatusLock; - -}; - -class LLMeshFilePicker : public LLFilePickerThread -{ -public: - LLMeshFilePicker(LLModelPreview* mp, S32 lod); - virtual void notify(const std::string& filename); - -private: - LLModelPreview* mMP; - S32 mLOD; -}; - - -class LLModelPreview : public LLViewerDynamicTexture, public LLMutex -{ - typedef boost::signals2::signal details_signal_t; - typedef boost::signals2::signal model_loaded_signal_t; - -public: - LLModelPreview(S32 width, S32 height, LLFloater* fmp); - virtual ~LLModelPreview(); - - void resetPreviewTarget(); - void setPreviewTarget(F32 distance); - void setTexture(U32 name) { mTextureName = name; } - - void setPhysicsFromLOD(S32 lod); - BOOL render(); - void update(); - void genBuffers(S32 lod, bool skinned); - void clearBuffers(); - void refresh(); - void rotate(F32 yaw_radians, F32 pitch_radians); - void zoom(F32 zoom_amt); - void pan(F32 right, F32 up); - virtual BOOL needsRender() { return mNeedsUpdate; } - void setPreviewLOD(S32 lod); - void clearModel(S32 lod); - void loadModel(std::string filename, S32 lod); - void loadModelCallback(S32 lod); - void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); - void generateNormals(); - void clearMaterials(); - U32 calcResourceCost(); - void rebuildUploadData(); - void saveUploadData(bool save_skinweights, bool save_joint_poisitions); - void saveUploadData(const std::string& filename, bool save_skinweights, bool save_joint_poisitions); - void clearIncompatible(S32 lod); - void updateStatusMessages(); - void clearGLODGroup(); - void onLODParamCommit(bool enforce_tri_limit); - - const bool getModelPivot( void ) const { return mHasPivot; } - void setHasPivot( bool val ) { mHasPivot = val; } - void setModelPivot( const LLVector3& pivot ) { mModelPivot = pivot; } - - //Determines the viability of an asset to be used as an avatar rig (w or w/o joint upload caps) - void critiqueRigForUploadApplicability( const std::vector &jointListFromAsset ); - void critiqueJointToNodeMappingFromScene( void ); - //Is a rig valid so that it can be used as a criteria for allowing for uploading of joint positions - //Accessors for joint position upload friendly rigs - const bool isRigValidForJointPositionUpload( void ) const { return mRigValidJointUpload; } - void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; } - bool isRigSuitableForJointPositionUpload( const std::vector &jointListFromAsset ); - //Determines if a rig is a legacy from the joint list - bool isRigLegacy( const std::vector &jointListFromAsset ); - //Accessors for the legacy rigs - const bool isLegacyRigValid( void ) const { return mLegacyRigValid; } - void setLegacyRigValid( bool rigValid ) { mLegacyRigValid = rigValid; } - - static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); - - boost::signals2::connection setDetailsCallback( const details_signal_t::slot_type& cb ){ return mDetailsSignal.connect(cb); } - boost::signals2::connection setModelLoadedCallback( const model_loaded_signal_t::slot_type& cb ){ return mModelLoadedSignal.connect(cb); } - - void setLoadState( U32 state ) { mLoadState = state; } - U32 getLoadState() { return mLoadState; } - //setRestJointFlag: If an asset comes through that changes the joints, we want the reset to persist - void setResetJointFlag( bool state ) { if ( !mResetJoints ) mResetJoints = state; } - const bool getResetJointFlag( void ) const { return mResetJoints; } - void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } - const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } - - LLVector3 getTranslationForJointOffset( std::string joint ); - - void createPreviewAvatar( void ); - LLVOAvatar* getPreviewAvatar( void ) { return mPreviewAvatar; } - - protected: - friend class LLModelLoader; - friend class LLFloaterModelPreview; - friend class LLFloaterModelWizard; - friend class LLFloaterModelPreview::DecompRequest; - friend class LLFloaterModelWizard::DecompRequest; - friend class LLPhysicsDecomp; - - LLFloater* mFMP; - - BOOL mNeedsUpdate; - bool mDirty; - bool mGenLOD; - U32 mTextureName; - F32 mCameraDistance; - F32 mCameraYaw; - F32 mCameraPitch; - F32 mCameraZoom; - LLVector3 mCameraOffset; - LLVector3 mPreviewTarget; - LLVector3 mPreviewScale; - S32 mPreviewLOD; - U32 mResourceCost; - std::string mLODFile[LLModel::NUM_LODS]; - bool mLoading; - U32 mLoadState; - bool mResetJoints; - bool mRigParityWithScene; - - std::map mViewOption; - - //GLOD object parameters (must rebuild object if these change) - bool mLODFrozen; - F32 mBuildShareTolerance; - U32 mBuildQueueMode; - U32 mBuildOperator; - U32 mBuildBorderMode; - U32 mRequestedLoDMode[LLModel::NUM_LODS]; - S32 mRequestedTriangleCount[LLModel::NUM_LODS]; - F32 mRequestedErrorThreshold[LLModel::NUM_LODS]; - U32 mRequestedBuildOperator[LLModel::NUM_LODS]; - U32 mRequestedQueueMode[LLModel::NUM_LODS]; - U32 mRequestedBorderMode[LLModel::NUM_LODS]; - F32 mRequestedShareTolerance[LLModel::NUM_LODS]; - F32 mRequestedCreaseAngle[LLModel::NUM_LODS]; - - LLModelLoader* mModelLoader; - - LLModelLoader::scene mScene[LLModel::NUM_LODS]; - LLModelLoader::scene mBaseScene; - - LLModelLoader::model_list mModel[LLModel::NUM_LODS]; - LLModelLoader::model_list mBaseModel; - - U32 mGroup; - std::map, U32> mObject; - U32 mMaxTriangleLimit; - - LLMeshUploadThread::instance_list mUploadData; - std::set mTextureSet; - - //map of vertex buffers to models (one vertex buffer in vector per face in model - std::map > > mVertexBuffer[LLModel::NUM_LODS+1]; - - details_signal_t mDetailsSignal; - model_loaded_signal_t mModelLoadedSignal; - - LLVector3 mModelPivot; - bool mHasPivot; - - float mPelvisZOffset; - - bool mRigValidJointUpload; - bool mLegacyRigValid; - - bool mLastJointUpdate; - - std::deque mMasterJointList; - std::deque mMasterLegacyJointList; - std::deque mJointsFromNode; - JointTransformMap mJointTransformMap; - LLPointer mPreviewAvatar; -}; - -#endif // LL_LLFLOATERMODELPREVIEW_H +/** + * @file llfloatermodelpreview.h + * @brief LLFloaterModelPreview class definition + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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$ + */ + +#ifndef LL_LLFLOATERMODELPREVIEW_H +#define LL_LLFLOATERMODELPREVIEW_H + +#include "llfloaternamedesc.h" + +#include "lldynamictexture.h" +#include "llfloatermodelwizard.h" +#include "llquaternion.h" +#include "llmeshrepository.h" +#include "llmodel.h" +#include "llthread.h" +#include "llviewermenufile.h" + +class LLComboBox; +class LLJoint; +class LLViewerJointMesh; +class LLVOAvatar; +class LLTextBox; +class LLVertexBuffer; +class LLModelPreview; +class LLFloaterModelPreview; +class daeElement; +class domProfile_COMMON; +class domInstance_geometry; +class domNode; +class domTranslate; +class domController; +class LLMenuButton; +class LLToggleableMenu; + +typedef std::map JointTransformMap; +typedef std::map:: iterator JointTransformMapIt; + +const S32 NUM_LOD = 4; + +class LLModelLoader : public LLThread +{ +public: + typedef enum + { + STARTING = 0, + READING_FILE, + CREATING_FACES, + GENERATING_VERTEX_BUFFERS, + GENERATING_LOD, + DONE, + ERROR_PARSING //basically loading failed + } eLoadState; + + U32 mState; + std::string mFilename; + S32 mLod; + LLModelPreview* mPreview; + LLMatrix4 mTransform; + BOOL mFirstTransform; + LLVector3 mExtents[2]; + bool mTrySLM; + + std::map > mModel; + + typedef std::vector > model_list; + model_list mModelList; + + typedef std::vector model_instance_list; + + typedef std::map scene; + + scene mScene; + + typedef std::queue > model_queue; + + //queue of models that need a physics rep + model_queue mPhysicsQ; + + LLModelLoader( std::string filename, S32 lod, LLModelPreview* preview, JointTransformMap& jointMap, + std::deque& jointsFromNodes ); + ~LLModelLoader() ; + + virtual void run(); + bool doLoadModel(); + bool loadFromSLM(const std::string& filename); + void loadModelCallback(); + + void loadTextures() ; //called in the main thread. + void processElement(daeElement* element); + std::vector getMaterials(LLModel* model, domInstance_geometry* instance_geo); + LLImportMaterial profileToMaterial(domProfile_COMMON* material); + std::string getElementLabel(daeElement *element); + LLColor4 getDaeColor(daeElement* element); + + daeElement* getChildFromElement( daeElement* pElement, std::string const & name ); + + bool isNodeAJoint( domNode* pNode ); + void processJointNode( domNode* pNode, std::map& jointTransforms ); + void extractTranslation( domTranslate* pTranslate, LLMatrix4& transform ); + void extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform ); + + void setLoadState(U32 state); + + void buildJointToNodeMappingFromScene( daeElement* pRoot ); + void processJointToNodeMapping( domNode* pNode ); + + + //map of avatar joints as named in COLLADA assets to internal joint names + std::map mJointMap; + JointTransformMap& mJointList; + std::deque& mJointsFromNode; + +private: + static std::list sActiveLoaderList; + static bool isAlive(LLModelLoader* loader) ; +}; + +class LLFloaterModelPreview : public LLFloater +{ +public: + + class DecompRequest : public LLPhysicsDecomp::Request + { + public: + S32 mContinue; + LLPointer mModel; + + DecompRequest(const std::string& stage, LLModel* mdl); + virtual S32 statusCallback(const char* status, S32 p1, S32 p2); + virtual void completed(); + + }; + static LLFloaterModelPreview* sInstance; + + LLFloaterModelPreview(const LLSD& key); + virtual ~LLFloaterModelPreview(); + + virtual BOOL postBuild(); + + BOOL handleMouseDown(S32 x, S32 y, MASK mask); + BOOL handleMouseUp(S32 x, S32 y, MASK mask); + BOOL handleHover(S32 x, S32 y, MASK mask); + BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + + static void onMouseCaptureLostModelPreview(LLMouseHandler*); + static void setUploadAmount(S32 amount) { sUploadAmount = amount; } + + void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); + + static void onBrowseLOD(void* data); + + static void onReset(void* data); + + static void onUpload(void* data); + + static void onClearMaterials(void* data); + + static void refresh(LLUICtrl* ctrl, void* data); + + void updateResourceCost(); + + void loadModel(S32 lod); + + void onViewOptionChecked(const LLSD& userdata); + bool isViewOptionChecked(const LLSD& userdata); + bool isViewOptionEnabled(const LLSD& userdata); + void setViewOptionEnabled(const std::string& option, bool enabled); + void enableViewOption(const std::string& option); + void disableViewOption(const std::string& option); + +protected: + friend class LLModelPreview; + friend class LLMeshFilePicker; + friend class LLPhysicsDecomp; + + static void onImportScaleCommit(LLUICtrl*, void*); + static void onPelvisOffsetCommit(LLUICtrl*, void*); + static void onUploadJointsCommit(LLUICtrl*,void*); + static void onUploadSkinCommit(LLUICtrl*,void*); + + static void onPhysicsLoadRadioCommit(LLUICtrl*,void *data); + + static void onPreviewLODCommit(LLUICtrl*,void*); + + static void onGenerateNormalsCommit(LLUICtrl*,void*); + + static void onAutoFillCommit(LLUICtrl*,void*); + static void onLODParamCommit(LLUICtrl*,void*); + static void onLODParamCommitTriangleLimit(LLUICtrl*,void*); + + static void onExplodeCommit(LLUICtrl*, void*); + + static void onPhysicsParamCommit(LLUICtrl* ctrl, void* userdata); + static void onPhysicsStageExecute(LLUICtrl* ctrl, void* userdata); + static void onCancel(LLUICtrl* ctrl, void* userdata); + static void onPhysicsStageCancel(LLUICtrl* ctrl, void* userdata); + + static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata); + static void onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata); + static void onPhysicsOptimize(LLUICtrl* ctrl, void* userdata); + static void onPhysicsDecomposeBack(LLUICtrl* ctrl, void* userdata); + static void onPhysicsSimplifyBack(LLUICtrl* ctrl, void* userdata); + + void draw(); + + void initDecompControls(); + + void setStatusMessage(const std::string& msg); + + LLModelPreview* mModelPreview; + + LLPhysicsDecomp::decomp_params mDecompParams; + + S32 mLastMouseX; + S32 mLastMouseY; + LLRect mPreviewRect; + U32 mGLName; + static S32 sUploadAmount; + + std::set > mCurRequest; + std::string mStatusMessage; + + //use "disabled" as false by default + std::map mViewOptionDisabled; + + //store which lod mode each LOD is using + // 0 - load from file + // 1 - auto generate + // 2 - None + S32 mLODMode[4]; + + LLMenuButton* mViewOptionMenuButton; + LLToggleableMenu* mViewOptionMenu; + LLMutex* mStatusLock; + +}; + +class LLMeshFilePicker : public LLFilePickerThread +{ +public: + LLMeshFilePicker(LLModelPreview* mp, S32 lod); + virtual void notify(const std::string& filename); + +private: + LLModelPreview* mMP; + S32 mLOD; +}; + + +class LLModelPreview : public LLViewerDynamicTexture, public LLMutex +{ + typedef boost::signals2::signal details_signal_t; + typedef boost::signals2::signal model_loaded_signal_t; + +public: + LLModelPreview(S32 width, S32 height, LLFloater* fmp); + virtual ~LLModelPreview(); + + void resetPreviewTarget(); + void setPreviewTarget(F32 distance); + void setTexture(U32 name) { mTextureName = name; } + + void setPhysicsFromLOD(S32 lod); + BOOL render(); + void update(); + void genBuffers(S32 lod, bool skinned); + void clearBuffers(); + void refresh(); + void rotate(F32 yaw_radians, F32 pitch_radians); + void zoom(F32 zoom_amt); + void pan(F32 right, F32 up); + virtual BOOL needsRender() { return mNeedsUpdate; } + void setPreviewLOD(S32 lod); + void clearModel(S32 lod); + void loadModel(std::string filename, S32 lod); + void loadModelCallback(S32 lod); + void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); + void generateNormals(); + void clearMaterials(); + U32 calcResourceCost(); + void rebuildUploadData(); + void saveUploadData(bool save_skinweights, bool save_joint_poisitions); + void saveUploadData(const std::string& filename, bool save_skinweights, bool save_joint_poisitions); + void clearIncompatible(S32 lod); + void updateStatusMessages(); + void clearGLODGroup(); + void onLODParamCommit(bool enforce_tri_limit); + + const bool getModelPivot( void ) const { return mHasPivot; } + void setHasPivot( bool val ) { mHasPivot = val; } + void setModelPivot( const LLVector3& pivot ) { mModelPivot = pivot; } + + //Determines the viability of an asset to be used as an avatar rig (w or w/o joint upload caps) + void critiqueRigForUploadApplicability( const std::vector &jointListFromAsset ); + void critiqueJointToNodeMappingFromScene( void ); + //Is a rig valid so that it can be used as a criteria for allowing for uploading of joint positions + //Accessors for joint position upload friendly rigs + const bool isRigValidForJointPositionUpload( void ) const { return mRigValidJointUpload; } + void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; } + bool isRigSuitableForJointPositionUpload( const std::vector &jointListFromAsset ); + //Determines if a rig is a legacy from the joint list + bool isRigLegacy( const std::vector &jointListFromAsset ); + //Accessors for the legacy rigs + const bool isLegacyRigValid( void ) const { return mLegacyRigValid; } + void setLegacyRigValid( bool rigValid ) { mLegacyRigValid = rigValid; } + //Verify that a controller matches vertex counts + bool verifyController( domController* pController ); + + static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); + + boost::signals2::connection setDetailsCallback( const details_signal_t::slot_type& cb ){ return mDetailsSignal.connect(cb); } + boost::signals2::connection setModelLoadedCallback( const model_loaded_signal_t::slot_type& cb ){ return mModelLoadedSignal.connect(cb); } + + void setLoadState( U32 state ) { mLoadState = state; } + U32 getLoadState() { return mLoadState; } + //setRestJointFlag: If an asset comes through that changes the joints, we want the reset to persist + void setResetJointFlag( bool state ) { if ( !mResetJoints ) mResetJoints = state; } + const bool getResetJointFlag( void ) const { return mResetJoints; } + void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } + const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } + + LLVector3 getTranslationForJointOffset( std::string joint ); + +private: + //Utility function for controller vertex compare + bool verifyCount( int expected, int result ); + //Creates the dummy avatar for the preview window + void createPreviewAvatar( void ); + //Accessor for the dummy avatar + LLVOAvatar* getPreviewAvatar( void ) { return mPreviewAvatar; } + + protected: + friend class LLModelLoader; + friend class LLFloaterModelPreview; + friend class LLFloaterModelWizard; + friend class LLFloaterModelPreview::DecompRequest; + friend class LLFloaterModelWizard::DecompRequest; + friend class LLPhysicsDecomp; + + LLFloater* mFMP; + + BOOL mNeedsUpdate; + bool mDirty; + bool mGenLOD; + U32 mTextureName; + F32 mCameraDistance; + F32 mCameraYaw; + F32 mCameraPitch; + F32 mCameraZoom; + LLVector3 mCameraOffset; + LLVector3 mPreviewTarget; + LLVector3 mPreviewScale; + S32 mPreviewLOD; + U32 mResourceCost; + std::string mLODFile[LLModel::NUM_LODS]; + bool mLoading; + U32 mLoadState; + bool mResetJoints; + bool mRigParityWithScene; + + std::map mViewOption; + + //GLOD object parameters (must rebuild object if these change) + bool mLODFrozen; + F32 mBuildShareTolerance; + U32 mBuildQueueMode; + U32 mBuildOperator; + U32 mBuildBorderMode; + U32 mRequestedLoDMode[LLModel::NUM_LODS]; + S32 mRequestedTriangleCount[LLModel::NUM_LODS]; + F32 mRequestedErrorThreshold[LLModel::NUM_LODS]; + U32 mRequestedBuildOperator[LLModel::NUM_LODS]; + U32 mRequestedQueueMode[LLModel::NUM_LODS]; + U32 mRequestedBorderMode[LLModel::NUM_LODS]; + F32 mRequestedShareTolerance[LLModel::NUM_LODS]; + F32 mRequestedCreaseAngle[LLModel::NUM_LODS]; + + LLModelLoader* mModelLoader; + + LLModelLoader::scene mScene[LLModel::NUM_LODS]; + LLModelLoader::scene mBaseScene; + + LLModelLoader::model_list mModel[LLModel::NUM_LODS]; + LLModelLoader::model_list mBaseModel; + + U32 mGroup; + std::map, U32> mObject; + U32 mMaxTriangleLimit; + + LLMeshUploadThread::instance_list mUploadData; + std::set mTextureSet; + + //map of vertex buffers to models (one vertex buffer in vector per face in model + std::map > > mVertexBuffer[LLModel::NUM_LODS+1]; + + details_signal_t mDetailsSignal; + model_loaded_signal_t mModelLoadedSignal; + + LLVector3 mModelPivot; + bool mHasPivot; + + float mPelvisZOffset; + + bool mRigValidJointUpload; + bool mLegacyRigValid; + + bool mLastJointUpdate; + + std::deque mMasterJointList; + std::deque mMasterLegacyJointList; + std::deque mJointsFromNode; + JointTransformMap mJointTransformMap; + LLPointer mPreviewAvatar; +}; + +#endif // LL_LLFLOATERMODELPREVIEW_H diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index 9d46e1eec5..f58595b3c5 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -4,6 +4,7 @@ name="Model Preview" title="Upload Model" width="620"> Idle + Dae parsing issue - see log for details. Loading... Generating Meshes... Error: Vertex number is more than 65534, aborted! diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 3dd16f8eb1..8603682e3a 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -1019,6 +1019,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se Idle + Dae parsing issue - see log for details. Loading... Generating Meshes... Error: Vertex number is more than 65534, aborted! -- cgit v1.2.3 From d9dfa9b8707b3bf68d7c5cd03a6ca738be7f891f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 14:31:22 -0500 Subject: SH-1777 Fix for "Prim" physics shape type not showing up on meshes with convex decompositions. --- indra/newview/llmeshrepository.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 29904c579c..3545b5128a 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2716,7 +2716,18 @@ void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail) bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) { LLSD mesh = mThread->getMeshHeader(mesh_id); - return mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0); + if (mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0)) + { + return true; + } + + LLModel::Decomposition* decomp = getDecomposition(mesh_id); + if (decomp && !decomp->mHull.empty()) + { + return true; + } + + return false; } LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) -- cgit v1.2.3 From 7d49f7af5843ae812617dd979fc61ad8ec0cd3c4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 15:31:10 -0500 Subject: SH-1785 Fix for hud attachments not rendering properly with indexed texture rendering. --- indra/newview/llviewerdisplay.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 5dadd2c33b..f725f0fe86 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -996,8 +996,7 @@ void render_hud_attachments() S32 use_occlusion = LLPipeline::sUseOcclusion; LLPipeline::sUseOcclusion = 0; - LLPipeline::sDisableShaders = TRUE; - + //cull, sort, and render hud objects static LLCullResult result; LLSpatialGroup::sNoDelete = TRUE; @@ -1037,7 +1036,6 @@ void render_hud_attachments() gPipeline.toggleRenderDebugFeature((void*) LLPipeline::RENDER_DEBUG_FEATURE_UI); } LLPipeline::sUseOcclusion = use_occlusion; - LLPipeline::sDisableShaders = FALSE; } glMatrixMode(GL_PROJECTION); glPopMatrix(); -- cgit v1.2.3 From 776353b4a6ced013a9406a6177d4cbc18177ccef Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 8 Jun 2011 15:25:59 -0600 Subject: fix for SH-1651 and SH-1652: Viewer Crash in Display:RenderUI when uploading skpfile.dae model with High LOD selected as Physics shape --- indra/newview/llfloatermodelpreview.cpp | 49 +------------------ indra/newview/llfloatermodelwizard.cpp | 49 +------------------ indra/newview/llmeshrepository.cpp | 86 ++++++++++++++++++++++----------- indra/newview/llmeshrepository.h | 1 + 4 files changed, 60 insertions(+), 125 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 1f6199ffb2..d56bc9cd10 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5144,54 +5144,7 @@ LLFloaterModelPreview::DecompRequest::DecompRequest(const std::string& stage, LL mParams = sInstance->mDecompParams; //copy out positions and indices - if (mdl) - { - U16 index_offset = 0; - U16 tri[3] ; - - mPositions.clear(); - mIndices.clear(); - mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; - mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; - - //queue up vertex positions and indices - for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = mdl->getVolumeFace(i); - if (mPositions.size() + face.mNumVertices > 65535) - { - continue; - } - - for (U32 j = 0; j < face.mNumVertices; ++j) - { - mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); - for(U32 k = 0 ; k < 3 ; k++) - { - mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; - mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; - } - } - - updateTriangleAreaThreshold() ; - - for (U32 j = 0; j+2 < face.mNumIndices; j += 3) - { - tri[0] = face.mIndices[j] + index_offset ; - tri[1] = face.mIndices[j + 1] + index_offset ; - tri[2] = face.mIndices[j + 2] + index_offset ; - - if(isValidTriangle(tri[0], tri[1], tri[2])) - { - mIndices.push_back(tri[0]); - mIndices.push_back(tri[1]); - mIndices.push_back(tri[2]); - } - } - - index_offset += face.mNumVertices; - } - } + assignData(mdl) ; } void LLFloaterModelPreview::setStatusMessage(const std::string& msg) diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index e44737f39e..0cd66fbdc2 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -438,54 +438,7 @@ LLFloaterModelWizard::DecompRequest::DecompRequest(const std::string& stage, LLM mParams = sInstance->mDecompParams; //copy out positions and indices - if (mdl) - { - U16 index_offset = 0; - U16 tri[3] ; - - mPositions.clear(); - mIndices.clear(); - mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; - mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; - - //queue up vertex positions and indices - for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = mdl->getVolumeFace(i); - if (mPositions.size() + face.mNumVertices > 65535) - { - continue; - } - - for (U32 j = 0; j < face.mNumVertices; ++j) - { - mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); - for(U32 k = 0 ; k < 3 ; k++) - { - mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; - mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; - } - } - - updateTriangleAreaThreshold() ; - - for (U32 j = 0; j+2 < face.mNumIndices; j += 3) - { - tri[0] = face.mIndices[j] + index_offset ; - tri[1] = face.mIndices[j + 1] + index_offset ; - tri[2] = face.mIndices[j + 2] + index_offset ; - - if(isValidTriangle(tri[0], tri[1], tri[2])) - { - mIndices.push_back(tri[0]); - mIndices.push_back(tri[1]); - mIndices.push_back(tri[2]); - } - } - - index_offset += face.mNumVertices; - } - } + assignData(mdl) ; } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 29904c579c..0b10024663 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1323,35 +1323,7 @@ LLMeshUploadThread::DecompRequest::DecompRequest(LLModel* mdl, LLModel* base_mod mThread = thread; //copy out positions and indices - if (mdl) - { - U16 index_offset = 0; - - mPositions.clear(); - mIndices.clear(); - - //queue up vertex positions and indices - for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = mdl->getVolumeFace(i); - if (mPositions.size() + face.mNumVertices > 65535) - { - continue; - } - - for (U32 j = 0; j < face.mNumVertices; ++j) - { - mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); - } - - for (U32 j = 0; j < face.mNumIndices; ++j) - { - mIndices.push_back(face.mIndices[j]+index_offset); - } - - index_offset += face.mNumVertices; - } - } + assignData(mdl) ; mThread->mFinalDecomp = this; mThread->mPhysicsComplete = false; @@ -3599,6 +3571,62 @@ void LLPhysicsDecomp::run() mDone = true; } +void LLPhysicsDecomp::Request::assignData(LLModel* mdl) +{ + if (!mdl) + { + return ; + } + + U16 index_offset = 0; + U16 tri[3] ; + + mPositions.clear(); + mIndices.clear(); + mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; + mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; + + //queue up vertex positions and indices + for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) + { + const LLVolumeFace& face = mdl->getVolumeFace(i); + if (mPositions.size() + face.mNumVertices > 65535) + { + continue; + } + + for (U32 j = 0; j < face.mNumVertices; ++j) + { + mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); + for(U32 k = 0 ; k < 3 ; k++) + { + mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; + mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; + } + } + + updateTriangleAreaThreshold() ; + + for (U32 j = 0; j+2 < face.mNumIndices; j += 3) + { + tri[0] = face.mIndices[j] + index_offset ; + tri[1] = face.mIndices[j + 1] + index_offset ; + tri[2] = face.mIndices[j + 2] + index_offset ; + + if(isValidTriangle(tri[0], tri[1], tri[2])) + { + mIndices.push_back(tri[0]); + mIndices.push_back(tri[1]); + mIndices.push_back(tri[2]); + } + } + + index_offset += face.mNumVertices; + } + + return ; +} + void LLPhysicsDecomp::Request::updateTriangleAreaThreshold() { F32 range = mBBox[1].mV[0] - mBBox[0].mV[0] ; diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index d5b06cc66f..adf60c7e03 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -166,6 +166,7 @@ public: LLVector3 mBBox[2] ; F32 mTriangleAreaThreshold ; + void assignData(LLModel* mdl) ; void updateTriangleAreaThreshold() ; bool isValidTriangle(U16 idx1, U16 idx2, U16 idx3) ; }; -- cgit v1.2.3 From 73d807bd894e64c653efc6093c408d046e510a5b Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 8 Jun 2011 16:46:29 -0700 Subject: change the color specifier to 'diffuse_color' in the mesh upload blobs --- indra/newview/llmeshrepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 6b8b0f5a00..d4198041ec 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1533,7 +1533,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) face_entry["offsett"] = 0.0; face_entry["imagerot"] = 0.0; } - face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor); face_entry["fullbright"] = material.mFullbright; instance_entry["face_list"][face_num] = face_entry; } -- cgit v1.2.3 From f96f223112b7a50336fe153d2e0408caa9ce3390 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 8 Jun 2011 17:50:35 -0600 Subject: fix for SH-1561: Enabling show Physics Shape disables glow --- indra/newview/pipeline.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1489c033e2..4d678117a5 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -773,14 +773,29 @@ void LLPipeline::updateRenderDeferred() //static void LLPipeline::refreshRenderDeferred() { + static BOOL physics_shapes_is_on = FALSE ; + static BOOL render_glow_copy = FALSE ; + if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) { + if(!physics_shapes_is_on) + { + physics_shapes_is_on = TRUE ; + render_glow_copy = sRenderGlow ; + } + //turn the deferred rendering and glow off when draw physics shapes. sRenderDeferred = FALSE ; sRenderGlow = FALSE ; } else { + if(physics_shapes_is_on) + { + physics_shapes_is_on = FALSE ; + sRenderGlow = render_glow_copy ; + } + updateRenderDeferred() ; } } -- cgit v1.2.3 From 0c6d1f7cf2e821f4ffe3a3bf88c57948eea1e569 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 19:14:49 -0500 Subject: SH-1692 Factor out all (but one) of the bindDeferredShader calls in lldrawpoolalpha. --- indra/newview/lldrawpoolalpha.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 71eee0188c..537f6216c2 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -125,6 +125,9 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) { simple_shader = &gDeferredAlphaProgram; fullbright_shader = &gObjectFullbrightProgram; + + //prime simple shader (loads shadow relevant uniforms) + gPipeline.bindDeferredShader(*simple_shader); } else { @@ -290,11 +293,6 @@ void LLDrawPoolAlpha::render(S32 pass) gGL.setSceneBlendType(LLRender::BT_ALPHA); } - if (deferred_render && current_shader != NULL) - { - gPipeline.unbindDeferredShader(*current_shader); - } - if (sShowDebugAlpha) { if(gPipeline.canUseWindLightShaders()) @@ -411,29 +409,11 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if(use_shaders && (current_shader != target_shader)) { llassert(target_shader != NULL); - if (deferred_render && current_shader != NULL) - { - gPipeline.unbindDeferredShader(*current_shader); - diffuse_channel = 0; - } current_shader = target_shader; - if (deferred_render) - { - gPipeline.bindDeferredShader(*current_shader); - diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - } - else - { - current_shader->bind(); - } + current_shader->bind(); } else if (!use_shaders && current_shader != NULL) { - if (deferred_render) - { - gPipeline.unbindDeferredShader(*current_shader); - diffuse_channel = 0; - } LLGLSLShader::bindNoShader(); current_shader = NULL; } @@ -510,12 +490,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) } } - if (deferred_render && current_shader != NULL) - { - gPipeline.unbindDeferredShader(*current_shader); - LLVertexBuffer::unbind(); - } - + LLVertexBuffer::unbind(); + if (!light_enabled) { gPipeline.enableLightsDynamic(); -- cgit v1.2.3 From 0ee8d6dcb66421d8f12cc79c891cd119c673ae2f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 19:50:44 -0500 Subject: SH-560 Fix for "Loading..." text remaining in model importer when load fails. --- indra/newview/llfloatermodelpreview.cpp | 162 ++++++++++++++++---------------- 1 file changed, 79 insertions(+), 83 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 46d39db6cd..371579e5c8 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1286,11 +1286,7 @@ void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& void LLModelLoader::run() { - if (!doLoadModel()) - { - mPreview = NULL; - } - + doLoadModel(); doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this)); } @@ -2302,87 +2298,87 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode ) //----------------------------------------------------------------------------- // verifyCount //----------------------------------------------------------------------------- -bool LLModelPreview::verifyCount( int expected, int result ) -{ - if ( expected != result ) - { - llinfos<< "Error: (expected/got)"<getSkin(); - - if ( pSkin ) - { - xsAnyURI & uri = pSkin->getSource(); - domElement* pElement = uri.getElement(); - - if ( !pElement ) - { - llinfos<<"Can't resolve skin source"<getTypeName(); - if ( stricmp(type_str, "geometry") == 0 ) - { - //Skin is reference directly by geometry and get the vertex count from skin - domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights(); - U32 vertexWeightsCount = pVertexWeights->getCount(); - domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement(); - domMesh* pMesh = pGeometry->getMesh(); - - if ( pMesh ) - { - //Get vertex count from geometry - domVertices* pVertices = pMesh->getVertices(); - if ( !pVertices ) - { - llinfos<<"No vertices!"<getInput_array()[0]->getSource(); - domSource* pSource = (domSource*) (domElement*) src.getElement(); - U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount(); - result = verifyCount( verticesCount, vertexWeightsCount ); - if ( !result ) - { - return result; - } - } - } - - U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount(); - result = verifyCount( vcountCount, vertexWeightsCount ); - if ( !result ) - { - return result; - } - - domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array(); - U32 sum = 0; - for (size_t i=0; igetVcount()->getValue()[i]; - } - result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); - } - } - - return result; -} +bool LLModelPreview::verifyController( domController* pController ) +{ + + bool result = true; + + domSkin* pSkin = pController->getSkin(); + + if ( pSkin ) + { + xsAnyURI & uri = pSkin->getSource(); + domElement* pElement = uri.getElement(); + + if ( !pElement ) + { + llinfos<<"Can't resolve skin source"<getTypeName(); + if ( stricmp(type_str, "geometry") == 0 ) + { + //Skin is reference directly by geometry and get the vertex count from skin + domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights(); + U32 vertexWeightsCount = pVertexWeights->getCount(); + domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement(); + domMesh* pMesh = pGeometry->getMesh(); + + if ( pMesh ) + { + //Get vertex count from geometry + domVertices* pVertices = pMesh->getVertices(); + if ( !pVertices ) + { + llinfos<<"No vertices!"<getInput_array()[0]->getSource(); + domSource* pSource = (domSource*) (domElement*) src.getElement(); + U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount(); + result = verifyCount( verticesCount, vertexWeightsCount ); + if ( !result ) + { + return result; + } + } + } + + U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount(); + result = verifyCount( vcountCount, vertexWeightsCount ); + if ( !result ) + { + return result; + } + + domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array(); + U32 sum = 0; + for (size_t i=0; igetVcount()->getValue()[i]; + } + result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); + } + } + + return result; +} //----------------------------------------------------------------------------- // extractTranslation() -- cgit v1.2.3 From 66fdaf51350734d4d69ebcea548165decbb6526a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 20:44:24 -0500 Subject: Unused variable --- indra/newview/lldrawpoolalpha.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 537f6216c2..8d46133912 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -344,8 +344,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) { BOOL initialized_lighting = FALSE; BOOL light_enabled = TRUE; - S32 diffuse_channel = 0; - + BOOL use_shaders = gPipeline.canUseVertexShaders(); for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) -- cgit v1.2.3 From 57521d594c5c77048fc3d82358159eb2acbc1c9e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2011 00:20:52 -0500 Subject: Fix for accidental checkin of hot pink fullbright. --- indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 5e6c5ebec8..d781e08548 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -23,7 +23,6 @@ void main() color.rgb = fullbrightScaleSoftClip(color.rgb); - //gl_FragColor = color; - gl_FragColor = vec4(1,0,1,1); + gl_FragColor = color; } -- cgit v1.2.3 From b6e7d771dab572a6783a47bd1359776c4e721ec1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2011 00:23:46 -0500 Subject: SH-1696 Protect against sculpt triangle bombs by turning high-surface area sculpties into spheres. --- indra/llmath/llvolume.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 53f73d8637..9eecb7bfe2 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -3232,7 +3232,11 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, // don't test lowest LOD to support legacy content DEV-33670 if (mDetail > SCULPT_MIN_AREA_DETAIL) { - if (sculptGetSurfaceArea() < SCULPT_MIN_AREA) + F32 area = sculptGetSurfaceArea(); + + const F32 SCULPT_MAX_AREA = 32.f; + + if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA) { data_is_empty = TRUE; } -- cgit v1.2.3 From cb6d4437b4ccfd1879e41f1508d619d33d36f1e9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 9 Jun 2011 10:31:50 -0400 Subject: SH-1773 WIP --- indra/newview/llmeshrepository.cpp | 45 +++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/llmeshrepository.cpp diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp old mode 100644 new mode 100755 index d4198041ec..c90a800a13 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -468,6 +468,48 @@ public: }; +void log_upload_error(const LLSD& content) +{ + if (content.has("error")) + { + const LLSD& err = content["error"]; + llwarns << "mesh upload failed " << err["message"].asString() << " id " << err["identifier"].asString() << llendl; + + if ((err["identifier"].asString() == "NewAgentInventory_InvalidAsset") && + content.has("errors")) + { + const LLSD& err_list = content["errors"]; + for (LLSD::array_const_iterator it = err_list.beginArray(); + it != err_list.endArray(); + ++it) + { + const LLSD& err_entry = *it; + std::string index_info; + std::string texture_index_str = err_entry["TextureIndex"].asString(); + if (!texture_index_str.empty()) + { + index_info += " texture_index: " + texture_index_str; + } + std::string mesh_index_str = err_entry["MeshIndex"].asString(); + if (!mesh_index_str.empty()) + { + index_info += " mesh_index: " + mesh_index_str; + } + llwarns << "mesh err code " << err_entry["error"].asString() + << " message " << err_entry["message"] + << index_info + << llendl; + } + } + } + else + { + llwarns << "bad mesh, no error information available" << llendl; + } + + +} + class LLModelObjectUploadResponder: public LLCurl::Responder { LLSD mObjectAsset; @@ -516,10 +558,11 @@ public: else { llinfos << "upload failed" << llendl; + log_upload_error(content); mThread->mWholeModelUploadURL = ""; } - } + }; class LLWholeModelUploadResponder: public LLCurl::Responder -- cgit v1.2.3 From 557c9be005b89663f227ecf4aa0fec9505a5da41 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 9 Jun 2011 12:52:44 -0400 Subject: SH-1773 WIP --- indra/newview/llmeshrepository.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index c90a800a13..7568f3659b 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -468,15 +468,16 @@ public: }; -void log_upload_error(const LLSD& content) +void log_upload_error(const LLSD& content,std::string stage) { if (content.has("error")) { const LLSD& err = content["error"]; - llwarns << "mesh upload failed " << err["message"].asString() << " id " << err["identifier"].asString() << llendl; + llwarns << "mesh upload failed, stage " << stage + << " message " << err["message"].asString() << " id " << err["identifier"].asString() + << llendl; - if ((err["identifier"].asString() == "NewAgentInventory_InvalidAsset") && - content.has("errors")) + if (content.has("errors")) { const LLSD& err_list = content["errors"]; for (LLSD::array_const_iterator it = err_list.beginArray(); @@ -553,12 +554,13 @@ public: llinfos << "LLWholeModelFeeResponder content: " << content << llendl; if (isGoodStatus(status)) { + llinfos << "fee request succeeded" << llendl; mThread->mWholeModelUploadURL = content["uploader"].asString(); } else { - llinfos << "upload failed" << llendl; - log_upload_error(content); + llwarns << "fee request failed" << llendl; + log_upload_error(content,"fee"); mThread->mWholeModelUploadURL = ""; } } @@ -581,13 +583,21 @@ public: const LLSD& content) { //assert_main_thread(); - llinfos << "upload completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,make_dump_name("whole_model_upload_response_",dump_num)); // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. - mPostData["asset_type"] = "object"; - gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mPostData,content)); + if (isGoodStatus(status)) + { + llinfos << "upload succeeded" << llendl; + mPostData["asset_type"] = "object"; + gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mPostData,content)); + } + else + { + llwarns << "upload failed" << llendl; + log_upload_error(content,"upload"); + } } }; -- cgit v1.2.3 From fdc4a704f3622d1da471619413aadb609220962d Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Thu, 9 Jun 2011 13:54:52 -0400 Subject: Added tag DRTVWR-63_2.7.2-beta1, 2.7.2-beta1 for changeset e0dc8b741eaa --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 746a420ecd..cfe05e2272 100644 --- a/.hgtags +++ b/.hgtags @@ -134,3 +134,5 @@ dac76a711da5f1489a01c1fa62ec97d99c25736d 2.6.6-release 8f2da1701c81a62352df2b8d413d27fb2cade9a6 2.6.3-release 43c7ee846b7eed80786acbbf35d03bd016a3e85d DRTVWR-59_2.7.0-beta1 43c7ee846b7eed80786acbbf35d03bd016a3e85d 2.7.0-beta1 +e0dc8b741eaa27dcdfbc9e956bb2579b954d15eb DRTVWR-63_2.7.2-beta1 +e0dc8b741eaa27dcdfbc9e956bb2579b954d15eb 2.7.2-beta1 -- cgit v1.2.3 From 37a3b0d75392836034955a9d00ac1d8a6db20473 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 9 Jun 2011 14:30:53 -0700 Subject: Remove ObjectAdd cap, no longer needed --- indra/newview/llmanipscale.cpp | 1 - indra/newview/llviewerregion.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 0eedabb5de..4eb94dfb8e 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -92,7 +92,6 @@ F32 get_default_max_prim_scale(bool is_flora) // a bit of a hack, but if it's foilage, we don't want to use the // new larger scale which would result in giant trees and grass if (gMeshRepo.meshRezEnabled() && - !gAgent.getRegion()->getCapability("ObjectAdd").empty() && !is_flora) { return DEFAULT_MAX_PRIM_SCALE; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f3fb4b82ad..002e0567e4 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1526,7 +1526,6 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("NewFileAgentInventory"); - capabilityNames.append("ObjectAdd"); capabilityNames.append("ParcelPropertiesUpdate"); capabilityNames.append("ParcelMediaURLFilterList"); capabilityNames.append("ParcelNavigateMedia"); -- cgit v1.2.3 From 91fe50ecc7f6e2c38286a456f2cb795fbcc92dd8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2011 17:03:53 -0500 Subject: SH-1802 Fix for disappearing meshes under some circuimstances. --- indra/llmath/llvolume.cpp | 22 +++++++++++++++------- indra/newview/llface.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 379ef4b344..8c81f27784 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2642,14 +2642,20 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) LLVector4a& min = face.mExtents[0]; LLVector4a& max = face.mExtents[1]; - min.clear(); - max.clear(); - min = max = face.mPositions[0]; - - for (S32 i = 1; i < face.mNumVertices; ++i) + if (face.mNumVertices < 3) + { //empty face, use a dummy 1cm (at 1m scale) bounding box + min.splat(-0.005f); + max.splat(0.005f); + } + else { - min.setMin(min, face.mPositions[i]); - max.setMax(max, face.mPositions[i]); + min = max = face.mPositions[0]; + + for (S32 i = 1; i < face.mNumVertices; ++i) + { + min.setMin(min, face.mPositions[i]); + max.setMax(max, face.mPositions[i]); + } } } } @@ -5506,6 +5512,8 @@ LLVolumeFace::LLVolumeFace() : mOctree(NULL) { mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3); + mExtents[0].splat(-0.5f); + mExtents[1].splat(0.5f); mCenter = mExtents+2; } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 540ed054e9..b6566fcbd0 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -693,6 +693,19 @@ static void xform(LLVector2 &tex_coord, F32 cosAng, F32 sinAng, F32 offS, F32 of } +bool less_than_max_mag(const LLVector4a& vec) +{ + LLVector4a MAX_MAG; + MAX_MAG.splat(1024.f*1024.f); + + LLVector4a val; + val.setAbs(vec); + + S32 lt = val.lessThan(MAX_MAG).getGatheredBits() & 0x7; + + return lt == 0x7; +} + BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, const LLMatrix4& mat_vert_in, const LLMatrix3& mat_normal_in, BOOL global_volume) { @@ -727,6 +740,8 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, min = face.mExtents[0]; max = face.mExtents[1]; + llassert(less_than_max_mag(min)); + llassert(less_than_max_mag(max)); //min, max are in volume space, convert to drawable render space LLVector4a center; @@ -738,6 +753,9 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, size.setSub(max, min); size.mul(0.5f); + llassert(less_than_max_mag(min)); + llassert(less_than_max_mag(max)); + if (!global_volume) { //VECTORIZE THIS @@ -775,6 +793,8 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, newMin = newMax = center; + llassert(less_than_max_mag(center)); + for (U32 i = 0; i < 4; i++) { LLVector4a delta; @@ -786,6 +806,9 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, newMin.setMin(newMin,min); newMax.setMax(newMax,max); + + llassert(less_than_max_mag(newMin)); + llassert(less_than_max_mag(newMax)); } if (!mDrawablep->isActive()) @@ -794,14 +817,22 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, offset.load3(mDrawablep->getRegion()->getOriginAgent().mV); newMin.add(offset); newMax.add(offset); + + llassert(less_than_max_mag(newMin)); + llassert(less_than_max_mag(newMax)); } t.setAdd(newMin, newMax); t.mul(0.5f); + llassert(less_than_max_mag(t)); + //VECTORIZE THIS mCenterLocal.set(t.getF32ptr()); + llassert(less_than_max_mag(newMin)); + llassert(less_than_max_mag(newMax)); + t.setSub(newMax,newMin); mBoundingSphereRadius = t.getLength3().getF32()*0.5f; -- cgit v1.2.3 From 73226014555b028ae2bdec29b8c7d60e6c20c2df Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 9 Jun 2011 17:07:51 -0600 Subject: partial fix for SH-1804: viewer crashes when uploading "Messerschmitt KR200.dae" eliminated crashing, but still failed to upload it. --- indra/newview/llfloatermodelpreview.cpp | 7 +++++-- indra/newview/llfloatermodelwizard.cpp | 7 +++++-- indra/newview/llmeshrepository.cpp | 5 ++++- indra/newview/llmeshrepository.h | 2 ++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 76f3e7fdf4..92ec714c80 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -915,8 +915,11 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data) { LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i]; DecompRequest* request = new DecompRequest(stage, mdl); - sInstance->mCurRequest.insert(request); - gMeshRepo.mDecompThread->submitRequest(request); + if(request->isValid()) + { + sInstance->mCurRequest.insert(request); + gMeshRepo.mDecompThread->submitRequest(request); + } } } diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 0cd66fbdc2..707c8288df 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -422,8 +422,11 @@ void LLFloaterModelWizard::executePhysicsStage(std::string stage_name) { LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i]; DecompRequest* request = new DecompRequest(stage_name, mdl); - sInstance->mCurRequest.insert(request); - gMeshRepo.mDecompThread->submitRequest(request); + if(request->isValid()) + { + sInstance->mCurRequest.insert(request); + gMeshRepo.mDecompThread->submitRequest(request); + } } } } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 6b8b0f5a00..8e5d132096 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1587,7 +1587,10 @@ void LLMeshUploadThread::doWholeModelUpload() llassert(physics != NULL); DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); - gMeshRepo.mDecompThread->submitRequest(request); + if(request->isValid()) + { + gMeshRepo.mDecompThread->submitRequest(request); + } } while (!mPhysicsComplete) diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index adf60c7e03..f237c3a60e 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -161,6 +161,8 @@ public: virtual void setStatusMessage(const std::string& msg); + bool isValid() const {return mPositions.size() > 2 && mIndices.size() > 2 ;} + protected: //internal use LLVector3 mBBox[2] ; -- cgit v1.2.3 From 0d5da61313a40f68382fb6823c6f5d4f3f18f3da Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 9 Jun 2011 16:22:13 -0700 Subject: Added log spam for mesh upload responses --- indra/newview/llmeshrepository.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 111802cd47..2c6d19bfe5 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -585,6 +585,7 @@ public: //assert_main_thread(); mThread->mPendingUploads--; dumpLLSDToFile(content,make_dump_name("whole_model_upload_response_",dump_num)); + llinfos << "LLWholeModelUploadResponder content: " << content << llendl; // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. if (isGoodStatus(status)) -- cgit v1.2.3 From ca38d143c2cada5b626ce3cd3962aecf90ba8ea2 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2011 19:22:17 -0500 Subject: Enable debug logging of capabilities to track down why viewer isn't fetching them correctly sometimes. --- indra/newview/app_settings/logcontrol.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 937c4e4c6a..9f4e89691f 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -20,6 +20,7 @@ tags AppInit + Capabilities SystemInfo TextureCache AppCache @@ -43,6 +44,7 @@ + Capabilities -- cgit v1.2.3 From cf9596c7f97937953c5f28d7ff3eea5df328dd31 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2011 19:22:46 -0500 Subject: SH-1804 Make it damn obvious that there are degenerate triangles in the physics shape preview render. --- indra/newview/llfloatermodelpreview.cpp | 132 ++++++++++++++++++++++---------- indra/newview/llmeshrepository.cpp | 17 ++-- 2 files changed, 101 insertions(+), 48 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 409d8bc79a..751e06c743 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -915,11 +915,8 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data) { LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i]; DecompRequest* request = new DecompRequest(stage, mdl); - if(request->isValid()) - { - sInstance->mCurRequest.insert(request); - gMeshRepo.mDecompThread->submitRequest(request); - } + sInstance->mCurRequest.insert(request); + gMeshRepo.mDecompThread->submitRequest(request); } } @@ -4869,39 +4866,43 @@ BOOL LLModelPreview::render() LLModel::Decomposition& physics = model->mPhysics; - if (physics.mMesh.empty()) - { //build vertex buffer for physics mesh - gMeshRepo.buildPhysicsMesh(physics); - } - - if (!physics.mMesh.empty()) - { //render hull instead of mesh + if (!physics.mHull.empty()) + { render_mesh = false; - for (U32 i = 0; i < physics.mMesh.size(); ++i) - { - if (explode > 0.f) + + if (physics.mMesh.empty()) + { //build vertex buffer for physics mesh + gMeshRepo.buildPhysicsMesh(physics); + } + + if (!physics.mMesh.empty()) + { //render hull instead of mesh + for (U32 i = 0; i < physics.mMesh.size(); ++i) { - gGL.pushMatrix(); + if (explode > 0.f) + { + gGL.pushMatrix(); - LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters; - offset *= explode; + LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters; + offset *= explode; - gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); - } + gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); + } - static std::vector hull_colors; + static std::vector hull_colors; - if (i+1 >= hull_colors.size()) - { - hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 255)); - } + if (i+1 >= hull_colors.size()) + { + hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 255)); + } - glColor4ubv(hull_colors[i].mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals); + glColor4ubv(hull_colors[i].mV); + LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals); - if (explode > 0.f) - { - gGL.popMatrix(); + if (explode > 0.f) + { + gGL.popMatrix(); + } } } } @@ -4927,22 +4928,71 @@ BOOL LLModelPreview::render() glColor3f(1.f, 1.f, 0.f); - glLineWidth(3.f); + glLineWidth(2.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); - { //show degenerate triangles + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glLineWidth(1.f); + } + } + + gGL.popMatrix(); + } + + glLineWidth(3.f); + glPointSize(8.f); + gPipeline.enableLightsFullbright(LLColor4::white); + //show degenerate triangles + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + LLGLDisable cull(GL_CULL_FACE); + glColor4f(1.f,0.f,0.f,1.f); + const LLVector4a scale(0.5f); + + for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + { + LLModelInstance& instance = *iter; + + LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS]; + + if (!model) + { + continue; + } + + gGL.pushMatrix(); + LLMatrix4 mat = instance.mTransform; + + glMultMatrixf((GLfloat*) mat.mMatrix); + + + LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread; + if (decomp) + { + LLMutexLock(decomp->mMutex); + + LLModel::Decomposition& physics = model->mPhysics; + + if (physics.mHull.empty()) + { + if (mVertexBuffer[LLModel::LOD_PHYSICS].empty()) + { + genBuffers(LLModel::LOD_PHYSICS, false); + } + + for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i) + { + LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; + + buffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0); + LLStrider pos_strider; buffer->getVertexStrider(pos_strider, 0); LLVector4a* pos = (LLVector4a*) pos_strider.get(); - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); - LLGLDisable cull(GL_CULL_FACE); LLStrider idx; buffer->getIndexStrider(idx, 0); - glColor4f(1.f,0.f,0.f,1.f); - const LLVector4a scale(0.5f); for (U32 i = 0; i < buffer->getNumIndices(); i += 3) { LLVector4a v1; v1.setMul(pos[*idx++], scale); @@ -4951,19 +5001,19 @@ BOOL LLModelPreview::render() if (ll_is_degenerate(v1,v2,v3)) { - buffer->draw(LLRender::TRIANGLES, 3, i); + buffer->draw(LLRender::LINE_LOOP, 3, i); + buffer->draw(LLRender::POINTS, 3, i); } } } - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); } } gGL.popMatrix(); } - + glLineWidth(1.f); + glPointSize(1.f); + gPipeline.enableLightsPreview(); gGL.setSceneBlendType(LLRender::BT_ALPHA); } } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 111802cd47..4f220d617e 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3272,15 +3272,18 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh) mesh.mNumTriangles = mCurRequest->mIndices.size()/3; - LLCDResult ret = LLCD_OK; - if (LLConvexDecomposition::getInstance() != NULL) + if (mesh.mNumTriangles > 0 && mesh.mNumVertices > 2) { - ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh); - } + LLCDResult ret = LLCD_OK; + if (LLConvexDecomposition::getInstance() != NULL) + { + ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh); + } - if (ret) - { - llerrs << "Convex Decomposition thread valid but could not set mesh data" << llendl; + if (ret) + { + llerrs << "Convex Decomposition thread valid but could not set mesh data" << llendl; + } } } -- cgit v1.2.3 From dd4e50610147393bb355186e83672a5741b0e299 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Jun 2011 01:28:53 -0500 Subject: Followup on mapbuffer work -- only use map buffer where map_buffer_range is available, and allow non-buffer-mapping implementation to take advantage of recorded mapped regions. --- indra/llrender/llvertexbuffer.cpp | 63 ++++++++++++++++++++++++++++-------- indra/newview/featuretable.txt | 10 +++++- indra/newview/featuretable_linux.txt | 10 +++++- indra/newview/featuretable_mac.txt | 10 +++++- indra/newview/featuretable_xp.txt | 10 +++++- 5 files changed, 85 insertions(+), 18 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 3197866fa9..4a0b964e61 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -968,11 +968,11 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran if (useVBOs()) { - if (!sDisableVBOMapping && gGLManager.mHasMapBufferRange) + if (sDisableVBOMapping || gGLManager.mHasMapBufferRange) { if (count == -1) { - count = mNumVerts; + count = mNumVerts-index; } bool mapped = false; @@ -985,6 +985,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran if (expand_region(region, index, count)) { mapped = true; + break; } } } @@ -992,7 +993,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran if (!mapped) { //not already mapped, map new region - MappedRegion region(type, map_range ? -1 : index, count); + MappedRegion region(type, !sDisableVBOMapping && map_range ? -1 : index, count); mMappedVertexRegions.push_back(region); } } @@ -1089,7 +1090,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran map_range = false; } - if (map_range) + if (map_range && !sDisableVBOMapping) { return mMappedData; } @@ -1113,11 +1114,11 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) if (useVBOs()) { - if (!sDisableVBOMapping && gGLManager.mHasMapBufferRange) + if (sDisableVBOMapping || gGLManager.mHasMapBufferRange) { if (count == -1) { - count = mNumIndices; + count = mNumIndices-index; } bool mapped = false; @@ -1128,13 +1129,14 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) if (expand_region(region, index, count)) { mapped = true; + break; } } if (!mapped) { //not already mapped, map new region - MappedRegion region(TYPE_INDEX, map_range ? -1 : index, count); + MappedRegion region(TYPE_INDEX, !sDisableVBOMapping && map_range ? -1 : index, count); mMappedIndexRegions.push_back(region); } } @@ -1217,7 +1219,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) map_range = false; } - if (map_range) + if (map_range && !sDisableVBOMapping) { return mMappedIndexData; } @@ -1243,9 +1245,26 @@ void LLVertexBuffer::unmapBuffer(S32 type) if(sDisableVBOMapping) { - stop_glerror(); - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), mMappedData); - stop_glerror(); + if (!mMappedVertexRegions.empty()) + { + stop_glerror(); + for (U32 i = 0; i < mMappedVertexRegions.size(); ++i) + { + const MappedRegion& region = mMappedVertexRegions[i]; + S32 offset = region.mIndex >= 0 ? mOffsets[region.mType]+sTypeSize[region.mType]*region.mIndex : 0; + S32 length = sTypeSize[region.mType]*region.mCount; + glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, mMappedData+offset); + stop_glerror(); + } + + mMappedVertexRegions.clear(); + } + else + { + stop_glerror(); + glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), mMappedData); + stop_glerror(); + } } else { @@ -1285,9 +1304,25 @@ void LLVertexBuffer::unmapBuffer(S32 type) { if(sDisableVBOMapping) { - stop_glerror(); - glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), mMappedIndexData); - stop_glerror(); + if (!mMappedIndexRegions.empty()) + { + for (U32 i = 0; i < mMappedIndexRegions.size(); ++i) + { + const MappedRegion& region = mMappedIndexRegions[i]; + S32 offset = region.mIndex >= 0 ? sizeof(U16)*region.mIndex : 0; + S32 length = sizeof(U16)*region.mCount; + glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, mMappedIndexData+offset); + stop_glerror(); + } + + mMappedIndexRegions.clear(); + } + else + { + stop_glerror(); + glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), mMappedIndexData); + stop_glerror(); + } } else { diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 1d29c5b597..4da155efda 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 28 +version 29 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -48,6 +48,7 @@ RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 +RenderVBOMappingDisable 1 1 RenderVolumeLODFactor 1 2.0 UseStartScreen 1 1 UseOcclusion 1 1 @@ -187,6 +188,7 @@ RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 RenderFSAASamples 1 8 + // // Class Unknown Hardware (unknown) // @@ -243,6 +245,12 @@ RenderDeferred 0 0 RenderDeferredSSAO 0 0 RenderShadowDetail 0 0 +// +// No GL_ARB_map_buffer_range +// +list NoMapBufferRange +RenderVBOMappingDisable 1 0 + // // "Default" setups for safe, low, medium, high diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 9daa5a5b29..dab73dc3d1 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -1,4 +1,4 @@ -version 24 +version 25 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -48,6 +48,7 @@ RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 +RenderVBOMappingDisable 1 1 RenderVolumeLODFactor 1 2.0 UseStartScreen 1 1 UseOcclusion 1 1 @@ -242,6 +243,13 @@ RenderDeferred 0 0 RenderDeferredSSAO 0 0 RenderShadowDetail 0 0 +// +// No GL_ARB_map_buffer_range +// +list NoMapBufferRange +RenderVBOMappingDisable 1 0 + + // "Default" setups for safe, low, medium, high // diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index d7b4128ca2..a1e25aae08 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 25 +version 26 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -48,6 +48,7 @@ RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 +RenderVBOMappingDisable 1 1 RenderVolumeLODFactor 1 2.0 UseStartScreen 1 1 UseOcclusion 1 1 @@ -244,6 +245,13 @@ RenderDeferred 0 0 RenderDeferredSSAO 0 0 RenderShadowDetail 0 0 +// +// No GL_ARB_map_buffer_range +// +list NoMapBufferRange +RenderVBOMappingDisable 1 0 + + // // "Default" setups for safe, low, medium, high // diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index 0a23b4d6a6..abe4ec9928 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -1,4 +1,4 @@ -version 28 +version 29 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -48,6 +48,7 @@ RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 +RenderVBOMappingDisable 1 1 RenderVolumeLODFactor 1 2.0 UseStartScreen 1 1 UseOcclusion 1 1 @@ -244,6 +245,13 @@ RenderDeferred 0 0 RenderDeferredSSAO 0 0 RenderShadowDetail 0 0 +// +// No GL_ARB_map_buffer_range +// +list NoMapBufferRange +RenderVBOMappingDisable 1 0 + + // // "Default" setups for safe, low, medium, high // -- cgit v1.2.3 From fd51f4d17012eb0a53ca9d8c5ccb8c7b4542fc3a Mon Sep 17 00:00:00 2001 From: prep linden Date: Fri, 10 Jun 2011 10:35:55 -0400 Subject: SH-1632 - minor camera and far plane tweak. Also need SH-1665 for full solution (model needs to stay at the origin - currently it translates during scaling). --- indra/newview/llfloatermodelpreview.cpp | 160 ++++++++++++++++---------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 75fa7b9d1f..4e71aa7fa6 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2203,87 +2203,87 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode ) //----------------------------------------------------------------------------- // verifyCount //----------------------------------------------------------------------------- -bool LLModelPreview::verifyCount( int expected, int result ) -{ - if ( expected != result ) - { - llinfos<< "Error: (expected/got)"<getSkin(); - - if ( pSkin ) - { - xsAnyURI & uri = pSkin->getSource(); - domElement* pElement = uri.getElement(); - - if ( !pElement ) - { - llinfos<<"Can't resolve skin source"<getTypeName(); - if ( stricmp(type_str, "geometry") == 0 ) - { - //Skin is reference directly by geometry and get the vertex count from skin - domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights(); - U32 vertexWeightsCount = pVertexWeights->getCount(); - domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement(); - domMesh* pMesh = pGeometry->getMesh(); - - if ( pMesh ) - { - //Get vertex count from geometry - domVertices* pVertices = pMesh->getVertices(); - if ( !pVertices ) - { - llinfos<<"No vertices!"<getInput_array()[0]->getSource(); - domSource* pSource = (domSource*) (domElement*) src.getElement(); - U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount(); - result = verifyCount( verticesCount, vertexWeightsCount ); - if ( !result ) - { - return result; - } - } - } - - U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount(); - result = verifyCount( vcountCount, vertexWeightsCount ); - if ( !result ) - { - return result; - } - - domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array(); - U32 sum = 0; - for (size_t i=0; igetVcount()->getValue()[i]; - } - result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); - } - } - - return result; -} +bool LLModelPreview::verifyController( domController* pController ) +{ + + bool result = true; + + domSkin* pSkin = pController->getSkin(); + + if ( pSkin ) + { + xsAnyURI & uri = pSkin->getSource(); + domElement* pElement = uri.getElement(); + + if ( !pElement ) + { + llinfos<<"Can't resolve skin source"<getTypeName(); + if ( stricmp(type_str, "geometry") == 0 ) + { + //Skin is reference directly by geometry and get the vertex count from skin + domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights(); + U32 vertexWeightsCount = pVertexWeights->getCount(); + domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement(); + domMesh* pMesh = pGeometry->getMesh(); + + if ( pMesh ) + { + //Get vertex count from geometry + domVertices* pVertices = pMesh->getVertices(); + if ( !pVertices ) + { + llinfos<<"No vertices!"<getInput_array()[0]->getSource(); + domSource* pSource = (domSource*) (domElement*) src.getElement(); + U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount(); + result = verifyCount( verticesCount, vertexWeightsCount ); + if ( !result ) + { + return result; + } + } + } + + U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount(); + result = verifyCount( vcountCount, vertexWeightsCount ); + if ( !result ) + { + return result; + } + + domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array(); + U32 sum = 0; + for (size_t i=0; igetVcount()->getValue()[i]; + } + result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); + } + } + + return result; +} //----------------------------------------------------------------------------- // extractTranslation() @@ -3372,7 +3372,7 @@ void LLModelPreview::resetPreviewTarget() mPreviewScale = (mModelLoader->mExtents[1] - mModelLoader->mExtents[0]) * 0.5f; } - setPreviewTarget(mPreviewScale.magVec()*2.f); + setPreviewTarget(mPreviewScale.magVec()*10.f); } void LLModelPreview::generateNormals() @@ -4590,7 +4590,7 @@ BOOL LLModelPreview::render() LLVector3 target_pos = mPreviewTarget+offset; F32 z_near = 0.001f; - F32 z_far = mCameraDistance+mPreviewScale.magVec()+mCameraOffset.magVec(); + F32 z_far = mCameraDistance*10.0f+mPreviewScale.magVec()+mCameraOffset.magVec(); if (skin_weight) { -- cgit v1.2.3 From 99b05f9647353f9bf5a44b1eb424105598d2b725 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Jun 2011 18:51:22 -0500 Subject: Fix for show object updates not working (and crashing, and behaving badly). --- indra/newview/llviewermessage.cpp | 12 ++---------- indra/newview/llviewerobject.cpp | 26 ++++++++------------------ indra/newview/pipeline.cpp | 36 ++++++++++++++++++++++++++++++++++++ indra/newview/pipeline.h | 16 ++++++++++++++++ 4 files changed, 62 insertions(+), 28 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3832be727f..b4a4aaa329 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -96,7 +96,6 @@ #include "llviewerwindow.h" #include "llvlmanager.h" #include "llvoavatarself.h" -#include "llvotextbubble.h" #include "llworld.h" #include "pipeline.h" #include "llfloaterworldmap.h" @@ -4228,15 +4227,8 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) // Display green bubble on kill if ( gShowObjectUpdates ) { - LLViewerObject* newobject; - newobject = gObjectList.createObjectViewer(LL_PCODE_LEGACY_TEXT_BUBBLE, objectp->getRegion()); - - LLVOTextBubble* bubble = (LLVOTextBubble*) newobject; - - bubble->mColor.setVec(0.f, 1.f, 0.f, 1.f); - bubble->setScale( 2.0f * bubble->getScale() ); - bubble->setPositionGlobal(objectp->getPositionGlobal()); - gPipeline.addObject(bubble); + LLColor4 color(0.f,1.f,0.f,1.f); + gPipeline.addDebugBlip(objectp->getPositionAgent(), color); } // Do the kill diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 72cdb4b355..be9ff872c0 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -89,7 +89,6 @@ #include "llvopartgroup.h" #include "llvosky.h" #include "llvosurfacepatch.h" -#include "llvotextbubble.h" #include "llvotree.h" #include "llvovolume.h" #include "llvowater.h" @@ -168,8 +167,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco // llwarns << "Creating new tree!" << llendl; // res = new LLVOTree(id, pcode, regionp); break; res = NULL; break; - case LL_PCODE_LEGACY_TEXT_BUBBLE: - res = new LLVOTextBubble(id, pcode, regionp); break; case LL_VO_CLOUDS: res = new LLVOClouds(id, pcode, regionp); break; case LL_VO_SURFACE_PATCH: @@ -1973,23 +1970,16 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if ( gShowObjectUpdates ) { - if (!((mPrimitiveCode == LL_PCODE_LEGACY_AVATAR) && (((LLVOAvatar *) this)->isSelf())) - && mRegionp) + LLColor4 color; + if (update_type == OUT_TERSE_IMPROVED) { - LLViewerObject* object = gObjectList.createObjectViewer(LL_PCODE_LEGACY_TEXT_BUBBLE, mRegionp); - LLVOTextBubble* bubble = (LLVOTextBubble*) object; - - if (update_type == OUT_TERSE_IMPROVED) - { - bubble->mColor.setVec(0.f, 0.f, 1.f, 1.f); - } - else - { - bubble->mColor.setVec(1.f, 0.f, 0.f, 1.f); - } - object->setPositionGlobal(getPositionGlobal()); - gPipeline.addObject(object); + color.setVec(0.f, 0.f, 1.f, 1.f); + } + else + { + color.setVec(1.f, 0.f, 0.f, 1.f); } + gPipeline.addDebugBlip(getPositionAgent(), color); } if ((0.0f == vel_mag_sq) && diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4d678117a5..f2294335ed 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4096,6 +4096,37 @@ void LLPipeline::renderDebug() bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); + if (!hud_only && !mDebugBlips.empty()) + { //render debug blips + glPointSize(8.f); + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + + gGL.begin(LLRender::POINTS); + for (std::list::iterator iter = mDebugBlips.begin(); iter != mDebugBlips.end(); ) + { + DebugBlip& blip = *iter; + + blip.mAge += gFrameIntervalSeconds; + if (blip.mAge > 2.f) + { + mDebugBlips.erase(iter++); + } + else + { + iter++; + } + + blip.mPosition.mV[2] += gFrameIntervalSeconds*2.f; + + gGL.color4fv(blip.mColor.mV); + gGL.vertex3fv(blip.mPosition.mV); + } + gGL.end(); + gGL.flush(); + glPointSize(1.f); + } + + // Debug stuff. for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) @@ -9839,4 +9870,9 @@ void LLPipeline::clearRenderTypeMask(U32 type, ...) } } +void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color) +{ + DebugBlip blip(position, color); + mDebugBlips.push_back(blip); +} diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index e967b8c31e..e9da25e544 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -360,6 +360,8 @@ public: static void updateRenderDeferred(); static void refreshRenderDeferred(); + void addDebugBlip(const LLVector3& position, const LLColor4& color); + private: void unloadShaders(); void addToQuickLookup( LLDrawPool* new_poolp ); @@ -730,6 +732,20 @@ public: protected: std::vector mSelectedFaces; + class DebugBlip + { + public: + LLColor4 mColor; + LLVector3 mPosition; + F32 mAge; + + DebugBlip(const LLVector3& position, const LLColor4& color) + : mColor(color), mPosition(position), mAge(0.f) + { } + }; + + std::list mDebugBlips; + LLPointer mFaceSelectImagep; U32 mLightMask; -- cgit v1.2.3 From 44f0a1b68118f662e68904eea83a3801b4577070 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 11 Jun 2011 16:51:01 -0500 Subject: SH-1778 Physics shape display fix up. --- indra/llprimitive/llmodel.cpp | 6 ++- indra/llrender/llrendertarget.cpp | 7 ++- indra/newview/llspatialpartition.cpp | 7 --- indra/newview/pipeline.cpp | 93 +++--------------------------------- 4 files changed, 15 insertions(+), 98 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index b3d5c7b072..e0cfa07614 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2093,7 +2093,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) if (decomp.has("BoundingVerts")) { - const LLSD::Binary& position = decomp["BundingVerts"].asBinary(); + const LLSD::Binary& position = decomp["BoundingVerts"].asBinary(); U16* p = (U16*) &position[0]; @@ -2129,7 +2129,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) { //empty base hull mesh to indicate decomposition has been loaded //but contains no base hull - mBaseHullMesh.clear();; + mBaseHullMesh.clear(); } } @@ -2252,6 +2252,8 @@ LLSD LLModel::Decomposition::asLLSD() const ret["Positions"] = p; } + llassert(!mBaseHull.empty()); + if (!mBaseHull.empty()) { LLSD::Binary p(mBaseHull.size()*3*2); diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index e773a639b0..b6463309e1 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -75,6 +75,9 @@ LLRenderTarget::~LLRenderTarget() void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples) { stop_glerror(); + + release(); + mResX = resx; mResY = resy; @@ -96,8 +99,6 @@ void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo mSamples = 0; } - release(); - if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) { if (depth) @@ -337,6 +338,8 @@ void LLRenderTarget::release() LLImageGL::deleteTextures(mTex.size(), &mTex[0], true); mTex.clear(); } + + mResX = mResY = 0; sBoundTarget = NULL; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index d96fa087b1..a5b91729e8 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2969,13 +2969,6 @@ void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColo void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) { - if (volume->isSelected()) - { - LLVector3 construct_me(5,5,5); - construct_me.normalize(); - } - - U8 physics_type = volume->getPhysicsShapeType(); if (physics_type == LLViewerObject::PHYSICS_SHAPE_NONE || volume->isFlexible()) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f2294335ed..ba948bf139 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -773,31 +773,7 @@ void LLPipeline::updateRenderDeferred() //static void LLPipeline::refreshRenderDeferred() { - static BOOL physics_shapes_is_on = FALSE ; - static BOOL render_glow_copy = FALSE ; - - if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) - { - if(!physics_shapes_is_on) - { - physics_shapes_is_on = TRUE ; - render_glow_copy = sRenderGlow ; - } - - //turn the deferred rendering and glow off when draw physics shapes. - sRenderDeferred = FALSE ; - sRenderGlow = FALSE ; - } - else - { - if(physics_shapes_is_on) - { - physics_shapes_is_on = FALSE ; - sRenderGlow = render_glow_copy ; - } - - updateRenderDeferred() ; - } + updateRenderDeferred(); } void LLPipeline::releaseGLBuffers() @@ -6106,7 +6082,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { LLMemType mt_ru(LLMemType::MTYPE_PIPELINE_RENDER_BLOOM); if (!(gPipeline.canUseVertexShaders() && - sRenderGlow)) + sRenderGlow) || + (!sRenderDeferred && hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))) { return; } @@ -6152,67 +6129,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.setColorMask(true, true); glClearColor(0,0,0,0); - - /*if (for_snapshot) - { - gGL.getTexUnit(0)->bind(&mGlow[1]); - { - //LLGLEnable stencil(GL_STENCIL_TEST); - //glStencilFunc(GL_NOTEQUAL, 255, 0xFFFFFFFF); - //glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - //LLGLDisable blend(GL_BLEND); - - // If the snapshot is constructed from tiles, calculate which - // tile we're in. - - //from LLViewerCamera::setPerpsective - if (zoom_factor > 1.f) - { - int pos_y = subfield / llceil(zoom_factor); - int pos_x = subfield - (pos_y*llceil(zoom_factor)); - F32 size = 1.f/zoom_factor; - - tc1.set(pos_x*size, pos_y*size); - tc2 = tc1 + LLVector2(size,size); - } - else - { - tc2.set(1,1); - } - - LLGLEnable blend(GL_BLEND); - gGL.setSceneBlendType(LLRender::BT_ADD); - - - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.color4f(1,1,1,1); - gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); - gGL.vertex2f(-1,-1); - - gGL.texCoord2f(tc1.mV[0], tc2.mV[1]); - gGL.vertex2f(-1,1); - - gGL.texCoord2f(tc2.mV[0], tc1.mV[1]); - gGL.vertex2f(1,-1); - - gGL.texCoord2f(tc2.mV[0], tc2.mV[1]); - gGL.vertex2f(1,1); - - gGL.end(); - - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - } - - gGL.flush(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - - return; - }*/ - + { { LLFastTimer ftm(FTM_RENDER_BLOOM_FBO); @@ -6568,6 +6485,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) { + gGL.setColorMask(true, false); + LLVector2 tc1(0,0); LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw()*2, (F32) gViewerWindow->getWorldViewHeightRaw()*2); -- cgit v1.2.3 From 786da1eb383502a268f71938e16b525a72e01abe Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Sat, 11 Jun 2011 18:10:19 -0400 Subject: VWR-25480 Worldmap: Partial region name search UI bug Patch converted and tested by Jonathan Yap --- doc/contributions.txt | 2 ++ indra/newview/llfloaterworldmap.cpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index daaffe2dee..96630b1995 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -158,6 +158,7 @@ Ann Congrejo CT-193 Ansariel Hiller STORM-1101 + VWR-25480 Ardy Lay STORM-859 VWR-19499 @@ -442,6 +443,7 @@ Jonathan Yap STORM-1095 STORM-1236 STORM-1259 + VWR-25480 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index f8a4ce7ad0..b3910982d1 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1527,17 +1527,24 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) mCompletingRegionName = ""; } - // if match found, highlight it and go - if (!match.isUndefined()) + if (num_results > 0) { - list->selectByValue(match); + // if match found, highlight it and go + if (!match.isUndefined()) + { + list->selectByValue(match); + } + // else select first found item + else + { + list->selectFirstItem(); + } getChild("search_results")->setFocus(TRUE); onCommitSearchResult(); } - - // if we found nothing, say "none" - if (num_results == 0) + else { + // if we found nothing, say "none" list->setCommentText(LLTrans::getString("worldmap_results_none_found")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } -- cgit v1.2.3 From 8746648c4ea43aff03854bab2a5739fbbbe24ea7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 11 Jun 2011 17:10:26 -0500 Subject: Fix for under water render going black when deferred rendering and anti-aliasing enabled. --- indra/newview/pipeline.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ba948bf139..e74bf2a620 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6257,9 +6257,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) LLVertexBuffer::unbind(); - if (LLPipeline::sRenderDeferred && !LLViewerCamera::getInstance()->cameraUnderWater()) + if (LLPipeline::sRenderDeferred) { - bool dof_enabled = true; + bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater(); LLGLSLShader* shader = &gDeferredPostProgram; if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2) @@ -6267,7 +6267,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader = &gDeferredGIFinalProgram; dof_enabled = false; } - else if (LLToolMgr::getInstance()->inBuildMode() || !gSavedSettings.getBOOL("RenderDepthOfField")) + else if (!dof_enabled || LLToolMgr::getInstance()->inBuildMode() || !gSavedSettings.getBOOL("RenderDepthOfField")) { //squish focal length when in build mode (or if DoF is disabled) so DoF doesn't make editing objects difficult shader = &gDeferredPostNoDoFProgram; dof_enabled = false; -- cgit v1.2.3 From ac504815137ec01767717e7c1a4c419a995f629c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 12 Jun 2011 16:00:33 -0400 Subject: STORM-787 Mute Gestures Button --- doc/contributions.txt | 1 + indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llfloaterpreference.cpp | 9 +++++++++ indra/newview/llfloaterpreference.h | 1 + indra/newview/llviewermessage.cpp | 3 +++ .../default/xui/en/panel_preferences_sound.xml | 22 ++++++++++++++++++---- 6 files changed, 43 insertions(+), 4 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index daaffe2dee..5cd8d06426 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -442,6 +442,7 @@ Jonathan Yap STORM-1095 STORM-1236 STORM-1259 + STORM-787 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index fc7fd2dd8a..9b12b8057f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3058,6 +3058,17 @@ Value 1 + EnableGestureSounds + + Comment + Play sounds from gestures + Persist + 1 + Type + Boolean + Value + 1 + EnableMouselook Comment diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 60a2f813aa..7848484ac6 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -327,6 +327,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); + mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); // mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs", boost::bind(&LLFloaterPreference::onClickSkipDialogs, this)); // mCommitCallbackRegistrar.add("Pref.ClickResetDialogs", boost::bind(&LLFloaterPreference::onClickResetDialogs, this)); mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); @@ -1286,6 +1287,14 @@ void LLFloaterPreference::onClickSetMiddleMouse() p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); } } + +void LLFloaterPreference::onClickSetSounds() +{ + // Disable Enable gesture sounds checkbox if the master sound is disabled + // or if sound effects are disabled. + getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); +} + /* void LLFloaterPreference::onClickSkipDialogs() { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index ef92575347..61f2c78640 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -129,6 +129,7 @@ public: void onClickSetKey(); void setKey(KEY key); void onClickSetMiddleMouse(); + void onClickSetSounds(); // void onClickSkipDialogs(); // void onClickResetDialogs(); void onClickEnablePopup(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3832be727f..0aada644f3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4332,6 +4332,9 @@ void process_sound_trigger(LLMessageSystem *msg, void **) { return; } + + // Don't play sounds from gestures if they are not enabled. + if (!gSavedSettings.getBOOL("EnableGestureSounds")) return; gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global); } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml index 91fe6f544c..1bdd2ccefb 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml @@ -123,8 +123,8 @@ function="Pref.setControlFalse" parameter="MuteAmbient" /> - + Date: Sun, 12 Jun 2011 19:59:06 -0400 Subject: STORM-787 Mute Gestures Button --- indra/newview/skins/default/xui/en/panel_preferences_sound.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml index 1bdd2ccefb..baa8d485ef 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml @@ -322,7 +322,7 @@ follows="left|bottom|right" height="15" tool_tip="Check this to hear sounds from gestures" - label="Enable sounds from gestures" + label="Play sounds from gestures" top_pad="1" left="25"/> Date: Mon, 13 Jun 2011 11:52:50 -0600 Subject: fix for SH-1412: Mesh upload dialog freezes viewer when uploading certain meshes. --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 6349ea47e2..3cccddf861 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -18,9 +18,9 @@ archive hash - 76827e62b9af4756caa1d3d8da0bafc3 + b2fe1c860613a68e74d4384be418ffee url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232275/arch/Darwin/installer/glod-1.0pre4-darwin-20110607.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232684/arch/Darwin/installer/glod-1.0pre4-darwin-20110610.tar.bz2 name darwin @@ -30,9 +30,9 @@ archive hash - 7841a681db47017ccc6527b52876bacb + c0c64dae149d0892343e2ff300fd06b9 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232275/arch/Linux/installer/glod-1.0pre4-linux-20110607.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232684/arch/Linux/installer/glod-1.0pre4-linux-20110611.tar.bz2 name linux @@ -42,9 +42,9 @@ archive hash - cca713fe7395260d91aaef2f2b5d820a + 842208365f5b108dac4c7c733b99da9c url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232275/arch/CYGWIN/installer/glod-1.0pre4-windows-20110607.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232684/arch/CYGWIN/installer/glod-1.0pre4-windows-20110610.tar.bz2 name windows -- cgit v1.2.3 From f1ec7a821b82df5361864ecfef49ee8cee4ba7d8 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Mon, 13 Jun 2011 15:28:24 -0700 Subject: FIX CT-636 CT-640 DA translation for Set22 and Set1 --- .../skins/default/xui/da/floater_about_land.xml | 4 +- indra/newview/skins/default/xui/da/floater_map.xml | 3 + .../newview/skins/default/xui/da/floater_tools.xml | 2 + .../skins/default/xui/da/menu_attachment_self.xml | 2 +- .../skins/default/xui/da/menu_avatar_self.xml | 2 +- .../skins/default/xui/da/menu_bottomtray.xml | 2 +- .../default/xui/da/menu_inspect_avatar_gear.xml | 6 +- .../default/xui/da/menu_inspect_self_gear.xml | 39 +- .../default/xui/da/menu_inventory_gear_default.xml | 1 + indra/newview/skins/default/xui/da/menu_object.xml | 4 +- .../default/xui/da/menu_places_gear_folder.xml | 5 +- .../default/xui/da/menu_places_gear_landmark.xml | 5 +- indra/newview/skins/default/xui/da/menu_viewer.xml | 8 +- .../newview/skins/default/xui/da/notifications.xml | 50 +- indra/newview/skins/default/xui/da/panel_login.xml | 7 + .../skins/default/xui/da/panel_nearby_media.xml | 2 +- .../newview/skins/default/xui/da/panel_people.xml | 2 + .../default/xui/da/panel_preferences_sound.xml | 4 +- .../newview/skins/default/xui/da/panel_profile.xml | 8 +- .../skins/default/xui/da/panel_script_ed.xml | 3 + indra/newview/skins/default/xui/da/strings.xml | 357 +++- .../skins/minimal/xui/da/floater_camera.xml | 65 + .../skins/minimal/xui/da/floater_help_browser.xml | 9 + .../skins/minimal/xui/da/floater_media_browser.xml | 19 + .../skins/minimal/xui/da/floater_nearby_chat.xml | 4 + .../skins/minimal/xui/da/floater_web_content.xml | 14 + .../skins/minimal/xui/da/inspect_avatar.xml | 24 + .../skins/minimal/xui/da/inspect_object.xml | 41 + .../minimal/xui/da/menu_add_wearable_gear.xml | 6 + .../skins/minimal/xui/da/menu_attachment_other.xml | 17 + .../skins/minimal/xui/da/menu_attachment_self.xml | 16 + .../skins/minimal/xui/da/menu_avatar_icon.xml | 7 + .../skins/minimal/xui/da/menu_avatar_other.xml | 16 + .../skins/minimal/xui/da/menu_avatar_self.xml | 31 + .../skins/minimal/xui/da/menu_bottomtray.xml | 17 + .../skins/minimal/xui/da/menu_cof_attachment.xml | 4 + .../skins/minimal/xui/da/menu_cof_body_part.xml | 5 + .../skins/minimal/xui/da/menu_cof_clothing.xml | 6 + .../newview/skins/minimal/xui/da/menu_cof_gear.xml | 5 + indra/newview/skins/minimal/xui/da/menu_edit.xml | 12 + .../skins/minimal/xui/da/menu_favorites.xml | 10 + .../skins/minimal/xui/da/menu_gesture_gear.xml | 10 + .../skins/minimal/xui/da/menu_group_plus.xml | 5 + .../skins/minimal/xui/da/menu_hide_navbar.xml | 6 + .../skins/minimal/xui/da/menu_im_well_button.xml | 4 + .../skins/minimal/xui/da/menu_imchiclet_adhoc.xml | 4 + .../skins/minimal/xui/da/menu_imchiclet_group.xml | 6 + .../skins/minimal/xui/da/menu_imchiclet_p2p.xml | 7 + .../minimal/xui/da/menu_inspect_avatar_gear.xml | 21 + .../minimal/xui/da/menu_inspect_object_gear.xml | 18 + .../minimal/xui/da/menu_inspect_self_gear.xml | 31 + .../minimal/xui/da/menu_inv_offer_chiclet.xml | 4 + .../skins/minimal/xui/da/menu_inventory.xml | 84 + .../skins/minimal/xui/da/menu_inventory_add.xml | 33 + .../minimal/xui/da/menu_inventory_gear_default.xml | 17 + indra/newview/skins/minimal/xui/da/menu_land.xml | 9 + .../newview/skins/minimal/xui/da/menu_landmark.xml | 7 + indra/newview/skins/minimal/xui/da/menu_login.xml | 24 + .../newview/skins/minimal/xui/da/menu_mini_map.xml | 11 + indra/newview/skins/minimal/xui/da/menu_navbar.xml | 11 + .../skins/minimal/xui/da/menu_nearby_chat.xml | 9 + .../xui/da/menu_notification_well_button.xml | 4 + indra/newview/skins/minimal/xui/da/menu_object.xml | 29 + .../skins/minimal/xui/da/menu_object_icon.xml | 5 + .../skins/minimal/xui/da/menu_outfit_gear.xml | 27 + .../skins/minimal/xui/da/menu_outfit_tab.xml | 9 + .../skins/minimal/xui/da/menu_participant_list.xml | 21 + .../xui/da/menu_people_friends_view_sort.xml | 8 + .../skins/minimal/xui/da/menu_people_groups.xml | 8 + .../xui/da/menu_people_groups_view_sort.xml | 5 + .../skins/minimal/xui/da/menu_people_nearby.xml | 13 + .../xui/da/menu_people_nearby_multiselect.xml | 10 + .../xui/da/menu_people_nearby_view_sort.xml | 8 + .../xui/da/menu_people_recent_view_sort.xml | 7 + indra/newview/skins/minimal/xui/da/menu_picks.xml | 8 + .../skins/minimal/xui/da/menu_picks_plus.xml | 5 + indra/newview/skins/minimal/xui/da/menu_place.xml | 7 + .../skins/minimal/xui/da/menu_place_add_button.xml | 5 + .../minimal/xui/da/menu_places_gear_folder.xml | 16 + .../minimal/xui/da/menu_places_gear_landmark.xml | 19 + .../skins/minimal/xui/da/menu_profile_overflow.xml | 12 + .../skins/minimal/xui/da/menu_save_outfit.xml | 5 + .../skins/minimal/xui/da/menu_script_chiclet.xml | 4 + indra/newview/skins/minimal/xui/da/menu_slurl.xml | 6 + .../minimal/xui/da/menu_teleport_history_gear.xml | 6 + .../minimal/xui/da/menu_teleport_history_item.xml | 6 + .../minimal/xui/da/menu_teleport_history_tab.xml | 5 + .../skins/minimal/xui/da/menu_text_editor.xml | 8 + .../skins/minimal/xui/da/menu_topinfobar.xml | 7 + .../skins/minimal/xui/da/menu_url_agent.xml | 6 + .../skins/minimal/xui/da/menu_url_group.xml | 6 + .../newview/skins/minimal/xui/da/menu_url_http.xml | 7 + .../skins/minimal/xui/da/menu_url_inventory.xml | 6 + .../newview/skins/minimal/xui/da/menu_url_map.xml | 6 + .../skins/minimal/xui/da/menu_url_objectim.xml | 8 + .../skins/minimal/xui/da/menu_url_parcel.xml | 6 + .../skins/minimal/xui/da/menu_url_slapp.xml | 5 + .../skins/minimal/xui/da/menu_url_slurl.xml | 7 + .../skins/minimal/xui/da/menu_url_teleport.xml | 6 + indra/newview/skins/minimal/xui/da/menu_viewer.xml | 14 + .../minimal/xui/da/menu_wearable_list_item.xml | 14 + .../skins/minimal/xui/da/menu_wearing_gear.xml | 5 + .../skins/minimal/xui/da/menu_wearing_tab.xml | 6 + .../newview/skins/minimal/xui/da/notifications.xml | 1833 ++++++++++++++++++++ .../minimal/xui/da/panel_adhoc_control_panel.xml | 14 + .../skins/minimal/xui/da/panel_bottomtray.xml | 39 + .../minimal/xui/da/panel_group_control_panel.xml | 17 + .../minimal/xui/da/panel_im_control_panel.xml | 29 + indra/newview/skins/minimal/xui/da/panel_login.xml | 48 + .../skins/minimal/xui/da/panel_navigation_bar.xml | 18 + .../newview/skins/minimal/xui/da/panel_people.xml | 94 + .../minimal/xui/da/panel_side_tray_tab_caption.xml | 7 + .../skins/minimal/xui/da/panel_status_bar.xml | 33 + 113 files changed, 3625 insertions(+), 47 deletions(-) create mode 100644 indra/newview/skins/minimal/xui/da/floater_camera.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_help_browser.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_media_browser.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_nearby_chat.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_web_content.xml create mode 100644 indra/newview/skins/minimal/xui/da/inspect_avatar.xml create mode 100644 indra/newview/skins/minimal/xui/da/inspect_object.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_add_wearable_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_attachment_other.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_attachment_self.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_avatar_icon.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_avatar_other.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_avatar_self.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_bottomtray.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_attachment.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_body_part.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_clothing.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_edit.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_favorites.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_gesture_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_group_plus.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_hide_navbar.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_im_well_button.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_imchiclet_adhoc.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_imchiclet_group.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_imchiclet_p2p.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inspect_avatar_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inspect_object_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inspect_self_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inv_offer_chiclet.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inventory.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inventory_add.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inventory_gear_default.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_land.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_landmark.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_login.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_mini_map.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_navbar.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_nearby_chat.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_notification_well_button.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_object.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_object_icon.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_outfit_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_outfit_tab.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_participant_list.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_friends_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_groups.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_groups_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_nearby.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_nearby_multiselect.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_nearby_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_recent_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_picks.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_picks_plus.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_place.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_place_add_button.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_places_gear_folder.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_places_gear_landmark.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_profile_overflow.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_save_outfit.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_script_chiclet.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_slurl.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_teleport_history_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_teleport_history_item.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_teleport_history_tab.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_text_editor.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_topinfobar.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_agent.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_group.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_http.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_inventory.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_map.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_objectim.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_parcel.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_slapp.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_slurl.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_teleport.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_viewer.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_wearable_list_item.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_wearing_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_wearing_tab.xml create mode 100644 indra/newview/skins/minimal/xui/da/notifications.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_adhoc_control_panel.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_bottomtray.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_group_control_panel.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_im_control_panel.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_login.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_navigation_bar.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_people.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_side_tray_tab_caption.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_status_bar.xml diff --git a/indra/newview/skins/default/xui/da/floater_about_land.xml b/indra/newview/skins/default/xui/da/floater_about_land.xml index 46e1eca126..5b9e618666 100644 --- a/indra/newview/skins/default/xui/da/floater_about_land.xml +++ b/indra/newview/skins/default/xui/da/floater_about_land.xml @@ -346,6 +346,7 @@ Kun større parceller kan vises i søgning. + @@ -360,6 +361,7 @@ Kun større parceller kan vises i søgning. + @@ -426,7 +428,7 @@ Kun større parceller kan vises i søgning. (Defineret via estate) - Tillad adgang for alle ([MATURITY]) + Tillad offentlig adgang ([MATURITY]) (Bemærk: Ellers oprettes blokeringslinier) En eller flere af disse valg er indstillet på estate niveau diff --git a/indra/newview/skins/default/xui/da/floater_map.xml b/indra/newview/skins/default/xui/da/floater_map.xml index 5df9bb5f6e..4912d73ba0 100644 --- a/indra/newview/skins/default/xui/da/floater_map.xml +++ b/indra/newview/skins/default/xui/da/floater_map.xml @@ -3,6 +3,9 @@ [REGION](Dobbeltklik for at åbne kort, klik-og-træk for at panorere) + + [REGION](Dobbeltklik for at teleportere, træk for at panorere) + MINIKORT diff --git a/indra/newview/skins/default/xui/da/floater_tools.xml b/indra/newview/skins/default/xui/da/floater_tools.xml index 9e673d0d5b..8264e366c0 100644 --- a/indra/newview/skins/default/xui/da/floater_tools.xml +++ b/indra/newview/skins/default/xui/da/floater_tools.xml @@ -64,6 +64,8 @@ + - + Friends All + No attachments worn + Buy -- cgit v1.2.3 From 7645c6a19f9b110121d674604a56c5a407736885 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Thu, 16 Jun 2011 15:43:14 -0400 Subject: Added tag DRTVWR-60_2.7.1-release, 2.7.1-release for changeset a9abb9633a26 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 253639c564..7ea9140f5f 100644 --- a/.hgtags +++ b/.hgtags @@ -136,3 +136,5 @@ dac76a711da5f1489a01c1fa62ec97d99c25736d 2.6.6-release 8f2da1701c81a62352df2b8d413d27fb2cade9a6 2.6.3-release 77e5a08344c95738ab879f9671b7758cddd712a3 DRTVWR-56_2.6.9-release 77e5a08344c95738ab879f9671b7758cddd712a3 2.6.9-release +a9abb9633a266c8d2fe62411cfd1c86d32da72bf DRTVWR-60_2.7.1-release +a9abb9633a266c8d2fe62411cfd1c86d32da72bf 2.7.1-release -- cgit v1.2.3 From cc6e80412949639f52138adde5b909a298cd2242 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Jun 2011 15:58:34 -0400 Subject: SH-1166 FIX --- indra/newview/skins/default/xui/en/notifications.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index c8d1d6c9fd..09105c1d28 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6824,6 +6824,8 @@ Select residents to share with. icon="alert.tga" type="alert"> [LABEL] failed to upload: [MESSAGE] [IDENTIFIER] + +See the log file for details. Date: Thu, 16 Jun 2011 23:53:41 +0300 Subject: STORM-1352 WIP Attempting to fix a crash in LLNearbyChatScreenChannel::showToastsBottom(). Apparently, a nearby chat toast got somehow destroyed while still remaining in the list of active toasts. Attempt to sort active toasts in showToastsBottom() then triggered the crash. I don't know how to reproduce the crash, i.e. force destroying a toast in a way that its onClose() method (which would remove references to the toast) isn't called. So we'll just remove references to the toast whenever it's destroyed. --- indra/newview/llnearbychathandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 11dc496311..ae44c76038 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -268,6 +268,9 @@ bool LLNearbyChatScreenChannel::createPoolToast() toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1)); + // If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352). + toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, this, _1, false)); + LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << llendl; m_toast_pool.push_back(toast->getHandle()); return true; @@ -371,6 +374,8 @@ void LLNearbyChatScreenChannel::arrangeToasts() int sort_toasts_predicate(LLHandle first, LLHandle second) { + if (!first.get() || !second.get()) return 0; // STORM-1352 + F32 v1 = first.get()->getTimeLeftToLive(); F32 v2 = second.get()->getTimeLeftToLive(); return v1 > v2; -- cgit v1.2.3 From 6c5ae7f6ab3b844a135c6662a2f015eca684ab14 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Jun 2011 17:00:12 -0400 Subject: Fix for linux build failure, hopefully --- indra/newview/llmeshrepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 76079b2bf5..6e0722bcf9 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1455,7 +1455,7 @@ void dump_llsd_to_file(const LLSD& content, std::string filename) LLSD llsd_from_file(std::string filename) { - std::ifstream ifs(filename); + std::ifstream ifs(filename.c_str()); LLSD result; LLSDSerialize::fromXML(result,ifs); return result; -- cgit v1.2.3 From e63f6311be2b2bca9b45ddbf43b675200dc51486 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 16 Jun 2011 15:55:22 -0600 Subject: fix for STORM-1274: crash at LLVOCacheEntry::~LLVOCacheEntry() line 138 --- indra/newview/llvocache.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index bbb19a63f1..f0b5b50feb 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -137,10 +137,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) LLVOCacheEntry::~LLVOCacheEntry() { - if(mBuffer != mDP.getBuffer()) - { - delete[] mBuffer ; //just in case - } mDP.freeBuffer(); } -- cgit v1.2.3 From 274266badcddc3733c9dc145b2df57dab0455858 Mon Sep 17 00:00:00 2001 From: LanceCorrimal Date: Fri, 17 Jun 2011 09:19:42 +0200 Subject: Changed popups for accepting inv offers from SystemMessage to SystemMessageTip: STORM-323 --- indra/newview/llviewermessage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 01a5cb18db..743e4e1469 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1502,7 +1502,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); LLSD args; args["MESSAGE"] = log_message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } break; @@ -1676,7 +1676,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); LLSD args; args["MESSAGE"] = log_message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } // we will want to open this item when it comes back. @@ -1727,7 +1727,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD args; args["MESSAGE"] = log_message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } if (busy && (!mFromGroup && !mFromObject)) -- cgit v1.2.3 From 796624d947b3d1caba8cdf3f9aba6155c5b0a3d4 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 17 Jun 2011 13:07:14 -0400 Subject: STORM-1320 OPEN-21 STORM-312 Update libndofdev on linux. Fixes spacenavigator. --- autobuild.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index ec52d6e331..15212aa647 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - c81bacf922bb3b540d92b660364c48ce + 9bf7a96c1d2fadb180fda91740c945c6 url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ndofdev-linux-0.2-20101013.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-libndofdev-linux/rev/233137/arch/Linux/installer/libndofdev-0.3-linux-20110617.tar.bz2 name linux @@ -1524,7 +1524,7 @@ hash bb0abe962b3b8208ed2dab0424aab33d url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-pcre/rev/228822/arch/Linux/installer/pcre-7.6-linux-20110504.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-pcre/rev/228822/arch/Linux/installer/pcre-7.6-linux-20110504.tar.bz2 name linux -- cgit v1.2.3 From f86a488231dc9a629d44a9f6aa6bfc9aa0eb57b4 Mon Sep 17 00:00:00 2001 From: Squire Date: Fri, 17 Jun 2011 11:05:31 -0700 Subject: CHOP-662 - initial fix to problems with regex characters in Group names causing the LLDirIterator to crash the viewer when opening chat logs --- indra/llvfs/CMakeLists.txt | 1 + indra/llvfs/lldiriterator.cpp | 21 ++++++++--- indra/llvfs/tests/lldiriterator_test.cpp | 62 ++++++++++++++++++++++++++++++++ indra/newview/lllogchat.cpp | 2 +- 4 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 indra/llvfs/tests/lldiriterator_test.cpp diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt index b6d1ce61e5..f89da4d6c5 100644 --- a/indra/llvfs/CMakeLists.txt +++ b/indra/llvfs/CMakeLists.txt @@ -80,6 +80,7 @@ if (LL_TESTS) # UNIT TESTS SET(llvfs_TEST_SOURCE_FILES # none so far + lldiriterator.cpp ) LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}") diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 041436ed92..3b132862ad 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -121,6 +121,14 @@ bool LLDirIterator::Impl::next(std::string &fname) return found; } +/* +converts the incoming glob into a regex. This involves +converting incoming glob expressions to regex equivilents and +at the same time, escaping any regex meaningful characters which +do not have glob meaning, i.e. + .()+|^$ +in the input +*/ std::string glob_to_regex(const std::string& glob) { std::string regex; @@ -135,9 +143,6 @@ std::string glob_to_regex(const std::string& glob) switch (c) { - case '.': - regex+="\\."; - break; case '*': if (glob.begin() == i) { @@ -170,7 +175,15 @@ std::string glob_to_regex(const std::string& glob) case '!': regex+= square_brace_open ? '^' : c; break; - default: + case '.': // This collection have different regex meaning + case '^': // And so need escaping + case '(': + case ')': + case '+': + case '|': + case '$': + regex+='\\'; + default: regex+=c; break; } diff --git a/indra/llvfs/tests/lldiriterator_test.cpp b/indra/llvfs/tests/lldiriterator_test.cpp new file mode 100644 index 0000000000..7c2cd49e41 --- /dev/null +++ b/indra/llvfs/tests/lldiriterator_test.cpp @@ -0,0 +1,62 @@ +/** + * @file lldiriterator_test.cpp + * @date 2011-06 + * @brief LLDirIterator test cases. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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$ + */ + +#include "linden_common.h" +#include "lltut.h" +#include "../lldiriterator.h" + + +namespace tut +{ + + struct LLDirIteratorFixture + { + LLDirIteratorFixture() + { + } + }; + typedef test_group LLDirIteratorTest_factory; + typedef LLDirIteratorTest_factory::object LLDirIteratorTest_t; + LLDirIteratorTest_factory tf("LLDirIterator"); + + /* + CHOP-662 was originally introduced to deal with crashes deleting files from + a directory (VWR-25500). However, this introduced a crash looking for + old chat logs as the glob_to_regex function in lldiriterator wasn't escaping lots of regexp characters + */ + void test_chop_662(void) + { + LLDirIterator iter(".","+bad-group-name]+??-??.*"); + } + + template<> template<> + void LLDirIteratorTest_t::test<1>() + { + test_chop_662(); + } + +} \ No newline at end of file diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index efc4e23838..ebb5912ace 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -230,7 +230,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { - std::string invalidChars = "\"\'\\/?*:.<>|"; + std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars std::string::size_type position = filename.find_first_of(invalidChars); while (position != filename.npos) { -- cgit v1.2.3 From c4d37c3cae78ee785043c022344e1c4a68239dc8 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Fri, 17 Jun 2011 11:34:11 -0700 Subject: WIP INTL-46 Traditional Chinese translation update 6/17 --- .../newview/skins/default/xui/zh/floater_about.xml | 10 +- .../skins/default/xui/zh/floater_about_land.xml | 26 +-- .../default/xui/zh/floater_animation_preview.xml | 6 +- .../skins/default/xui/zh/floater_avatar_picker.xml | 8 +- .../default/xui/zh/floater_avatar_textures.xml | 8 +- .../skins/default/xui/zh/floater_buy_currency.xml | 2 +- .../skins/default/xui/zh/floater_buy_land.xml | 6 +- .../default/xui/zh/floater_day_cycle_options.xml | 2 +- .../skins/default/xui/zh/floater_gesture.xml | 8 +- .../skins/default/xui/zh/floater_god_tools.xml | 2 +- .../skins/default/xui/zh/floater_image_preview.xml | 2 +- .../skins/default/xui/zh/floater_incoming_call.xml | 6 +- .../xui/zh/floater_inventory_view_finder.xml | 4 +- .../skins/default/xui/zh/floater_media_browser.xml | 18 +- .../skins/default/xui/zh/floater_mem_leaking.xml | 2 +- .../skins/default/xui/zh/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/zh/floater_pay.xml | 8 +- .../skins/default/xui/zh/floater_pay_object.xml | 8 +- .../default/xui/zh/floater_preview_animation.xml | 6 +- .../default/xui/zh/floater_preview_gesture.xml | 14 +- .../skins/default/xui/zh/floater_script_debug.xml | 2 +- .../skins/default/xui/zh/floater_sell_land.xml | 2 +- .../skins/default/xui/zh/floater_snapshot.xml | 2 +- .../newview/skins/default/xui/zh/floater_stats.xml | 28 +-- .../newview/skins/default/xui/zh/floater_tools.xml | 204 ++++++++++----------- .../skins/default/xui/zh/floater_top_objects.xml | 16 +- .../skins/default/xui/zh/floater_url_entry.xml | 2 +- .../skins/default/xui/zh/floater_voice_effect.xml | 2 +- .../newview/skins/default/xui/zh/floater_water.xml | 2 +- .../skins/default/xui/zh/floater_web_content.xml | 4 +- .../skins/default/xui/zh/floater_window_size.xml | 2 +- .../skins/default/xui/zh/floater_world_map.xml | 4 +- .../newview/skins/default/xui/zh/inspect_group.xml | 6 +- .../skins/default/xui/zh/inspect_object.xml | 2 +- .../skins/default/xui/zh/menu_attachment_other.xml | 2 +- .../skins/default/xui/zh/menu_avatar_icon.xml | 2 +- .../skins/default/xui/zh/menu_avatar_other.xml | 2 +- .../skins/default/xui/zh/menu_gesture_gear.xml | 2 +- .../default/xui/zh/menu_inspect_avatar_gear.xml | 2 +- .../default/xui/zh/menu_inspect_object_gear.xml | 14 +- .../skins/default/xui/zh/menu_inventory.xml | 24 +-- .../default/xui/zh/menu_inventory_gear_default.xml | 8 +- .../newview/skins/default/xui/zh/menu_landmark.xml | 2 +- indra/newview/skins/default/xui/zh/menu_login.xml | 14 +- .../skins/default/xui/zh/menu_outfit_gear.xml | 8 +- .../skins/default/xui/zh/menu_participant_list.xml | 2 +- .../xui/zh/menu_people_groups_view_sort.xml | 2 +- .../skins/default/xui/zh/menu_people_nearby.xml | 2 +- .../xui/zh/menu_people_nearby_multiselect.xml | 2 +- .../skins/default/xui/zh/menu_picks_plus.xml | 2 +- indra/newview/skins/default/xui/zh/menu_place.xml | 2 +- .../default/xui/zh/menu_places_gear_folder.xml | 2 +- .../default/xui/zh/menu_places_gear_landmark.xml | 2 +- .../skins/default/xui/zh/menu_profile_overflow.xml | 2 +- indra/newview/skins/default/xui/zh/menu_viewer.xml | 52 +++--- indra/newview/skins/default/xui/zh/mime_types.xml | 2 +- .../newview/skins/default/xui/zh/notifications.xml | 36 ++-- .../default/xui/zh/panel_adhoc_control_panel.xml | 2 +- .../default/xui/zh/panel_avatar_list_item.xml | 2 +- .../skins/default/xui/zh/panel_edit_hair.xml | 2 +- .../skins/default/xui/zh/panel_edit_pants.xml | 2 +- .../skins/default/xui/zh/panel_edit_pick.xml | 12 +- .../skins/default/xui/zh/panel_edit_shape.xml | 22 +-- .../skins/default/xui/zh/panel_edit_shirt.xml | 2 +- .../skins/default/xui/zh/panel_edit_skirt.xml | 2 +- .../skins/default/xui/zh/panel_edit_socks.xml | 2 +- .../skins/default/xui/zh/panel_edit_tattoo.xml | 8 +- .../skins/default/xui/zh/panel_edit_wearable.xml | 8 +- .../skins/default/xui/zh/panel_group_general.xml | 6 +- .../skins/default/xui/zh/panel_group_invite.xml | 2 +- .../default/xui/zh/panel_group_land_money.xml | 6 +- .../skins/default/xui/zh/panel_group_notices.xml | 16 +- .../skins/default/xui/zh/panel_group_roles.xml | 2 +- .../default/xui/zh/panel_im_control_panel.xml | 2 +- indra/newview/skins/default/xui/zh/panel_me.xml | 2 +- .../xui/zh/panel_media_settings_general.xml | 2 +- .../xui/zh/panel_media_settings_permissions.xml | 10 +- .../skins/default/xui/zh/panel_nearby_chat_bar.xml | 4 +- .../skins/default/xui/zh/panel_nearby_media.xml | 6 +- .../skins/default/xui/zh/panel_notify_textbox.xml | 6 +- .../skins/default/xui/zh/panel_outfit_edit.xml | 6 +- .../skins/default/xui/zh/panel_pick_info.xml | 2 +- indra/newview/skins/default/xui/zh/panel_picks.xml | 14 +- .../skins/default/xui/zh/panel_place_profile.xml | 12 +- .../default/xui/zh/panel_preferences_chat.xml | 2 +- .../default/xui/zh/panel_preferences_general.xml | 34 ++-- .../default/xui/zh/panel_preferences_move.xml | 4 +- .../default/xui/zh/panel_preferences_sound.xml | 32 ++-- .../default/xui/zh/panel_prim_media_controls.xml | 2 +- .../newview/skins/default/xui/zh/panel_profile.xml | 4 +- .../skins/default/xui/zh/panel_profile_view.xml | 2 +- .../skins/default/xui/zh/panel_region_covenant.xml | 10 +- .../skins/default/xui/zh/panel_region_debug.xml | 14 +- .../skins/default/xui/zh/panel_region_estate.xml | 2 +- .../skins/default/xui/zh/panel_region_general.xml | 12 +- .../skins/default/xui/zh/panel_side_tray.xml | 2 +- .../default/xui/zh/panel_teleport_history.xml | 2 +- .../skins/default/xui/zh/sidepanel_appearance.xml | 2 +- .../skins/default/xui/zh/sidepanel_task_info.xml | 20 +- indra/newview/skins/default/xui/zh/strings.xml | 176 +++++++++--------- .../skins/default/xui/zh/teleport_strings.xml | 2 +- 101 files changed, 549 insertions(+), 549 deletions(-) diff --git a/indra/newview/skins/default/xui/zh/floater_about.xml b/indra/newview/skins/default/xui/zh/floater_about.xml index 58e8c41c38..bee940ddc1 100644 --- a/indra/newview/skins/default/xui/zh/floater_about.xml +++ b/indra/newview/skins/default/xui/zh/floater_about.xml @@ -25,11 +25,11 @@ OpenGL Version: [OPENGL_VERSION] -libcurl Version: [LIBCURL_VERSION] -J2C Decoder Version: [J2C_VERSION] -Audio Driver Version: [AUDIO_DRIVER_VERSION] -Qt Webkit Version: [QT_WEBKIT_VERSION] -Voice Server Version: [VOICE_VERSION] +libcurl 版本: [LIBCURL_VERSION] +J2C 解碼器版本: [J2C_VERSION] +音效驅動程式版本: [AUDIO_DRIVER_VERSION] +Qt Webkit 版本: [QT_WEBKIT_VERSION] +語音伺服器版本: [VOICE_VERSION] (無) diff --git a/indra/newview/skins/default/xui/zh/floater_about_land.xml b/indra/newview/skins/default/xui/zh/floater_about_land.xml index a9142b22ad..efd8909e67 100644 --- a/indra/newview/skins/default/xui/zh/floater_about_land.xml +++ b/indra/newview/skins/default/xui/zh/floater_about_land.xml @@ -81,7 +81,7 @@ 分級: - Adult + 成人 擁有者: @@ -186,7 +186,7 @@ 分級: - Adult + 成人 Resale: @@ -289,7 +289,7 @@ Only large parcels can be listed in search. Moderate Content - Adult Content + 成人內容 Your parcel information or content is considered moderate. @@ -307,35 +307,35 @@ Only large parcels can be listed in search. 禁止推撞(地區設定覆蓋) - Allow other Residents to: + 允許其他居民去: - - + + 建造: - Object Entry: + 物件進入: - Run Scripts: + 執行腳本: - Land Options: + 土地選項: - - + + - + @@ -467,7 +467,7 @@ Only large parcels can be listed in search. - Banned Residents + 被封鎖的居民 -- cgit v1.2.3 From 44308a50c2389b3d021d5f6bfa125b06f1b643d1 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Fri, 24 Jun 2011 11:09:26 -0700 Subject: sync with viewer-development --- indra/newview/skins/default/xui/en/panel_cof_wearables.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml index bbeb592e96..9e70706603 100644 --- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml +++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml @@ -52,7 +52,7 @@ multi_select="true" name="list_attachments" top="0" - width="311"> + width="311"/> Date: Sat, 25 Jun 2011 11:08:36 -0400 Subject: STORM-1326 [ALL LANGS] (Spanish) [HARDCODED] Selling land, advice with "Anyone" in English. --- doc/contributions.txt | 1 + indra/newview/llfloaterauction.cpp | 3 ++- indra/newview/llfloatersellland.cpp | 3 ++- indra/newview/skins/default/xui/en/strings.xml | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index b744f4db3e..ce7afd2b84 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -446,6 +446,7 @@ Jonathan Yap STORM-1313 STORM-899 STORM-1273 + STORM-1326 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index c95b046707..c6743ca13b 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -55,6 +55,7 @@ #include "llrender.h" #include "llsdutil.h" #include "llsdutil_math.h" +#include "lltrans.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -457,7 +458,7 @@ void LLFloaterAuction::onClickSellToAnyone(void* data) LLSD args; args["LAND_SIZE"] = llformat("%d", area); args["SALE_PRICE"] = llformat("%d", sale_price); - args["NAME"] = "Anyone"; + args["NAME"] = LLTrans::getString("Anyone"); LLNotification::Params params("ConfirmLandSaleChange"); // Re-use existing dialog params.substitutions(args) diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 8558a1277c..3434841d09 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -41,6 +41,7 @@ #include "llviewerparcelmgr.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" +#include "lltrans.h" class LLAvatarName; @@ -451,7 +452,7 @@ void LLFloaterSellLandUI::doSellLand(void *userdata) // Do a confirmation S32 sale_price = self->getChild("price")->getValue(); S32 area = parcel->getArea(); - std::string authorizedBuyerName = "Anyone"; + std::string authorizedBuyerName = LLTrans::getString("Anyone"); bool sell_to_anyone = true; if ("user" == self->getChild("sell_to")->getValue().asString()) { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 71f48c833d..143a989d32 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2250,6 +2250,9 @@ Returns a string with the requested data about the region mainland teen + + anyone + error -- cgit v1.2.3 From 9a40b84beded2bb0d0d2adb062b1611bdeb756ed Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 25 Jun 2011 16:37:10 -0400 Subject: STORM-1302 (all langs) [TRANSLATED BUT IN ENG] (Spanish) Side Menu > Gente tab > MIS AMIGOS tab > buttons "Call", "Share" and "Teleport" and their tooltips --- doc/contributions.txt | 1 + indra/newview/skins/default/xui/da/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/de/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/en/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/es/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/fr/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/it/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/ja/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/pl/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/pt/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/zh/panel_people.xml | 8 ++++---- 11 files changed, 41 insertions(+), 40 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index b744f4db3e..cc376df3ea 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -446,6 +446,7 @@ Jonathan Yap STORM-1313 STORM-899 STORM-1273 + STORM-1302 Kage Pixel VWR-11 Ken March diff --git a/indra/newview/skins/default/xui/da/panel_people.xml b/indra/newview/skins/default/xui/da/panel_people.xml index 925492b2d7..66a128cd13 100644 --- a/indra/newview/skins/default/xui/da/panel_people.xml +++ b/indra/newview/skins/default/xui/da/panel_people.xml @@ -66,16 +66,16 @@ Leder du efter nogen at være sammen med? Prøv [secondlife:///app/worldmap Verd