API Reference

This file contains a reference for headers that weren’t documented elsewhere.

BasicTypes.h

namespace Fwog

Enums

enum ImageType

Values:

enumerator TEX_1D
enumerator TEX_2D
enumerator TEX_3D
enumerator TEX_1D_ARRAY
enumerator TEX_2D_ARRAY
enumerator TEX_CUBEMAP
enumerator TEX_CUBEMAP_ARRAY
enumerator TEX_2D_MULTISAMPLE
enumerator TEX_2D_MULTISAMPLE_ARRAY
enum ComponentSwizzle

Specifies how a component is swizzled.

Values:

enumerator ZERO
enumerator ONE
enumerator R
enumerator G
enumerator B
enumerator A
enum Format

Values:

enumerator UNDEFINED
enumerator R8_UNORM
enumerator R8_SNORM
enumerator R16_UNORM
enumerator R16_SNORM
enumerator R8G8_UNORM
enumerator R8G8_SNORM
enumerator R16G16_UNORM
enumerator R16G16_SNORM
enumerator R3G3B2_UNORM
enumerator R4G4B4_UNORM
enumerator R5G5B5_UNORM
enumerator R8G8B8_UNORM
enumerator R8G8B8_SNORM
enumerator R10G10B10_UNORM
enumerator R12G12B12_UNORM
enumerator R16G16B16_SNORM
enumerator R2G2B2A2_UNORM
enumerator R4G4B4A4_UNORM
enumerator R5G5B5A1_UNORM
enumerator R8G8B8A8_UNORM
enumerator R8G8B8A8_SNORM
enumerator R10G10B10A2_UNORM
enumerator R10G10B10A2_UINT
enumerator R12G12B12A12_UNORM
enumerator R16G16B16A16_UNORM
enumerator R16G16B16A16_SNORM
enumerator R8G8B8_SRGB
enumerator R8G8B8A8_SRGB
enumerator R16_FLOAT
enumerator R16G16_FLOAT
enumerator R16G16B16_FLOAT
enumerator R16G16B16A16_FLOAT
enumerator R32_FLOAT
enumerator R32G32_FLOAT
enumerator R32G32B32_FLOAT
enumerator R32G32B32A32_FLOAT
enumerator R11G11B10_FLOAT
enumerator R9G9B9_E5
enumerator R8_SINT
enumerator R8_UINT
enumerator R16_SINT
enumerator R16_UINT
enumerator R32_SINT
enumerator R32_UINT
enumerator R8G8_SINT
enumerator R8G8_UINT
enumerator R16G16_SINT
enumerator R16G16_UINT
enumerator R32G32_SINT
enumerator R32G32_UINT
enumerator R8G8B8_SINT
enumerator R8G8B8_UINT
enumerator R16G16B16_SINT
enumerator R16G16B16_UINT
enumerator R32G32B32_SINT
enumerator R32G32B32_UINT
enumerator R8G8B8A8_SINT
enumerator R8G8B8A8_UINT
enumerator R16G16B16A16_SINT
enumerator R16G16B16A16_UINT
enumerator R32G32B32A32_SINT
enumerator R32G32B32A32_UINT
enumerator D32_FLOAT
enumerator D32_UNORM
enumerator D24_UNORM
enumerator D16_UNORM
enumerator D32_FLOAT_S8_UINT
enumerator D24_UNORM_S8_UINT
enumerator BC1_RGB_UNORM
enumerator BC1_RGB_SRGB
enumerator BC1_RGBA_UNORM
enumerator BC1_RGBA_SRGB
enumerator BC2_RGBA_UNORM
enumerator BC2_RGBA_SRGB
enumerator BC3_RGBA_UNORM
enumerator BC3_RGBA_SRGB
enumerator BC4_R_UNORM
enumerator BC4_R_SNORM
enumerator BC5_RG_UNORM
enumerator BC5_RG_SNORM
enumerator BC6H_RGB_UFLOAT
enumerator BC6H_RGB_SFLOAT
enumerator BC7_RGBA_UNORM
enumerator BC7_RGBA_SRGB
enum SampleCount

Values:

enumerator SAMPLES_1
enumerator SAMPLES_2
enumerator SAMPLES_4
enumerator SAMPLES_8
enumerator SAMPLES_16
enumerator SAMPLES_32
enum UploadFormat

Values:

enumerator UNDEFINED
enumerator R
enumerator RG
enumerator RGB
enumerator BGR
enumerator RGBA
enumerator BGRA
enumerator R_INTEGER
enumerator RG_INTEGER
enumerator RGB_INTEGER
enumerator BGR_INTEGER
enumerator RGBA_INTEGER
enumerator BGRA_INTEGER
enumerator DEPTH_COMPONENT
enumerator STENCIL_INDEX
enumerator DEPTH_STENCIL
enumerator INFER_FORMAT

For CopyTextureToBuffer and CopyBufferToTexture.

enum UploadType

Values:

enumerator UNDEFINED
enumerator UBYTE
enumerator SBYTE
enumerator USHORT
enumerator SSHORT
enumerator UINT
enumerator SINT
enumerator FLOAT
enumerator UBYTE_3_3_2
enumerator UBYTE_2_3_3_REV
enumerator USHORT_5_6_5
enumerator USHORT_5_6_5_REV
enumerator USHORT_4_4_4_4
enumerator USHORT_4_4_4_4_REV
enumerator USHORT_5_5_5_1
enumerator USHORT_1_5_5_5_REV
enumerator UINT_8_8_8_8
enumerator UINT_8_8_8_8_REV
enumerator UINT_10_10_10_2
enumerator UINT_2_10_10_10_REV
enumerator INFER_TYPE

For CopyTextureToBuffer and CopyBufferToTexture.

enum Filter

Values:

enumerator NONE
enumerator NEAREST
enumerator LINEAR
enum AddressMode

Values:

enumerator REPEAT
enumerator MIRRORED_REPEAT
enumerator CLAMP_TO_EDGE
enumerator CLAMP_TO_BORDER
enumerator MIRROR_CLAMP_TO_EDGE
enum BorderColor

Values:

enumerator FLOAT_TRANSPARENT_BLACK
enumerator INT_TRANSPARENT_BLACK
enumerator FLOAT_OPAQUE_BLACK
enumerator INT_OPAQUE_BLACK
enumerator FLOAT_OPAQUE_WHITE
enumerator INT_OPAQUE_WHITE
enum AspectMaskBit

Values:

enumerator COLOR_BUFFER_BIT
enumerator DEPTH_BUFFER_BIT
enumerator STENCIL_BUFFER_BIT
enum PrimitiveTopology

Values:

enumerator POINT_LIST
enumerator LINE_LIST
enumerator LINE_STRIP
enumerator TRIANGLE_LIST
enumerator TRIANGLE_STRIP
enumerator TRIANGLE_FAN
enumerator PATCH_LIST

Note

Available only in pipelines with tessellation shaders

enum PolygonMode

Values:

enumerator FILL
enumerator LINE
enumerator POINT
enum CullMode

Values:

enumerator NONE
enumerator FRONT
enumerator BACK
enumerator FRONT_AND_BACK
enum FrontFace

Values:

enumerator CLOCKWISE
enumerator COUNTERCLOCKWISE
enum CompareOp

Values:

enumerator NEVER
enumerator LESS
enumerator EQUAL
enumerator LESS_OR_EQUAL
enumerator GREATER
enumerator NOT_EQUAL
enumerator GREATER_OR_EQUAL
enumerator ALWAYS
enum LogicOp

Values:

enumerator CLEAR
enumerator SET
enumerator COPY
enumerator COPY_INVERTED
enumerator NO_OP
enumerator INVERT
enumerator AND
enumerator NAND
enumerator OR
enumerator NOR
enumerator XOR
enumerator EQUIVALENT
enumerator AND_REVERSE
enumerator OR_REVERSE
enumerator AND_INVERTED
enumerator OR_INVERTED
enum BlendFactor

Values:

enumerator ZERO
enumerator ONE
enumerator SRC_COLOR
enumerator ONE_MINUS_SRC_COLOR
enumerator DST_COLOR
enumerator ONE_MINUS_DST_COLOR
enumerator SRC_ALPHA
enumerator ONE_MINUS_SRC_ALPHA
enumerator DST_ALPHA
enumerator ONE_MINUS_DST_ALPHA
enumerator CONSTANT_COLOR
enumerator ONE_MINUS_CONSTANT_COLOR
enumerator CONSTANT_ALPHA
enumerator ONE_MINUS_CONSTANT_ALPHA
enumerator SRC_ALPHA_SATURATE
enumerator SRC1_COLOR
enumerator ONE_MINUS_SRC1_COLOR
enumerator SRC1_ALPHA
enumerator ONE_MINUS_SRC1_ALPHA
enum BlendOp

Values:

enumerator ADD
enumerator SUBTRACT
enumerator REVERSE_SUBTRACT
enumerator MIN
enumerator MAX
enum ColorComponentFlag

Values:

enumerator NONE
enumerator R_BIT
enumerator G_BIT
enumerator B_BIT
enumerator A_BIT
enumerator RGBA_BITS
enum IndexType

Values:

enumerator UNSIGNED_BYTE
enumerator UNSIGNED_SHORT
enumerator UNSIGNED_INT
enum MemoryBarrierBit

Values:

enumerator NONE
enumerator VERTEX_BUFFER_BIT
enumerator INDEX_BUFFER_BIT
enumerator UNIFORM_BUFFER_BIT
enumerator TEXTURE_FETCH_BIT
enumerator IMAGE_ACCESS_BIT
enumerator COMMAND_BUFFER_BIT
enumerator TEXTURE_UPDATE_BIT
enumerator BUFFER_UPDATE_BIT
enumerator MAPPED_BUFFER_BIT
enumerator FRAMEBUFFER_BIT
enumerator SHADER_STORAGE_BIT
enumerator QUERY_COUNTER_BIT
enumerator ALL_BITS
enum StencilOp

Values:

enumerator KEEP
enumerator ZERO
enumerator REPLACE
enumerator INCREMENT_AND_CLAMP
enumerator DECREMENT_AND_CLAMP
enumerator INVERT
enumerator INCREMENT_AND_WRAP
enumerator DECREMENT_AND_WRAP
enum ClipDepthRange

Values:

enumerator NEGATIVE_ONE_TO_ONE
enumerator ZERO_TO_ONE

Functions

inline Extent2D operator+(uint32_t val, Extent2D ext)
inline Extent2D operator-(uint32_t val, Extent2D ext)
inline Extent2D operator*(uint32_t val, Extent2D ext)
inline Extent2D operator/(uint32_t val, Extent2D ext)
inline Extent2D operator>>(uint32_t val, Extent2D ext)
inline Extent2D operator<<(uint32_t val, Extent2D ext)
inline Extent3D operator+(uint32_t val, Extent3D ext)
inline Extent3D operator-(uint32_t val, Extent3D ext)
inline Extent3D operator*(uint32_t val, Extent3D ext)
inline Extent3D operator/(uint32_t val, Extent3D ext)
inline Extent3D operator>>(uint32_t val, Extent3D ext)
inline Extent3D operator<<(uint32_t val, Extent3D ext)
inline Offset2D operator+(uint32_t val, Offset2D ext)
inline Offset2D operator-(uint32_t val, Offset2D ext)
inline Offset2D operator*(uint32_t val, Offset2D ext)
inline Offset2D operator/(uint32_t val, Offset2D ext)
inline Offset2D operator>>(uint32_t val, Offset2D ext)
inline Offset2D operator<<(uint32_t val, Offset2D ext)
inline Offset3D operator+(uint32_t val, Offset3D ext)
inline Offset3D operator-(uint32_t val, Offset3D ext)
inline Offset3D operator*(uint32_t val, Offset3D ext)
inline Offset3D operator/(uint32_t val, Offset3D ext)
inline Offset3D operator>>(uint32_t val, Offset3D ext)
inline Offset3D operator<<(uint32_t val, Offset3D ext)

Variables

constexpr uint64_t WHOLE_BUFFER = static_cast<uint64_t>(-1)

Convenience constant to allow binding the whole buffer in Cmd::BindUniformBuffer and Cmd::BindStorageBuffer.

If an offset is provided with this constant, then the range [offset, buffer.Size()) will be bound.

struct DispatchIndirectCommand

Public Members

uint32_t groupCountX
uint32_t groupCountY
uint32_t groupCountZ
struct DrawIndexedIndirectCommand

Public Members

uint32_t indexCount
uint32_t instanceCount
uint32_t firstIndex
int32_t vertexOffset
uint32_t firstInstance
struct DrawIndirectCommand

Public Members

uint32_t vertexCount
uint32_t instanceCount
uint32_t firstVertex
uint32_t firstInstance
struct Extent2D

Public Functions

