mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:28:46 +02:00
Rendering just the overlay layer and improving the resoruceCache inspector to sort
This commit is contained in:
parent
ee5de175eb
commit
4480d56433
4 changed files with 178 additions and 95 deletions
|
@ -240,7 +240,7 @@ void GraphicsEngine::render_performFrame() {
|
||||||
renderArgs._context->setStereoViews(stereoEyeOffsets);
|
renderArgs._context->setStereoViews(stereoEyeOffsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool renderScene = true;
|
||||||
gpu::FramebufferPointer finalFramebuffer;
|
gpu::FramebufferPointer finalFramebuffer;
|
||||||
QSize finalFramebufferSize;
|
QSize finalFramebufferSize;
|
||||||
{
|
{
|
||||||
|
@ -277,13 +277,32 @@ void GraphicsEngine::render_performFrame() {
|
||||||
qApp->getApplicationCompositor().setFrameInfo(_renderFrameCount, eyeToWorld, sensorToWorld);
|
qApp->getApplicationCompositor().setFrameInfo(_renderFrameCount, eyeToWorld, sensorToWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
|
if (renderScene) {
|
||||||
PROFILE_RANGE(render, "/runRenderFrame");
|
PROFILE_RANGE(render, "/runRenderFrame");
|
||||||
renderArgs._hudOperator = displayPlugin->getHUDOperator();
|
renderArgs._hudOperator = displayPlugin->getHUDOperator();
|
||||||
renderArgs._hudTexture = qApp->getApplicationOverlay().getOverlayTexture();
|
renderArgs._hudTexture = qApp->getApplicationOverlay().getOverlayTexture();
|
||||||
renderArgs._takingSnapshot = qApp->takeSnapshotOperators(snapshotOperators);
|
renderArgs._takingSnapshot = qApp->takeSnapshotOperators(snapshotOperators);
|
||||||
renderArgs._blitFramebuffer = finalFramebuffer;
|
renderArgs._blitFramebuffer = finalFramebuffer;
|
||||||
render_runRenderFrame(&renderArgs);
|
render_runRenderFrame(&renderArgs);
|
||||||
|
} else {
|
||||||
|
// Instead of clearing, drawing the splash screen background (that looks like the default skybox)
|
||||||
|
gpu::doInBatch("splashFrame", _gpuContext, [&](gpu::Batch& batch) {
|
||||||
|
batch.setFramebuffer(finalFramebuffer);
|
||||||
|
batch.enableSkybox(true);
|
||||||
|
batch.enableStereo(isStereo);
|
||||||
|
batch.clearDepthStencilFramebuffer(1.0, 0);
|
||||||
|
batch.setViewportTransform({ 0, 0, finalFramebuffer->getSize() });
|
||||||
|
_splashScreen->render(batch, viewFrustum, renderArgs._renderMethod == RenderArgs::RenderMethod::FORWARD);
|
||||||
|
});
|
||||||
|
|
||||||
|
// THen just use the HUD operator of thedisplay plugin
|
||||||
|
gpu::doInBatch("drawHUD", renderArgs._context, [&](gpu::Batch& batch) {
|
||||||
|
batch.setFramebuffer(finalFramebuffer);
|
||||||
|
// TODO we should do more transform setup here just like in "REnderHUDLayerTask.cpp CompositeHUD job if we wanted to support stereo
|
||||||
|
displayPlugin->getHUDOperator()(batch, qApp->getApplicationOverlay().getOverlayTexture());
|
||||||
|
});
|
||||||
|
// And voila
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,6 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
_numLoadingResources++;
|
|
||||||
resource = createResource(url);
|
resource = createResource(url);
|
||||||
resource->setExtra(extra);
|
resource->setExtra(extra);
|
||||||
resource->setExtraHash(extraHash);
|
resource->setExtraHash(extraHash);
|
||||||
|
@ -391,7 +390,6 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
||||||
resource->setCache(this);
|
resource->setCache(this);
|
||||||
resource->moveToThread(qApp->thread());
|
resource->moveToThread(qApp->thread());
|
||||||
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
||||||
connect(resource.data(), &Resource::finished, this, &ResourceCache::decreaseNumLoading);
|
|
||||||
{
|
{
|
||||||
QWriteLocker locker(&_resourcesLock);
|
QWriteLocker locker(&_resourcesLock);
|
||||||
_resources[url].insert(extraHash, resource);
|
_resources[url].insert(extraHash, resource);
|
||||||
|
@ -518,10 +516,12 @@ void ResourceCache::updateTotalSize(const qint64& deltaSize) {
|
||||||
|
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceCache::decreaseNumLoading() {
|
void ResourceCache::incrementNumLoading() {
|
||||||
|
_numLoadingResources++;
|
||||||
|
}
|
||||||
|
void ResourceCache::decrementNumLoading() {
|
||||||
_numLoadingResources--;
|
_numLoadingResources--;
|
||||||
emit dirty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QSharedPointer<Resource>> ResourceCache::getLoadingRequests() {
|
QList<QSharedPointer<Resource>> ResourceCache::getLoadingRequests() {
|
||||||
|
|
|
@ -201,7 +201,6 @@ class ResourceCache : public QObject {
|
||||||
Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty)
|
Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty)
|
||||||
|
|
||||||
Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty)
|
Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty)
|
||||||
Q_PROPERTY(size_t numPending READ getNumPendingResources NOTIFY dirty)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -209,12 +208,12 @@ public:
|
||||||
size_t getSizeTotalResources() const { return _totalResourcesSize; }
|
size_t getSizeTotalResources() const { return _totalResourcesSize; }
|
||||||
size_t getNumCachedResources() const { return _numUnusedResources; }
|
size_t getNumCachedResources() const { return _numUnusedResources; }
|
||||||
size_t getSizeCachedResources() const { return _unusedResourcesSize; }
|
size_t getSizeCachedResources() const { return _unusedResourcesSize; }
|
||||||
size_t getNumPendingResources() const { return _numPendingResources; }
|
|
||||||
size_t getNumLoadingResources() const { return _numLoadingResources; }
|
size_t getNumLoadingResources() const { return _numLoadingResources; }
|
||||||
|
|
||||||
Q_INVOKABLE QVariantList getResourceList();
|
Q_INVOKABLE QVariantList getResourceList();
|
||||||
|
|
||||||
Q_INVOKABLE void decreaseNumLoading();
|
Q_INVOKABLE void incrementNumLoading();
|
||||||
|
Q_INVOKABLE void decrementNumLoading();
|
||||||
|
|
||||||
static void setRequestLimit(uint32_t limit);
|
static void setRequestLimit(uint32_t limit);
|
||||||
static uint32_t getRequestLimit() { return DependencyManager::get<ResourceCacheSharedItems>()->getRequestLimit(); }
|
static uint32_t getRequestLimit() { return DependencyManager::get<ResourceCacheSharedItems>()->getRequestLimit(); }
|
||||||
|
@ -296,7 +295,6 @@ private:
|
||||||
|
|
||||||
std::atomic<size_t> _numTotalResources { 0 };
|
std::atomic<size_t> _numTotalResources { 0 };
|
||||||
std::atomic<qint64> _totalResourcesSize { 0 };
|
std::atomic<qint64> _totalResourcesSize { 0 };
|
||||||
std::atomic<size_t> _numPendingResources{ 0 };
|
|
||||||
std::atomic<size_t> _numLoadingResources{ 0 };
|
std::atomic<size_t> _numLoadingResources{ 0 };
|
||||||
|
|
||||||
// Cached resources
|
// Cached resources
|
||||||
|
@ -326,7 +324,6 @@ class ScriptableResourceCache : public QObject {
|
||||||
Q_PROPERTY(size_t sizeTotal READ getSizeTotalResources NOTIFY dirty)
|
Q_PROPERTY(size_t sizeTotal READ getSizeTotalResources NOTIFY dirty)
|
||||||
Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty)
|
Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty)
|
||||||
|
|
||||||
Q_PROPERTY(size_t numPending READ getNumPendingResources NOTIFY dirty)
|
|
||||||
Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty)
|
Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty)
|
||||||
|
|
||||||
Q_PROPERTY(size_t numGlobalQueriesPending READ getNumGlobalQueriesPending NOTIFY dirty)
|
Q_PROPERTY(size_t numGlobalQueriesPending READ getNumGlobalQueriesPending NOTIFY dirty)
|
||||||
|
@ -405,7 +402,6 @@ private:
|
||||||
size_t getSizeTotalResources() const { return _resourceCache->getSizeTotalResources(); }
|
size_t getSizeTotalResources() const { return _resourceCache->getSizeTotalResources(); }
|
||||||
size_t getNumCachedResources() const { return _resourceCache->getNumCachedResources(); }
|
size_t getNumCachedResources() const { return _resourceCache->getNumCachedResources(); }
|
||||||
size_t getSizeCachedResources() const { return _resourceCache->getSizeCachedResources(); }
|
size_t getSizeCachedResources() const { return _resourceCache->getSizeCachedResources(); }
|
||||||
size_t getNumPendingResources() const { return _resourceCache->getNumPendingResources(); }
|
|
||||||
size_t getNumLoadingResources() const { return _resourceCache->getNumLoadingResources(); }
|
size_t getNumLoadingResources() const { return _resourceCache->getNumLoadingResources(); }
|
||||||
|
|
||||||
size_t getNumGlobalQueriesPending() const { return ResourceCache::getLoadingRequestCount(); }
|
size_t getNumGlobalQueriesPending() const { return ResourceCache::getLoadingRequestCount(); }
|
||||||
|
|
|
@ -10,11 +10,14 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.5
|
import QtQuick.Controls 2.5
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQml.Models 2.12
|
||||||
|
|
||||||
import "../../lib/prop" as Prop
|
import "../../lib/prop" as Prop
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root;
|
id: root;
|
||||||
|
Prop.Global { id: global }
|
||||||
|
|
||||||
anchors.fill: parent.fill
|
anchors.fill: parent.fill
|
||||||
property var cache: {}
|
property var cache: {}
|
||||||
property string cacheResourceName: ""
|
property string cacheResourceName: ""
|
||||||
|
@ -68,6 +71,9 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property var itemFields: ['name', 'root', 'base', 'path', 'index']
|
||||||
|
property var itemFieldsVisibility: {'name': true, 'root': false, 'base':false, 'path':false, 'index':false}
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: header
|
id: header
|
||||||
|
@ -88,6 +94,7 @@ Item {
|
||||||
Item {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
height: totalCount.height
|
||||||
|
|
||||||
Prop.PropScalar {
|
Prop.PropScalar {
|
||||||
id: totalCount
|
id: totalCount
|
||||||
|
@ -111,14 +118,150 @@ Item {
|
||||||
readOnly: true
|
readOnly: true
|
||||||
onSourceValueVarChanged: { /*console.log( root.cacheResourceName + " NumCached Value Changed!!!!");*/updateItemListFromCache() }
|
onSourceValueVarChanged: { /*console.log( root.cacheResourceName + " NumCached Value Changed!!!!");*/updateItemListFromCache() }
|
||||||
}
|
}
|
||||||
height: totalCount.height
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: orderSelector.height
|
||||||
|
|
||||||
|
Prop.PropComboBox {
|
||||||
|
anchors.left: parent.left
|
||||||
|
id: orderSelector
|
||||||
|
model: [ "name", "base", "root" ]
|
||||||
|
property var selectedIndex: currentIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
Prop.PropCheckBox {
|
||||||
|
id: showName
|
||||||
|
text: 'name'
|
||||||
|
checked: itemFieldsVisibility['name']
|
||||||
|
}
|
||||||
|
Prop.PropCheckBox {
|
||||||
|
id: showRoot
|
||||||
|
text: 'root'
|
||||||
|
checked: itemFieldsVisibility['root']
|
||||||
|
}
|
||||||
|
Prop.PropCheckBox {
|
||||||
|
id: showBase
|
||||||
|
text: 'base'
|
||||||
|
checked: itemFieldsVisibility['base']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ListModel {
|
Component {
|
||||||
id: resourceItemsModel
|
id: resouceItemDelegate
|
||||||
|
MouseArea {
|
||||||
|
id: dragArea
|
||||||
|
property bool held: false
|
||||||
|
anchors { left: parent.left; right: parent.right }
|
||||||
|
height: item.height
|
||||||
|
onPressed: {held = true}
|
||||||
|
onReleased: {held = false}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: item
|
||||||
|
width: parent.width
|
||||||
|
height: global.slimHeight
|
||||||
|
color: dragArea.held ? global.colorBackHighlight : (model.index % 2 ? global.colorBackShadow : global.colorBack)
|
||||||
|
Row {
|
||||||
|
id: itemRow
|
||||||
|
anchors.verticalCenter : parent.verticalCenter
|
||||||
|
Prop.PropText {
|
||||||
|
id: itemIndex
|
||||||
|
text: model.index
|
||||||
|
width: 30
|
||||||
|
}
|
||||||
|
Prop.PropSplitter {
|
||||||
|
visible: showRoot.checked
|
||||||
|
size:8
|
||||||
|
}
|
||||||
|
Prop.PropLabel {
|
||||||
|
visible: showRoot.checked
|
||||||
|
text: model.root
|
||||||
|
width: 30
|
||||||
|
}
|
||||||
|
Prop.PropSplitter {
|
||||||
|
visible: showBase.checked
|
||||||
|
size:8
|
||||||
|
}
|
||||||
|
Prop.PropLabel {
|
||||||
|
visible: showBase.checked
|
||||||
|
text: model.base
|
||||||
|
width: 60
|
||||||
|
}
|
||||||
|
Prop.PropSplitter {
|
||||||
|
visible: showName.checked
|
||||||
|
size:8
|
||||||
|
}
|
||||||
|
Prop.PropLabel {
|
||||||
|
visible: showName.checked
|
||||||
|
text: model.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
DelegateModel {
|
||||||
|
id: visualModel
|
||||||
|
|
||||||
|
model: ListModel {}
|
||||||
|
|
||||||
|
property var lessThan: [
|
||||||
|
function(left, right) { return left.name < right.name },
|
||||||
|
function(left, right) { return left.base < right.base },
|
||||||
|
function(left, right) { return left.root < right.root }
|
||||||
|
]
|
||||||
|
|
||||||
|
property int sortOrder: orderSelector.selectedIndex
|
||||||
|
onSortOrderChanged: items.setGroups(0, items.count, "unsorted")
|
||||||
|
|
||||||
|
function insertPosition(lessThan, item) {
|
||||||
|
var lower = 0
|
||||||
|
var upper = items.count
|
||||||
|
while (lower < upper) {
|
||||||
|
var middle = Math.floor(lower + (upper - lower) / 2)
|
||||||
|
var result = lessThan(item.model, items.get(middle).model);
|
||||||
|
if (result) {
|
||||||
|
upper = middle
|
||||||
|
} else {
|
||||||
|
lower = middle + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lower
|
||||||
|
}
|
||||||
|
|
||||||
|
function sort(lessThan) {
|
||||||
|
while (unsortedItems.count > 0) {
|
||||||
|
var item = unsortedItems.get(0)
|
||||||
|
var index = insertPosition(lessThan, item)
|
||||||
|
|
||||||
|
item.groups = "items"
|
||||||
|
items.move(item.itemsIndex, index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
items.includeByDefault: false
|
||||||
|
groups: DelegateModelGroup {
|
||||||
|
id: unsortedItems
|
||||||
|
name: "unsorted"
|
||||||
|
|
||||||
|
includeByDefault: true
|
||||||
|
onChanged: {
|
||||||
|
if (visualModel.sortOrder == visualModel.lessThan.length)
|
||||||
|
setGroups(0, count, "items")
|
||||||
|
else
|
||||||
|
visualModel.sort(visualModel.lessThan[visualModel.sortOrder])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
delegate: resouceItemDelegate
|
||||||
|
}
|
||||||
|
property alias resourceItemsModel: visualModel.model
|
||||||
property var currentItemsList: new Array();
|
property var currentItemsList: new Array();
|
||||||
|
|
||||||
function packItemEntry(item) {
|
function packItemEntry(item) {
|
||||||
|
@ -135,6 +278,7 @@ Item {
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function resetItemList(itemList) {
|
function resetItemList(itemList) {
|
||||||
currentItemsList = []
|
currentItemsList = []
|
||||||
resourceItemsModel.clear()
|
resourceItemsModel.clear()
|
||||||
|
@ -146,86 +290,11 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateItemList(newItemList) {
|
function updateItemList(newItemList) {
|
||||||
resetItemList(newItemList)
|
resetItemList(newItemList)
|
||||||
/*
|
|
||||||
var nextListLength = (currentItemList.length < newItemList.length ? newItemList.length : currentItemList.length )
|
|
||||||
var nextList = new Array(nextListLength)
|
|
||||||
|
|
||||||
var addedList = []
|
|
||||||
var removedList = []
|
|
||||||
var movedList = []
|
|
||||||
|
|
||||||
for (var i in currentItemList) {
|
|
||||||
var item = currentItemList[i]
|
|
||||||
var foundPos = newItemList.findIndex(item)
|
|
||||||
if (foundPos == i) {
|
|
||||||
newList[i] = item
|
|
||||||
newItemList[i] = 0
|
|
||||||
} else if (foundPos == -1) {
|
|
||||||
removedList.push(i)
|
|
||||||
} else {
|
|
||||||
movedList.push([i,foundPos])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i in newItemList) {
|
|
||||||
var item = newItemList[i]
|
|
||||||
if (item != 0) {
|
|
||||||
var foundPos = currentItemList.findIndex(item)
|
|
||||||
if (foundPos == -1) {
|
|
||||||
addedList.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (var i in itemList) {
|
|
||||||
newList[i] = itemList[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
/*currentItemsList.clear()
|
|
||||||
resourceItemsModel.clear()
|
|
||||||
for (var i in itemList) {
|
|
||||||
currentItemsList.append(itemList[i].toString())
|
|
||||||
resourceItemsModel.append(packItemEntry(currentItemsList[i]))
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: resouceItemDelegate
|
|
||||||
Row {
|
|
||||||
id: itemRow
|
|
||||||
Prop.PropText {
|
|
||||||
text: model.index
|
|
||||||
width: 30
|
|
||||||
}
|
|
||||||
Prop.PropSplitter {
|
|
||||||
size:8
|
|
||||||
}
|
|
||||||
Prop.PropLabel {
|
|
||||||
text: model.root
|
|
||||||
width: 30
|
|
||||||
}
|
|
||||||
Prop.PropSplitter {
|
|
||||||
size:8
|
|
||||||
}
|
|
||||||
Prop.PropLabel {
|
|
||||||
text: model.base
|
|
||||||
width: 60
|
|
||||||
}
|
|
||||||
Prop.PropSplitter {
|
|
||||||
size:8
|
|
||||||
}
|
|
||||||
Prop.PropLabel {
|
|
||||||
text: model.name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
anchors.top: header.bottom
|
anchors.top: header.bottom
|
||||||
|
@ -235,7 +304,6 @@ Item {
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
id: listView
|
id: listView
|
||||||
model: resourceItemsModel
|
model: visualModel
|
||||||
delegate: resouceItemDelegate
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue