18#ifndef INCLUDED_RENDERER_BACKEND_GL_DEVICECOMMANDCONTEXT
19#define INCLUDED_RENDERER_BACKEND_GL_DEVICECOMMANDCONTEXT
63 const Rect& sourceRegion,
const Rect& destinationRegion,
70 void ClearFramebuffer(
const bool color,
const bool depth,
const bool stencil)
override;
76 const void* data,
const size_t dataSize,
79 const void* data,
const size_t dataSize,
102 const uint32_t bindingSlot,
const void* data,
const uint32_t dataSize)
override;
112 const uint32_t firstIndex,
const uint32_t indexCount,
const int32_t vertexOffset)
override;
119 const int32_t vertexOffset)
override;
130 const uint32_t groupCountZ)
override;
137 const int32_t bindingSlot,
138 const float value)
override;
140 const int32_t bindingSlot,
141 const float valueX,
const float valueY)
override;
143 const int32_t bindingSlot,
144 const float valueX,
const float valueY,
145 const float valueZ)
override;
147 const int32_t bindingSlot,
148 const float valueX,
const float valueY,
149 const float valueZ,
const float valueW)
override;
156 void Flush()
override;
165 static std::unique_ptr<CDeviceCommandContext>
Create(
CDevice* device);
209 const GLenum target,
const GLuint handle);
A wrapper for backend shader program to handle high-level operations like file reloading and handling...
Definition: ShaderProgram.h:34
Represents a texture object.
Definition: TextureManager.h:262
Simplifed version of std::span (C++20) as we don't support the original one yet.
Definition: Span.h:37
Definition: DeviceCommandContext.h:206
~ScopedBind()
Definition: DeviceCommandContext.cpp:1387
BindUnit m_OldBindUnit
Definition: DeviceCommandContext.h:214
ScopedBind(CDeviceCommandContext *deviceCommandContext, const GLenum target, const GLuint handle)
Definition: DeviceCommandContext.cpp:1376
CDeviceCommandContext * m_DeviceCommandContext
Definition: DeviceCommandContext.h:213
uint32_t m_ActiveTextureUnit
Definition: DeviceCommandContext.h:215
Definition: DeviceCommandContext.h:221
ScopedBufferBind(CDeviceCommandContext *deviceCommandContext, CBuffer *buffer)
Definition: DeviceCommandContext.cpp:1393
size_t m_CacheIndex
Definition: DeviceCommandContext.h:229
CDeviceCommandContext * m_DeviceCommandContext
Definition: DeviceCommandContext.h:228
~ScopedBufferBind()
Definition: DeviceCommandContext.cpp:1414
Definition: DeviceCommandContext.h:50
void ResetStates()
Definition: DeviceCommandContext.cpp:577
void SetComputePipelineState(IComputePipelineState *pipelineState) override
Binds the graphics pipeline state.
Definition: DeviceCommandContext.cpp:273
void DrawInstanced(const uint32_t firstVertex, const uint32_t vertexCount, const uint32_t firstInstance, const uint32_t instanceCount) override
Definition: DeviceCommandContext.cpp:1163
void SetVertexBufferData(const uint32_t bindingSlot, const void *data, const uint32_t dataSize) override
Definition: DeviceCommandContext.cpp:1071
uint32_t m_ActiveTextureUnit
Definition: DeviceCommandContext.h:198
void DrawIndexed(const uint32_t firstIndex, const uint32_t indexCount, const int32_t vertexOffset) override
Definition: DeviceCommandContext.cpp:1141
void UploadTextureRegion(ITexture *texture, const Format dataFormat, const void *data, const size_t dataSize, const uint32_t xOffset, const uint32_t yOffset, const uint32_t width, const uint32_t height, const uint32_t level=0, const uint32_t layer=0) override
Definition: DeviceCommandContext.cpp:309
bool m_InsidePass
Definition: DeviceCommandContext.h:195
bool m_InsideFramebufferPass
Definition: DeviceCommandContext.h:194
void EndFramebufferPass() override
Finishes a framebuffer pass, performs attachment store operations.
Definition: DeviceCommandContext.cpp:961
void UploadBufferRegion(IBuffer *buffer, const void *data, const uint32_t dataOffset, const uint32_t dataSize) override
Definition: DeviceCommandContext.cpp:446
std::array< BoundBuffer, 2 > m_BoundBuffers
Definition: DeviceCommandContext.h:219
void EndScopedLabel() override
Definition: DeviceCommandContext.cpp:489
void Dispatch(const uint32_t groupCountX, const uint32_t groupCountY, const uint32_t groupCountZ) override
Dispatches groupCountX * groupCountY * groupCountZ compute groups.
Definition: DeviceCommandContext.cpp:1255
std::array< VertexAttributeFormat, static_cast< size_t >(VertexAttributeStream::UV7)+1 > m_VertexAttributeFormat
Definition: DeviceCommandContext.h:245
void SetIndexBuffer(IBuffer *buffer) override
Definition: DeviceCommandContext.cpp:1096
SComputePipelineStateDesc m_ComputePipelineStateDesc
Definition: DeviceCommandContext.h:186
void Flush() override
Definition: DeviceCommandContext.cpp:555
void BeginFramebufferPass(IFramebuffer *framebuffer) override
Starts a framebuffer pass, performs attachment load operations.
Definition: DeviceCommandContext.cpp:931
void UploadTexture(ITexture *texture, const Format dataFormat, const void *data, const size_t dataSize, const uint32_t level=0, const uint32_t layer=0) override
Definition: DeviceCommandContext.cpp:297
uint32_t m_ScissorCount
Definition: DeviceCommandContext.h:182
void BindBuffer(const IBuffer::Type type, CBuffer *buffer)
Definition: DeviceCommandContext.cpp:523
void OnTextureDestroy(CTexture *texture)
Definition: DeviceCommandContext.cpp:547
void ResolveFramebuffer(IFramebuffer *sourceFramebuffer, IFramebuffer *destinationFramebuffer) override
Resolves multisample source framebuffer attachments to destination attachments.
Definition: DeviceCommandContext.cpp:867
void SetVertexInputLayout(IVertexInputLayout *vertexInputLayout) override
Binds the vertex input layout.
Definition: DeviceCommandContext.cpp:1027
void SetIndexBufferData(const void *data, const uint32_t dataSize) override
Definition: DeviceCommandContext.cpp:1104
CDeviceCommandContext(CDevice *device)
Definition: DeviceCommandContext.cpp:223
CDevice * m_Device
Definition: DeviceCommandContext.h:177
CFramebuffer * m_Framebuffer
Definition: DeviceCommandContext.h:180
void BeginPass() override
Definition: DeviceCommandContext.cpp:1115
bool m_InsideComputePass
Definition: DeviceCommandContext.h:196
void SetStorageTexture(const int32_t bindingSlot, ITexture *texture) override
Sets a read & write resource to the binding slot.
Definition: DeviceCommandContext.cpp:1315
IDevice * GetDevice() override
Definition: DeviceCommandContext.cpp:252
static std::unique_ptr< CDeviceCommandContext > Create(CDevice *device)
Definition: DeviceCommandContext.cpp:211
uint32_t m_ScopedLabelDepth
Definition: DeviceCommandContext.h:188
std::function< void(u8 *)> UploadBufferFunction
Definition: DeviceCommandContext.h:84
CShaderProgram * m_ShaderProgram
Definition: DeviceCommandContext.h:181
void EndComputePass() override
Finishes a compute pass.
Definition: DeviceCommandContext.cpp:1249
CBuffer * m_VertexBuffer
Definition: DeviceCommandContext.h:190
std::pair< GLenum, GLuint > BoundBuffer
Definition: DeviceCommandContext.h:218
void BindTexture(const uint32_t unit, const GLenum target, const GLuint handle)
Definition: DeviceCommandContext.cpp:499
void DrawIndexedInRange(const uint32_t firstIndex, const uint32_t indexCount, const uint32_t start, const uint32_t end) override
Definition: DeviceCommandContext.cpp:1218
void Draw(const uint32_t firstVertex, const uint32_t vertexCount) override
Definition: DeviceCommandContext.cpp:1127
void SetGraphicsPipelineState(const SGraphicsPipelineStateDesc &pipelineState)
Definition: DeviceCommandContext.cpp:257
void SetUniform(const int32_t bindingSlot, const float value) override
Definition: DeviceCommandContext.cpp:1335
void ReadbackFramebufferSync(const uint32_t x, const uint32_t y, const uint32_t width, const uint32_t height, void *data) override
Readbacks the current backbuffer to data in R8G8B8_UNORM format somewhen between the function call an...
Definition: DeviceCommandContext.cpp:987
void EndPass() override
Definition: DeviceCommandContext.cpp:1121
std::array< BindUnit, 16 > m_BoundTextures
Definition: DeviceCommandContext.h:204
void BlitFramebuffer(IFramebuffer *sourceFramebuffer, IFramebuffer *destinationFramebuffer, const Rect &sourceRegion, const Rect &destinationRegion, const Sampler::Filter filter) override
Copies source region into destination region automatically applying compatible format conversion and ...
Definition: DeviceCommandContext.cpp:836
void ClearFramebuffer(const bool color, const bool depth, const bool stencil) override
Clears all mentioned attachments.
Definition: DeviceCommandContext.cpp:894
void SetTexture(const int32_t bindingSlot, ITexture *texture) override
Sets a read-only texture to the binding slot.
Definition: DeviceCommandContext.cpp:1273
const void * m_IndexBufferData
Definition: DeviceCommandContext.h:192
void UploadBuffer(IBuffer *buffer, const void *data, const uint32_t dataSize) override
Definition: DeviceCommandContext.cpp:433
CBuffer * m_IndexBuffer
Definition: DeviceCommandContext.h:191
void SetViewports(const uint32_t viewportCount, const Rect *viewports) override
Definition: DeviceCommandContext.cpp:1019
std::array< Rect, 1 > m_Scissors
Definition: DeviceCommandContext.h:184
void BeginScopedLabel(const char *name) override
Definition: DeviceCommandContext.cpp:480
void BeginComputePass() override
Starts a compute pass, can't be called inside a framebuffer pass.
Definition: DeviceCommandContext.cpp:1242
SGraphicsPipelineStateDesc m_GraphicsPipelineStateDesc
Definition: DeviceCommandContext.h:179
void SetScissors(const uint32_t scissorCount, const Rect *scissors) override
Definition: DeviceCommandContext.cpp:996
void DrawIndexedInstanced(const uint32_t firstIndex, const uint32_t indexCount, const uint32_t firstInstance, const uint32_t instanceCount, const int32_t vertexOffset) override
Definition: DeviceCommandContext.cpp:1185
void SetGraphicsPipelineStateImpl(const SGraphicsPipelineStateDesc &pipelineStateDesc, const bool force)
Definition: DeviceCommandContext.cpp:590
void SetVertexBuffer(const uint32_t bindingSlot, IBuffer *buffer, const uint32_t offset) override
Definition: DeviceCommandContext.cpp:1049
Definition: Framebuffer.h:41
A compiled vertex+fragment shader program.
Definition: ShaderProgram.h:89
Represents a low-level GL texture, encapsulates all properties initialization.
Definition: Texture.h:43
Type
Definition: IBuffer.h:35
A holder for precompiled compute pipeline description.
Definition: PipelineState.h:207
Definition: IDeviceCommandContext.h:42
IFramebuffer stores attachments which should be used by backend as rendering destinations.
Definition: IFramebuffer.h:85
A holder for precompiled graphics pipeline description.
Definition: PipelineState.h:198
Definition: ITexture.h:34
Filter
Definition: Sampler.h:36
Format
Definition: Format.h:28
Backend
Definition: Backend.h:28
VertexAttributeRate
Definition: IShaderProgram.h:48
Definition: VideoMode.h:29
Definition: DeviceCommandContext.h:200
GLenum target
Definition: DeviceCommandContext.h:201
GLuint handle
Definition: DeviceCommandContext.h:202
Definition: DeviceCommandContext.h:233
VertexAttributeRate rate
Definition: DeviceCommandContext.h:237
uint32_t stride
Definition: DeviceCommandContext.h:236
uint32_t bindingSlot
Definition: DeviceCommandContext.h:238
bool active
Definition: DeviceCommandContext.h:240
bool initialized
Definition: DeviceCommandContext.h:241
Format format
Definition: DeviceCommandContext.h:234
uint32_t offset
Definition: DeviceCommandContext.h:235
Definition: IDeviceCommandContext.h:58
Definition: PipelineState.h:175
Definition: PipelineState.h:165
uint8_t u8
Definition: types.h:37
unsigned int uint32_t
Definition: wposix_types.h:53