bool operator==(const Extent2D&) const noexcept = default
inline Extent2D operator+(const Extent2D &other) const
inline Extent2D operator-(const Extent2D &other) const
inline Extent2D operator*(const Extent2D &other) const
inline Extent2D operator/(const Extent2D &other) const
inline Extent2D operator>>(const Extent2D &other) const
inline Extent2D operator<<(const Extent2D &other) const
inline Extent2D operator+(uint32_t val) const
inline Extent2D operator-(uint32_t val) const
inline Extent2D operator*(uint32_t val) const
inline Extent2D operator/(uint32_t val) const
inline Extent2D operator>>(uint32_t val) const
inline Extent2D operator<<(uint32_t val) const

Public Members

uint32_t width = {}
uint32_t height = {}
struct Extent3D

Public Functions

inline operator Extent2D() const
bool operator==(const Extent3D&) const noexcept = default
inline Extent3D operator+(const Extent3D &other) const
inline Extent3D operator-(const Extent3D &other) const
inline Extent3D operator*(const Extent3D &other) const
inline Extent3D operator/(const Extent3D &other) const
inline Extent3D operator>>(const Extent3D &other) const
inline Extent3D operator<<(const Extent3D &other) const
inline Extent3D operator+(uint32_t val) const
inline Extent3D operator-(uint32_t val) const
inline Extent3D operator*(uint32_t val) const
inline Extent3D operator/(uint32_t val) const
inline Extent3D operator>>(uint32_t val) const
inline Extent3D operator<<(uint32_t val) const

Public Members

uint32_t width = {}
uint32_t height = {}
uint32_t depth = {}
struct Offset2D

Public Functions

bool operator==(const Offset2D&) const noexcept = default
inline Offset2D operator+(const Offset2D &other) const
inline Offset2D operator-(const Offset2D &other) const
inline Offset2D operator*(const Offset2D &other) const
inline Offset2D operator/(const Offset2D &other) const
inline Offset2D operator>>(const Offset2D &other) const
inline Offset2D operator<<(const Offset2D &other) const
inline Offset2D operator+(uint32_t val) const
inline Offset2D operator-(uint32_t val) const
inline Offset2D operator*(uint32_t val) const
inline Offset2D operator/(uint32_t val) const
inline Offset2D operator>>(uint32_t val) const
inline Offset2D operator<<(uint32_t val) const

Public Members

uint32_t x = {}
uint32_t y = {}
struct Offset3D

Public Functions

inline operator Offset2D() const
bool operator==(const Offset3D&) const noexcept = default
inline Offset3D operator+(const Offset3D &other) const
inline Offset3D operator-(const Offset3D &other) const
inline Offset3D operator*(const Offset3D &other) const
inline Offset3D operator/(const Offset3D &other) const
inline Offset3D operator>>(const Offset3D &other) const
inline Offset3D operator<<(const Offset3D &other) const
inline Offset3D operator+(uint32_t val) const
inline Offset3D operator-(uint32_t val) const
inline Offset3D operator*(uint32_t val) const
inline Offset3D operator/(uint32_t val) const
inline Offset3D operator>>(uint32_t val) const
inline Offset3D operator<<(uint32_t val) const

Public Members

uint32_t x = {}
uint32_t y = {}
uint32_t z = {}
struct Rect2D

Public Functions

bool operator==(const Rect2D&) const noexcept = default

Public Members

Offset2D offset
Extent2D extent

Buffer.h

namespace Fwog

Enums

enum BufferStorageFlag

Values:

enumerator NONE
enumerator DYNAMIC_STORAGE

Allows the user to update the buffer’s contents with Buffer::UpdateData.

enumerator CLIENT_STORAGE

Hints to the implementation to place the buffer storage in host memory.

enumerator MAP_MEMORY

Maps the buffer (persistently and coherently) upon creation.

class Buffer
#include <Buffer.h>

Encapsulates an OpenGL buffer.

Public Functions

explicit Buffer(size_t size, BufferStorageFlags storageFlags = BufferStorageFlag::NONE)
explicit Buffer(TriviallyCopyableByteSpan data, BufferStorageFlags storageFlags = BufferStorageFlag::NONE)
Buffer(Buffer &&old) noexcept
Buffer &operator=(Buffer &&old) noexcept
Buffer(const Buffer&) = delete
Buffer &operator=(const Buffer&) = delete
~Buffer()
void UpdateData(TriviallyCopyableByteSpan data, size_t destOffsetBytes = 0)
void ClearSubData(const BufferClearInfo &clear)
inline void *GetMappedPointer() noexcept

Gets a pointer that is mapped to the buffer’s data store.

