Skip to content

Commit

Permalink
Merge remote-tracking branch 'overte/master' into application
Browse files Browse the repository at this point in the history
  • Loading branch information
HifiExperiments committed Oct 26, 2024
2 parents c6731d2 + c660c22 commit 7f4efaf
Show file tree
Hide file tree
Showing 48 changed files with 229 additions and 262 deletions.
2 changes: 1 addition & 1 deletion interface/src/Application_Assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ bool Application::importSVOFromURL(const QString& urlString) {

bool Application::importFromZIP(const QString& filePath) {
qDebug() << "A zip file has been dropped in: " << filePath;
qApp->getFileDownloadInterface()->runUnzip(filePath, QUrl(), true, true, false);
qApp->getFileDownloadInterface()->runUnzip(filePath, QUrl(), true, true);
return true;
}

Expand Down
1 change: 1 addition & 0 deletions interface/src/Application_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
#include <scripting/DesktopScriptingInterface.h>
#include <scripting/HMDScriptingInterface.h>
#include <scripting/KeyboardScriptingInterface.h>
#include <scripting/SelectionScriptingInterface.h>
#include <scripting/TestScriptingInterface.h>
#include <scripting/TTSScriptingInterface.h>
#include <scripting/WindowScriptingInterface.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1748,9 +1748,8 @@ ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const Sha
if (!std::get<2>(key)) {
_pipelines[std::make_tuple(std::get<0>(key), std::get<1>(key), std::get<2>(key), wireframe)] = std::make_shared<render::ShapePipeline>(pipeline, nullptr, nullptr, nullptr);
} else {
const auto& fadeEffect = DependencyManager::get<FadeEffect>();
_pipelines[std::make_tuple(std::get<0>(key), std::get<1>(key), std::get<2>(key), wireframe)] = std::make_shared<render::ShapePipeline>(pipeline, nullptr,
fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter());
FadeEffect::getBatchSetter(), FadeEffect::getItemUniformSetter());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
_dpi = entity->getDpi();
_color = entity->getColor();
_alpha = entity->getAlpha();
_wantsKeyboardFocus = entity->wantsKeyboardFocus();
_wantsKeyboardFocus = entity->getWantsKeyboardFocus();
_pulseProperties = entity->getPulseProperties();

if (_contentType == ContentType::NoContent) {
Expand Down
1 change: 0 additions & 1 deletion libraries/entities/src/EntityItem.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ public:
QUuid getOwningAvatarIDForProperties() const;

virtual bool wantsHandControllerPointerEvents() const { return false; }
virtual bool wantsKeyboardFocus() const { return false; }
virtual void setProxyWindow(QWindow* proxyWindow) {}
virtual QObject* getEventHandler() { return nullptr; }

Expand Down
4 changes: 3 additions & 1 deletion libraries/render-utils/src/AmbientOcclusionEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,8 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
config->setGPUBatchRunTime(_gpuTimer->getGPUAverage(), _gpuTimer->getBatchAverage());
}

gpu::PipelinePointer DebugAmbientOcclusion::_debugPipeline;

void DebugAmbientOcclusion::configure(const Config& config) {
_showCursorPixel = config.showCursorPixel;

Expand All @@ -851,7 +853,7 @@ void DebugAmbientOcclusion::configure(const Config& config) {
}
}

const gpu::PipelinePointer& DebugAmbientOcclusion::getDebugPipeline() {
gpu::PipelinePointer& DebugAmbientOcclusion::getDebugPipeline() {
if (!_debugPipeline) {
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::ssao_debugOcclusion);
gpu::StatePointer state = std::make_shared<gpu::State>();
Expand Down
4 changes: 2 additions & 2 deletions libraries/render-utils/src/AmbientOcclusionEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ class DebugAmbientOcclusion {
};
gpu::StructBuffer<Parameters> _parametersBuffer;

const gpu::PipelinePointer& getDebugPipeline();
static gpu::PipelinePointer& getDebugPipeline();

gpu::PipelinePointer _debugPipeline;
static gpu::PipelinePointer _debugPipeline;

bool _showCursorPixel { false };
};
Expand Down
18 changes: 12 additions & 6 deletions libraries/render-utils/src/AntialiasingEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace gr {

#if !ANTIALIASING_USE_TAA

gpu::PipelinePointer Antialiasing::_antialiasingPipeline;
gpu::PipelinePointer Antialiasing::_blendPipeline;

Antialiasing::Antialiasing() {
_geometryId = DependencyManager::get<GeometryCache>()->allocateID();
}
Expand Down Expand Up @@ -144,6 +147,10 @@ void AntialiasingConfig::setAAMode(int mode) {
emit dirty();
}

gpu::PipelinePointer Antialiasing::_antialiasingPipeline;
gpu::PipelinePointer Antialiasing::_blendPipeline;
gpu::PipelinePointer Antialiasing::_debugBlendPipeline;

Antialiasing::Antialiasing(bool isSharpenEnabled) :
_isSharpenEnabled{ isSharpenEnabled } {
}
Expand All @@ -154,7 +161,7 @@ Antialiasing::~Antialiasing() {
_antialiasingTextures[1].reset();
}

const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline(const render::RenderContextPointer& renderContext) {
gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() {

if (!_antialiasingPipeline) {
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::taa);
Expand All @@ -169,7 +176,7 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline(const render::
return _antialiasingPipeline;
}

const gpu::PipelinePointer& Antialiasing::getBlendPipeline() {
gpu::PipelinePointer& Antialiasing::getBlendPipeline() {
if (!_blendPipeline) {
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::fxaa_blend);
gpu::StatePointer state = std::make_shared<gpu::State>();
Expand All @@ -180,7 +187,7 @@ const gpu::PipelinePointer& Antialiasing::getBlendPipeline() {
return _blendPipeline;
}

const gpu::PipelinePointer& Antialiasing::getDebugBlendPipeline() {
gpu::PipelinePointer& Antialiasing::getDebugBlendPipeline() {
if (!_debugBlendPipeline) {
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::taa_blend);
gpu::StatePointer state = std::make_shared<gpu::State>();
Expand Down Expand Up @@ -260,7 +267,6 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
batch.setViewportTransform(args->_viewport);

// TAA step
getAntialiasingPipeline(renderContext);
batch.setResourceFramebufferSwapChainTexture(ru::Texture::TaaHistory, _antialiasingBuffers, 0);
batch.setResourceTexture(ru::Texture::TaaSource, sourceBuffer->getRenderBuffer(0));
batch.setResourceTexture(ru::Texture::TaaVelocity, velocityBuffer->getVelocityTexture());
Expand All @@ -269,9 +275,9 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const

batch.setUniformBuffer(ru::Buffer::TaaParams, _params);
batch.setUniformBuffer(ru::Buffer::DeferredFrameTransform, deferredFrameTransform->getFrameTransformBuffer());

batch.setFramebufferSwapChain(_antialiasingBuffers, 1);
batch.setPipeline(getAntialiasingPipeline(renderContext));
batch.setPipeline(getAntialiasingPipeline());
batch.draw(gpu::TRIANGLE_STRIP, 4);

// Blend step
Expand Down
20 changes: 10 additions & 10 deletions libraries/render-utils/src/AntialiasingEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ class Antialiasing {
void configure(const Config& config);
void run(const render::RenderContextPointer& renderContext, const Inputs& inputs);

const gpu::PipelinePointer& getAntialiasingPipeline(const render::RenderContextPointer& renderContext);
const gpu::PipelinePointer& getBlendPipeline();
const gpu::PipelinePointer& getDebugBlendPipeline();
static gpu::PipelinePointer& getAntialiasingPipeline();
static gpu::PipelinePointer& getBlendPipeline();
static gpu::PipelinePointer& getDebugBlendPipeline();

private:

gpu::FramebufferSwapChainPointer _antialiasingBuffers;
gpu::TexturePointer _antialiasingTextures[2];
gpu::BufferPointer _blendParamsBuffer;
gpu::PipelinePointer _antialiasingPipeline;
gpu::PipelinePointer _blendPipeline;
gpu::PipelinePointer _debugBlendPipeline;
static gpu::PipelinePointer _antialiasingPipeline;
static gpu::PipelinePointer _blendPipeline;
static gpu::PipelinePointer _debugBlendPipeline;

TAAParamsBuffer _params;
AntialiasingConfig::Mode _mode{ AntialiasingConfig::TAA };
Expand All @@ -251,17 +251,17 @@ class Antialiasing {
void configure(const Config& config) {}
void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceBuffer);

const gpu::PipelinePointer& getAntialiasingPipeline();
const gpu::PipelinePointer& getBlendPipeline();
static gpu::PipelinePointer& getAntialiasingPipeline();
static gpu::PipelinePointer& getBlendPipeline();

private:
gpu::FramebufferPointer _antialiasingBuffer;

gpu::TexturePointer _antialiasingTexture;
gpu::BufferPointer _paramsBuffer;

gpu::PipelinePointer _antialiasingPipeline;
gpu::PipelinePointer _blendPipeline;
static gpu::PipelinePointer _antialiasingPipeline;
static gpu::PipelinePointer _blendPipeline;
int _geometryId { 0 };
};
#endif
Expand Down
5 changes: 5 additions & 0 deletions libraries/render-utils/src/BloomEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

#define BLOOM_BLUR_LEVEL_COUNT 3

gpu::PipelinePointer BloomThreshold::_pipeline;
gpu::PipelinePointer BloomApply::_pipeline;
gpu::PipelinePointer BloomDraw::_pipeline;
gpu::PipelinePointer DebugBloom::_pipeline;

BloomThreshold::BloomThreshold(unsigned int downsamplingFactor) {
assert(downsamplingFactor > 0);
_parameters.edit()._sampleCount = downsamplingFactor;
Expand Down
8 changes: 4 additions & 4 deletions libraries/render-utils/src/BloomEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class BloomThreshold {

#include "BloomThreshold.shared.slh"

static gpu::PipelinePointer _pipeline;
gpu::FramebufferPointer _outputBuffer;
gpu::PipelinePointer _pipeline;
gpu::StructBuffer<Parameters> _parameters;
};

Expand All @@ -68,7 +68,7 @@ class BloomApply {

#include "BloomApply.shared.slh"

gpu::PipelinePointer _pipeline;
static gpu::PipelinePointer _pipeline;
gpu::StructBuffer<Parameters> _parameters;
};

Expand All @@ -83,7 +83,7 @@ class BloomDraw {

private:

gpu::PipelinePointer _pipeline;
static gpu::PipelinePointer _pipeline;
};

class DebugBloomConfig : public render::Job::Config {
Expand Down Expand Up @@ -125,7 +125,7 @@ class DebugBloom {
void run(const render::RenderContextPointer& renderContext, const Inputs& inputs);

private:
gpu::PipelinePointer _pipeline;
static gpu::PipelinePointer _pipeline;
gpu::BufferPointer _params;
DebugBloomConfig::Mode _mode;
};
Expand Down
7 changes: 5 additions & 2 deletions libraries/render-utils/src/DebugDeferredBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ static std::string getFileContent(const std::string& fileName, const std::string
return defaultContent;
}

DebugDeferredBuffer::StandardPipelines DebugDeferredBuffer::_pipelines;
DebugDeferredBuffer::CustomPipelines DebugDeferredBuffer::_customPipelines;

#include <QStandardPaths> // TODO REMOVE: Temporary until UI
DebugDeferredBuffer::DebugDeferredBuffer() {
// TODO REMOVE: Temporary until UI
Expand Down Expand Up @@ -334,7 +337,7 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Mode mode, const std::strin
return std::string();
}

bool DebugDeferredBuffer::pipelineNeedsUpdate(Mode mode, const std::string& customFile) const {
bool DebugDeferredBuffer::pipelineNeedsUpdate(Mode mode, const std::string& customFile) {
if (mode != CustomMode) {
return !_pipelines[mode];
}
Expand All @@ -351,7 +354,7 @@ bool DebugDeferredBuffer::pipelineNeedsUpdate(Mode mode, const std::string& cust
return true;
}

const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, const std::string& customFile) {
gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, const std::string& customFile) {
if (pipelineNeedsUpdate(mode, customFile)) {
static_assert(shader::render_utils::program::debug_deferred_buffer != 0, "Validate debug deferred program");

Expand Down
12 changes: 6 additions & 6 deletions libraries/render-utils/src/DebugDeferredBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ class DebugDeferredBuffer {

struct CustomPipeline {
gpu::PipelinePointer pipeline;
mutable QFileInfo info;
QFileInfo info;
};
using StandardPipelines = std::array<gpu::PipelinePointer, NumModes>;
using CustomPipelines = std::unordered_map<std::string, CustomPipeline>;

bool pipelineNeedsUpdate(Mode mode, const std::string& customFile = std::string()) const;
const gpu::PipelinePointer& getPipeline(Mode mode, const std::string& customFile = std::string());
std::string getShaderSourceCode(Mode mode, const std::string& customFile = std::string());
static bool pipelineNeedsUpdate(Mode mode, const std::string& customFile = std::string());
static gpu::PipelinePointer& getPipeline(Mode mode, const std::string& customFile = std::string());
static std::string getShaderSourceCode(Mode mode, const std::string& customFile = std::string());

ParametersBuffer _parameters;
StandardPipelines _pipelines;
CustomPipelines _customPipelines;
static StandardPipelines _pipelines;
static CustomPipelines _customPipelines;
int _geometryId{ 0 };
};

Expand Down
61 changes: 14 additions & 47 deletions libraries/render-utils/src/FadeEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,36 @@
#include "render-utils/ShaderConstants.h"
#include <PathUtils.h>

gpu::TexturePointer FadeEffect::_maskMap;

FadeEffect::FadeEffect() {
auto texturePath = PathUtils::resourcesPath() + "images/fadeMask.png";
_maskMap = DependencyManager::get<TextureCache>()->getImageTexture(texturePath, image::TextureUsage::STRICT_TEXTURE);
std::once_flag once;
std::call_once(once, [] {
auto texturePath = PathUtils::resourcesPath() + "images/fadeMask.png";
_maskMap = DependencyManager::get<TextureCache>()->getImageTexture(texturePath, image::TextureUsage::STRICT_TEXTURE);
});
}

void FadeEffect::build(render::Task::TaskConcept& task, const task::Varying& editableItems) {
void FadeEffect::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) {
auto editedFadeCategory = task.addJob<FadeJob>("Fade");
auto& fadeJob = task._jobs.back();
_configurations = fadeJob.get<FadeJob>().getConfigurationBuffer();

const auto fadeEditInput = FadeEditJob::Input(editableItems, editedFadeCategory).asVarying();
const auto fadeEditInput = FadeEditJob::Input(inputs, editedFadeCategory).asVarying();
task.addJob<FadeEditJob>("FadeEdit", fadeEditInput);
}

render::ShapePipeline::BatchSetter FadeEffect::getBatchSetter() const {
return [this](const render::ShapePipeline& shapePipeline, gpu::Batch& batch, render::Args*) {
render::ShapePipeline::BatchSetter FadeEffect::getBatchSetter() {
return [](const render::ShapePipeline& shapePipeline, gpu::Batch& batch, render::Args*) {
batch.setResourceTexture(render_utils::slot::texture::FadeMask, _maskMap);
batch.setUniformBuffer(render_utils::slot::buffer::FadeParameters, _configurations);
batch.setUniformBuffer(render_utils::slot::buffer::FadeParameters, FadeJob::getConfigurationBuffer());
};
}

render::ShapePipeline::ItemSetter FadeEffect::getItemUniformSetter() const {
render::ShapePipeline::ItemSetter FadeEffect::getItemUniformSetter() {
return [](const render::ShapePipeline& shapePipeline, render::Args* args, const render::Item& item) {
if (!render::TransitionStage::isIndexInvalid(item.getTransitionId())) {
const auto& scene = args->_scene;
const auto& batch = args->_batch;
auto transitionStage = scene->getStage<render::TransitionStage>(render::TransitionStage::getName());
auto transitionStage = scene->getStage<render::TransitionStage>();
auto& transitionState = transitionStage->getTransition(item.getTransitionId());

if (transitionState.paramsBuffer._size != sizeof(gpu::StructBuffer<FadeObjectParams>)) {
Expand Down Expand Up @@ -71,39 +74,3 @@ render::ShapePipeline::ItemSetter FadeEffect::getItemUniformSetter() const {
}
};
}

render::ShapePipeline::ItemSetter FadeEffect::getItemStoredSetter() {
return [this](const render::ShapePipeline& shapePipeline, render::Args* args, const render::Item& item) {
if (!render::TransitionStage::isIndexInvalid(item.getTransitionId())) {
auto scene = args->_scene;
auto transitionStage = scene->getStage<render::TransitionStage>(render::TransitionStage::getName());
auto& transitionState = transitionStage->getTransition(item.getTransitionId());
const auto fadeCategory = FadeJob::transitionToCategory[transitionState.eventType];

_lastCategory = fadeCategory;
_lastThreshold = transitionState.threshold;
_lastNoiseOffset = transitionState.noiseOffset;
_lastBaseOffset = transitionState.baseOffset;
_lastBaseInvSize = transitionState.baseInvSize;
}
};
}

void FadeEffect::packToAttributes(const int category, const float threshold, const glm::vec3& noiseOffset,
const glm::vec3& baseOffset, const glm::vec3& baseInvSize,
glm::vec4& packedData1, glm::vec4& packedData2, glm::vec4& packedData3) {
packedData1.x = noiseOffset.x;
packedData1.y = noiseOffset.y;
packedData1.z = noiseOffset.z;
packedData1.w = (float)(category+0.1f); // GLSL hack so that casting back from float to int in fragment shader returns the correct value.

packedData2.x = baseOffset.x;
packedData2.y = baseOffset.y;
packedData2.z = baseOffset.z;
packedData2.w = threshold;

packedData3.x = baseInvSize.x;
packedData3.y = baseInvSize.y;
packedData3.z = baseInvSize.z;
packedData3.w = 0.f;
}
Loading

0 comments on commit 7f4efaf

Please sign in to comment.