Fixing the scripts and investigating the scripting

This commit is contained in:
samcake 2017-06-20 17:23:44 -07:00
parent 3727b2af7e
commit d853a76376
12 changed files with 56 additions and 139 deletions

View file

@ -1874,7 +1874,7 @@ void Application::initializeGL() {
render::CullFunctor cullFunctor = LODManager::shouldRender;
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraFrame", cullFunctor);
// _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraFrame", cullFunctor);
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, isDeferred);
_renderEngine->load();
_renderEngine->registerScene(_main3DScene);

View file

@ -63,4 +63,6 @@ void EngineStats::run(const RenderContextPointer& renderContext) {
config->frameSetPipelineCount = _gpuStats._PSNumSetPipelines;
config->frameSetInputFormatCount = _gpuStats._ISNumFormatChanges;
config->emitDirty();
}

View file

@ -1006,6 +1006,7 @@ void ScriptEngine::run() {
emit runningStateChanged();
{
PROFILE_RANGE(script, _fileNameString);
evaluate(_scriptContents, _fileNameString);
maybeEmitUncaughtException(__FUNCTION__);
}

View file

@ -49,11 +49,15 @@ Item {
property var valueMax : 1
property var _values : new Array()
property var _values
property var tick : 0
function createValues() {
if (!_values) {
_values = new Array();
}
for (var i =0; i < plots.length; i++) {
var plot = plots[i];
var object = plot["object"] || root.object;
var value = plot["prop"];
@ -80,6 +84,7 @@ Item {
Component.onCompleted: {
createValues();
console.log("PlotPerf plot values is", JSON.stringify(_values));
}
function resetMax() {
for (var i = 0; i < _values.length; i++) {
@ -93,7 +98,7 @@ Item {
var VALUE_HISTORY_SIZE = 100;
tick++;
var currentValueMax = 0
for (var i = 0; i < _values.length; i++) {
@ -128,7 +133,6 @@ Item {
if ((valueMax < currentValueMax) || (tick % VALUE_HISTORY_SIZE == 0)) {
valueMax = currentValueMax;
}
mycanvas.requestPaint()
}

View file

@ -13,7 +13,6 @@ import "configSlider"
import "../lib/plotperf"
Column {
property var mainViewTask: Render.getConfig("RenderMainView")
spacing: 8
Column {
id: surfaceGeometry
@ -33,7 +32,7 @@ Column {
ConfigSlider {
label: qsTr(modelData.split(":")[0])
integral: (modelData.split(":")[3] == 'true')
config: mainViewTask.getConfig("AmbientOcclusion")
config: Render.getConfig("RenderMainView.AmbientOcclusion")
property: modelData.split(":")[1]
max: modelData.split(":")[2]
min: 0.0
@ -51,8 +50,8 @@ Column {
]
CheckBox {
text: qsTr(modelData.split(":")[0])
checked: mainViewTask.getConfig("AmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { mainViewTask.getConfig("AmbientOcclusion")[modelData.split(":")[1]] = checked }
checked: Render.getConfig("RenderMainView.AmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { Render.getConfig("RenderMainView.AmbientOcclusion")[modelData.split(":")[1]] = checked }
}
}
}
@ -63,8 +62,8 @@ Column {
]
CheckBox {
text: qsTr(modelData.split(":")[0])
checked: mainViewTask.getConfig("DebugAmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { mainViewTask.getConfig("DebugAmbientOcclusion")[modelData.split(":")[1]] = checked }
checked: Render.getConfig("RenderMainView.DebugAmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { Render.getConfig("RenderMainView.DebugAmbientOcclusion")[modelData.split(":")[1]] = checked }
}
}
}
@ -73,7 +72,7 @@ Column {
PlotPerf {
title: "Timing"
height: 50
object: mainViewTask.getConfig("AmbientOcclusion")
object: Render.getConfig("RenderMainView.AmbientOcclusion")
valueUnit: "ms"
valueScale: 1
valueNumDigits: "3"

View file

@ -13,7 +13,7 @@ var qml = Script.resolvePath('ambientOcclusionPass.qml');
var window = new OverlayWindow({
title: 'Ambient Occlusion Pass',
source: qml,
width: 400, height: 250,
width: 400, height: 300,
});
window.setPosition(Window.innerWidth - 420, 50 + 550 + 50);
window.closed.connect(function() { Script.stop(); });

View file

@ -13,7 +13,7 @@ var qml = Script.resolvePath('deferredLighting.qml');
var window = new OverlayWindow({
title: 'Lighting',
source: qml,
width: 400, height:350,
width: 400, height:400,
});
window.setPosition(Window.innerWidth - 420, 50);
window.closed.connect(function() { Script.stop(); });

View file

@ -15,7 +15,7 @@ var window = new OverlayWindow({
title: 'Light Clustering',
source: qml,
width: 400,
height: 300
height: 400
});
window.setPosition(Window.innerWidth - 420, 50 + 250 + 50 + 250 + 50 );
window.closed.connect(function() { Script.stop(); });

View file

@ -17,19 +17,18 @@ Column {
Column {
id: lightClustering
spacing: 10
property var mainViewTask: Render.getConfig("RenderMainView");
Column{
PlotPerf {
title: "Light CLustering Timing"
height: 50
object: mainViewTask.getConfig("LightClustering")
object: Render.getConfig("RenderMainView.LightClustering")
valueUnit: "ms"
valueScale: 1
valueNumDigits: "4"
plots: [
{
object: mainViewTask.getConfig("LightClustering"),
object: Render.getConfig("RenderMainView.LightClustering"),
prop: "cpuRunTime",
label: "time",
scale: 1,
@ -41,19 +40,19 @@ Column {
PlotPerf {
title: "Lights"
height: 50
object: mainViewTask.getConfig("LightClustering")
object: Render.getConfig("RenderMainView.LightClustering")
valueUnit: ""
valueScale: 1
valueNumDigits: "0"
plots: [
{
object: mainViewTask.getConfig("LightClustering"),
object: Render.getConfig("RenderMainView.LightClustering"),
prop: "numClusteredLights",
label: "visible",
color: "#D959FE"
},
{
object: mainViewTask.getConfig("LightClustering"),
object: Render.getConfig("RenderMainView.LightClustering"),
prop: "numInputLights",
label: "input",
color: "#FED959"
@ -64,25 +63,25 @@ Column {
PlotPerf {
title: "Scene Lights"
height: 80
object: mainViewTask.getConfig("LightClustering")
object: Render.getConfig("RenderMainView.LightClustering")
valueUnit: ""
valueScale: 1
valueNumDigits: "0"
plots: [
{
object: mainViewTask.getConfig("LightClustering"),
object: Render.getConfig("RenderMainView.LightClustering"),
prop: "numSceneLights",
label: "current",
color: "#00B4EF"
},
{
object: mainViewTask.getConfig("LightClustering"),
object: Render.getConfig("RenderMainView.LightClustering"),
prop: "numFreeSceneLights",
label: "free",
color: "#1AC567"
},
{
object: mainViewTask.getConfig("LightClustering"),
object: Render.getConfig("RenderMainView.LightClustering"),
prop: "numAllocatedSceneLights",
label: "allocated",
color: "#9495FF"
@ -93,7 +92,7 @@ Column {
ConfigSlider {
label: qsTr("Range Near [m]")
integral: false
config: mainViewTask.getConfig("LightClustering")
config: Render.getConfig("RenderMainView.LightClustering")
property: "rangeNear"
max: 20.0
min: 0.1
@ -101,7 +100,7 @@ Column {
ConfigSlider {
label: qsTr("Range Far [m]")
integral: false
config: mainViewTask.getConfig("LightClustering")
config: Render.getConfig("RenderMainView.LightClustering")
property: "rangeFar"
max: 500.0
min: 100.0
@ -109,7 +108,7 @@ Column {
ConfigSlider {
label: qsTr("Grid X")
integral: true
config: mainViewTask.getConfig("LightClustering")
config: Render.getConfig("RenderMainView.LightClustering")
property: "dimX"
max: 32
min: 1
@ -117,7 +116,7 @@ Column {
ConfigSlider {
label: qsTr("Grid Y")
integral: true
config: mainViewTask.getConfig("LightClustering")
config: Render.getConfig("RenderMainView.LightClustering")
property: "dimY"
max: 32
min: 1
@ -125,33 +124,33 @@ Column {
ConfigSlider {
label: qsTr("Grid Z")
integral: true
config: mainViewTask.getConfig("LightClustering")
config: Render.getConfig("RenderMainView.LightClustering")
property: "dimZ"
max: 31
min: 1
}
CheckBox {
text: "Freeze"
checked: mainViewTask.getConfig("LightClustering")["freeze"]
onCheckedChanged: { mainViewTask.getConfig("LightClustering")["freeze"] = checked }
checked: Render.getConfig("RenderMainView.LightClustering")["freeze"]
onCheckedChanged: { Render.getConfig("RenderMainView.LightClustering")["freeze"] = checked }
}
CheckBox {
text: "Draw Grid"
checked: mainViewTask.getConfig("DebugLightClusters")["doDrawGrid"]
onCheckedChanged: { mainViewTask.getConfig("DebugLightClusters")["doDrawGrid"] = checked }
checked: Render.getConfig("RenderMainView.DebugLightClusters")["doDrawGrid"]
onCheckedChanged: { Render.getConfig("RenderMainView.DebugLightClusters")["doDrawGrid"] = checked }
}
CheckBox {
text: "Draw Cluster From Depth"
checked: mainViewTask.getConfig("DebugLightClusters")["doDrawClusterFromDepth"]
onCheckedChanged: { mainViewTask.getConfig("DebugLightClusters")["doDrawClusterFromDepth"] = checked }
checked: Render.getConfig("RenderMainView.DebugLightClusters")["doDrawClusterFromDepth"]
onCheckedChanged: { Render.getConfig("RenderMainView.DebugLightClusters")["doDrawClusterFromDepth"] = checked }
}
CheckBox {
text: "Draw Content"
checked: mainViewTask.getConfig("DebugLightClusters")["doDrawContent"]
onCheckedChanged: { mainViewTask.getConfig("DebugLightClusters")["doDrawContent"] = checked }
checked: Render.getConfig("RenderMainView.DebugLightClusters")["doDrawContent"]
onCheckedChanged: { Render.getConfig("RenderMainView.DebugLightClusters")["doDrawContent"] = checked }
}
Label {
text: "Num Cluster Items = " + mainViewTask.getConfig("LightClustering")["numClusteredLightReferences"].toFixed(0)
text: "Num Cluster Items = " + Render.getConfig("RenderMainView.LightClustering")["numClusteredLightReferences"].toFixed(0)
}
}

View file

@ -14,8 +14,8 @@ var qml = Script.resolvePath('stats.qml');
var window = new OverlayWindow({
title: 'Render Stats',
source: qml,
width: 320,
height: 720
width: 400,
height: 400
});
window.setPosition(500, 50);
window.closed.connect(function() { Script.stop(); });

View file

@ -21,99 +21,13 @@ Item {
spacing: 8
anchors.fill:parent
property var mainViewTask: Render.getConfig("RenderMainView");
property var config: mainViewTask.getConfig("Stats")
property var config: Render.getConfig("Stats")
function evalEvenHeight() {
// Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ?
return (height - spacing * (children.length - 1)) / children.length
}
PlotPerf {
title: "Num Buffers"
height: parent.evalEvenHeight()
object: stats.config
plots: [
{
prop: "bufferCPUCount",
label: "CPU",
color: "#00B4EF"
},
{
prop: "bufferGPUCount",
label: "GPU",
color: "#1AC567"
}
]
}
PlotPerf {
title: "gpu::Buffer Memory"
height: parent.evalEvenHeight()
object: stats.config
valueScale: 1048576
valueUnit: "Mb"
valueNumDigits: "1"
plots: [
{
prop: "bufferCPUMemoryUsage",
label: "CPU",
color: "#00B4EF"
},
{
prop: "bufferGPUMemoryUsage",
label: "GPU",
color: "#1AC567"
}
]
}
PlotPerf {
title: "Num Textures"
height: parent.evalEvenHeight()
object: stats.config
plots: [
{
prop: "textureCPUCount",
label: "CPU",
color: "#00B4EF"
},
{
prop: "textureGPUCount",
label: "GPU",
color: "#1AC567"
},
{
prop: "texturePendingGPUTransferCount",
label: "Transfer",
color: "#9495FF"
}
]
}
PlotPerf {
title: "gpu::Texture Memory"
height: parent.evalEvenHeight()
object: stats.config
valueScale: 1048576
valueUnit: "Mb"
valueNumDigits: "1"
plots: [
{
prop: "textureCPUMemoryUsage",
label: "CPU",
color: "#00B4EF"
},
{
prop: "textureGPUMemoryUsage",
label: "GPU",
color: "#1AC567"
},
{
prop: "textureGPUVirtualMemoryUsage",
label: "GPU Virtual",
color: "#9495FF"
}
]
}
PlotPerf {
title: "Triangles"
height: parent.evalEvenHeight()
@ -183,9 +97,9 @@ Item {
]
}
property var drawOpaqueConfig: mainViewTask.getConfig("DrawOpaqueDeferred")
property var drawTransparentConfig: mainViewTask.getConfig("DrawTransparentDeferred")
property var drawLightConfig: mainViewTask.getConfig("DrawLight")
property var drawOpaqueConfig: Render.getConfig("RenderMainView.DrawOpaqueDeferred")
property var drawTransparentConfig: Render.getConfig("RenderMainView.DrawTransparentDeferred")
property var drawLightConfig: Render.getConfig("RenderMainView.DrawLight")
PlotPerf {
title: "Items"
@ -200,13 +114,13 @@ Item {
color: "#1AC567"
},
{
object: mainViewTask.getConfig("DrawTransparentDeferred"),
object: Render.getConfig("RenderMainView.DrawTransparentDeferred"),
prop: "numDrawn",
label: "Translucents",
color: "#00B4EF"
},
{
object: mainViewTask.getConfig("DrawLight"),
object: Render.getConfig("RenderMainView.DrawLight"),
prop: "numDrawn",
label: "Lights",
color: "#FED959"
@ -223,25 +137,25 @@ Item {
valueNumDigits: "2"
plots: [
{
object: mainViewTask.getConfig("DrawOpaqueDeferred"),
object: Render.getConfig("RenderMainView.DrawOpaqueDeferred"),
prop: "cpuRunTime",
label: "Opaques",
color: "#1AC567"
},
{
object: mainViewTask.getConfig("DrawTransparentDeferred"),
object: Render.getConfig("RenderMainView.DrawTransparentDeferred"),
prop: "cpuRunTime",
label: "Translucents",
color: "#00B4EF"
},
{
object: mainViewTask.getConfig("RenderDeferred"),
object: Render.getConfig("RenderMainView.RenderDeferred"),
prop: "cpuRunTime",
label: "Lighting",
color: "#FED959"
},
{
object: mainViewTask.getConfig("RenderDeferredTask"),
object: Render.getConfig("RenderMainView.RenderDeferredTask"),
prop: "cpuRunTime",
label: "RenderFrame",
color: "#E2334D"

View file

@ -20,9 +20,7 @@ Item {
id: stats
spacing: 8
anchors.fill:parent
property var mainViewTask: Render.getConfig("RenderMainView");
function evalEvenHeight() {
// Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ?
return (height - spacing * (children.length - 1)) / children.length