11 #ifndef hifi_gpu_Framebuffer_h
12 #define hifi_gpu_Framebuffer_h
15 #include "ResourceSwapChain.h"
22 typedef Element Format;
41 BUFFER_COLORS = 0x000000FF,
43 BUFFER_DEPTH = 0x40000000,
44 BUFFER_STENCIL = 0x80000000,
45 BUFFER_DEPTHSTENCIL = 0xC0000000,
67 static Framebuffer*
create(
const std::string& name,
const Format& colorBufferFormat, uint16 width, uint16 height);
79 static Framebuffer*
create(
const std::string& name,
const Format& colorBufferFormat,
const Format& depthStencilBufferFormat, uint16 width, uint16 height);
105 int32
setRenderBuffer(uint32 slot,
const TexturePointer& texture, uint32 subresource = 0);
130 bool setDepthBuffer(
const TexturePointer& texture,
const Format& format, uint32 subresource = 0);
249 #if !defined(Q_OS_ANDROID)
250 static const uint32 MAX_NUM_RENDER_BUFFERS = 8;
252 static const uint32 MAX_NUM_RENDER_BUFFERS = 4;
305 static Transform
evalSubregionTexcoordTransform(
const glm::ivec2& sourceSurface,
const glm::ivec2& destRegionSize,
const glm::ivec2& destRegionOffset = glm::ivec2(0));
352 void updateSize(
const TexturePointer& texture);
364 friend class Serializer;
365 friend class Deserializer;
370 typedef std::shared_ptr<Framebuffer> FramebufferPointer;
371 typedef ResourceSwapChain<Framebuffer> FramebufferSwapChain;
372 typedef std::shared_ptr<FramebufferSwapChain> FramebufferSwapChainPointer;
Definition: gpu/src/gpu/Framebuffer.h:27
Stamp _depthStamp
Definition: gpu/src/gpu/Framebuffer.h:322
bool validateTargetCompatibility(const Texture &texture, uint32 subresource=0) const
Checks if a texture is compatible with being a render attachment.
Definition: gpu/src/gpu/Framebuffer.cpp:55
void setName(const std::string &name)
Sets the framebuffer name.
Definition: gpu/src/gpu/Framebuffer.h:242
const TextureViews & getRenderBuffers() const
Definition: gpu/src/gpu/Framebuffer.h:95
std::string _name
Framebuffer name.
Definition: gpu/src/gpu/Framebuffer.h:318
TextureView _depthStencilBuffer
Depth, stencil, or combined depth stencil rneder buffer.
Definition: gpu/src/gpu/Framebuffer.h:332
static glm::vec4 evalSubregionTexcoordTransformCoefficients(const glm::ivec2 &sourceSurface, const glm::ivec2 &destRegionSize, const glm::ivec2 &destRegionOffset=glm::ivec2(0))
Used to get coefficients for mapping one surface to an area on the other surface.
Definition: gpu/src/gpu/Framebuffer.cpp:259
bool isEmpty() const
Definition: gpu/src/gpu/Framebuffer.h:179
const TexturePointer & getDepthStencilBuffer() const
Definition: gpu/src/gpu/Framebuffer.cpp:248
BufferMask
Definition: gpu/src/gpu/Framebuffer.h:32
bool setDepthStencilBuffer(const TexturePointer &texture, const Format &format, uint32 subresource=0)
Sets the combined depth stencil render buffer.
Definition: gpu/src/gpu/Framebuffer.cpp:230
void removeRenderBuffers()
Removes all render buffers from the current framebuffer.
Definition: gpu/src/gpu/Framebuffer.cpp:136
static Framebuffer * create(const std::string &name)
Creates a framebuffer with a given name. Does not create any render buffers.
Definition: gpu/src/gpu/Framebuffer.cpp:24
uint16 _width
Framebuffer width in pixels.
Definition: gpu/src/gpu/Framebuffer.h:338
int32 setRenderBuffer(uint32 slot, const TexturePointer &texture, uint32 subresource=0)
Sets a given render buffer slot in the framebuffer.
Definition: gpu/src/gpu/Framebuffer.cpp:100
float getAspectRatio() const
Definition: gpu/src/gpu/Framebuffer.h:247
uint32 getNumRenderBuffers() const
Definition: gpu/src/gpu/Framebuffer.cpp:148
bool hasDepth() const
Definition: gpu/src/gpu/Framebuffer.h:194
bool hasDepthStencil() const
Definition: gpu/src/gpu/Framebuffer.h:189
bool setDepthBuffer(const TexturePointer &texture, const Format &format, uint32 subresource=0)
Sets depth render buffer.
Definition: gpu/src/gpu/Framebuffer.cpp:198
Vec2u getSize() const
Definition: gpu/src/gpu/Framebuffer.h:215
uint16 _numSamples
Number of samples per pixel. Greater than 1 when MSAA is used.
Definition: gpu/src/gpu/Framebuffer.h:344
bool assignDepthStencilBuffer(const TexturePointer &texture, const Format &format, uint32 subresource)
Sets depth stencil buffer.
Definition: gpu/src/gpu/Framebuffer.cpp:174
Format getDepthStencilBufferFormat() const
Definition: gpu/src/gpu/Framebuffer.cpp:256
uint32 getRenderBufferSubresource(uint32 slot) const
Get subresource index for a give slot.
Definition: gpu/src/gpu/Framebuffer.cpp:166
void updateSize(const TexturePointer &texture)
Copy width, height and sample count from a texture.
Definition: gpu/src/gpu/Framebuffer.cpp:73
bool hasStencil() const
Definition: gpu/src/gpu/Framebuffer.h:199
Stamp getDepthStamp() const
Definition: gpu/src/gpu/Framebuffer.h:269
Masks getBufferMask() const
Definition: gpu/src/gpu/Framebuffer.h:174
const std::string & getName() const
Definition: gpu/src/gpu/Framebuffer.h:235
static Transform evalSubregionTexcoordTransform(const glm::ivec2 &sourceSurface, const glm::ivec2 &destRegionSize, const glm::ivec2 &destRegionOffset=glm::ivec2(0))
Used to get transform for mapping one surface to an area on the other surface.
Definition: gpu/src/gpu/Framebuffer.cpp:271
const std::vector< Stamp > & getColorStamps() const
Definition: gpu/src/gpu/Framebuffer.h:276
TextureViews _renderBuffers
Color render buffers.
Definition: gpu/src/gpu/Framebuffer.h:329
uint16 getHeight() const
Definition: gpu/src/gpu/Framebuffer.cpp:91
bool setStencilBuffer(const TexturePointer &texture, const Format &format, uint32 subresource=0)
Sets stencil render buffer.
Definition: gpu/src/gpu/Framebuffer.cpp:214
static uint32 getMaxNumRenderBuffers()
Definition: gpu/src/gpu/Framebuffer.h:257
bool hasColor() const
Definition: gpu/src/gpu/Framebuffer.h:184
uint16 getNumSamples() const
Definition: gpu/src/gpu/Framebuffer.cpp:95
uint16 _height
Framebuffer height in pixels.
Definition: gpu/src/gpu/Framebuffer.h:341
const GPUObjectPointer gpuObject
Definition: gpu/src/gpu/Framebuffer.h:262
std::vector< Stamp > _colorStamps
Definition: gpu/src/gpu/Framebuffer.h:326
Masks _bufferMask
Bit sum of BufferMask enums. Used to check which buffers are populated.
Definition: gpu/src/gpu/Framebuffer.h:335
uint16 getWidth() const
Definition: gpu/src/gpu/Framebuffer.cpp:87
uint32 getDepthStencilBufferSubresource() const
Definition: gpu/src/gpu/Framebuffer.cpp:252
const TexturePointer & getRenderBuffer(uint32 slot) const
Returns render buffer from particular slot.
Definition: gpu/src/gpu/Framebuffer.cpp:156
Definition: gpu/src/gpu/Forward.h:134