Merge branch 'master' of https://github.com/highfidelity/hifi into hdr

This commit is contained in:
samcake 2016-10-01 15:36:14 -07:00
commit 918f7cd515
17 changed files with 99 additions and 55 deletions

View file

@ -91,7 +91,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
// check for a wallet UUID on the command line or in the config // check for a wallet UUID on the command line or in the config
// this would represent where the user running AC wants funds sent to // this would represent where the user running AC wants funds sent to
if (!walletUUID.isNull()) { if (!walletUUID.isNull()) {
qCDebug(assigmnentclient) << "The destination wallet UUID for credits is" << uuidStringWithoutCurlyBraces(walletUUID); qCDebug(assignment_client) << "The destination wallet UUID for credits is" << uuidStringWithoutCurlyBraces(walletUUID);
_requestAssignment.setWalletUUID(walletUUID); _requestAssignment.setWalletUUID(walletUUID);
} }
@ -102,16 +102,16 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
} }
_assignmentServerSocket = HifiSockAddr(_assignmentServerHostname, assignmentServerPort, true); _assignmentServerSocket = HifiSockAddr(_assignmentServerHostname, assignmentServerPort, true);
_assignmentServerSocket.setObjectName("AssigmentServer"); _assignmentServerSocket.setObjectName("AssignmentServer");
nodeList->setAssignmentServerSocket(_assignmentServerSocket); nodeList->setAssignmentServerSocket(_assignmentServerSocket);
qCDebug(assigmnentclient) << "Assignment server socket is" << _assignmentServerSocket; qCDebug(assignment_client) << "Assignment server socket is" << _assignmentServerSocket;
// call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required // call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required
qCDebug(assigmnentclient) << "Waiting for assignment -" << _requestAssignment; qCDebug(assignment_client) << "Waiting for assignment -" << _requestAssignment;
if (_assignmentServerHostname != "localhost") { if (_assignmentServerHostname != "localhost") {
qCDebug(assigmnentclient) << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); qCDebug(assignment_client) << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort();
} }
connect(&_requestTimer, SIGNAL(timeout()), SLOT(sendAssignmentRequest())); connect(&_requestTimer, SIGNAL(timeout()), SLOT(sendAssignmentRequest()));
@ -129,7 +129,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
_assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, assignmentMonitorPort); _assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, assignmentMonitorPort);
_assignmentClientMonitorSocket.setObjectName("AssignmentClientMonitor"); _assignmentClientMonitorSocket.setObjectName("AssignmentClientMonitor");
qCDebug(assigmnentclient) << "Assignment-client monitor socket is" << _assignmentClientMonitorSocket; qCDebug(assignment_client) << "Assignment-client monitor socket is" << _assignmentClientMonitorSocket;
// Hook up a timer to send this child's status to the Monitor once per second // Hook up a timer to send this child's status to the Monitor once per second
setUpStatusToMonitor(); setUpStatusToMonitor();
@ -140,7 +140,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
} }
void AssignmentClient::stopAssignmentClient() { void AssignmentClient::stopAssignmentClient() {
qCDebug(assigmnentclient) << "Forced stop of assignment-client."; qCDebug(assignment_client) << "Forced stop of assignment-client.";
_requestTimer.stop(); _requestTimer.stop();
_statsTimerACM.stop(); _statsTimerACM.stop();
@ -218,14 +218,14 @@ void AssignmentClient::sendAssignmentRequest() {
quint16 localAssignmentServerPort; quint16 localAssignmentServerPort;
if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) { if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) {
if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { if (localAssignmentServerPort != _assignmentServerSocket.getPort()) {
qCDebug(assigmnentclient) << "Port for local assignment server read from shared memory is" qCDebug(assignment_client) << "Port for local assignment server read from shared memory is"
<< localAssignmentServerPort; << localAssignmentServerPort;
_assignmentServerSocket.setPort(localAssignmentServerPort); _assignmentServerSocket.setPort(localAssignmentServerPort);
nodeList->setAssignmentServerSocket(_assignmentServerSocket); nodeList->setAssignmentServerSocket(_assignmentServerSocket);
} }
} else { } else {
qCWarning(assigmnentclient) << "Failed to read local assignment server port from shared memory" qCWarning(assignment_client) << "Failed to read local assignment server port from shared memory"
<< "- will send assignment request to previous assignment server socket."; << "- will send assignment request to previous assignment server socket.";
} }
} }
@ -235,10 +235,10 @@ void AssignmentClient::sendAssignmentRequest() {
} }
void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessage> message) { void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessage> message) {
qCDebug(assigmnentclient) << "Received a PacketType::CreateAssignment - attempting to unpack."; qCDebug(assignment_client) << "Received a PacketType::CreateAssignment - attempting to unpack.";
if (_currentAssignment) { if (_currentAssignment) {
qCWarning(assigmnentclient) << "Received a PacketType::CreateAssignment while still running an active assignment. Ignoring."; qCWarning(assignment_client) << "Received a PacketType::CreateAssignment while still running an active assignment. Ignoring.";
return; return;
} }
@ -246,7 +246,7 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessa
_currentAssignment = AssignmentFactory::unpackAssignment(*message); _currentAssignment = AssignmentFactory::unpackAssignment(*message);
if (_currentAssignment && !_isAssigned) { if (_currentAssignment && !_isAssigned) {
qDebug(assigmnentclient) << "Received an assignment -" << *_currentAssignment; qDebug(assignment_client) << "Received an assignment -" << *_currentAssignment;
_isAssigned = true; _isAssigned = true;
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
@ -256,7 +256,7 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessa
nodeList->getDomainHandler().setSockAddr(message->getSenderSockAddr(), _assignmentServerHostname); nodeList->getDomainHandler().setSockAddr(message->getSenderSockAddr(), _assignmentServerHostname);
nodeList->getDomainHandler().setAssignmentUUID(_currentAssignment->getUUID()); nodeList->getDomainHandler().setAssignmentUUID(_currentAssignment->getUUID());
qCDebug(assigmnentclient) << "Destination IP for assignment is" << nodeList->getDomainHandler().getIP().toString(); qCDebug(assignment_client) << "Destination IP for assignment is" << nodeList->getDomainHandler().getIP().toString();
// start the deployed assignment // start the deployed assignment
QThread* workerThread = new QThread; QThread* workerThread = new QThread;
@ -284,7 +284,7 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessa
// Starts an event loop, and emits workerThread->started() // Starts an event loop, and emits workerThread->started()
workerThread->start(); workerThread->start();
} else { } else {
qCWarning(assigmnentclient) << "Received an assignment that could not be unpacked. Re-requesting."; qCWarning(assignment_client) << "Received an assignment that could not be unpacked. Re-requesting.";
} }
} }
@ -294,10 +294,10 @@ void AssignmentClient::handleStopNodePacket(QSharedPointer<ReceivedMessage> mess
if (senderSockAddr.getAddress() == QHostAddress::LocalHost || if (senderSockAddr.getAddress() == QHostAddress::LocalHost ||
senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) {
qCDebug(assigmnentclient) << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode."; qCDebug(assignment_client) << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode.";
QCoreApplication::quit(); QCoreApplication::quit();
} else { } else {
qCWarning(assigmnentclient) << "Got a stop packet from other than localhost."; qCWarning(assignment_client) << "Got a stop packet from other than localhost.";
} }
} }
@ -317,7 +317,7 @@ void AssignmentClient::handleAuthenticationRequest() {
// ask the account manager to log us in from the env variables // ask the account manager to log us in from the env variables
accountManager->requestAccessToken(username, password); accountManager->requestAccessToken(username, password);
} else { } else {
qCWarning(assigmnentclient) << "Authentication was requested against" << qPrintable(accountManager->getAuthURL().toString()) qCWarning(assignment_client) << "Authentication was requested against" << qPrintable(accountManager->getAuthURL().toString())
<< "but both or one of" << qPrintable(DATA_SERVER_USERNAME_ENV) << "but both or one of" << qPrintable(DATA_SERVER_USERNAME_ENV)
<< "/" << qPrintable(DATA_SERVER_PASSWORD_ENV) << "are not set. Unable to authenticate."; << "/" << qPrintable(DATA_SERVER_PASSWORD_ENV) << "are not set. Unable to authenticate.";
@ -335,7 +335,7 @@ void AssignmentClient::assignmentCompleted() {
// reset the logging target to the the CHILD_TARGET_NAME // reset the logging target to the the CHILD_TARGET_NAME
LogHandler::getInstance().setTargetName(ASSIGNMENT_CLIENT_TARGET_NAME); LogHandler::getInstance().setTargetName(ASSIGNMENT_CLIENT_TARGET_NAME);
qCDebug(assigmnentclient) << "Assignment finished or never started - waiting for new assignment."; qCDebug(assignment_client) << "Assignment finished or never started - waiting for new assignment.";
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();

View file

@ -11,4 +11,4 @@
#include "AssignmentClientLogging.h" #include "AssignmentClientLogging.h"
Q_LOGGING_CATEGORY(assigmnentclient, "hifi.assignment-client") Q_LOGGING_CATEGORY(assignment_client, "hifi.assignment-client")

View file

@ -14,6 +14,6 @@
#include <QLoggingCategory> #include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(assigmnentclient) Q_DECLARE_LOGGING_CATEGORY(assignment_client)
#endif // hifi_AssignmentClientLogging_h #endif // hifi_AssignmentClientLogging_h

View file

@ -6,8 +6,8 @@ if (WIN32)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add( ExternalProject_Add(
${EXTERNAL_NAME} ${EXTERNAL_NAME}
URL http://hifi-public.s3.amazonaws.com/dependencies/qtaudio_wasapi.zip URL http://hifi-public.s3.amazonaws.com/dependencies/qtaudio_wasapi2.zip
URL_MD5 11c8a7728d6eda7223df800e10b70723 URL_MD5 272b27bd6c211c45c0c23d4701b63b5e
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""

View file

@ -49,6 +49,7 @@ macro(PACKAGE_LIBRARIES_FOR_DEPLOYMENT)
TARGET ${TARGET_NAME} TARGET ${TARGET_NAME}
POST_BUILD POST_BUILD
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} ) COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windowsd.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
) )
endif () endif ()

