Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2434 Intel HD4000 compatibility pass #2541

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 1 addition & 52 deletions indra/newview/llglsandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,57 +1121,6 @@ F32 gpu_benchmark()

LLGLSLShader::unbind();

F32 time_passed = 0; // seconds

{ //run CPU timer benchmark
glFinish();
gBenchmarkProgram.bind();
for (S32 c = -1; c < samples && time_passed < time_limit; ++c)
{
LLTimer timer;
timer.start();

for (U32 i = 0; i < count; ++i)
{
dest[i].bindTarget();
texHolder.bind(i);
buff->setBuffer();
buff->drawArrays(LLRender::TRIANGLES, 0, 3);
dest[i].flush();
}

//wait for current batch of copies to finish
glFinish();

F32 time = timer.getElapsedTimeF32();
time_passed += time;

if (c >= 0) // <-- ignore the first sample as it tends to be artificially slow
{
//store result in gigabytes per second
F32 gb = (F32)((F64)(res * res * 8 * count)) / (1000000000);
F32 gbps = gb / time;
results.push_back(gbps);
}
}
gBenchmarkProgram.unbind();
}

std::sort(results.begin(), results.end());

F32 gbps = results[results.size()/2];

LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to CPU timers, " << (F32)results.size() << " tests took " << time_passed << " seconds" << LL_ENDL;

#if LL_DARWIN
if (gbps > 512.f)
{
LL_WARNS("Benchmark") << "Memory bandwidth is improbably high and likely incorrect; discarding result." << LL_ENDL;
//OSX is probably lying, discard result
return -1.f;
}
#endif

RunitaiLinden marked this conversation as resolved.
Show resolved Hide resolved
// run GPU timer benchmark
{
ShaderProfileHelper initProfile;
Expand All @@ -1196,7 +1145,7 @@ F32 gpu_benchmark()
F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
F64 gpixels_drawn = samples_drawn / 1000000000.0;
F32 samples_sec = (F32)(gpixels_drawn/seconds);
gbps = samples_sec*4; // 4 bytes per sample
F32 gbps = samples_sec*4; // 4 bytes per sample

LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;

Expand Down
11 changes: 10 additions & 1 deletion indra/newview/llviewerregion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,16 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
if (features.has("GLTFEnabled"))
{
bool enabled = features["GLTFEnabled"];
gSavedSettings.setBOOL("GLTFEnabled", enabled);

// call setShaders the first time GLTFEnabled is received as true (causes GLTF specific shaders to be loaded)
if (enabled != gSavedSettings.getBOOL("GLTFEnabled"))
{
gSavedSettings.setBOOL("GLTFEnabled", enabled);
if (enabled)
{
LLViewerShaderMgr::instance()->setShaders();
}
}
}
else
{
Expand Down
89 changes: 51 additions & 38 deletions indra/newview/llviewershadermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,20 @@ void LLViewerShaderMgr::finalizeShaderList()
mShaderList.push_back(&gDeferredDiffuseProgram);
mShaderList.push_back(&gDeferredBumpProgram);
mShaderList.push_back(&gDeferredPBROpaqueProgram);
mShaderList.push_back(&gGLTFPBRMetallicRoughnessProgram);

if (gSavedSettings.getBOOL("GLTFEnabled"))
{
mShaderList.push_back(&gGLTFPBRMetallicRoughnessProgram);
}

mShaderList.push_back(&gDeferredAvatarProgram);
mShaderList.push_back(&gDeferredTerrainProgram);

for (U32 paint_type = 0; paint_type < TERRAIN_PAINT_TYPE_COUNT; ++paint_type)
{
mShaderList.push_back(&gDeferredPBRTerrainProgram[paint_type]);
}

mShaderList.push_back(&gDeferredDiffuseAlphaMaskProgram);
mShaderList.push_back(&gDeferredNonIndexedDiffuseAlphaMaskProgram);
mShaderList.push_back(&gDeferredTreeProgram);
Expand Down Expand Up @@ -1323,26 +1330,29 @@ bool LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}

if (success)
if (gSavedSettings.getBOOL("GLTFEnabled"))
{
gGLTFPBRMetallicRoughnessProgram.mName = "GLTF PBR Metallic Roughness Shader";
gGLTFPBRMetallicRoughnessProgram.mFeatures.hasSrgb = true;
if (success)
{
gGLTFPBRMetallicRoughnessProgram.mName = "GLTF PBR Metallic Roughness Shader";
gGLTFPBRMetallicRoughnessProgram.mFeatures.hasSrgb = true;

gGLTFPBRMetallicRoughnessProgram.mShaderFiles.clear();
gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessV.glsl", GL_VERTEX_SHADER));
gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessF.glsl", GL_FRAGMENT_SHADER));
gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gGLTFPBRMetallicRoughnessProgram.clearPermutations();
gGLTFPBRMetallicRoughnessProgram.mShaderFiles.clear();
gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessV.glsl", GL_VERTEX_SHADER));
gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessF.glsl", GL_FRAGMENT_SHADER));
gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gGLTFPBRMetallicRoughnessProgram.clearPermutations();

success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);

//llassert(success);
if (!success)
{
LL_WARNS() << "Failed to create GLTF PBR Metallic Roughness Shader, disabling!" << LL_ENDL;
gSavedSettings.setBOOL("RenderCanUseGLTFPBROpaqueShaders", false);
// continue as if this shader never happened
success = true;
//llassert(success);
if (!success)
{
LL_WARNS() << "Failed to create GLTF PBR Metallic Roughness Shader, disabling!" << LL_ENDL;
gSavedSettings.setBOOL("RenderCanUseGLTFPBROpaqueShaders", false);
// continue as if this shader never happened
success = true;
}
}
}

Expand Down Expand Up @@ -2977,29 +2987,32 @@ bool LLViewerShaderMgr::loadShadersInterface()
success = gCopyDepthProgram.createShader();
}

