mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 12:53:03 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into tablet-ui-grab-no-patch
This commit is contained in:
commit
a9194e1bdb
20 changed files with 174 additions and 33 deletions
|
@ -68,6 +68,7 @@ AudioMixer::AudioMixer(ReceivedMessage& message) :
|
|||
packetReceiver.registerListener(PacketType::KillAvatar, this, "handleKillAvatarPacket");
|
||||
packetReceiver.registerListener(PacketType::NodeMuteRequest, this, "handleNodeMuteRequestPacket");
|
||||
packetReceiver.registerListener(PacketType::RadiusIgnoreRequest, this, "handleRadiusIgnoreRequestPacket");
|
||||
packetReceiver.registerListener(PacketType::RequestsDomainListData, this, "handleRequestsDomainListDataPacket");
|
||||
|
||||
connect(nodeList.data(), &NodeList::nodeKilled, this, &AudioMixer::handleNodeKilled);
|
||||
}
|
||||
|
@ -221,6 +222,20 @@ void AudioMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> packet,
|
|||
}
|
||||
}
|
||||
|
||||
void AudioMixer::handleRequestsDomainListDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->getOrCreateLinkedData(senderNode);
|
||||
|
||||
if (senderNode->getLinkedData()) {
|
||||
AudioMixerClientData* nodeData = dynamic_cast<AudioMixerClientData*>(senderNode->getLinkedData());
|
||||
if (nodeData != nullptr) {
|
||||
bool isRequesting;
|
||||
message->readPrimitive(&isRequesting);
|
||||
nodeData->setRequestsDomainListData(isRequesting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioMixer::handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
||||
sendingNode->parseIgnoreRequestMessage(packet);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ private slots:
|
|||
void handleMuteEnvironmentPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
|
||||
void handleNegotiateAudioFormat(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||
void handleNodeKilled(SharedNodePointer killedNode);
|
||||
void handleRequestsDomainListDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
|
||||
void handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
|
||||
void handleRadiusIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
|
||||
void handleKillAvatarPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
glm::vec3 getPosition() { return getAvatarAudioStream() ? getAvatarAudioStream()->getPosition() : glm::vec3(0); }
|
||||
glm::vec3 getAvatarBoundingBoxCorner() { return getAvatarAudioStream() ? getAvatarAudioStream()->getAvatarBoundingBoxCorner() : glm::vec3(0); }
|
||||
glm::vec3 getAvatarBoundingBoxScale() { return getAvatarAudioStream() ? getAvatarAudioStream()->getAvatarBoundingBoxScale() : glm::vec3(0); }
|
||||
bool getRequestsDomainListData() { return _requestsDomainListData; }
|
||||
void setRequestsDomainListData(bool requesting) { _requestsDomainListData = requesting; }
|
||||
|
||||
signals:
|
||||
void injectorStreamFinished(const QUuid& streamIdentifier);
|
||||
|
@ -122,6 +124,7 @@ private:
|
|||
bool _shouldFlushEncoder { false };
|
||||
|
||||
bool _shouldMuteClient { false };
|
||||
bool _requestsDomainListData { false };
|
||||
};
|
||||
|
||||
#endif // hifi_AudioMixerClientData_h
|
||||
|
|
|
@ -209,8 +209,13 @@ bool AudioMixerSlave::prepareMix(const SharedNodePointer& node) {
|
|||
// and that it isn't being ignored by our listening node
|
||||
// and that it isn't ignoring our listening node
|
||||
AudioMixerClientData* otherData = static_cast<AudioMixerClientData*>(otherNode->getLinkedData());
|
||||
|
||||
// When this is true, the AudioMixer will send Audio data to a client about avatars that have ignored them
|
||||
bool getsAnyIgnored = nodeData->getRequestsDomainListData() && node->getCanKick();
|
||||
|
||||
if (otherData
|
||||
&& !node->isIgnoringNodeWithID(otherNode->getUUID()) && !otherNode->isIgnoringNodeWithID(node->getUUID())) {
|
||||
&& (!node->isIgnoringNodeWithID(otherNode->getUUID()) || (otherData->getRequestsDomainListData() && otherNode->getCanKick()))
|
||||
&& (!otherNode->isIgnoringNodeWithID(node->getUUID()) || getsAnyIgnored)) {
|
||||
|
||||
// check to see if we're ignoring in radius
|
||||
bool insideIgnoreRadius = false;
|
||||
|
@ -219,7 +224,7 @@ bool AudioMixerSlave::prepareMix(const SharedNodePointer& node) {
|
|||
// We'll always be inside the radius in that case.
|
||||
insideIgnoreRadius = true;
|
||||
// Check to see if the space bubble is enabled
|
||||
} else if ((node->isIgnoreRadiusEnabled() || otherNode->isIgnoreRadiusEnabled()) && (*otherNode != *node)) {
|
||||
} else if ((node->isIgnoreRadiusEnabled() || otherNode->isIgnoreRadiusEnabled())) {
|
||||
// Define the minimum bubble size
|
||||
static const glm::vec3 minBubbleSize = glm::vec3(0.3f, 1.3f, 0.3f);
|
||||
AudioMixerClientData* nodeData = reinterpret_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||
|
|
|
@ -299,7 +299,7 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
AvatarMixerClientData* otherData = reinterpret_cast<AvatarMixerClientData*>(otherNode->getLinkedData());
|
||||
AvatarMixerClientData* nodeData = reinterpret_cast<AvatarMixerClientData*>(node->getLinkedData());
|
||||
// Check to see if the space bubble is enabled
|
||||
if ((node->isIgnoreRadiusEnabled() && !getsIgnoredByMe) || (otherNode->isIgnoreRadiusEnabled() && !getsAnyIgnored)) {
|
||||
if (node->isIgnoreRadiusEnabled() || otherNode->isIgnoreRadiusEnabled()) {
|
||||
// Define the minimum bubble size
|
||||
static const glm::vec3 minBubbleSize = glm::vec3(0.3f, 1.3f, 0.3f);
|
||||
// Define the scale of the box for the current node
|
||||
|
@ -326,11 +326,11 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
// Perform the collision check between the two bounding boxes
|
||||
if (nodeBox.touches(otherNodeBox)) {
|
||||
nodeData->ignoreOther(node, otherNode);
|
||||
return false;
|
||||
return getsAnyIgnored;
|
||||
}
|
||||
}
|
||||
// Not close enough to ignore
|
||||
nodeData->removeFromRadiusIgnoringSet(otherNode->getUUID());
|
||||
nodeData->removeFromRadiusIgnoringSet(node, otherNode->getUUID());
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -57,6 +57,15 @@ void AvatarMixerClientData::ignoreOther(SharedNodePointer self, SharedNodePointe
|
|||
}
|
||||
}
|
||||
|
||||
void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other) {
|
||||
if (isRadiusIgnoring(other)) {
|
||||
_radiusIgnoredOthers.erase(other);
|
||||
auto exitingSpaceBubblePacket = NLPacket::create(PacketType::ExitingSpaceBubble, NUM_BYTES_RFC4122_UUID);
|
||||
exitingSpaceBubblePacket->write(other.toRfc4122());
|
||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(*exitingSpaceBubblePacket, *self);
|
||||
}
|
||||
}
|
||||
|
||||
void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) {
|
||||
_currentViewFrustum.fromByteArray(message);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
glm::vec3 getGlobalBoundingBoxCorner() { return _avatar ? _avatar->getGlobalBoundingBoxCorner() : glm::vec3(0); }
|
||||
bool isRadiusIgnoring(const QUuid& other) { return _radiusIgnoredOthers.find(other) != _radiusIgnoredOthers.end(); }
|
||||
void addToRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.insert(other); }
|
||||
void removeFromRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.erase(other); }
|
||||
void removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other);
|
||||
void ignoreOther(SharedNodePointer self, SharedNodePointer other);
|
||||
|
||||
void readViewFrustumPacket(const QByteArray& message);
|
||||
|
|
|
@ -83,6 +83,18 @@ Item {
|
|||
text: "Missed Frame Count: " + root.appdropped;
|
||||
visible: root.appdropped > 0;
|
||||
}
|
||||
StatText {
|
||||
text: "Long Render Count: " + root.longrenders;
|
||||
visible: root.longrenders > 0;
|
||||
}
|
||||
StatText {
|
||||
text: "Long Submit Count: " + root.longsubmits;
|
||||
visible: root.longsubmits > 0;
|
||||
}
|
||||
StatText {
|
||||
text: "Long Frame Count: " + root.longframes;
|
||||
visible: root.longframes > 0;
|
||||
}
|
||||
StatText {
|
||||
text: "Packets In/Out: " + root.packetInCount + "/" + root.packetOutCount
|
||||
}
|
||||
|
|
|
@ -1339,7 +1339,10 @@ void Avatar::addToScene(AvatarSharedPointer myHandle) {
|
|||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
if (scene) {
|
||||
render::PendingChanges pendingChanges;
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars() && !DependencyManager::get<NodeList>()->isIgnoringNode(getSessionUUID())) {
|
||||
auto nodelist = DependencyManager::get<NodeList>();
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()
|
||||
&& !nodelist->isIgnoringNode(getSessionUUID())
|
||||
&& !nodelist->isRadiusIgnoringNode(getSessionUUID())) {
|
||||
addToScene(myHandle, scene, pendingChanges);
|
||||
}
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
|
|
|
@ -79,6 +79,7 @@ AvatarManager::AvatarManager(QObject* parent) :
|
|||
packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket");
|
||||
packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar");
|
||||
packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket");
|
||||
packetReceiver.registerListener(PacketType::ExitingSpaceBubble, this, "processExitingSpaceBubble");
|
||||
|
||||
// when we hear that the user has ignored an avatar by session UUID
|
||||
// immediately remove that avatar instead of waiting for the absence of packets from avatar mixer
|
||||
|
@ -257,6 +258,9 @@ void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar
|
|||
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble) {
|
||||
emit DependencyManager::get<UsersScriptingInterface>()->enteredIgnoreRadius();
|
||||
}
|
||||
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble || removalReason == YourAvatarEnteredTheirBubble) {
|
||||
DependencyManager::get<NodeList>()->radiusIgnoreNodeBySessionID(avatar->getSessionUUID(), true);
|
||||
}
|
||||
_avatarFades.push_back(removedAvatar);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,12 +127,18 @@ void Stats::updateStats(bool force) {
|
|||
auto displayPlugin = qApp->getActiveDisplayPlugin();
|
||||
auto stats = displayPlugin->getHardwareStats();
|
||||
STAT_UPDATE(appdropped, stats["app_dropped_frame_count"].toInt());
|
||||
STAT_UPDATE(longrenders, stats["long_render_count"].toInt());
|
||||
STAT_UPDATE(longsubmits, stats["long_submit_count"].toInt());
|
||||
STAT_UPDATE(longframes, stats["long_frame_count"].toInt());
|
||||
STAT_UPDATE(renderrate, displayPlugin->renderRate());
|
||||
STAT_UPDATE(presentrate, displayPlugin->presentRate());
|
||||
STAT_UPDATE(presentnewrate, displayPlugin->newFramePresentRate());
|
||||
STAT_UPDATE(presentdroprate, displayPlugin->droppedFrameRate());
|
||||
STAT_UPDATE(stutterrate, displayPlugin->stutterRate());
|
||||
} else {
|
||||
STAT_UPDATE(appdropped, -1);
|
||||
STAT_UPDATE(longrenders, -1);
|
||||
STAT_UPDATE(longsubmits, -1);
|
||||
STAT_UPDATE(presentrate, -1);
|
||||
STAT_UPDATE(presentnewrate, -1);
|
||||
STAT_UPDATE(presentdroprate, -1);
|
||||
|
|
|
@ -40,6 +40,9 @@ class Stats : public QQuickItem {
|
|||
STATS_PROPERTY(float, stutterrate, 0)
|
||||
|
||||
STATS_PROPERTY(int, appdropped, 0)
|
||||
STATS_PROPERTY(int, longsubmits, 0)
|
||||
STATS_PROPERTY(int, longrenders, 0)
|
||||
STATS_PROPERTY(int, longframes, 0)
|
||||
|
||||
STATS_PROPERTY(float, presentnewrate, 0)
|
||||
STATS_PROPERTY(float, presentdroprate, 0)
|
||||
|
@ -137,6 +140,9 @@ public slots:
|
|||
void forceUpdateStats() { updateStats(true); }
|
||||
|
||||
signals:
|
||||
void longsubmitsChanged();
|
||||
void longrendersChanged();
|
||||
void longframesChanged();
|
||||
void appdroppedChanged();
|
||||
void framerateChanged();
|
||||
void expandedChanged();
|
||||
|
|
|
@ -161,6 +161,13 @@ void AvatarHashMap::processKillAvatar(QSharedPointer<ReceivedMessage> message, S
|
|||
removeAvatar(sessionUUID, reason);
|
||||
}
|
||||
|
||||
void AvatarHashMap::processExitingSpaceBubble(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode) {
|
||||
// read the node id
|
||||
QUuid sessionUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->radiusIgnoreNodeBySessionID(sessionUUID, false);
|
||||
}
|
||||
|
||||
void AvatarHashMap::removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason) {
|
||||
QWriteLocker locker(&_hashLock);
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ private slots:
|
|||
void processAvatarDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||
void processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||
void processKillAvatar(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||
void processExitingSpaceBubble(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||
|
||||
protected:
|
||||
AvatarHashMap();
|
||||
|
|
|
@ -238,6 +238,10 @@ void NodeList::reset() {
|
|||
|
||||
_numNoReplyDomainCheckIns = 0;
|
||||
|
||||
// lock and clear our set of radius ignored IDs
|
||||
_radiusIgnoredSetLock.lockForWrite();
|
||||
_radiusIgnoredNodeIDs.clear();
|
||||
_radiusIgnoredSetLock.unlock();
|
||||
// lock and clear our set of ignored IDs
|
||||
_ignoredSetLock.lockForWrite();
|
||||
_ignoredNodeIDs.clear();
|
||||
|
@ -781,6 +785,22 @@ void NodeList::sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationN
|
|||
sendPacket(std::move(ignorePacket), *destinationNode);
|
||||
}
|
||||
|
||||
void NodeList::radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled) {
|
||||
if (radiusIgnoreEnabled) {
|
||||
QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for insert
|
||||
// add this nodeID to our set of ignored IDs
|
||||
_radiusIgnoredNodeIDs.insert(nodeID);
|
||||
} else {
|
||||
QWriteLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // write lock for unsafe_erase
|
||||
_radiusIgnoredNodeIDs.unsafe_erase(nodeID);
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeList::isRadiusIgnoringNode(const QUuid& nodeID) const {
|
||||
QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for reading
|
||||
return _radiusIgnoredNodeIDs.find(nodeID) != _radiusIgnoredNodeIDs.cend();
|
||||
}
|
||||
|
||||
void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) {
|
||||
// enumerate the nodes to send a reliable ignore packet to each that can leverage it
|
||||
if (!nodeID.isNull() && _sessionUUID != nodeID) {
|
||||
|
@ -1020,12 +1040,12 @@ void NodeList::processUsernameFromIDReply(QSharedPointer<ReceivedMessage> messag
|
|||
}
|
||||
|
||||
void NodeList::setRequestsDomainListData(bool isRequesting) {
|
||||
// Tell the avatar mixer whether I want to receive any additional data to which I might be entitled
|
||||
// Tell the avatar mixer and audio mixer whether I want to receive any additional data to which I might be entitled
|
||||
if (_requestsDomainListData == isRequesting) {
|
||||
return;
|
||||
}
|
||||
eachMatchingNode([](const SharedNodePointer& node)->bool {
|
||||
return node->getType() == NodeType::AvatarMixer;
|
||||
return (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer);
|
||||
}, [this, isRequesting](const SharedNodePointer& destinationNode) {
|
||||
auto packet = NLPacket::create(PacketType::RequestsDomainListData, sizeof(bool), true); // reliable
|
||||
packet->writePrimitive(isRequesting);
|
||||
|
|
|
@ -76,6 +76,8 @@ public:
|
|||
void toggleIgnoreRadius() { ignoreNodesInRadius(!getIgnoreRadiusEnabled()); }
|
||||
void enableIgnoreRadius() { ignoreNodesInRadius(true); }
|
||||
void disableIgnoreRadius() { ignoreNodesInRadius(false); }
|
||||
void radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled);
|
||||
bool isRadiusIgnoringNode(const QUuid& other) const;
|
||||
void ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled);
|
||||
bool isIgnoringNode(const QUuid& nodeID) const;
|
||||
void personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled);
|
||||
|
@ -159,6 +161,8 @@ private:
|
|||
QTimer _keepAlivePingTimer;
|
||||
bool _requestsDomainListData;
|
||||
|
||||
mutable QReadWriteLock _radiusIgnoredSetLock;
|
||||
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _radiusIgnoredNodeIDs;
|
||||
mutable QReadWriteLock _ignoredSetLock;
|
||||
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
|
||||
mutable QReadWriteLock _personalMutedSetLock;
|
||||
|
|
|
@ -105,7 +105,8 @@ public:
|
|||
UsernameFromIDReply,
|
||||
ViewFrustum,
|
||||
RequestsDomainListData,
|
||||
LAST_PACKET_TYPE = RequestsDomainListData
|
||||
ExitingSpaceBubble,
|
||||
LAST_PACKET_TYPE = ExitingSpaceBubble
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@ OculusDisplayPlugin::OculusDisplayPlugin() {
|
|||
|
||||
bool OculusDisplayPlugin::internalActivate() {
|
||||
bool result = Parent::internalActivate();
|
||||
_longSubmits = 0;
|
||||
_longRenders = 0;
|
||||
_longFrames = 0;
|
||||
|
||||
currentDebugMode = ovrPerfHud_Off;
|
||||
if (result && _session) {
|
||||
ovr_SetInt(_session, OVR_PERF_HUD_MODE, currentDebugMode);
|
||||
|
@ -112,35 +116,43 @@ void OculusDisplayPlugin::uncustomizeContext() {
|
|||
Parent::uncustomizeContext();
|
||||
}
|
||||
|
||||
static const uint64_t FRAME_BUDGET = (11 * USECS_PER_MSEC);
|
||||
static const uint64_t FRAME_OVER_BUDGET = (15 * USECS_PER_MSEC);
|
||||
|
||||
void OculusDisplayPlugin::hmdPresent() {
|
||||
static uint64_t lastSubmitEnd = 0;
|
||||
|
||||
if (!_customized) {
|
||||
return;
|
||||
}
|
||||
|
||||
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)_currentFrame->frameIndex)
|
||||
|
||||
int curIndex;
|
||||
ovr_GetTextureSwapChainCurrentIndex(_session, _textureSwapChain, &curIndex);
|
||||
GLuint curTexId;
|
||||
ovr_GetTextureSwapChainBufferGL(_session, _textureSwapChain, curIndex, &curTexId);
|
||||
{
|
||||
PROFILE_RANGE_EX(render, "Oculus Blit", 0xff00ff00, (uint64_t)_currentFrame->frameIndex)
|
||||
int curIndex;
|
||||
ovr_GetTextureSwapChainCurrentIndex(_session, _textureSwapChain, &curIndex);
|
||||
GLuint curTexId;
|
||||
ovr_GetTextureSwapChainBufferGL(_session, _textureSwapChain, curIndex, &curTexId);
|
||||
|
||||
// Manually bind the texture to the FBO
|
||||
// FIXME we should have a way of wrapping raw GL ids in GPU objects without
|
||||
// taking ownership of the object
|
||||
auto fbo = getGLBackend()->getFramebufferID(_outputFramebuffer);
|
||||
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, curTexId, 0);
|
||||
render([&](gpu::Batch& batch) {
|
||||
batch.enableStereo(false);
|
||||
batch.setFramebuffer(_outputFramebuffer);
|
||||
batch.setViewportTransform(ivec4(uvec2(), _outputFramebuffer->getSize()));
|
||||
batch.setStateScissorRect(ivec4(uvec2(), _outputFramebuffer->getSize()));
|
||||
batch.resetViewTransform();
|
||||
batch.setProjectionTransform(mat4());
|
||||
batch.setPipeline(_presentPipeline);
|
||||
batch.setResourceTexture(0, _compositeFramebuffer->getRenderBuffer(0));
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
});
|
||||
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, 0, 0);
|
||||
// Manually bind the texture to the FBO
|
||||
// FIXME we should have a way of wrapping raw GL ids in GPU objects without
|
||||
// taking ownership of the object
|
||||
auto fbo = getGLBackend()->getFramebufferID(_outputFramebuffer);
|
||||
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, curTexId, 0);
|
||||
render([&](gpu::Batch& batch) {
|
||||
batch.enableStereo(false);
|
||||
batch.setFramebuffer(_outputFramebuffer);
|
||||
batch.setViewportTransform(ivec4(uvec2(), _outputFramebuffer->getSize()));
|
||||
batch.setStateScissorRect(ivec4(uvec2(), _outputFramebuffer->getSize()));
|
||||
batch.resetViewTransform();
|
||||
batch.setProjectionTransform(mat4());
|
||||
batch.setPipeline(_presentPipeline);
|
||||
batch.setResourceTexture(0, _compositeFramebuffer->getRenderBuffer(0));
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
});
|
||||
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, 0, 0);
|
||||
}
|
||||
|
||||
{
|
||||
auto result = ovr_CommitTextureSwapChain(_session, _textureSwapChain);
|
||||
|
@ -148,8 +160,33 @@ void OculusDisplayPlugin::hmdPresent() {
|
|||
_sceneLayer.SensorSampleTime = _currentPresentFrameInfo.sensorSampleTime;
|
||||
_sceneLayer.RenderPose[ovrEyeType::ovrEye_Left] = ovrPoseFromGlm(_currentPresentFrameInfo.renderPose);
|
||||
_sceneLayer.RenderPose[ovrEyeType::ovrEye_Right] = ovrPoseFromGlm(_currentPresentFrameInfo.renderPose);
|
||||
|
||||
auto submitStart = usecTimestampNow();
|
||||
uint64_t nonSubmitInterval = 0;
|
||||
if (lastSubmitEnd != 0) {
|
||||
nonSubmitInterval = submitStart - lastSubmitEnd;
|
||||
if (nonSubmitInterval > FRAME_BUDGET) {
|
||||
++_longRenders;
|
||||
}
|
||||
}
|
||||
ovrLayerHeader* layers = &_sceneLayer.Header;
|
||||
result = ovr_SubmitFrame(_session, _currentFrame->frameIndex, &_viewScaleDesc, &layers, 1);
|
||||
{
|
||||
PROFILE_RANGE_EX(render, "Oculus Submit", 0xff00ff00, (uint64_t)_currentFrame->frameIndex)
|
||||
result = ovr_SubmitFrame(_session, _currentFrame->frameIndex, &_viewScaleDesc, &layers, 1);
|
||||
}
|
||||
lastSubmitEnd = usecTimestampNow();
|
||||
if (nonSubmitInterval != 0) {
|
||||
auto submitInterval = lastSubmitEnd - submitStart;
|
||||
if (nonSubmitInterval < FRAME_BUDGET && submitInterval > FRAME_BUDGET) {
|
||||
++_longSubmits;
|
||||
}
|
||||
if ((nonSubmitInterval + submitInterval) > FRAME_OVER_BUDGET) {
|
||||
++_longFrames;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!OVR_SUCCESS(result)) {
|
||||
logWarning("Failed to present");
|
||||
}
|
||||
|
@ -168,6 +205,7 @@ void OculusDisplayPlugin::hmdPresent() {
|
|||
_appDroppedFrames.store(appDroppedFrames);
|
||||
_compositorDroppedFrames.store(compositorDroppedFrames);
|
||||
}
|
||||
|
||||
_presentRate.increment();
|
||||
}
|
||||
|
||||
|
@ -176,6 +214,9 @@ QJsonObject OculusDisplayPlugin::getHardwareStats() const {
|
|||
QJsonObject hardwareStats;
|
||||
hardwareStats["app_dropped_frame_count"] = _appDroppedFrames.load();
|
||||
hardwareStats["compositor_dropped_frame_count"] = _compositorDroppedFrames.load();
|
||||
hardwareStats["long_render_count"] = _longRenders.load();
|
||||
hardwareStats["long_submit_count"] = _longSubmits.load();
|
||||
hardwareStats["long_frame_count"] = _longFrames.load();
|
||||
return hardwareStats;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,5 +41,8 @@ private:
|
|||
|
||||
std::atomic_int _compositorDroppedFrames;
|
||||
std::atomic_int _appDroppedFrames;
|
||||
std::atomic_int _longSubmits;
|
||||
std::atomic_int _longRenders;
|
||||
std::atomic_int _longFrames;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ var DEFAULT_SCRIPTS = [
|
|||
"system/mute.js",
|
||||
"system/goto.js",
|
||||
"system/hmd.js",
|
||||
"system/marketplaces/marketplace.js",
|
||||
"system/marketplaces/marketplaces.js",
|
||||
"system/edit.js",
|
||||
"system/pal.js", //"system/mod.js", // older UX, if you prefer
|
||||
"system/selectAudioDevice.js",
|
||||
|
|
Loading…
Reference in a new issue