Returns:

A pointer to mapped memory if the buffer was created with BufferStorageFlag::MAP_MEMORY, otherwise nullptr

inline const void *GetMappedPointer() const noexcept
inline auto Handle() const noexcept
inline auto Size() const noexcept
inline bool IsMapped() const noexcept
void Invalidate()

Invalidates the content of the buffer’s data store.

This call can be used to optimize driver synchronization in certain cases.

Protected Functions

Buffer(const void *data, size_t size, BufferStorageFlags storageFlags)
void UpdateData(const void *data, size_t size, size_t offset = 0)

Protected Attributes

size_t size_ = {}
BufferStorageFlags storageFlags_ = {}
uint32_t id_ = {}
void *mappedMemory_ = {}
struct BufferClearInfo

Public Members

uint64_t offset = 0
uint64_t size = WHOLE_BUFFER
Format internalFormat
UploadFormat uploadFormat = UploadFormat::INFER_FORMAT
UploadType uploadType = UploadType::INFER_TYPE
const void *data = nullptr
class TriviallyCopyableByteSpan : public std::span<const std::byte>
#include <Buffer.h>

Used to constrain the types accpeted by Buffer.

Public Functions

template<typename T> inline requires std::is_trivially_copyable_v< T > TriviallyCopyableByteSpan (const T &t)
template<typename T> inline requires std::is_trivially_copyable_v< T > TriviallyCopyableByteSpan (std::span< const T > t)
template<typename T> inline requires std::is_trivially_copyable_v< T > TriviallyCopyableByteSpan (std::span< T > t)

DebugMarker.h

namespace Fwog
class ScopedDebugMarker
#include <DebugMarker.h>

Use to demarcate a scope for viewing in a graphics debugger.

Public Functions

ScopedDebugMarker(const char *message)
~ScopedDebugMarker()
ScopedDebugMarker(const ScopedDebugMarker&) = delete

Fence.h

namespace Fwog
class Fence
#include <Fence.h>

An object used for CPU-GPU synchronization.

Public Functions

explicit Fence()
Fence(Fence &&old) noexcept
Fence &operator=(Fence &&old) noexcept
Fence(const Fence&) = delete
Fence &operator=(const Fence&) = delete
~Fence()
void Signal()

Inserts a fence into the command stream.

uint64_t Wait()

Waits for the fence to be signaled and returns.

Todo:

Add timeout parameter

Returns:

How long (in nanoseconds) the fence blocked

Private Functions

void DeleteSync()

Private Members

void *sync_ = {}

Shader.h

namespace Fwog

Enums

enum PipelineStage

Values:

enumerator VERTEX_SHADER
enumerator TESSELLATION_CONTROL_SHADER
enumerator TESSELLATION_EVALUATION_SHADER
enumerator FRAGMENT_SHADER
enumerator COMPUTE_SHADER
class Shader
#include <Shader.h>

A shader object to be used in one or more GraphicsPipeline or ComputePipeline objects.

Public Functions

explicit Shader(PipelineStage stage, std::string_view source)

Constructs the shader.

Parameters:
  • stage – A pipeline stage

  • source – A GLSL source string

Throws:

ShaderCompilationException – if the shader is malformed

Shader(const Shader&) = delete
Shader(Shader &&old) noexcept
Shader &operator=(const Shader&) = delete
Shader &operator=(Shader &&old) noexcept
~Shader()
inline uint32_t Handle() const

Gets the handle of the underlying OpenGL shader object.

Returns:

The shader

Private Members

uint32_t id_ = {}

Texture.h

namespace Fwog

Functions

Texture CreateTexture2D(Extent2D size, Format format, std::string_view name = "")
Texture CreateTexture2DMip(Extent2D size, Format format, uint32_t mipLevels, std::string_view name = "")
struct ComponentMapping
#include <Texture.h>

Specifies a color component mapping.

struct CompressedTextureUpdateInfo
#include <Texture.h>

Parameters for Texture::UpdateCompressedImage.

Public Members

uint32_t level = 0
Offset3D offset = {}
Extent3D extent = {}
const void *data = nullptr
class Sampler
#include <Texture.h>

Encapsulates an OpenGL sampler.

Public Functions

explicit Sampler(const SamplerState &samplerState)
inline uint32_t Handle() const

Gets the handle of the underlying OpenGL sampler object.

Returns:

The sampler

Private Functions

Sampler() = default
inline explicit Sampler(uint32_t id)

Private Members

uint32_t id_ = {}

Friends

friend class detail::SamplerCache
struct SamplerState
#include <Texture.h>

Parameters for the constructor of Sampler.

Public Functions

bool operator==(const SamplerState &rhs) const noexcept = default

Public Members

float lodBias = {0}
float minLod = {-1000}
float maxLod = {1000}
Filter minFilter = Filter::LINEAR
Filter magFilter = Filter::LINEAR
Filter mipmapFilter = Filter::NONE
AddressMode addressModeU = AddressMode::CLAMP_TO_EDGE
AddressMode addressModeV = AddressMode::CLAMP_TO_EDGE
AddressMode addressModeW = AddressMode::CLAMP_TO_EDGE
BorderColor borderColor = BorderColor::FLOAT_OPAQUE_WHITE
SampleCount anisotropy = SampleCount::SAMPLES_1
bool compareEnable = false
CompareOp compareOp = CompareOp::NEVER
class Texture
#include <Texture.h>

Encapsulates an immutable OpenGL texture.

Subclassed by Fwog::TextureView

Public Functions

explicit Texture(const TextureCreateInfo &createInfo, std::string_view name = "")

Constructs the texture.

Parameters:
  • createInfo – Parameters to construct the texture

  • name – An optional name for viewing the resource in a graphics debugger

Texture(Texture &&old) noexcept
Texture &operator=(Texture &&old) noexcept
Texture(const Texture&) = delete
Texture &operator=(const Texture&) = delete
virtual ~Texture()
bool operator==(const Texture&) const noexcept = default

Todo:

Remove

void UpdateImage(const TextureUpdateInfo &info)

Updates a subresource of the image.

Note

info.format must not be a compressed image format

Parameters:

info – The subresource and data to upload

void UpdateCompressedImage(const CompressedTextureUpdateInfo &info)

Updates a subresource of the image.

Note

Image must be in a compressed image format

Note

info.data must be in a compatible compressed image format

Parameters:

info – The subresource and data to upload

void ClearImage(const TextureClearInfo &info)

Clears a subresource of the image to a specified value.

Parameters:

info – The subresource and value to clear it with

void GenMipmaps()

Automatically generates LoDs of the image. All mip levels beyond 0 are filled with the generated LoDs.

TextureView CreateSingleMipView(uint32_t level)

Creates a view of a single mip level of the image.

TextureView CreateSingleLayerView(uint32_t layer)

Creates a view of a single array layer of the image.

TextureView CreateFormatView(Format newFormat)

Reinterpret the data of this texture.

Parameters:

newFormat – The format to reinterpret the data as

Returns:

A new texture view

TextureView CreateSwizzleView(ComponentMapping components)

Creates a view of the texture with a new component mapping.

Parameters:

components – The swizzled components

Returns:

A new texture view

uint64_t GetBindlessHandle(Sampler sampler)

Generates and makes resident a bindless handle from the image and a sampler. Only available if GL_ARB_bindless_texture is supported.

Todo:

Improve this

Parameters:

sampler – The sampler to bind to the texture

Returns:

A bindless texture handle that can be placed in a buffer and used to construct a combined texture sampler in a shader

inline const TextureCreateInfo &GetCreateInfo() const noexcept
inline Extent3D Extent() const noexcept
inline uint32_t Handle() noexcept

Gets the handle of the underlying OpenGL texture object.

Returns:

The texture

Protected Functions

void subImageInternal(const TextureUpdateInfo &info)
void subCompressedImageInternal(const CompressedTextureUpdateInfo &info)
Texture() = default

Protected Attributes

uint32_t id_ = {}
TextureCreateInfo createInfo_ = {}
uint64_t bindlessHandle_ = 0

Friends

friend void CopyBufferToTexture(const CopyBufferToTextureInfo &copy)

Copies buffer data into a texture.

struct TextureClearInfo
#include <Texture.h>

Parameters for Texture::ClearImage.

Public Members

uint32_t level = 0
Offset3D offset = {}
Extent3D extent = {}
UploadFormat format = UploadFormat::INFER_FORMAT
UploadType type = UploadType::INFER_TYPE
const void *data = nullptr

If null, then the subresource will be cleared with zeroes.

struct TextureCreateInfo
#include <Texture.h>

Parameters for the constructor of Texture.

Public Functions

bool operator==(const TextureCreateInfo&) const noexcept = default

Public Members