View file

@ -771,6 +771,21 @@ void DomainGatekeeper::getGroupMemberships(const QString& username) {
// loop through the groups mentioned on the settings page and ask if this user is in each. The replies // loop through the groups mentioned on the settings page and ask if this user is in each. The replies
// will be received asynchronously and permissions will be updated as the answers come in. // will be received asynchronously and permissions will be updated as the answers come in.
QJsonObject json;
QSet<QString> groupIDSet;
foreach (QUuid groupID, _server->_settingsManager.getGroupIDs() + _server->_settingsManager.getBlacklistGroupIDs()) {
groupIDSet += groupID.toString().mid(1,36);
}
if (groupIDSet.isEmpty()) {
// if no groups are in the permissions settings, don't ask who is in which groups.
return;
}
QJsonArray groupIDs = QJsonArray::fromStringList(groupIDSet.toList());
json["groups"] = groupIDs;
// if we've already asked, wait for the answer before asking again // if we've already asked, wait for the answer before asking again
QString lowerUsername = username.toLower(); QString lowerUsername = username.toLower();
if (_inFlightGroupMembershipsRequests.contains(lowerUsername)) { if (_inFlightGroupMembershipsRequests.contains(lowerUsername)) {
@ -779,13 +794,6 @@ void DomainGatekeeper::getGroupMemberships(const QString& username) {
} }
_inFlightGroupMembershipsRequests += lowerUsername; _inFlightGroupMembershipsRequests += lowerUsername;
QJsonObject json;
QSet<QString> groupIDSet;
foreach (QUuid groupID, _server->_settingsManager.getGroupIDs() + _server->_settingsManager.getBlacklistGroupIDs()) {
groupIDSet += groupID.toString().mid(1,36);
}
QJsonArray groupIDs = QJsonArray::fromStringList(groupIDSet.toList());
json["groups"] = groupIDs;
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.jsonCallbackReceiver = this;

View file

@ -1749,7 +1749,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
_ephemeralACScripts[scriptAssignment->getUUID()] = formData[0].second; _ephemeralACScripts[scriptAssignment->getUUID()] = formData[0].second;
// add the script assigment to the assignment queue // add the script assignment to the assignment queue
SharedAssignmentPointer sharedScriptedAssignment(scriptAssignment); SharedAssignmentPointer sharedScriptedAssignment(scriptAssignment);
_unfulfilledAssignments.enqueue(sharedScriptedAssignment); _unfulfilledAssignments.enqueue(sharedScriptedAssignment);
_allAssignments.insert(sharedScriptedAssignment->getUUID(), sharedScriptedAssignment); _allAssignments.insert(sharedScriptedAssignment->getUUID(), sharedScriptedAssignment);

View file

@ -68,6 +68,7 @@
#include <InfoView.h> #include <InfoView.h>
#include <input-plugins/InputPlugin.h> #include <input-plugins/InputPlugin.h>
#include <controllers/UserInputMapper.h> #include <controllers/UserInputMapper.h>
#include <controllers/ScriptingInterface.h>
#include <controllers/StateController.h> #include <controllers/StateController.h>
#include <UserActivityLoggerScriptingInterface.h> #include <UserActivityLoggerScriptingInterface.h>
#include <LogHandler.h> #include <LogHandler.h>
@ -4918,6 +4919,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data()); scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptEngine)); scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptEngine));
auto scriptingInterface = DependencyManager::get<controller::ScriptingInterface>();
scriptEngine->registerGlobalObject("Controller", scriptingInterface.data());
UserInputMapper::registerControllerTypes(scriptEngine);
} }
bool Application::canAcceptURL(const QString& urlString) const { bool Application::canAcceptURL(const QString& urlString) const {

View file

@ -87,7 +87,7 @@ public:
AudioOutputIODevice(MixedProcessedAudioStream& receivedAudioStream, AudioClient* audio) : AudioOutputIODevice(MixedProcessedAudioStream& receivedAudioStream, AudioClient* audio) :
_receivedAudioStream(receivedAudioStream), _audio(audio), _unfulfilledReads(0) {}; _receivedAudioStream(receivedAudioStream), _audio(audio), _unfulfilledReads(0) {};
void start() { open(QIODevice::ReadOnly); } void start() { open(QIODevice::ReadOnly | QIODevice::Unbuffered); }
void stop() { close(); } void stop() { close(); }
qint64 readData(char * data, qint64 maxSize) override; qint64 readData(char * data, qint64 maxSize) override;
qint64 writeData(const char * data, qint64 maxSize) override { return 0; } qint64 writeData(const char * data, qint64 maxSize) override { return 0; }
@ -167,7 +167,8 @@ public slots:
int setOutputBufferSize(int numFrames, bool persist = true); int setOutputBufferSize(int numFrames, bool persist = true);
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) override; bool outputLocalInjector(bool isStereo, AudioInjector* injector) override;
bool shouldLoopbackInjectors() override { return _shouldEchoToServer; }
bool switchInputToAudioDevice(const QString& inputDeviceName); bool switchInputToAudioDevice(const QString& inputDeviceName);
bool switchOutputToAudioDevice(const QString& outputDeviceName); bool switchOutputToAudioDevice(const QString& outputDeviceName);

View file

@ -33,6 +33,7 @@ public:
public slots: public slots:
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0; virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0;
virtual bool shouldLoopbackInjectors() { return false; }
virtual void setIsStereoInput(bool stereo) = 0; virtual void setIsStereoInput(bool stereo) = 0;
}; };