if (success)
if (gSavedSettings.getBOOL("LocalTerrainPaintEnabled"))
{
LLGLSLShader* shader = &gPBRTerrainBakeProgram;
U32 bit_depth = gSavedSettings.getU32("TerrainPaintBitDepth");
// LLTerrainPaintMap currently uses an RGB8 texture internally
bit_depth = llclamp(bit_depth, 1, 8);
shader->mName = llformat("Terrain Bake Shader RGB%o", bit_depth);
shader->mFeatures.isPBRTerrain = true;

shader->mShaderFiles.clear();
shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeV.glsl", GL_VERTEX_SHADER));
shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeF.glsl", GL_FRAGMENT_SHADER));
shader->mShaderLevel = mShaderLevel[SHADER_INTERFACE];
const U32 value_range = (1 << bit_depth) - 1;
shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range));
success = success && shader->createShader();
//llassert(success);
if (!success)
if (success)
{
LL_WARNS() << "Failed to create shader '" << shader->mName << "', disabling!" << LL_ENDL;
gSavedSettings.setBOOL("RenderCanUseTerrainBakeShaders", false);
// continue as if this shader never happened
success = true;
LLGLSLShader* shader = &gPBRTerrainBakeProgram;
U32 bit_depth = gSavedSettings.getU32("TerrainPaintBitDepth");
// LLTerrainPaintMap currently uses an RGB8 texture internally
bit_depth = llclamp(bit_depth, 1, 8);
shader->mName = llformat("Terrain Bake Shader RGB%o", bit_depth);
shader->mFeatures.isPBRTerrain = true;

shader->mShaderFiles.clear();
shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeV.glsl", GL_VERTEX_SHADER));
shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeF.glsl", GL_FRAGMENT_SHADER));
shader->mShaderLevel = mShaderLevel[SHADER_INTERFACE];
const U32 value_range = (1 << bit_depth) - 1;
shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range));
success = success && shader->createShader();
//llassert(success);
if (!success)
{
LL_WARNS() << "Failed to create shader '" << shader->mName << "', disabling!" << LL_ENDL;
gSavedSettings.setBOOL("RenderCanUseTerrainBakeShaders", false);
// continue as if this shader never happened
success = true;
}
}
}

Expand Down
17 changes: 17 additions & 0 deletions indra/newview/llwearablelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "llnotificationsutil.h"
#include "llinventorymodel.h"
#include "lltrans.h"
#include "llappviewer.h"

// Callback struct
struct LLWearableArrivedData
Expand Down Expand Up @@ -97,6 +98,22 @@ void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& weara
// static
void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID& uuid, void* userdata, S32 status, LLExtStat ext_status )
{
if (!LLCoros::on_main_coro())
{
// if triggered from a coroutine, dispatch to main thread before accessing app state
std::string filename_in = filename;
LLUUID uuid_in = uuid;

LLAppViewer::instance()->postToMainCoro([=]()
{
processGetAssetReply(filename_in.c_str(), uuid_in, userdata, status, ext_status);
});

return;
}

LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;

bool isNewWearable = false;
LLWearableArrivedData* data = (LLWearableArrivedData*) userdata;
LLViewerWearable* wearable = NULL; // NULL indicates failure
Expand Down
Loading