mirror of
https://github.com/overte-org/overte.git
synced 2025-06-21 22:20:26 +02:00
Additional plugin debugging, better plugin resource cleanup
This commit is contained in:
parent
5615f883ce
commit
28771cbda9
29 changed files with 135 additions and 54 deletions
|
@ -1498,6 +1498,9 @@ void Application::cleanupBeforeQuit() {
|
||||||
DependencyManager::get<ScriptEngines>()->shutdownScripting(); // stop all currently running global scripts
|
DependencyManager::get<ScriptEngines>()->shutdownScripting(); // stop all currently running global scripts
|
||||||
DependencyManager::destroy<ScriptEngines>();
|
DependencyManager::destroy<ScriptEngines>();
|
||||||
|
|
||||||
|
_displayPlugin.reset();
|
||||||
|
PluginManager::getInstance()->shutdown();
|
||||||
|
|
||||||
// Cleanup all overlays after the scripts, as scripts might add more
|
// Cleanup all overlays after the scripts, as scripts might add more
|
||||||
_overlays.cleanupAllOverlays();
|
_overlays.cleanupAllOverlays();
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ void ApplicationOverlay::buildFramebufferObject() {
|
||||||
|
|
||||||
auto uiSize = qApp->getUiSize();
|
auto uiSize = qApp->getUiSize();
|
||||||
if (!_overlayFramebuffer || uiSize != _overlayFramebuffer->getSize()) {
|
if (!_overlayFramebuffer || uiSize != _overlayFramebuffer->getSize()) {
|
||||||
_overlayFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_overlayFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("ApplicationOverlay"));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto width = uiSize.x;
|
auto width = uiSize.x;
|
||||||
|
|
|
@ -356,6 +356,7 @@ void OpenGLDisplayPlugin::customizeContext() {
|
||||||
gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA),
|
gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA),
|
||||||
image.width(), image.height(),
|
image.width(), image.height(),
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
||||||
|
cursorData.texture->setSource("cursor texture");
|
||||||
auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha();
|
auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha();
|
||||||
cursorData.texture->setUsage(usage.build());
|
cursorData.texture->setUsage(usage.build());
|
||||||
cursorData.texture->assignStoredMip(0, gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), image.byteCount(), image.constBits());
|
cursorData.texture->assignStoredMip(0, gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), image.byteCount(), image.constBits());
|
||||||
|
@ -413,8 +414,6 @@ void OpenGLDisplayPlugin::customizeContext() {
|
||||||
_cursorPipeline = gpu::Pipeline::create(program, state);
|
_cursorPipeline = gpu::Pipeline::create(program, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto renderSize = getRecommendedRenderSize();
|
|
||||||
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::uncustomizeContext() {
|
void OpenGLDisplayPlugin::uncustomizeContext() {
|
||||||
|
@ -424,6 +423,7 @@ void OpenGLDisplayPlugin::uncustomizeContext() {
|
||||||
_compositeFramebuffer.reset();
|
_compositeFramebuffer.reset();
|
||||||
withPresentThreadLock([&] {
|
withPresentThreadLock([&] {
|
||||||
_currentFrame.reset();
|
_currentFrame.reset();
|
||||||
|
_lastFrame = nullptr;
|
||||||
while (!_newFrameQueue.empty()) {
|
while (!_newFrameQueue.empty()) {
|
||||||
_gpuContext->consumeFrameUpdates(_newFrameQueue.front());
|
_gpuContext->consumeFrameUpdates(_newFrameQueue.front());
|
||||||
_newFrameQueue.pop();
|
_newFrameQueue.pop();
|
||||||
|
@ -559,7 +559,7 @@ void OpenGLDisplayPlugin::compositeScene() {
|
||||||
void OpenGLDisplayPlugin::compositeLayers() {
|
void OpenGLDisplayPlugin::compositeLayers() {
|
||||||
auto renderSize = getRecommendedRenderSize();
|
auto renderSize = getRecommendedRenderSize();
|
||||||
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
|
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
|
||||||
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
|
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("displayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -611,10 +611,10 @@ void OpenGLDisplayPlugin::present() {
|
||||||
{
|
{
|
||||||
withPresentThreadLock([&] {
|
withPresentThreadLock([&] {
|
||||||
_renderRate.increment();
|
_renderRate.increment();
|
||||||
if (_currentFrame != _lastFrame) {
|
if (_currentFrame.get() != _lastFrame) {
|
||||||
_newFrameRate.increment();
|
_newFrameRate.increment();
|
||||||
}
|
}
|
||||||
_lastFrame = _currentFrame;
|
_lastFrame = _currentFrame.get();
|
||||||
});
|
});
|
||||||
// Execute the frame rendering commands
|
// Execute the frame rendering commands
|
||||||
PROFILE_RANGE_EX("execute", 0xff00ff00, (uint64_t)presentCount())
|
PROFILE_RANGE_EX("execute", 0xff00ff00, (uint64_t)presentCount())
|
||||||
|
@ -755,3 +755,8 @@ void OpenGLDisplayPlugin::render(std::function<void(gpu::Batch& batch)> f) {
|
||||||
f(batch);
|
f(batch);
|
||||||
_gpuContext->executeBatch(batch);
|
_gpuContext->executeBatch(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OpenGLDisplayPlugin::~OpenGLDisplayPlugin() {
|
||||||
|
qDebug() << "Destroying OpenGLDisplayPlugin";
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
||||||
using Lock = std::unique_lock<Mutex>;
|
using Lock = std::unique_lock<Mutex>;
|
||||||
using Condition = std::condition_variable;
|
using Condition = std::condition_variable;
|
||||||
public:
|
public:
|
||||||
|
~OpenGLDisplayPlugin();
|
||||||
// These must be final to ensure proper ordering of operations
|
// These must be final to ensure proper ordering of operations
|
||||||
// between the main thread and the presentation thread
|
// between the main thread and the presentation thread
|
||||||
bool activate() override final;
|
bool activate() override final;
|
||||||
|
@ -115,7 +116,7 @@ protected:
|
||||||
RateCounter<> _renderRate;
|
RateCounter<> _renderRate;
|
||||||
|
|
||||||
gpu::FramePointer _currentFrame;
|
gpu::FramePointer _currentFrame;
|
||||||
gpu::FramePointer _lastFrame;
|
gpu::Frame* _lastFrame { nullptr };
|
||||||
gpu::FramebufferPointer _compositeFramebuffer;
|
gpu::FramebufferPointer _compositeFramebuffer;
|
||||||
gpu::PipelinePointer _overlayPipeline;
|
gpu::PipelinePointer _overlayPipeline;
|
||||||
gpu::PipelinePointer _simplePipeline;
|
gpu::PipelinePointer _simplePipeline;
|
||||||
|
|
|
@ -125,6 +125,7 @@ void HmdDisplayPlugin::uncustomizeContext() {
|
||||||
batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, vec4(0));
|
batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, vec4(0));
|
||||||
});
|
});
|
||||||
_overlayRenderer = OverlayRenderer();
|
_overlayRenderer = OverlayRenderer();
|
||||||
|
_previewTexture.reset();
|
||||||
Parent::uncustomizeContext();
|
Parent::uncustomizeContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +266,7 @@ void HmdDisplayPlugin::internalPresent() {
|
||||||
gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA),
|
gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA),
|
||||||
image.width(), image.height(),
|
image.width(), image.height(),
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
||||||
|
_previewTexture->setSource("HMD Preview Texture");
|
||||||
_previewTexture->setUsage(gpu::Texture::Usage::Builder().withColor().build());
|
_previewTexture->setUsage(gpu::Texture::Usage::Builder().withColor().build());
|
||||||
_previewTexture->assignStoredMip(0, gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), image.byteCount(), image.constBits());
|
_previewTexture->assignStoredMip(0, gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), image.byteCount(), image.constBits());
|
||||||
_previewTexture->autoGenerateMips(-1);
|
_previewTexture->autoGenerateMips(-1);
|
||||||
|
@ -633,3 +635,6 @@ void HmdDisplayPlugin::compositeExtra() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HmdDisplayPlugin::~HmdDisplayPlugin() {
|
||||||
|
qDebug() << "Destroying HmdDisplayPlugin";
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
class HmdDisplayPlugin : public OpenGLDisplayPlugin {
|
class HmdDisplayPlugin : public OpenGLDisplayPlugin {
|
||||||
using Parent = OpenGLDisplayPlugin;
|
using Parent = OpenGLDisplayPlugin;
|
||||||
public:
|
public:
|
||||||
|
~HmdDisplayPlugin();
|
||||||
bool isHmd() const override final { return true; }
|
bool isHmd() const override final { return true; }
|
||||||
float getIPD() const override final { return _ipd; }
|
float getIPD() const override final { return _ipd; }
|
||||||
glm::mat4 getEyeToHeadTransform(Eye eye) const override final { return _eyeOffsets[eye]; }
|
glm::mat4 getEyeToHeadTransform(Eye eye) const override final { return _eyeOffsets[eye]; }
|
||||||
|
|
|
@ -20,16 +20,17 @@ using namespace gpu;
|
||||||
Framebuffer::~Framebuffer() {
|
Framebuffer::~Framebuffer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Framebuffer* Framebuffer::create() {
|
Framebuffer* Framebuffer::create(const std::string& name) {
|
||||||
auto framebuffer = new Framebuffer();
|
auto framebuffer = new Framebuffer();
|
||||||
|
framebuffer->setName(name);
|
||||||
framebuffer->_renderBuffers.resize(MAX_NUM_RENDER_BUFFERS);
|
framebuffer->_renderBuffers.resize(MAX_NUM_RENDER_BUFFERS);
|
||||||
framebuffer->_colorStamps.resize(MAX_NUM_RENDER_BUFFERS, 0);
|
framebuffer->_colorStamps.resize(MAX_NUM_RENDER_BUFFERS, 0);
|
||||||
return framebuffer;
|
return framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Framebuffer* Framebuffer::create( const Format& colorBufferFormat, uint16 width, uint16 height) {
|
Framebuffer* Framebuffer::create(const std::string& name, const Format& colorBufferFormat, uint16 width, uint16 height) {
|
||||||
auto framebuffer = Framebuffer::create();
|
auto framebuffer = Framebuffer::create(name);
|
||||||
|
|
||||||
auto colorTexture = TexturePointer(Texture::create2D(colorBufferFormat, width, height, Sampler(Sampler::FILTER_MIN_MAG_POINT)));
|
auto colorTexture = TexturePointer(Texture::create2D(colorBufferFormat, width, height, Sampler(Sampler::FILTER_MIN_MAG_POINT)));
|
||||||
colorTexture->setSource("Framebuffer::colorTexture");
|
colorTexture->setSource("Framebuffer::colorTexture");
|
||||||
|
@ -39,13 +40,11 @@ Framebuffer* Framebuffer::create( const Format& colorBufferFormat, uint16 width,
|
||||||
return framebuffer;
|
return framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Framebuffer* Framebuffer::create( const Format& colorBufferFormat, const Format& depthStencilBufferFormat, uint16 width, uint16 height) {
|
Framebuffer* Framebuffer::create(const std::string& name, const Format& colorBufferFormat, const Format& depthStencilBufferFormat, uint16 width, uint16 height) {
|
||||||
auto framebuffer = Framebuffer::create();
|
auto framebuffer = Framebuffer::create(name);
|
||||||
|
|
||||||
auto colorTexture = TexturePointer(Texture::create2D(colorBufferFormat, width, height, Sampler(Sampler::FILTER_MIN_MAG_POINT)));
|
auto colorTexture = TexturePointer(Texture::create2D(colorBufferFormat, width, height, Sampler(Sampler::FILTER_MIN_MAG_POINT)));
|
||||||
colorTexture->setSource("Framebuffer::colorTexture");
|
|
||||||
auto depthTexture = TexturePointer(Texture::create2D(depthStencilBufferFormat, width, height, Sampler(Sampler::FILTER_MIN_MAG_POINT)));
|
auto depthTexture = TexturePointer(Texture::create2D(depthStencilBufferFormat, width, height, Sampler(Sampler::FILTER_MIN_MAG_POINT)));
|
||||||
depthTexture->setSource("Framebuffer::depthTexture");
|
|
||||||
framebuffer->setRenderBuffer(0, colorTexture);
|
framebuffer->setRenderBuffer(0, colorTexture);
|
||||||
framebuffer->setDepthStencilBuffer(depthTexture, depthStencilBufferFormat);
|
framebuffer->setDepthStencilBuffer(depthTexture, depthStencilBufferFormat);
|
||||||
|
|
||||||
|
@ -53,11 +52,10 @@ Framebuffer* Framebuffer::create( const Format& colorBufferFormat, const Format&
|
||||||
}
|
}
|
||||||
|
|
||||||
Framebuffer* Framebuffer::createShadowmap(uint16 width) {
|
Framebuffer* Framebuffer::createShadowmap(uint16 width) {
|
||||||
auto framebuffer = Framebuffer::create();
|
auto framebuffer = Framebuffer::create("Shadowmap");
|
||||||
|
|
||||||
auto depthFormat = Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); // Depth32 texel format
|
auto depthFormat = Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); // Depth32 texel format
|
||||||
auto depthTexture = TexturePointer(Texture::create2D(depthFormat, width, width));
|
auto depthTexture = TexturePointer(Texture::create2D(depthFormat, width, width));
|
||||||
depthTexture->setSource("Framebuffer::shadowMap");
|
|
||||||
Sampler::Desc samplerDesc;
|
Sampler::Desc samplerDesc;
|
||||||
samplerDesc._borderColor = glm::vec4(1.0f);
|
samplerDesc._borderColor = glm::vec4(1.0f);
|
||||||
samplerDesc._wrapModeU = Sampler::WRAP_BORDER;
|
samplerDesc._wrapModeU = Sampler::WRAP_BORDER;
|
||||||
|
@ -155,6 +153,10 @@ int Framebuffer::setRenderBuffer(uint32 slot, const TexturePointer& texture, uin
|
||||||
if (!validateTargetCompatibility(*texture, subresource)) {
|
if (!validateTargetCompatibility(*texture, subresource)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (texture->source().empty()) {
|
||||||
|
texture->setSource(_name + "::color::" + std::to_string(slot));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++_colorStamps[slot];
|
++_colorStamps[slot];
|
||||||
|
@ -216,7 +218,6 @@ uint32 Framebuffer::getRenderBufferSubresource(uint32 slot) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Framebuffer::setDepthStencilBuffer(const TexturePointer& texture, const Format& format, uint32 subresource) {
|
bool Framebuffer::setDepthStencilBuffer(const TexturePointer& texture, const Format& format, uint32 subresource) {
|
||||||
++_depthStamp;
|
|
||||||
if (isSwapchain()) {
|
if (isSwapchain()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -226,8 +227,13 @@ bool Framebuffer::setDepthStencilBuffer(const TexturePointer& texture, const For
|
||||||
if (!validateTargetCompatibility(*texture)) {
|
if (!validateTargetCompatibility(*texture)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (texture->source().empty()) {
|
||||||
|
texture->setSource(_name + "::depthStencil");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++_depthStamp;
|
||||||
updateSize(texture);
|
updateSize(texture);
|
||||||
|
|
||||||
// assign the new one
|
// assign the new one
|
||||||
|
|
|
@ -88,9 +88,9 @@ public:
|
||||||
~Framebuffer();
|
~Framebuffer();
|
||||||
|
|
||||||
static Framebuffer* create(const SwapchainPointer& swapchain);
|
static Framebuffer* create(const SwapchainPointer& swapchain);
|
||||||
static Framebuffer* create();
|
static Framebuffer* create(const std::string& name);
|
||||||
static Framebuffer* create(const Format& colorBufferFormat, uint16 width, uint16 height);
|
static Framebuffer* create(const std::string& name, const Format& colorBufferFormat, uint16 width, uint16 height);
|
||||||
static Framebuffer* create(const Format& colorBufferFormat, const Format& depthStencilBufferFormat, uint16 width, uint16 height);
|
static Framebuffer* create(const std::string& name, const Format& colorBufferFormat, const Format& depthStencilBufferFormat, uint16 width, uint16 height);
|
||||||
static Framebuffer* createShadowmap(uint16 width);
|
static Framebuffer* createShadowmap(uint16 width);
|
||||||
|
|
||||||
bool isSwapchain() const;
|
bool isSwapchain() const;
|
||||||
|
@ -127,6 +127,8 @@ public:
|
||||||
uint16 getWidth() const;
|
uint16 getWidth() const;
|
||||||
uint16 getHeight() const;
|
uint16 getHeight() const;
|
||||||
uint16 getNumSamples() const;
|
uint16 getNumSamples() const;
|
||||||
|
const std::string& getName() const { return _name; }
|
||||||
|
void setName(const std::string& name) { _name = name; }
|
||||||
|
|
||||||
float getAspectRatio() const { return getWidth() / (float) getHeight() ; }
|
float getAspectRatio() const { return getWidth() / (float) getHeight() ; }
|
||||||
|
|
||||||
|
@ -145,6 +147,7 @@ public:
|
||||||
static Transform evalSubregionTexcoordTransform(const glm::ivec2& sourceSurface, const glm::ivec4& destViewport);
|
static Transform evalSubregionTexcoordTransform(const glm::ivec2& sourceSurface, const glm::ivec4& destViewport);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
std::string _name;
|
||||||
SwapchainPointer _swapchain;
|
SwapchainPointer _swapchain;
|
||||||
|
|
||||||
Stamp _depthStamp { 0 };
|
Stamp _depthStamp { 0 };
|
||||||
|
|
|
@ -276,4 +276,30 @@ void PluginManager::saveSettings() {
|
||||||
saveInputPluginSettings(getInputPlugins());
|
saveInputPluginSettings(getInputPlugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PluginManager::shutdown() {
|
||||||
|
for (auto inputPlugin : getInputPlugins()) {
|
||||||
|
if (inputPlugin->isActive()) {
|
||||||
|
inputPlugin->deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto displayPlugins : getDisplayPlugins()) {
|
||||||
|
if (displayPlugins->isActive()) {
|
||||||
|
displayPlugins->deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto loadedPlugins = getLoadedPlugins();
|
||||||
|
// Now grab the dynamic plugins
|
||||||
|
for (auto loader : getLoadedPlugins()) {
|
||||||
|
InputProvider* inputProvider = qobject_cast<InputProvider*>(loader->instance());
|
||||||
|
if (inputProvider) {
|
||||||
|
inputProvider->destroyInputPlugins();
|
||||||
|
}
|
||||||
|
DisplayProvider* displayProvider = qobject_cast<DisplayProvider*>(loader->instance());
|
||||||
|
if (displayProvider) {
|
||||||
|
displayProvider->destroyDisplayPlugins();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,8 @@ public:
|
||||||
void disableInputs(const QStringList& inputs);
|
void disableInputs(const QStringList& inputs);
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void setContainer(PluginContainer* container) { _container = container; }
|
void setContainer(PluginContainer* container) { _container = container; }
|
||||||
|
|
||||||
|
void shutdown();
|
||||||
private:
|
private:
|
||||||
PluginContainer* _container { nullptr };
|
PluginContainer* _container { nullptr };
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
virtual ~DisplayProvider() {}
|
virtual ~DisplayProvider() {}
|
||||||
|
|
||||||
virtual DisplayPluginList getDisplayPlugins() = 0;
|
virtual DisplayPluginList getDisplayPlugins() = 0;
|
||||||
|
virtual void destroyDisplayPlugins() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DisplayProvider_iid "com.highfidelity.plugins.display"
|
#define DisplayProvider_iid "com.highfidelity.plugins.display"
|
||||||
|
@ -29,6 +30,7 @@ class InputProvider {
|
||||||
public:
|
public:
|
||||||
virtual ~InputProvider() {}
|
virtual ~InputProvider() {}
|
||||||
virtual InputPluginList getInputPlugins() = 0;
|
virtual InputPluginList getInputPlugins() = 0;
|
||||||
|
virtual void destroyInputPlugins() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define InputProvider_iid "com.highfidelity.plugins.input"
|
#define InputProvider_iid "com.highfidelity.plugins.input"
|
||||||
|
|
|
@ -75,11 +75,11 @@ void AmbientOcclusionFramebuffer::allocate() {
|
||||||
auto height = _frameSize.y;
|
auto height = _frameSize.y;
|
||||||
|
|
||||||
_occlusionTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
_occlusionTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_occlusionFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_occlusionFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("occlusion"));
|
||||||
_occlusionFramebuffer->setRenderBuffer(0, _occlusionTexture);
|
_occlusionFramebuffer->setRenderBuffer(0, _occlusionTexture);
|
||||||
|
|
||||||
_occlusionBlurredTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
_occlusionBlurredTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_occlusionBlurredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_occlusionBlurredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("occlusionBlurred"));
|
||||||
_occlusionBlurredFramebuffer->setRenderBuffer(0, _occlusionBlurredTexture);
|
_occlusionBlurredFramebuffer->setRenderBuffer(0, _occlusionBlurredTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,10 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() {
|
||||||
|
|
||||||
if (!_antialiasingBuffer) {
|
if (!_antialiasingBuffer) {
|
||||||
// Link the antialiasing FBO to texture
|
// Link the antialiasing FBO to texture
|
||||||
_antialiasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_antialiasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("antialiasing"));
|
||||||
auto format = gpu::Element::COLOR_SRGBA_32; // DependencyManager::get<FramebufferCache>()->getLightingTexture()->getTexelFormat();
|
auto format = gpu::Element::COLOR_SRGBA_32; // DependencyManager::get<FramebufferCache>()->getLightingTexture()->getTexelFormat();
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
||||||
_antialiasingTexture = gpu::TexturePointer(gpu::Texture::create2D(format, width, height, defaultSampler));
|
_antialiasingTexture = gpu::TexturePointer(gpu::Texture::create2D(format, width, height, defaultSampler));
|
||||||
_antialiasingTexture->setSource("Antialiasing::_antialiasingTexture");
|
|
||||||
_antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture);
|
_antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,8 @@ void DeferredFramebuffer::updatePrimaryDepth(const gpu::TexturePointer& depthBuf
|
||||||
|
|
||||||
void DeferredFramebuffer::allocate() {
|
void DeferredFramebuffer::allocate() {
|
||||||
|
|
||||||
_deferredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_deferredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("deferred"));
|
||||||
_deferredFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_deferredFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create("deferredDepthColor"));
|
||||||
|
|
||||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
||||||
auto linearFormat = gpu::Element::COLOR_RGBA_32;
|
auto linearFormat = gpu::Element::COLOR_RGBA_32;
|
||||||
|
@ -54,11 +54,8 @@ void DeferredFramebuffer::allocate() {
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
||||||
|
|
||||||
_deferredColorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler));
|
_deferredColorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler));
|
||||||
_deferredColorTexture->setSource("DeferredFramebuffer::_deferredColorTexture");
|
|
||||||
_deferredNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(linearFormat, width, height, defaultSampler));
|
_deferredNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(linearFormat, width, height, defaultSampler));
|
||||||
_deferredNormalTexture->setSource("DeferredFramebuffer::_deferredNormalTexture");
|
|
||||||
_deferredSpecularTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler));
|
_deferredSpecularTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler));
|
||||||
_deferredSpecularTexture->setSource("DeferredFramebuffer::_deferredSpecularTexture");
|
|
||||||
|
|
||||||
_deferredFramebuffer->setRenderBuffer(0, _deferredColorTexture);
|
_deferredFramebuffer->setRenderBuffer(0, _deferredColorTexture);
|
||||||
_deferredFramebuffer->setRenderBuffer(1, _deferredNormalTexture);
|
_deferredFramebuffer->setRenderBuffer(1, _deferredNormalTexture);
|
||||||
|
@ -69,7 +66,6 @@ void DeferredFramebuffer::allocate() {
|
||||||
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||||
if (!_primaryDepthTexture) {
|
if (!_primaryDepthTexture) {
|
||||||
_primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));
|
_primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));
|
||||||
_primaryDepthTexture->setSource("DeferredFramebuffer::_primaryDepthTexture");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_deferredFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
_deferredFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
||||||
|
@ -80,8 +76,7 @@ void DeferredFramebuffer::allocate() {
|
||||||
auto smoothSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR);
|
auto smoothSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR);
|
||||||
|
|
||||||
_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::R11G11B10), width, height, defaultSampler));
|
_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::R11G11B10), width, height, defaultSampler));
|
||||||
_lightingTexture->setSource("DeferredFramebuffer::_lightingTexture");
|
_lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("lighting"));
|
||||||
_lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
|
||||||
_lightingFramebuffer->setRenderBuffer(0, _lightingTexture);
|
_lightingFramebuffer->setRenderBuffer(0, _lightingTexture);
|
||||||
_lightingFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
_lightingFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
||||||
|
|
||||||
|
|
|
@ -346,12 +346,11 @@ void PreparePrimaryFramebuffer::run(const SceneContextPointer& sceneContext, con
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_primaryFramebuffer) {
|
if (!_primaryFramebuffer) {
|
||||||
_primaryFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_primaryFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("deferredPrimary"));
|
||||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
||||||
|
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
||||||
auto primaryColorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, frameSize.x, frameSize.y, defaultSampler));
|
auto primaryColorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, frameSize.x, frameSize.y, defaultSampler));
|
||||||
primaryColorTexture->setSource("PreparePrimaryFramebuffer::primaryColorTexture");
|
|
||||||
|
|
||||||
|
|
||||||
_primaryFramebuffer->setRenderBuffer(0, primaryColorTexture);
|
_primaryFramebuffer->setRenderBuffer(0, primaryColorTexture);
|
||||||
|
@ -359,7 +358,6 @@ void PreparePrimaryFramebuffer::run(const SceneContextPointer& sceneContext, con
|
||||||
|
|
||||||
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||||
auto primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, frameSize.x, frameSize.y, defaultSampler));
|
auto primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, frameSize.x, frameSize.y, defaultSampler));
|
||||||
primaryDepthTexture->setSource("PreparePrimaryFramebuffer::primaryDepthTexture");
|
|
||||||
|
|
||||||
_primaryFramebuffer->setDepthStencilBuffer(primaryDepthTexture, depthFormat);
|
_primaryFramebuffer->setDepthStencilBuffer(primaryDepthTexture, depthFormat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
|
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
||||||
|
|
||||||
_selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("selfie"));
|
||||||
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
||||||
_selfieFramebuffer->setRenderBuffer(0, tex);
|
_selfieFramebuffer->setRenderBuffer(0, tex);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
gpu::FramebufferPointer FramebufferCache::getFramebuffer() {
|
gpu::FramebufferPointer FramebufferCache::getFramebuffer() {
|
||||||
std::unique_lock<std::mutex> lock(_mutex);
|
std::unique_lock<std::mutex> lock(_mutex);
|
||||||
if (_cachedFramebuffers.empty()) {
|
if (_cachedFramebuffers.empty()) {
|
||||||
_cachedFramebuffers.push_back(gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_SRGBA_32, _frameBufferSize.width(), _frameBufferSize.height())));
|
_cachedFramebuffers.push_back(gpu::FramebufferPointer(gpu::Framebuffer::create("cached", gpu::Element::COLOR_SRGBA_32, _frameBufferSize.width(), _frameBufferSize.height())));
|
||||||
}
|
}
|
||||||
gpu::FramebufferPointer result = _cachedFramebuffers.front();
|
gpu::FramebufferPointer result = _cachedFramebuffers.front();
|
||||||
_cachedFramebuffers.pop_front();
|
_cachedFramebuffers.pop_front();
|
||||||
|
|
|
@ -319,7 +319,7 @@ void diffuseProfileGPU(gpu::TexturePointer& profileMap, RenderArgs* args) {
|
||||||
makePipeline = gpu::Pipeline::create(program, state);
|
makePipeline = gpu::Pipeline::create(program, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("diffuseProfile"));
|
||||||
makeFramebuffer->setRenderBuffer(0, profileMap);
|
makeFramebuffer->setRenderBuffer(0, profileMap);
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||||
|
@ -356,7 +356,7 @@ void diffuseScatterGPU(const gpu::TexturePointer& profileMap, gpu::TexturePointe
|
||||||
makePipeline = gpu::Pipeline::create(program, state);
|
makePipeline = gpu::Pipeline::create(program, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("diffuseScatter"));
|
||||||
makeFramebuffer->setRenderBuffer(0, lut);
|
makeFramebuffer->setRenderBuffer(0, lut);
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||||
|
@ -393,7 +393,7 @@ void computeSpecularBeckmannGPU(gpu::TexturePointer& beckmannMap, RenderArgs* ar
|
||||||
makePipeline = gpu::Pipeline::create(program, state);
|
makePipeline = gpu::Pipeline::create(program, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("computeSpecularBeckmann"));
|
||||||
makeFramebuffer->setRenderBuffer(0, beckmannMap);
|
makeFramebuffer->setRenderBuffer(0, beckmannMap);
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||||
|
|
|
@ -74,22 +74,19 @@ void LinearDepthFramebuffer::allocate() {
|
||||||
// For Linear Depth:
|
// For Linear Depth:
|
||||||
_linearDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RGB), width, height,
|
_linearDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RGB), width, height,
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_linearDepthTexture->setSource("LinearDepthFramebuffer::_linearDepthTexture");
|
_linearDepthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("linearDepth"));
|
||||||
_linearDepthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
|
||||||
_linearDepthFramebuffer->setRenderBuffer(0, _linearDepthTexture);
|
_linearDepthFramebuffer->setRenderBuffer(0, _linearDepthTexture);
|
||||||
_linearDepthFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, _primaryDepthTexture->getTexelFormat());
|
_linearDepthFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, _primaryDepthTexture->getTexelFormat());
|
||||||
|
|
||||||
// For Downsampling:
|
// For Downsampling:
|
||||||
_halfLinearDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RGB), _halfFrameSize.x, _halfFrameSize.y,
|
_halfLinearDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RGB), _halfFrameSize.x, _halfFrameSize.y,
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_halfLinearDepthTexture->setSource("LinearDepthFramebuffer::_halfLinearDepthTexture");
|
|
||||||
_halfLinearDepthTexture->autoGenerateMips(5);
|
_halfLinearDepthTexture->autoGenerateMips(5);
|
||||||
|
|
||||||
_halfNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB), _halfFrameSize.x, _halfFrameSize.y,
|
_halfNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB), _halfFrameSize.x, _halfFrameSize.y,
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_halfNormalTexture->setSource("LinearDepthFramebuffer::_halfNormalTexture");
|
|
||||||
|
|
||||||
_downsampleFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_downsampleFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("halfLinearDepth"));
|
||||||
_downsampleFramebuffer->setRenderBuffer(0, _halfLinearDepthTexture);
|
_downsampleFramebuffer->setRenderBuffer(0, _halfLinearDepthTexture);
|
||||||
_downsampleFramebuffer->setRenderBuffer(1, _halfNormalTexture);
|
_downsampleFramebuffer->setRenderBuffer(1, _halfNormalTexture);
|
||||||
}
|
}
|
||||||
|
@ -304,18 +301,15 @@ void SurfaceGeometryFramebuffer::allocate() {
|
||||||
auto height = _frameSize.y;
|
auto height = _frameSize.y;
|
||||||
|
|
||||||
_curvatureTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
_curvatureTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_curvatureTexture->setSource("SurfaceGeometryFramebuffer::_curvatureTexture");
|
_curvatureFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("surfaceGeometry::curvature"));
|
||||||
_curvatureFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
|
||||||
_curvatureFramebuffer->setRenderBuffer(0, _curvatureTexture);
|
_curvatureFramebuffer->setRenderBuffer(0, _curvatureTexture);
|
||||||
|
|
||||||
_lowCurvatureTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
_lowCurvatureTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_lowCurvatureTexture->setSource("SurfaceGeometryFramebuffer::_lowCurvatureTexture");
|
_lowCurvatureFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("surfaceGeometry::lowCurvature"));
|
||||||
_lowCurvatureFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
|
||||||
_lowCurvatureFramebuffer->setRenderBuffer(0, _lowCurvatureTexture);
|
_lowCurvatureFramebuffer->setRenderBuffer(0, _lowCurvatureTexture);
|
||||||
|
|
||||||
_blurringTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
_blurringTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR_MIP_POINT)));
|
||||||
_blurringTexture->setSource("SurfaceGeometryFramebuffer::_blurringTexture");
|
_blurringFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("surfaceGeometry::blurring"));
|
||||||
_blurringFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
|
||||||
_blurringFramebuffer->setRenderBuffer(0, _blurringTexture);
|
_blurringFramebuffer->setRenderBuffer(0, _blurringTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ bool BlurInOutResource::updateResources(const gpu::FramebufferPointer& sourceFra
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_blurredFramebuffer) {
|
if (!_blurredFramebuffer) {
|
||||||
_blurredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_blurredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("blur"));
|
||||||
|
|
||||||
// attach depthStencil if present in source
|
// attach depthStencil if present in source
|
||||||
//if (sourceFramebuffer->hasDepthStencil()) {
|
//if (sourceFramebuffer->hasDepthStencil()) {
|
||||||
|
@ -124,7 +124,7 @@ bool BlurInOutResource::updateResources(const gpu::FramebufferPointer& sourceFra
|
||||||
// The job output the blur result in a new Framebuffer spawning here.
|
// The job output the blur result in a new Framebuffer spawning here.
|
||||||
// Let s make sure it s ready for this
|
// Let s make sure it s ready for this
|
||||||
if (!_outputFramebuffer) {
|
if (!_outputFramebuffer) {
|
||||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("blurOutput"));
|
||||||
|
|
||||||
// attach depthStencil if present in source
|
// attach depthStencil if present in source
|
||||||
/* if (sourceFramebuffer->hasDepthStencil()) {
|
/* if (sourceFramebuffer->hasDepthStencil()) {
|
||||||
|
|
|
@ -38,6 +38,10 @@ public:
|
||||||
return _inputPlugins;
|
return _inputPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void destroyInputPlugins() override {
|
||||||
|
_inputPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InputPluginList _inputPlugins;
|
InputPluginList _inputPlugins;
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,6 +37,10 @@ public:
|
||||||
return _inputPlugins;
|
return _inputPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void destroyInputPlugins() override {
|
||||||
|
_inputPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InputPluginList _inputPlugins;
|
InputPluginList _inputPlugins;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,9 @@ public:
|
||||||
return _inputPlugins;
|
return _inputPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void destroyInputPlugins() override {
|
||||||
|
_inputPlugins.clear();
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
InputPluginList _inputPlugins;
|
InputPluginList _inputPlugins;
|
||||||
};
|
};
|
||||||
|
|
|
@ -126,3 +126,7 @@ void OculusBaseDisplayPlugin::updatePresentPose() {
|
||||||
//_currentPresentFrameInfo.presentPose = toGlm(trackingState.HeadPose.ThePose);
|
//_currentPresentFrameInfo.presentPose = toGlm(trackingState.HeadPose.ThePose);
|
||||||
_currentPresentFrameInfo.presentPose = _currentPresentFrameInfo.renderPose;
|
_currentPresentFrameInfo.presentPose = _currentPresentFrameInfo.renderPose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OculusBaseDisplayPlugin::~OculusBaseDisplayPlugin() {
|
||||||
|
qDebug() << "Destroying OculusBaseDisplayPlugin";
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
class OculusBaseDisplayPlugin : public HmdDisplayPlugin {
|
class OculusBaseDisplayPlugin : public HmdDisplayPlugin {
|
||||||
using Parent = HmdDisplayPlugin;
|
using Parent = HmdDisplayPlugin;
|
||||||
public:
|
public:
|
||||||
|
~OculusBaseDisplayPlugin();
|
||||||
bool isSupported() const override;
|
bool isSupported() const override;
|
||||||
|
|
||||||
// Stereo specific methods
|
// Stereo specific methods
|
||||||
|
|
|
@ -46,7 +46,7 @@ void OculusDisplayPlugin::cycleDebugOutput() {
|
||||||
|
|
||||||
void OculusDisplayPlugin::customizeContext() {
|
void OculusDisplayPlugin::customizeContext() {
|
||||||
Parent::customizeContext();
|
Parent::customizeContext();
|
||||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_SRGBA_32, _renderTargetSize.x, _renderTargetSize.y));
|
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OculusOutput", gpu::Element::COLOR_SRGBA_32, _renderTargetSize.x, _renderTargetSize.y));
|
||||||
ovrTextureSwapChainDesc desc = { };
|
ovrTextureSwapChainDesc desc = { };
|
||||||
desc.Type = ovrTexture_2D;
|
desc.Type = ovrTexture_2D;
|
||||||
desc.ArraySize = 1;
|
desc.ArraySize = 1;
|
||||||
|
@ -97,6 +97,7 @@ void OculusDisplayPlugin::uncustomizeContext() {
|
||||||
|
|
||||||
ovr_DestroyTextureSwapChain(_session, _textureSwapChain);
|
ovr_DestroyTextureSwapChain(_session, _textureSwapChain);
|
||||||
_textureSwapChain = nullptr;
|
_textureSwapChain = nullptr;
|
||||||
|
_outputFramebuffer.reset();
|
||||||
Parent::uncustomizeContext();
|
Parent::uncustomizeContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,3 +164,7 @@ QString OculusDisplayPlugin::getPreferredAudioOutDevice() const {
|
||||||
}
|
}
|
||||||
return AudioClient::friendlyNameForAudioDevice(buffer);
|
return AudioClient::friendlyNameForAudioDevice(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OculusDisplayPlugin::~OculusDisplayPlugin() {
|
||||||
|
qDebug() << "Destroying OculusDisplayPlugin";
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
class OculusDisplayPlugin : public OculusBaseDisplayPlugin {
|
class OculusDisplayPlugin : public OculusBaseDisplayPlugin {
|
||||||
using Parent = OculusBaseDisplayPlugin;
|
using Parent = OculusBaseDisplayPlugin;
|
||||||
public:
|
public:
|
||||||
|
~OculusDisplayPlugin();
|
||||||
const QString& getName() const override { return NAME; }
|
const QString& getName() const override { return NAME; }
|
||||||
|
|
||||||
void init() override;
|
void init() override;
|
||||||
|
|
|
@ -62,6 +62,14 @@ public:
|
||||||
return _inputPlugins;
|
return _inputPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void destroyInputPlugins() override {
|
||||||
|
_inputPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void destroyDisplayPlugins() override {
|
||||||
|
_displayPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DisplayPluginList _displayPlugins;
|
DisplayPluginList _displayPlugins;
|
||||||
InputPluginList _inputPlugins;
|
InputPluginList _inputPlugins;
|
||||||
|
|
|
@ -38,6 +38,10 @@ public:
|
||||||
return _displayPlugins;
|
return _displayPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void destroyDisplayPlugins() override {
|
||||||
|
_displayPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DisplayPluginList _displayPlugins;
|
DisplayPluginList _displayPlugins;
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,6 +51,13 @@ public:
|
||||||
return _inputPlugins;
|
return _inputPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void destroyInputPlugins() override {
|
||||||
|
_inputPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void destroyDisplayPlugins() override {
|
||||||
|
_displayPlugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DisplayPluginList _displayPlugins;
|
DisplayPluginList _displayPlugins;
|
||||||
|
|
Loading…
Reference in a new issue