ImageType imageType = {}
Format format = {}
Extent3D extent = {}
uint32_t mipLevels = 0
uint32_t arrayLayers = 0
SampleCount sampleCount = {}
struct TextureUpdateInfo
#include <Texture.h>

Parameters for Texture::UpdateImage.

Public Members

uint32_t level = 0
Offset3D offset = {}
Extent3D extent = {}
UploadFormat format = UploadFormat::INFER_FORMAT
UploadType type = UploadType::INFER_TYPE
const void *pixels = nullptr
uint32_t rowLength = 0

Specifies, in texels, the size of rows in the array (for 2D and 3D images). If zero, it is assumed to be tightly packed according to size.

uint32_t imageHeight = 0

Specifies, in texels, the number of rows in the array (for 3D images. If zero, it is assumed to be tightly packed according to size.

class TextureView : public Fwog::Texture
#include <Texture.h>

Encapsulates an OpenGL texture view.

Public Functions

explicit TextureView(const TextureViewCreateInfo &viewInfo, Texture &texture, std::string_view name = "")

Constructs the texture view with explicit parameters.

Parameters:
  • viewInfo – Parameters to construct the texture

  • texture – A texture of which to construct a view

  • name – An optional name for viewing the resource in a graphics debugger

explicit TextureView(const TextureViewCreateInfo &viewInfo, TextureView &textureView, std::string_view name = "")
explicit TextureView(Texture &texture, std::string_view name = "")
TextureView(TextureView &&old) noexcept
TextureView &operator=(TextureView &&old) noexcept
TextureView(const TextureView &other) = delete
TextureView &operator=(const TextureView &other) = delete
~TextureView()
inline TextureViewCreateInfo GetViewInfo() const noexcept

Private Functions

TextureView()

Private Members

TextureViewCreateInfo viewInfo_ = {}
struct TextureViewCreateInfo
#include <Texture.h>

Parameters for the constructor of TextureView.

Public Members

ImageType viewType = {}

Note

Must be an image type compatible with the base texture as defined by table 8.21 in the OpenGL spec

Format format = {}

Note

Must be a format compatible with the base texture as defined by table 8.22 in the OpenGL spec

ComponentMapping components = {}
uint32_t minLevel = 0
uint32_t numLevels = 0
uint32_t minLayer = 0
uint32_t numLayers = 0
namespace detail

Functions

uint32_t GetHandle(const Texture &texture)

Timer.h

namespace Fwog
class TimerQuery
#include <Timer.h>

Synchronous single-buffered GPU-timeline timer. Querying the timer will result in a stall as commands are flushed and waited on to complete.

Use sparingly, and only if detailed perf data is needed for a particular draw.

Todo:

This class is in desparate need of an update

Public Functions

TimerQuery()
~TimerQuery()
TimerQuery(const TimerQuery&) = delete
TimerQuery(TimerQuery&&) = delete
TimerQuery &operator=(const TimerQuery&) = delete
TimerQuery &operator=(TimerQuery&&) = delete
uint64_t GetTimestamp()

Private Members

uint32_t queries[2]
class TimerQueryAsync
#include <Timer.h>

Async N-buffered timer query that does not induce pipeline stalls.

Useful for measuring performance of passes every frame without causing stalls. However, the results returned may be from multiple frames ago, and results are not guaranteed to be available. In practice, setting N to 5 should allow at least one query to be available every frame.

Public Functions

TimerQueryAsync(uint32_t N)
~TimerQueryAsync()
TimerQueryAsync(const TimerQueryAsync&) = delete
TimerQueryAsync(TimerQueryAsync&&) = delete
TimerQueryAsync &operator=(const TimerQueryAsync&) = delete
TimerQueryAsync &operator=(TimerQueryAsync&&) = delete
void BeginZone()

Begins a query zone.

Note

EndZone must be called before another zone can begin

void EndZone()

Ends a query zone.

Note

BeginZone must be called before a zone can end

std::optional<uint64_t> PopTimestamp()

Gets the latest available query.

Returns:

The latest query, if available. Otherwise, std::nullopt is returned

Private Members

uint32_t start_ = {}
uint32_t count_ = {}
const uint32_t capacity_ = {}
uint32_t *queries = {}
template<typename T>
class TimerScoped
#include <Timer.h>

RAII wrapper for TimerQueryAsync.

Public Functions

inline TimerScoped(T &zone)
inline ~TimerScoped()

Private Members

T &zone_