mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 02:35:56 +02:00
Merge branch 'warnings-win' of github.com:Atlante45/hifi into warnings-win
This commit is contained in:
commit
4bfa279b1b
5 changed files with 74 additions and 46 deletions
|
@ -3431,10 +3431,10 @@ namespace render {
|
||||||
|
|
||||||
// Background rendering decision
|
// Background rendering decision
|
||||||
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||||
auto skybox = model::SkyboxPointer();
|
|
||||||
if (skyStage->getBackgroundMode() == model::SunSkyStage::NO_BACKGROUND) {
|
if (skyStage->getBackgroundMode() == model::SunSkyStage::NO_BACKGROUND) {
|
||||||
|
// this line intentionally left blank
|
||||||
} else if (skyStage->getBackgroundMode() == model::SunSkyStage::SKY_DOME) {
|
} else if (skyStage->getBackgroundMode() == model::SunSkyStage::SKY_DOME) {
|
||||||
if (/*!selfAvatarOnly &&*/ Menu::getInstance()->isOptionChecked(MenuOption::Stars)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) {
|
||||||
PerformanceTimer perfTimer("stars");
|
PerformanceTimer perfTimer("stars");
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||||
"Application::payloadRender<BackgroundRenderData>() ... stars...");
|
"Application::payloadRender<BackgroundRenderData>() ... stars...");
|
||||||
|
@ -3500,8 +3500,7 @@ namespace render {
|
||||||
}
|
}
|
||||||
} else if (skyStage->getBackgroundMode() == model::SunSkyStage::SKY_BOX) {
|
} else if (skyStage->getBackgroundMode() == model::SunSkyStage::SKY_BOX) {
|
||||||
PerformanceTimer perfTimer("skybox");
|
PerformanceTimer perfTimer("skybox");
|
||||||
|
auto skybox = skyStage->getSkybox();
|
||||||
skybox = skyStage->getSkybox();
|
|
||||||
if (skybox) {
|
if (skybox) {
|
||||||
skybox->render(batch, *(qApp->getDisplayViewFrustum()));
|
skybox->render(batch, *(qApp->getDisplayViewFrustum()));
|
||||||
}
|
}
|
||||||
|
@ -3767,6 +3766,10 @@ void Application::clearDomainOctreeDetails() {
|
||||||
|
|
||||||
// reset the model renderer
|
// reset the model renderer
|
||||||
getEntities()->clear();
|
getEntities()->clear();
|
||||||
|
|
||||||
|
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||||
|
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::domainChanged(const QString& domainHostname) {
|
void Application::domainChanged(const QString& domainHostname) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ static const float LATE_MIX_RIGHT_DEFAULT = 90.0f;
|
||||||
static const float WET_DRY_MIX_DEFAULT = 50.0f;
|
static const float WET_DRY_MIX_DEFAULT = 50.0f;
|
||||||
|
|
||||||
static void setOption(QScriptValue arguments, const QString name, float defaultValue, float& variable) {
|
static void setOption(QScriptValue arguments, const QString name, float defaultValue, float& variable) {
|
||||||
variable = arguments.property(name).isNumber() ? arguments.property(name).toNumber() : defaultValue;
|
variable = arguments.property(name).isNumber() ? (float)arguments.property(name).toNumber() : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) {
|
AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) {
|
||||||
|
|
|
@ -226,9 +226,16 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
||||||
|
|
||||||
while (!toProcess.empty()) {
|
while (!toProcess.empty()) {
|
||||||
EntityItemPointer childEntity = std::static_pointer_cast<EntityItem>(toProcess.dequeue());
|
EntityItemPointer childEntity = std::static_pointer_cast<EntityItem>(toProcess.dequeue());
|
||||||
|
if (!childEntity) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BoundingBoxRelatedProperties newChildBBRelProperties(childEntity);
|
BoundingBoxRelatedProperties newChildBBRelProperties(childEntity);
|
||||||
|
EntityTreeElementPointer containingElement = childEntity->getElement();
|
||||||
|
if (!containingElement) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
UpdateEntityOperator theChildOperator(getThisPointer(),
|
UpdateEntityOperator theChildOperator(getThisPointer(),
|
||||||
childEntity->getElement(),
|
containingElement,
|
||||||
childEntity, newChildBBRelProperties);
|
childEntity, newChildBBRelProperties);
|
||||||
recurseTreeWithOperator(&theChildOperator);
|
recurseTreeWithOperator(&theChildOperator);
|
||||||
foreach (SpatiallyNestablePointer childChild, childEntity->getChildren()) {
|
foreach (SpatiallyNestablePointer childChild, childEntity->getChildren()) {
|
||||||
|
|
|
@ -48,35 +48,32 @@ template <
|
||||||
>
|
>
|
||||||
class GLEscrow {
|
class GLEscrow {
|
||||||
public:
|
public:
|
||||||
|
static const uint64_t MAX_UNSIGNALED_TIME = USECS_PER_SECOND / 2;
|
||||||
|
|
||||||
struct Item {
|
struct Item {
|
||||||
T _value;
|
const T _value;
|
||||||
GLsync _sync;
|
GLsync _sync;
|
||||||
uint64_t _created;
|
const uint64_t _created;
|
||||||
|
|
||||||
Item(T value, GLsync sync) :
|
Item(T value, GLsync sync) :
|
||||||
_value(value), _sync(sync), _created(usecTimestampNow())
|
_value(value), _sync(sync), _created(usecTimestampNow())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t age() {
|
uint64_t age() const {
|
||||||
return usecTimestampNow() - _created;
|
return usecTimestampNow() - _created;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool signaled() {
|
bool signaled() const {
|
||||||
auto result = glClientWaitSync(_sync, 0, 0);
|
auto result = glClientWaitSync(_sync, 0, 0);
|
||||||
if (GL_TIMEOUT_EXPIRED != result && GL_WAIT_FAILED != result) {
|
if (GL_TIMEOUT_EXPIRED != result && GL_WAIT_FAILED != result) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (age() > (USECS_PER_SECOND / 2)) {
|
|
||||||
qWarning() << "Long unsignaled sync";
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using Mutex = std::recursive_mutex;
|
using Mutex = std::mutex;
|
||||||
using Lock = std::unique_lock<Mutex>;
|
|
||||||
using Recycler = std::function<void(T t)>;
|
using Recycler = std::function<void(T t)>;
|
||||||
// deque gives us random access, double ended push & pop and size, all in constant time
|
// deque gives us random access, double ended push & pop and size, all in constant time
|
||||||
using Deque = std::deque<Item>;
|
using Deque = std::deque<Item>;
|
||||||
|
@ -86,9 +83,32 @@ public:
|
||||||
_recycler = recycler;
|
_recycler = recycler;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t depth() {
|
template <typename F>
|
||||||
|
void withLock(F f) {
|
||||||
|
using Lock = std::unique_lock<Mutex>;
|
||||||
Lock lock(_mutex);
|
Lock lock(_mutex);
|
||||||
return _submits.size();
|
f();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename F>
|
||||||
|
bool tryLock(F f) {
|
||||||
|
using Lock = std::unique_lock<Mutex>;
|
||||||
|
bool result = false;
|
||||||
|
Lock lock(_mutex, std::try_to_lock_t());
|
||||||
|
if (lock.owns_lock()) {
|
||||||
|
f();
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t depth() {
|
||||||
|
size_t result{ 0 };
|
||||||
|
withLock([&]{
|
||||||
|
result = _submits.size();
|
||||||
|
});
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit a new resource from the producer context
|
// Submit a new resource from the producer context
|
||||||
|
@ -103,11 +123,9 @@ public:
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
withLock([&]{
|
||||||
Lock lock(_mutex);
|
|
||||||
_submits.push_back(Item(t, writeSync));
|
_submits.push_back(Item(t, writeSync));
|
||||||
}
|
});
|
||||||
|
|
||||||
return cleanTrash();
|
return cleanTrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,13 +137,13 @@ public:
|
||||||
// On the one hand using try_lock() reduces the chance of blocking the consumer thread,
|
// On the one hand using try_lock() reduces the chance of blocking the consumer thread,
|
||||||
// but if the produce thread is going fast enough, it could effectively
|
// but if the produce thread is going fast enough, it could effectively
|
||||||
// starve the consumer out of ever actually getting resources.
|
// starve the consumer out of ever actually getting resources.
|
||||||
if (_mutex.try_lock()) {
|
tryLock([&]{
|
||||||
|
// May be called on any thread, but must be inside a locked section
|
||||||
if (signaled(_submits, 0)) {
|
if (signaled(_submits, 0)) {
|
||||||
result = _submits.at(0)._value;
|
result = _submits.at(0)._value;
|
||||||
_submits.pop_front();
|
_submits.pop_front();
|
||||||
}
|
}
|
||||||
_mutex.unlock();
|
});
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,37 +171,45 @@ public:
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
Lock lock(_mutex);
|
withLock([&]{
|
||||||
_releases.push_back(Item(t, readSync));
|
_releases.push_back(Item(t, readSync));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t cleanTrash() {
|
size_t cleanTrash() {
|
||||||
size_t wastedWork{ 0 };
|
size_t wastedWork{ 0 };
|
||||||
List trash;
|
List trash;
|
||||||
{
|
tryLock([&]{
|
||||||
|
while (!_submits.empty()) {
|
||||||
|
const auto& item = _submits.front();
|
||||||
|
if (!item._sync || item.age() < MAX_UNSIGNALED_TIME) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
qWarning() << "Long unsignaled sync " << item._sync << " unsignaled for " << item.age();
|
||||||
|
_trash.push_front(item);
|
||||||
|
_submits.pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
// We only ever need one ready item available in the list, so if the
|
// We only ever need one ready item available in the list, so if the
|
||||||
// second item is signaled (implying the first is as well, remove the first
|
// second item is signaled (implying the first is as well, remove the first
|
||||||
// item. Iterate until the SECOND item in the list is not in the ready state
|
// item. Iterate until the SECOND item in the list is not in the ready state
|
||||||
// The signaled function takes care of checking against the deque size
|
// The signaled function takes care of checking against the deque size
|
||||||
while (signaled(_submits, 1)) {
|
while (signaled(_submits, 1)) {
|
||||||
pop(_submits);
|
_trash.push_front(_submits.front());
|
||||||
|
_submits.pop_front();
|
||||||
++wastedWork;
|
++wastedWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stuff in the release queue can be cleared out as soon as it's signaled
|
// Stuff in the release queue can be cleared out as soon as it's signaled
|
||||||
while (signaled(_releases, 0)) {
|
while (signaled(_releases, 0)) {
|
||||||
pop(_releases);
|
_trash.push_front(_releases.front());
|
||||||
|
_releases.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
trash.swap(_trash);
|
||||||
// FIXME I don't think this lock should be necessary, only the submitting thread
|
});
|
||||||
// touches the trash
|
|
||||||
Lock lock(_mutex);
|
|
||||||
trash.swap(_trash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME maybe doing a timing on the deleters and warn if it's taking excessive time?
|
// FIXME maybe doing a timing on the deleters and warn if it's taking excessive time?
|
||||||
// although we are out of the lock, so it shouldn't be blocking anything
|
// although we are out of the lock, so it shouldn't be blocking anything
|
||||||
std::for_each(trash.begin(), trash.end(), [&](typename List::const_reference item) {
|
std::for_each(trash.begin(), trash.end(), [&](typename List::const_reference item) {
|
||||||
|
@ -197,14 +223,6 @@ private:
|
||||||
return wastedWork;
|
return wastedWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
// May be called on any thread, but must be inside a locked section
|
|
||||||
void pop(Deque& deque) {
|
|
||||||
Lock lock(_mutex);
|
|
||||||
auto& item = deque.front();
|
|
||||||
_trash.push_front(item);
|
|
||||||
deque.pop_front();
|
|
||||||
}
|
|
||||||
|
|
||||||
// May be called on any thread, but must be inside a locked section
|
// May be called on any thread, but must be inside a locked section
|
||||||
bool signaled(Deque& deque, size_t i) {
|
bool signaled(Deque& deque, size_t i) {
|
||||||
if (i >= deque.size()) {
|
if (i >= deque.size()) {
|
||||||
|
|
|
@ -216,7 +216,7 @@ void renderItems(const SceneContextPointer& sceneContext, const RenderContextPoi
|
||||||
|
|
||||||
class FetchItems {
|
class FetchItems {
|
||||||
public:
|
public:
|
||||||
typedef std::function<void (const RenderContextPointer& context, int count)> ProbeNumItems;
|
typedef std::function<void (const RenderContextPointer& context, size_t count)> ProbeNumItems;
|
||||||
FetchItems(const ProbeNumItems& probe): _probeNumItems(probe) {}
|
FetchItems(const ProbeNumItems& probe): _probeNumItems(probe) {}
|
||||||
FetchItems(const ItemFilter& filter, const ProbeNumItems& probe): _filter(filter), _probeNumItems(probe) {}
|
FetchItems(const ItemFilter& filter, const ProbeNumItems& probe): _filter(filter), _probeNumItems(probe) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue