15 uint32_t vertexCount, uint32_t vertexLocation)
16 : m_vertexBuffer(buffer),
17 m_constantBuffers(constantBuffers),
18 m_vertexCount(vertexCount),
19 m_startVertexLocation(vertexLocation) {}
24 for (
const auto& b : m_constantBuffers)
27 context->
Draw(m_vertexCount);
32 for (
const auto& b : m_constantBuffers) {
33 if (b && b->GetSlot() == 0) {
38 context->
Draw(m_vertexCount);
42 for (
const auto& b : m_constantBuffers) {
43 if (b && b->GetSlot() == 3)
return true;
52 uint32_t startIndexLocation,
53 int32_t baseVertexLocation)
54 : m_vertexBuffer(vertexBuffer),
55 m_indexBuffer(indexBuffer),
56 m_constantBuffers(constantBuffers),
57 m_indexCount(indexCount),
58 m_startIndexLocation(startIndexLocation),
59 m_baseVertexLocation(baseVertexLocation) {}
67 bool hasBones =
false;
68 for (
const auto& b : m_constantBuffers) {
69 if (b && b->GetSlot() == 3) { hasBones =
true;
break; }
76 for (
const auto& b : m_constantBuffers) {
78 if (b->GetSlot() == 3) {
94 for (
const auto& b : m_constantBuffers) {
95 if (b && b->GetSlot() == 0) {
104 for (
const auto& b : m_constantBuffers) {
105 if (b && b->GetSlot() == 3)
return true;
114 constantBuffer(buffer),
116 if (Size <= INLINE_CAPACITY) {
118 memcpy(m_inlineData, Data, Size);
121 m_heapData = malloc(Size);
123 memcpy(m_heapData, Data, Size);
125 SLEAK_ERROR(
"Failed to allocate memory at UpdateConstantBufferCommand!");
131 void* data = m_heapData ? m_heapData :
static_cast<void*
>(m_inlineData);
132 constantBuffer->Update(data, Size);
136 constantBuffer(buffer), slot(slot) {}
155 : m_material(material) {}
168 auto* diffuse = m_material->GetDiffuseTexture();
175 : m_executeFunction(function) {}
178 if (m_executeFunction)
179 m_executeFunction(context);
Implements a dynamic array-like list for storing and managing a collection of elements.
void Execute(RenderContext *context) override
Replays this command into the main forward/deferred pass.
BindConstantBufferCommand(RefPtr< BufferBase > buffer, int slot)
void Execute(RenderContext *context) override
Binds the material either through the deferred PBR path or the plain forward path,...
BindMaterialCommand(::Sleak::Material *material)
std::function< void(RenderContext *)> ExecuteFunction
CustomCommand(ExecuteFunction executeFunction)
void Execute(RenderContext *context) override
Replays this command into the main forward/deferred pass.
void ExecuteShadow(RenderContext *context) override
bool IsSkinned() const override
DrawCommand(RefPtr< BufferBase > vertexBuffer, List< RefPtr< BufferBase > > constantBuffers, uint32_t vertexCount, uint32_t startVertexLocation=0)
void Execute(RenderContext *context) override
Replays this command into the main forward/deferred pass.
DrawIndexedCommand(RefPtr< BufferBase > vertexBuffer, RefPtr< BufferBase > indexBuffer, List< RefPtr< BufferBase > > constantBuffers, uint32_t indexCount, uint32_t startIndexLocation=0, int32_t baseVertexLocation=0)
void Execute(RenderContext *context) override
Binds buffers, routes bone data through the skinned pipeline when present, then draws.
bool IsSkinned() const override
void ExecuteShadow(RenderContext *context) override
Abstract interface for high-level graphics command execution and resource management.
virtual void BindBoneBuffer(RefPtr< BufferBase > buffer)
virtual void Draw(uint32_t vertexCount)=0
Non-indexed draw from the currently bound vertex buffer.
virtual void SetRenderMode(RenderMode mode)=0
virtual void BindVertexBuffer(RefPtr< BufferBase > buffer, uint32_t slot=0)=0
virtual void EndSkinnedPass()
virtual void BindIndexBuffer(RefPtr< BufferBase > buffer, uint32_t slot=0)=0
virtual bool IsInGeometryPass() const
virtual void BeginSkinnedPass()
virtual void BindTextureRaw(Sleak::Texture *texture, uint32_t slot=0)
virtual void BindPBRMaterial(Sleak::Material *material)
virtual void SetRenderFace(RenderFace face)=0
virtual void BindConstantBuffer(RefPtr< BufferBase > buffer, uint32_t slot=0)=0
virtual void DrawIndexed(uint32_t indexCount)=0
Indexed draw from the currently bound vertex/index buffers.
void Execute(RenderContext *context) override
Replays this command into the main forward/deferred pass.
SetRenderFaceCommand(RenderFace face)
SetRenderModeCommand(RenderMode mode)
void Execute(RenderContext *context) override
Replays this command into the main forward/deferred pass.
void Execute(RenderContext *context) override
Replays this command into the main forward/deferred pass.
UpdateConstantBufferCommand(RefPtr< BufferBase > buffer, void *Data, uint16_t Size)
Copies the payload into inline storage, falling back to a heap allocation past INLINE_CAPACITY.
Backend-facing rendering layer shared by the four graphics backends.
RenderMode
Rasterizer fill style for a draw.
RenderFace
Which triangle winding gets culled.
Root namespace for everything the engine exposes.