View file

@ -211,6 +211,7 @@ int64_t AudioInjector::injectNextFrame() {
} }
// if we haven't setup the packet to send then do so now // if we haven't setup the packet to send then do so now
static int loopbackOptionOffset = -1;
static int positionOptionOffset = -1; static int positionOptionOffset = -1;
static int volumeOptionOffset = -1; static int volumeOptionOffset = -1;
static int audioDataOffset = -1; static int audioDataOffset = -1;
@ -260,10 +261,9 @@ int64_t AudioInjector::injectNextFrame() {
// pack the stereo/mono type of the stream // pack the stereo/mono type of the stream
audioPacketStream << _options.stereo; audioPacketStream << _options.stereo;
// pack the flag for loopback. Now, we don't loopback // pack the flag for loopback, if requested
// and _always_ play locally, so loopbackFlag should be loopbackOptionOffset = _currentPacket->pos();
// false always. uchar loopbackFlag = (_localAudioInterface && _localAudioInterface->shouldLoopbackInjectors());
uchar loopbackFlag = (uchar)false;
audioPacketStream << loopbackFlag; audioPacketStream << loopbackFlag;
// pack the position for injected audio // pack the position for injected audio
@ -293,6 +293,7 @@ int64_t AudioInjector::injectNextFrame() {
return NEXT_FRAME_DELTA_ERROR_OR_FINISHED; return NEXT_FRAME_DELTA_ERROR_OR_FINISHED;
} }
} }
if (!_frameTimer->isValid()) { if (!_frameTimer->isValid()) {
// in the case where we have been restarted, the frame timer will be invalid and we need to start it back over here // in the case where we have been restarted, the frame timer will be invalid and we need to start it back over here
_frameTimer->restart(); _frameTimer->restart();
@ -317,6 +318,9 @@ int64_t AudioInjector::injectNextFrame() {
// pack the sequence number // pack the sequence number
_currentPacket->writePrimitive(_outgoingSequenceNumber); _currentPacket->writePrimitive(_outgoingSequenceNumber);
_currentPacket->seek(loopbackOptionOffset);
_currentPacket->writePrimitive((uchar)(_localAudioInterface && _localAudioInterface->shouldLoopbackInjectors()));
_currentPacket->seek(positionOptionOffset); _currentPacket->seek(positionOptionOffset);
_currentPacket->writePrimitive(_options.position); _currentPacket->writePrimitive(_options.position);
_currentPacket->writePrimitive(_options.orientation); _currentPacket->writePrimitive(_options.orientation);

View file

@ -67,8 +67,8 @@ void GLWidget::createContext() {
_context = new gl::Context(); _context = new gl::Context();
_context->setWindow(windowHandle()); _context->setWindow(windowHandle());
_context->create(); _context->create();
_context->clear();
_context->makeCurrent(); _context->makeCurrent();
_context->clear();
} }
bool GLWidget::makeCurrent() { bool GLWidget::makeCurrent() {

View file

@ -18,7 +18,6 @@
std::unordered_map<TexturePointer, nvtxRangeId_t> _map; std::unordered_map<TexturePointer, nvtxRangeId_t> _map;
#endif #endif
//#define TEXTURE_TRANSFER_PBOS
#ifdef TEXTURE_TRANSFER_PBOS #ifdef TEXTURE_TRANSFER_PBOS
#define TEXTURE_TRANSFER_BLOCK_SIZE (64 * 1024) #define TEXTURE_TRANSFER_BLOCK_SIZE (64 * 1024)
@ -62,11 +61,16 @@ void GLTextureTransferHelper::transferTexture(const gpu::TexturePointer& texture
void GLTextureTransferHelper::setup() { void GLTextureTransferHelper::setup() {
#ifdef THREADED_TEXTURE_TRANSFER #ifdef THREADED_TEXTURE_TRANSFER
_context.makeCurrent(); _context.makeCurrent();
#ifdef TEXTURE_TRANSFER_FORCE_DRAW
// FIXME don't use opengl 4.5 DSA functionality without verifying it's present
glCreateRenderbuffers(1, &_drawRenderbuffer); glCreateRenderbuffers(1, &_drawRenderbuffer);
glNamedRenderbufferStorage(_drawRenderbuffer, GL_RGBA8, 128, 128); glNamedRenderbufferStorage(_drawRenderbuffer, GL_RGBA8, 128, 128);
glCreateFramebuffers(1, &_drawFramebuffer); glCreateFramebuffers(1, &_drawFramebuffer);
glNamedFramebufferRenderbuffer(_drawFramebuffer, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _drawRenderbuffer); glNamedFramebufferRenderbuffer(_drawFramebuffer, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _drawRenderbuffer);
glCreateFramebuffers(1, &_readFramebuffer); glCreateFramebuffers(1, &_readFramebuffer);
#endif
#ifdef TEXTURE_TRANSFER_PBOS #ifdef TEXTURE_TRANSFER_PBOS
std::array<GLuint, TEXTURE_TRANSFER_PBO_COUNT> pbos; std::array<GLuint, TEXTURE_TRANSFER_PBO_COUNT> pbos;
glCreateBuffers(TEXTURE_TRANSFER_PBO_COUNT, &pbos[0]); glCreateBuffers(TEXTURE_TRANSFER_PBO_COUNT, &pbos[0]);
@ -84,7 +88,9 @@ void GLTextureTransferHelper::setup() {
void GLTextureTransferHelper::shutdown() { void GLTextureTransferHelper::shutdown() {
#ifdef THREADED_TEXTURE_TRANSFER #ifdef THREADED_TEXTURE_TRANSFER
_context.makeCurrent(); _context.makeCurrent();
#endif
#ifdef TEXTURE_TRANSFER_FORCE_DRAW
glNamedFramebufferRenderbuffer(_drawFramebuffer, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); glNamedFramebufferRenderbuffer(_drawFramebuffer, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
glDeleteFramebuffers(1, &_drawFramebuffer); glDeleteFramebuffers(1, &_drawFramebuffer);
_drawFramebuffer = 0; _drawFramebuffer = 0;
@ -165,6 +171,11 @@ bool GLTextureTransferHelper::process() {
} }
gltexture->finishTransfer(); gltexture->finishTransfer();
#ifdef TEXTURE_TRANSFER_FORCE_DRAW
// FIXME force a draw on the texture transfer thread before passing the texture to the main thread for use
#endif
#ifdef THREADED_TEXTURE_TRANSFER #ifdef THREADED_TEXTURE_TRANSFER
clientWait(); clientWait();
#endif #endif

View file

@ -21,6 +21,14 @@
#define THREADED_TEXTURE_TRANSFER #define THREADED_TEXTURE_TRANSFER
#endif #endif
#ifdef THREADED_TEXTURE_TRANSFER
// FIXME when sparse textures are enabled, it's harder to force a draw on the transfer thread
// also, the current draw code is implicitly using OpenGL 4.5 functionality
//#define TEXTURE_TRANSFER_FORCE_DRAW
// FIXME PBO's increase the complexity and don't seem to work reliably
//#define TEXTURE_TRANSFER_PBOS
#endif
namespace gpu { namespace gl { namespace gpu { namespace gl {
using TextureList = std::list<TexturePointer>; using TextureList = std::list<TexturePointer>;
@ -43,11 +51,15 @@ public:
private: private:
#ifdef THREADED_TEXTURE_TRANSFER #ifdef THREADED_TEXTURE_TRANSFER
::gl::OffscreenContext _context; ::gl::OffscreenContext _context;
#endif
#ifdef TEXTURE_TRANSFER_FORCE_DRAW
// Framebuffers / renderbuffers for forcing access to the texture on the transfer thread // Framebuffers / renderbuffers for forcing access to the texture on the transfer thread
GLuint _drawRenderbuffer { 0 }; GLuint _drawRenderbuffer { 0 };
GLuint _drawFramebuffer { 0 }; GLuint _drawFramebuffer { 0 };
GLuint _readFramebuffer { 0 }; GLuint _readFramebuffer { 0 };
#endif #endif
// A mutex for protecting items access on the render and transfer threads // A mutex for protecting items access on the render and transfer threads
Mutex _mutex; Mutex _mutex;
// Commands that have been submitted for execution on the texture transfer thread // Commands that have been submitted for execution on the texture transfer thread

View file

@ -536,15 +536,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
QUuid domainUUID; QUuid domainUUID;
packetStream >> domainUUID; packetStream >> domainUUID;
// if this was the first domain-server list from this domain, we've now connected if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) {
if (!_domainHandler.isConnected()) {
_domainHandler.setUUID(domainUUID);
_domainHandler.setIsConnected(true);
// in case we didn't use a place name to get to this domain,
// give the address manager a chance to lookup a default one now
DependencyManager::get<AddressManager>()->lookupShareableNameForDomainID(domainUUID);
} else if (_domainHandler.getUUID() != domainUUID) {
// Recieved packet from different domain. // Recieved packet from different domain.
qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" << _domainHandler.getUUID(); qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" << _domainHandler.getUUID();
return; return;
@ -555,6 +547,16 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
packetStream >> newUUID; packetStream >> newUUID;
setSessionUUID(newUUID); setSessionUUID(newUUID);
// if this was the first domain-server list from this domain, we've now connected
if (!_domainHandler.isConnected()) {
_domainHandler.setUUID(domainUUID);
_domainHandler.setIsConnected(true);
// in case we didn't use a place name to get to this domain,
// give the address manager a chance to lookup a default one now
DependencyManager::get<AddressManager>()->lookupShareableNameForDomainID(domainUUID);
}
// pull the permissions/right/privileges for this node out of the stream // pull the permissions/right/privileges for this node out of the stream
NodePermissions newPermissions; NodePermissions newPermissions;
packetStream >> newPermissions; packetStream >> newPermissions;

View file

@ -517,10 +517,6 @@ void ScriptEngine::init() {
// constants // constants
globalObject().setProperty("TREE_SCALE", newVariant(QVariant(TREE_SCALE))); globalObject().setProperty("TREE_SCALE", newVariant(QVariant(TREE_SCALE)));
auto scriptingInterface = DependencyManager::get<controller::ScriptingInterface>();
registerGlobalObject("Controller", scriptingInterface.data());
UserInputMapper::registerControllerTypes(this);
auto recordingInterface = DependencyManager::get<RecordingScriptingInterface>(); auto recordingInterface = DependencyManager::get<RecordingScriptingInterface>();
registerGlobalObject("Recording", recordingInterface.data()); registerGlobalObject("Recording", recordingInterface.data());
@ -1021,9 +1017,12 @@ void ScriptEngine::updateMemoryCost(const qint64& deltaSize) {
} }
void ScriptEngine::timerFired() { void ScriptEngine::timerFired() {
if (DependencyManager::get<ScriptEngines>()->isStopped()) { {
qCDebug(scriptengine) << "Script.timerFired() while shutting down is ignored... parent script:" << getFilename(); auto engine = DependencyManager::get<ScriptEngines>();
return; // bail early if (!engine || engine->isStopped()) {
qCDebug(scriptengine) << "Script.timerFired() while shutting down is ignored... parent script:" << getFilename();
return; // bail early
}
} }
QTimer* callingTimer = reinterpret_cast<QTimer*>(sender()); QTimer* callingTimer = reinterpret_cast<QTimer*>(sender());

View file

@ -166,7 +166,7 @@ public:
void setUserLoaded(bool isUserLoaded) { _isUserLoaded = isUserLoaded; } void setUserLoaded(bool isUserLoaded) { _isUserLoaded = isUserLoaded; }
bool isUserLoaded() const { return _isUserLoaded; } bool isUserLoaded() const { return _isUserLoaded; }
// NOTE - this is used by the TypedArray implemetation. we need to review this for thread safety // NOTE - this is used by the TypedArray implementation. we need to review this for thread safety
ArrayBufferClass* getArrayBufferClass() { return _arrayBufferClass; } ArrayBufferClass* getArrayBufferClass() { return _arrayBufferClass; }
void setEmitScriptUpdatesFunction(std::function<bool()> func) { _emitScriptUpdates = func; } void setEmitScriptUpdatesFunction(std::function<bool()> func) { _emitScriptUpdates = func; }