mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
More profiling ranges and updated performance testing scripts
This commit is contained in:
parent
cac239ad88
commit
446f800aee
6 changed files with 112 additions and 47 deletions
|
@ -9,9 +9,7 @@
|
||||||
var NUM_MOONS = 20;
|
var NUM_MOONS = 20;
|
||||||
// 1 = 60Hz, 2 = 30Hz, 3 = 20Hz, etc
|
// 1 = 60Hz, 2 = 30Hz, 3 = 20Hz, etc
|
||||||
var UPDATE_FREQUENCY_DIVISOR = 2;
|
var UPDATE_FREQUENCY_DIVISOR = 2;
|
||||||
|
|
||||||
var MAX_RANGE = 75.0;
|
var MAX_RANGE = 75.0;
|
||||||
var LIFETIME = 600;
|
|
||||||
var SCALE = 0.1;
|
var SCALE = 0.1;
|
||||||
|
|
||||||
var center = Vec3.sum(MyAvatar.position,
|
var center = Vec3.sum(MyAvatar.position,
|
||||||
|
@ -22,44 +20,47 @@ var PARTICLE_MIN_SIZE = 2.50;
|
||||||
var PARTICLE_MAX_SIZE = 2.50;
|
var PARTICLE_MAX_SIZE = 2.50;
|
||||||
|
|
||||||
|
|
||||||
var planet = Entities.addEntity({
|
function deleteAnimationTestEntitites() {
|
||||||
type: "Sphere",
|
var ids = Entities.findEntities(MyAvatar.position, 50);
|
||||||
position: center,
|
for (var i = 0; i < ids.length; i++) {
|
||||||
dimensions: { x: 10 * SCALE, y: 10 * SCALE, z: 10 * SCALE },
|
var id = ids[i];
|
||||||
color: { red: 0, green: 0, blue: 255 },
|
var properties = Entities.getEntityProperties(id);
|
||||||
ignoreCollisions: true,
|
if (properties.name == "AnimationTest") {
|
||||||
collisionsWillMove: false,
|
Entities.deleteEntity(id);
|
||||||
lifetime: LIFETIME
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteAnimationTestEntitites();
|
||||||
|
|
||||||
var moons = [];
|
var moons = [];
|
||||||
|
|
||||||
// Create initial test particles that will move according to gravity from the planets
|
// Create initial test particles that will move according to gravity from the planets
|
||||||
for (var i = 0; i < NUM_MOONS; i++) {
|
for (var i = 0; i < NUM_MOONS; i++) {
|
||||||
var radius = PARTICLE_MIN_SIZE + Math.random() * PARTICLE_MAX_SIZE;
|
var radius = PARTICLE_MIN_SIZE + Math.random() * PARTICLE_MAX_SIZE;
|
||||||
radius *= SCALE;
|
radius *= SCALE;
|
||||||
var gray = Math.random() * 155;
|
var gray = Math.random() * 155;
|
||||||
var position = { x: 10 , y: i * 3, z: 0 };
|
var position = { x: 10 , y: i * 3, z: 0 };
|
||||||
var color = { red: 100 + gray, green: 100 + gray, blue: 100 + gray };
|
var color = { red: 100 + gray, green: 100 + gray, blue: 100 + gray };
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
color = { red: 255, green: 0, blue: 0 };
|
color = { red: 255, green: 0, blue: 0 };
|
||||||
radius = 6 * SCALE
|
radius = 6 * SCALE
|
||||||
}
|
}
|
||||||
moons.push(Entities.addEntity({
|
moons.push(Entities.addEntity({
|
||||||
type: "Sphere",
|
type: "Sphere",
|
||||||
position: Vec3.sum(center, position),
|
name: "AnimationTest",
|
||||||
dimensions: { x: radius, y: radius, z: radius },
|
position: Vec3.sum(center, position),
|
||||||
color: color,
|
dimensions: { x: radius, y: radius, z: radius },
|
||||||
ignoreCollisions: true,
|
color: color,
|
||||||
lifetime: LIFETIME,
|
ignoreCollisions: true,
|
||||||
collisionsWillMove: false
|
collisionsWillMove: false
|
||||||
}));
|
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
|
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
Entities.deleteEntity(planet);
|
|
||||||
for (var i = 0; i < moons.length; i++) {
|
for (var i = 0; i < moons.length; i++) {
|
||||||
Entities.deleteEntity(moons[i]);
|
Entities.deleteEntity(moons[i]);
|
||||||
}
|
}
|
||||||
|
@ -70,22 +71,20 @@ var updateCount = 0;
|
||||||
function update(deltaTime) {
|
function update(deltaTime) {
|
||||||
// Apply gravitational force from planets
|
// Apply gravitational force from planets
|
||||||
totalTime += deltaTime;
|
totalTime += deltaTime;
|
||||||
updateCount++;
|
updateCount++;
|
||||||
if (0 != updateCount % UPDATE_FREQUENCY_DIVISOR) {
|
if (0 != updateCount % UPDATE_FREQUENCY_DIVISOR) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var planetProperties = Entities.getEntityProperties(planet);
|
|
||||||
var center = planetProperties.position;
|
|
||||||
var particlePos = Entities.getEntityProperties(moons[0]).position;
|
var particlePos = Entities.getEntityProperties(moons[0]).position;
|
||||||
var relativePos = Vec3.subtract(particlePos.position, center);
|
var relativePos = Vec3.subtract(particlePos.position, center);
|
||||||
for (var t = 0; t < moons.length; t++) {
|
for (var t = 0; t < moons.length; t++) {
|
||||||
var thetaDelta = (Math.PI * 2.0 / NUM_MOONS) * t;
|
var thetaDelta = (Math.PI * 2.0 / NUM_MOONS) * t;
|
||||||
var y = Math.sin(totalTime + thetaDelta) * 10.0 * SCALE;
|
var y = Math.sin(totalTime + thetaDelta) * 10.0 * SCALE;
|
||||||
var x = Math.cos(totalTime + thetaDelta) * 10.0 * SCALE;
|
var x = Math.cos(totalTime + thetaDelta) * 10.0 * SCALE;
|
||||||
var newBasePos = Vec3.sum({ x: 0, y: y, z: x }, center);
|
var newBasePos = Vec3.sum({ x: 0, y: y, z: x }, center);
|
||||||
Entities.editEntity(moons[t], { position: newBasePos});
|
Entities.editEntity(moons[t], { position: newBasePos});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(deleteAnimationTestEntitites);
|
||||||
|
|
58
examples/cubePerfTest.js
Normal file
58
examples/cubePerfTest.js
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2015/07/01
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
var SIDE_SIZE = 10;
|
||||||
|
|
||||||
|
var center = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
|
var DEGREES_TO_RADIANS = Math.PI / 180.0;
|
||||||
|
var PARTICLE_MIN_SIZE = 2.50;
|
||||||
|
var PARTICLE_MAX_SIZE = 2.50;
|
||||||
|
var LIFETIME = 600;
|
||||||
|
var boxes = [];
|
||||||
|
|
||||||
|
var ids = Entities.findEntities({ x: 512, y: 512, z: 512 }, 50);
|
||||||
|
for (var i = 0; i < ids.length; i++) {
|
||||||
|
var id = ids[i];
|
||||||
|
var properties = Entities.getEntityProperties(id);
|
||||||
|
if (properties.name == "PerfTest") {
|
||||||
|
Entities.deleteEntity(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create initial test particles that will move according to gravity from the planets
|
||||||
|
for (var x = 0; x < SIDE_SIZE; x++) {
|
||||||
|
for (var y = 0; y < SIDE_SIZE; y++) {
|
||||||
|
for (var z = 0; z < SIDE_SIZE; z++) {
|
||||||
|
var gray = Math.random() * 155;
|
||||||
|
var cube = Math.random() > 0.5;
|
||||||
|
var color = { red: 100 + gray, green: 100 + gray, blue: 100 + gray };
|
||||||
|
var position = { x: 512 + x * 0.2, y: 512 + y * 0.2, z: 512 + z * 0.2};
|
||||||
|
var radius = Math.random() * 0.1;
|
||||||
|
boxes.push(Entities.addEntity({
|
||||||
|
type: cube ? "Box" : "Sphere",
|
||||||
|
name: "PerfTest",
|
||||||
|
position: position,
|
||||||
|
dimensions: { x: radius, y: radius, z: radius },
|
||||||
|
color: color,
|
||||||
|
ignoreCollisions: true,
|
||||||
|
collisionsWillMove: false,
|
||||||
|
lifetime: LIFETIME
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function scriptEnding() {
|
||||||
|
for (var i = 0; i < boxes.length; i++) {
|
||||||
|
//Entities.deleteEntity(boxes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Script.scriptEnding.connect(scriptEnding);
|
|
@ -887,12 +887,6 @@ void Application::paintGL() {
|
||||||
|
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
/*
|
|
||||||
gpu::Context context(new gpu::GLBackend());
|
|
||||||
RenderArgs renderArgs(&context, nullptr, getViewFrustum(), lodManager->getOctreeSizeScale(),
|
|
||||||
lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
|
|
||||||
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
|
||||||
*/
|
|
||||||
_applicationOverlay.renderOverlay(&renderArgs);
|
_applicationOverlay.renderOverlay(&renderArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -968,6 +962,8 @@ void Application::paintGL() {
|
||||||
} else if (TV3DManager::isConnected()) {
|
} else if (TV3DManager::isConnected()) {
|
||||||
TV3DManager::display(&renderArgs, _myCamera);
|
TV3DManager::display(&renderArgs, _myCamera);
|
||||||
} else {
|
} else {
|
||||||
|
PROFILE_RANGE(__function__ "/mainRender");
|
||||||
|
|
||||||
DependencyManager::get<GlowEffect>()->prepare(&renderArgs);
|
DependencyManager::get<GlowEffect>()->prepare(&renderArgs);
|
||||||
|
|
||||||
// Viewport is assigned to the size of the framebuffer
|
// Viewport is assigned to the size of the framebuffer
|
||||||
|
@ -1002,6 +998,7 @@ void Application::paintGL() {
|
||||||
|
|
||||||
|
|
||||||
if (!OculusManager::isConnected() || OculusManager::allowSwap()) {
|
if (!OculusManager::isConnected() || OculusManager::allowSwap()) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__ "/bufferSwap");
|
||||||
_glWidget->swapBuffers();
|
_glWidget->swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,6 +1048,7 @@ void Application::resetCameras(Camera& camera, const glm::uvec2& size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::resizeGL() {
|
void Application::resizeGL() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
// Set the desired FBO texture size. If it hasn't changed, this does nothing.
|
// Set the desired FBO texture size. If it hasn't changed, this does nothing.
|
||||||
// Otherwise, it must rebuild the FBOs
|
// Otherwise, it must rebuild the FBOs
|
||||||
QSize renderSize;
|
QSize renderSize;
|
||||||
|
@ -1526,6 +1524,7 @@ void Application::focusOutEvent(QFocusEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
// Used by application overlay to determine how to draw cursor(s)
|
// Used by application overlay to determine how to draw cursor(s)
|
||||||
_lastMouseMoveWasSimulated = deviceID > 0;
|
_lastMouseMoveWasSimulated = deviceID > 0;
|
||||||
if (!_lastMouseMoveWasSimulated) {
|
if (!_lastMouseMoveWasSimulated) {
|
||||||
|
@ -1829,6 +1828,7 @@ void Application::idle() {
|
||||||
PerformanceTimer perfTimer("update");
|
PerformanceTimer perfTimer("update");
|
||||||
PerformanceWarning warn(showWarnings, "Application::idle()... update()");
|
PerformanceWarning warn(showWarnings, "Application::idle()... update()");
|
||||||
const float BIGGEST_DELTA_TIME_SECS = 0.25f;
|
const float BIGGEST_DELTA_TIME_SECS = 0.25f;
|
||||||
|
PROFILE_RANGE(__FUNCTION__ "/idleUpdate");
|
||||||
update(glm::clamp((float)timeSinceLastUpdate / 1000.0f, 0.0f, BIGGEST_DELTA_TIME_SECS));
|
update(glm::clamp((float)timeSinceLastUpdate / 1000.0f, 0.0f, BIGGEST_DELTA_TIME_SECS));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -2954,6 +2954,7 @@ QRect Application::getDesirableApplicationGeometry() {
|
||||||
// or the "myCamera".
|
// or the "myCamera".
|
||||||
//
|
//
|
||||||
void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) {
|
void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
// We will use these below, from either the camera or head vectors calculated above
|
// We will use these below, from either the camera or head vectors calculated above
|
||||||
viewFrustum.setProjection(camera.getProjection());
|
viewFrustum.setProjection(camera.getProjection());
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ void ApplicationCompositor::bindCursorTexture(gpu::Batch& batch, uint8_t cursorI
|
||||||
|
|
||||||
// Draws the FBO texture for the screen
|
// Draws the FBO texture for the screen
|
||||||
void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) {
|
void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
if (_alpha == 0.0f) {
|
if (_alpha == 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -252,6 +253,7 @@ vec2 getPolarCoordinates(const PalmData& palm) {
|
||||||
|
|
||||||
// Draws the FBO texture for Oculus rift.
|
// Draws the FBO texture for Oculus rift.
|
||||||
void ApplicationCompositor::displayOverlayTextureHmd(RenderArgs* renderArgs, int eye) {
|
void ApplicationCompositor::displayOverlayTextureHmd(RenderArgs* renderArgs, int eye) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
if (_alpha == 0.0f) {
|
if (_alpha == 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ ApplicationOverlay::~ApplicationOverlay() {
|
||||||
|
|
||||||
// Renders the overlays either to a texture or to the screen
|
// Renders the overlays either to a texture or to the screen
|
||||||
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
CHECK_GL_ERROR();
|
CHECK_GL_ERROR();
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderQmlUi(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderQmlUi(RenderArgs* renderArgs) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
if (_uiTexture) {
|
if (_uiTexture) {
|
||||||
gpu::Batch batch;
|
gpu::Batch batch;
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
|
@ -112,6 +114,7 @@ void ApplicationOverlay::renderQmlUi(RenderArgs* renderArgs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
glm::vec2 size = qApp->getCanvasSize();
|
glm::vec2 size = qApp->getCanvasSize();
|
||||||
|
|
||||||
mat4 legacyProjection = glm::ortho<float>(0, size.x, size.y, 0, ORTHO_NEAR_CLIP, ORTHO_FAR_CLIP);
|
mat4 legacyProjection = glm::ortho<float>(0, size.x, size.y, 0, ORTHO_NEAR_CLIP, ORTHO_FAR_CLIP);
|
||||||
|
@ -219,6 +222,7 @@ GLuint ApplicationOverlay::getOverlayTexture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::buildFramebufferObject() {
|
void ApplicationOverlay::buildFramebufferObject() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
QSize fboSize = qApp->getDeviceSize();
|
QSize fboSize = qApp->getDeviceSize();
|
||||||
if (_overlayFramebuffer && fboSize == _overlayFramebuffer->size()) {
|
if (_overlayFramebuffer && fboSize == _overlayFramebuffer->size()) {
|
||||||
// Already built
|
// Already built
|
||||||
|
|
|
@ -96,6 +96,7 @@ void Overlays::cleanupOverlaysToDelete() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::renderHUD(RenderArgs* renderArgs) {
|
void Overlays::renderHUD(RenderArgs* renderArgs) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
QReadLocker lock(&_lock);
|
QReadLocker lock(&_lock);
|
||||||
gpu::Batch batch;
|
gpu::Batch batch;
|
||||||
renderArgs->_batch = &batch;
|
renderArgs->_batch = &batch;
|
||||||
|
|
Loading…
Reference in a new issue