diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp index 1d2bafc5db..103a104aa8 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp @@ -99,10 +99,10 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = (&::gpu::gl::GLBackend::do_setUniformBuffer), (&::gpu::gl::GLBackend::do_setResourceBuffer), (&::gpu::gl::GLBackend::do_setResourceTexture), - (&::gpu::gl::GLBackend::do_setResourceFramebufferRingTexture), + (&::gpu::gl::GLBackend::do_setResourceFramebufferSwapChainTexture), (&::gpu::gl::GLBackend::do_setFramebuffer), - (&::gpu::gl::GLBackend::do_setFramebufferRing), + (&::gpu::gl::GLBackend::do_setFramebufferSwapChain), (&::gpu::gl::GLBackend::do_clearFramebuffer), (&::gpu::gl::GLBackend::do_blit), (&::gpu::gl::GLBackend::do_generateTextureMips), diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackend.h b/libraries/gpu-gl/src/gpu/gl/GLBackend.h index f8e084008b..20259e7d4d 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gl/src/gpu/gl/GLBackend.h @@ -126,14 +126,14 @@ public: // Resource Stage virtual void do_setResourceBuffer(const Batch& batch, size_t paramOffset) final; virtual void do_setResourceTexture(const Batch& batch, size_t paramOffset) final; - virtual void do_setResourceFramebufferRingTexture(const Batch& batch, size_t paramOffset) final; + virtual void do_setResourceFramebufferSwapChainTexture(const Batch& batch, size_t paramOffset) final; // Pipeline Stage virtual void do_setPipeline(const Batch& batch, size_t paramOffset) final; // Output stage virtual void do_setFramebuffer(const Batch& batch, size_t paramOffset) final; - virtual void do_setFramebufferRing(const Batch& batch, size_t paramOffset) final; + virtual void do_setFramebufferSwapChain(const Batch& batch, size_t paramOffset) final; virtual void do_clearFramebuffer(const Batch& batch, size_t paramOffset) final; virtual void do_blit(const Batch& batch, size_t paramOffset) = 0; diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackendOutput.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackendOutput.cpp index e34330f9a1..59e77ebe90 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackendOutput.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackendOutput.cpp @@ -40,11 +40,11 @@ void GLBackend::do_setFramebuffer(const Batch& batch, size_t paramOffset) { setFramebuffer(framebuffer); } -void GLBackend::do_setFramebufferRing(const Batch& batch, size_t paramOffset) { - auto ringbuffer = batch._ringbuffers.get(batch._params[paramOffset]._uint); - if (ringbuffer) { +void GLBackend::do_setFramebufferSwapChain(const Batch& batch, size_t paramOffset) { + auto swapChain = batch._swapChains.get(batch._params[paramOffset]._uint); + if (swapChain) { auto index = batch._params[paramOffset + 1]._uint; - FramebufferPointer framebuffer = static_cast(ringbuffer.get())->get(index); + FramebufferPointer framebuffer = static_cast(swapChain.get())->get(index); setFramebuffer(framebuffer); } } @@ -61,7 +61,7 @@ void GLBackend::setFramebuffer(const FramebufferPointer& framebuffer) { } void GLBackend::do_advance(const Batch& batch, size_t paramOffset) { - auto ringbuffer = batch._ringbuffers.get(batch._params[paramOffset]._uint); + auto ringbuffer = batch._swapChains.get(batch._params[paramOffset]._uint); if (ringbuffer) { ringbuffer->advance(); } diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp index 3ca3e0f306..237b8bc1e9 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp @@ -256,22 +256,22 @@ void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) { setResourceTexture(slot, resourceTexture); } -void GLBackend::do_setResourceFramebufferRingTexture(const Batch& batch, size_t paramOffset) { +void GLBackend::do_setResourceFramebufferSwapChainTexture(const Batch& batch, size_t paramOffset) { GLuint slot = batch._params[paramOffset + 1]._uint; if (slot >= (GLuint)MAX_NUM_RESOURCE_TEXTURES) { - qCDebug(gpugllogging) << "GLBackend::do_setResourceFramebufferRingTexture: Trying to set a resource Texture at slot #" << slot << " which doesn't exist. MaxNumResourceTextures = " << getMaxNumResourceTextures(); + qCDebug(gpugllogging) << "GLBackend::do_setResourceFramebufferSwapChainTexture: Trying to set a resource Texture at slot #" << slot << " which doesn't exist. MaxNumResourceTextures = " << getMaxNumResourceTextures(); return; } - RingBufferPointer ringBuffer = batch._ringbuffers.get(batch._params[paramOffset + 0]._uint); + SwapChainPointer swapChain = batch._swapChains.get(batch._params[paramOffset + 0]._uint); - if (!ringBuffer) { + if (!swapChain) { releaseResourceTexture(slot); return; } auto index = batch._params[paramOffset + 2]._uint; auto renderBufferSlot = batch._params[paramOffset + 3]._uint; - FramebufferPointer resourceFramebuffer = static_cast(ringBuffer.get())->get(index); + FramebufferPointer resourceFramebuffer = static_cast(swapChain.get())->get(index); TexturePointer resourceTexture = resourceFramebuffer->getRenderBuffer(renderBufferSlot); setResourceTexture(slot, resourceTexture); diff --git a/libraries/gpu/src/gpu/Batch.cpp b/libraries/gpu/src/gpu/Batch.cpp index ca16284663..3446bc7db7 100644 --- a/libraries/gpu/src/gpu/Batch.cpp +++ b/libraries/gpu/src/gpu/Batch.cpp @@ -73,7 +73,7 @@ Batch::Batch(const Batch& batch_) { _transforms._items.swap(batch._transforms._items); _pipelines._items.swap(batch._pipelines._items); _framebuffers._items.swap(batch._framebuffers._items); - _ringbuffers._items.swap(batch._ringbuffers._items); + _swapChains._items.swap(batch._swapChains._items); _drawCallInfos.swap(batch._drawCallInfos); _queries._items.swap(batch._queries._items); _lambdas._items.swap(batch._lambdas._items); @@ -111,7 +111,7 @@ void Batch::clear() { _transforms.clear(); _pipelines.clear(); _framebuffers.clear(); - _ringbuffers.clear(); + _swapChains.clear(); _objects.clear(); _drawCallInfos.clear(); } @@ -322,12 +322,12 @@ void Batch::setResourceTexture(uint32 slot, const TextureView& view) { setResourceTexture(slot, view._texture); } -void Batch::setResourceFramebufferRingTexture(uint32 slot, const FramebufferRingPointer& framebuffer, unsigned int ringIndex, unsigned int renderBufferSlot) { - ADD_COMMAND(setResourceFramebufferRingTexture); +void Batch::setResourceFramebufferSwapChainTexture(uint32 slot, const FramebufferSwapChainPointer& framebuffer, unsigned int swapChainIndex, unsigned int renderBufferSlot) { + ADD_COMMAND(setResourceFramebufferSwapChainTexture); - _params.emplace_back(_ringbuffers.cache(framebuffer)); + _params.emplace_back(_swapChains.cache(framebuffer)); _params.emplace_back(slot); - _params.emplace_back(ringIndex); + _params.emplace_back(swapChainIndex); _params.emplace_back(renderBufferSlot); } @@ -338,17 +338,17 @@ void Batch::setFramebuffer(const FramebufferPointer& framebuffer) { } -void Batch::setFramebufferRing(const FramebufferRingPointer& framebuffer, unsigned int ringIndex) { - ADD_COMMAND(setFramebufferRing); +void Batch::setFramebufferSwapChain(const FramebufferSwapChainPointer& framebuffer, unsigned int swapChainIndex) { + ADD_COMMAND(setFramebufferSwapChain); - _params.emplace_back(_ringbuffers.cache(framebuffer)); - _params.emplace_back(ringIndex); + _params.emplace_back(_swapChains.cache(framebuffer)); + _params.emplace_back(swapChainIndex); } -void Batch::advance(const RingBufferPointer& ringbuffer) { +void Batch::advance(const SwapChainPointer& swapChain) { ADD_COMMAND(advance); - _params.emplace_back(_ringbuffers.cache(ringbuffer)); + _params.emplace_back(_swapChains.cache(swapChain)); } void Batch::clearFramebuffer(Framebuffer::Masks targets, const Vec4& color, float depth, int stencil, bool enableScissor) { diff --git a/libraries/gpu/src/gpu/Batch.h b/libraries/gpu/src/gpu/Batch.h index e61946d575..43fdb623e3 100644 --- a/libraries/gpu/src/gpu/Batch.h +++ b/libraries/gpu/src/gpu/Batch.h @@ -187,13 +187,13 @@ public: void setResourceTexture(uint32 slot, const TexturePointer& texture); void setResourceTexture(uint32 slot, const TextureView& view); // not a command, just a shortcut from a TextureView - void setResourceFramebufferRingTexture(uint32 slot, const FramebufferRingPointer& framebuffer, unsigned int ringIndex, unsigned int renderBufferSlot = 0U); // not a command, just a shortcut from a TextureView + void setResourceFramebufferSwapChainTexture(uint32 slot, const FramebufferSwapChainPointer& framebuffer, unsigned int swpaChainIndex, unsigned int renderBufferSlot = 0U); // not a command, just a shortcut from a TextureView // Ouput Stage void setFramebuffer(const FramebufferPointer& framebuffer); - void setFramebufferRing(const FramebufferRingPointer& framebuffer, unsigned int ringIndex); + void setFramebufferSwapChain(const FramebufferSwapChainPointer& framebuffer, unsigned int swapChainIndex); - void advance(const RingBufferPointer& ringbuffer); + void advance(const SwapChainPointer& swapChain); // Clear framebuffer layers // Targets can be any of the render buffers contained in the currnetly bound Framebuffer @@ -302,10 +302,10 @@ public: COMMAND_setUniformBuffer, COMMAND_setResourceBuffer, COMMAND_setResourceTexture, - COMMAND_setResourceFramebufferRingTexture, + COMMAND_setResourceFramebufferSwapChainTexture, COMMAND_setFramebuffer, - COMMAND_setFramebufferRing, + COMMAND_setFramebufferSwapChain, COMMAND_clearFramebuffer, COMMAND_blit, COMMAND_generateTextureMips, @@ -428,7 +428,7 @@ public: typedef Cache::Vector TransformCaches; typedef Cache::Vector PipelineCaches; typedef Cache::Vector FramebufferCaches; - typedef Cache::Vector RingBufferCaches; + typedef Cache::Vector SwapChainCaches; typedef Cache::Vector QueryCaches; typedef Cache::Vector StringCaches; typedef Cache>::Vector LambdaCache; @@ -483,7 +483,7 @@ public: TransformCaches _transforms; PipelineCaches _pipelines; FramebufferCaches _framebuffers; - RingBufferCaches _ringbuffers; + SwapChainCaches _swapChains; QueryCaches _queries; LambdaCache _lambdas; StringCaches _profileRanges; diff --git a/libraries/gpu/src/gpu/Framebuffer.h b/libraries/gpu/src/gpu/Framebuffer.h index b0cd898eea..fbbec50a28 100755 --- a/libraries/gpu/src/gpu/Framebuffer.h +++ b/libraries/gpu/src/gpu/Framebuffer.h @@ -12,7 +12,7 @@ #define hifi_gpu_Framebuffer_h #include "Texture.h" -#include "ResourceRing.h" +#include "ResourceSwapChain.h" #include class Transform; // Texcood transform util @@ -178,8 +178,8 @@ protected: Framebuffer() {} }; typedef std::shared_ptr FramebufferPointer; -typedef ResourceRing FramebufferRing; -typedef std::shared_ptr FramebufferRingPointer; +typedef ResourceSwapChain FramebufferSwapChain; +typedef std::shared_ptr FramebufferSwapChainPointer; } diff --git a/libraries/gpu/src/gpu/ResourceRing.h b/libraries/gpu/src/gpu/ResourceSwapChain.h similarity index 75% rename from libraries/gpu/src/gpu/ResourceRing.h rename to libraries/gpu/src/gpu/ResourceSwapChain.h index c61f7a02f7..7b46b35521 100644 --- a/libraries/gpu/src/gpu/ResourceRing.h +++ b/libraries/gpu/src/gpu/ResourceSwapChain.h @@ -5,18 +5,18 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#ifndef hifi_gpu_ResourceRing_h -#define hifi_gpu_ResourceRing_h +#ifndef hifi_gpu_ResourceSwapChain_h +#define hifi_gpu_ResourceSwapChain_h #include #include namespace gpu { - class RingBuffer { + class SwapChain { public: - RingBuffer(unsigned int size = 2U) : _size{ size } {} - virtual ~RingBuffer() {} + SwapChain(unsigned int size = 2U) : _size{ size } {} + virtual ~SwapChain() {} void advance() { _frontIndex = (_frontIndex + 1) % _size; @@ -29,10 +29,10 @@ namespace gpu { unsigned int _frontIndex{ 0U }; }; - typedef std::shared_ptr RingBufferPointer; + typedef std::shared_ptr SwapChainPointer; template - class ResourceRing : public RingBuffer { + class ResourceSwapChain : public SwapChain { public: enum { @@ -42,7 +42,7 @@ namespace gpu { using Type = R; using TypePointer = std::shared_ptr; - ResourceRing(unsigned int size = 2U) : RingBuffer{ size } {} + ResourceSwapChain(unsigned int size = 2U) : SwapChain{ size } {} void reset() { for (auto& ptr : _resources) { diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index 9f2678770f..06cf4f6675 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -188,7 +188,7 @@ const int AntialiasingPass_NextMapSlot = 4; Antialiasing::Antialiasing() { - _antialiasingBuffers = std::make_shared(2U); + _antialiasingBuffers = std::make_shared(2U); } Antialiasing::~Antialiasing() { @@ -343,7 +343,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const // TAA step getAntialiasingPipeline(); - batch.setResourceFramebufferRingTexture(AntialiasingPass_HistoryMapSlot, _antialiasingBuffers, 0); + batch.setResourceFramebufferSwapChainTexture(AntialiasingPass_HistoryMapSlot, _antialiasingBuffers, 0); batch.setResourceTexture(AntialiasingPass_SourceMapSlot, sourceBuffer->getRenderBuffer(0)); batch.setResourceTexture(AntialiasingPass_VelocityMapSlot, velocityBuffer->getVelocityTexture()); batch.setResourceTexture(AntialiasingPass_DepthMapSlot, linearDepthBuffer->getLinearDepthTexture()); @@ -351,7 +351,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const batch.setUniformBuffer(AntialiasingPass_ParamsSlot, _params); batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, deferredFrameTransform->getFrameTransformBuffer()); - batch.setFramebufferRing(_antialiasingBuffers, 1); + batch.setFramebufferSwapChain(_antialiasingBuffers, 1); batch.setPipeline(getAntialiasingPipeline()); batch.draw(gpu::TRIANGLE_STRIP, 4); @@ -364,7 +364,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const } else { batch.setPipeline(getBlendPipeline()); } - batch.setResourceFramebufferRingTexture(AntialiasingPass_NextMapSlot, _antialiasingBuffers, 1); + batch.setResourceFramebufferSwapChainTexture(AntialiasingPass_NextMapSlot, _antialiasingBuffers, 1); batch.draw(gpu::TRIANGLE_STRIP, 4); batch.advance(_antialiasingBuffers); diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index f47a64c589..0dc57f97cd 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -191,7 +191,7 @@ private: // Uniforms for AA gpu::int32 _texcoordOffsetLoc; - gpu::FramebufferRingPointer _antialiasingBuffers; + gpu::FramebufferSwapChainPointer _antialiasingBuffers; gpu::TexturePointer _antialiasingTextures[2]; gpu::PipelinePointer _antialiasingPipeline;