3#include "../IContext.h"
5#include "../VertexFormat.h"
6#include "../Statistics.h"
8#include "EffectsCommon.h"
12 const int kMaxVertexInputSlots = 32;
16 size_t numVertexBuffers = 0;
18 uint32_t strides[kMaxVertexInputSlots] = {};
19 uint32_t offsets[kMaxVertexInputSlots] = {};
32 void frameStatisticsConfigure(
bool enable)
override { frameStatisticsEnabled = enable; }
37 this->setVariable(name,
reinterpret_cast<const unsigned char *
>(&value),
sizeof(
float));
41 this->setVariable(name,
reinterpret_cast<const unsigned char *
>(&value),
sizeof(
int));
45 this->setVariable(name,
reinterpret_cast<const unsigned char *
>(value),
sizeof(
float) * 2);
49 this->setVariable(name,
reinterpret_cast<const unsigned char *
>(value),
sizeof(
float) * 3);
53 this->setVariable(name,
reinterpret_cast<const unsigned char *
>(value),
sizeof(
float) * 4);
56 void setVariable(
const StringView& name,
const uint8_t * data,
size_t size);
98 void setCurrentEffect(
Effect * currentEffect);
99 void updateConstantBuffers();
102 void frameStatisticsAccountDrawCall(
size_t count,
bool indexed);
105 void uploadStatisticsBufferUpload(
size_t size);
106 void uploadStatisticsTextureUpload(
size_t size);
109 FrameStatistics currStats{};
111 UploadStatistics prevUploadStats{};
112 UploadStatistics currUploadStats{};
116 uint32_t dirtySRV[(int)Cogs::ShaderType::NumShaderSlots] = {};
117 uint32_t dirtyCB[(int)Cogs::ShaderType::NumShaderSlots] = {};
124 Effect * effect =
nullptr;
125 bool constantBuffersUpdated =
true;
126 bool frameStatisticsEnabled =
false;
127 bool uploadStatisticsEnabled =
true;
Provides a weakly referenced view over the contents of a string.
Contains all Cogs related functionality.
void setVector4Variable(const StringView &name, const float *value) override
Sets the vector variable with the given name to the given four-component value.
void frameStatisticsBeginFrame()
void setVector3Variable(const StringView &name, const float *value) override
Sets the vector variable with the given name to the given three-component value.
void setScalarVariable(const StringView &name, const float value) override
Sets the scalar floating point variable with the given name to the given value.
void setConstantBuffer(const StringView &name, const BufferHandle bufferHandle, const uint32_t offset, const uint32_t size) final
Sets a constant buffer to be bound to the given name and slot.
void setSamplerState(const StringView &name, unsigned int unit, SamplerStateHandle handle) final
Sets the sampler slot given by unit with the given name to contain the given sampler state.
void setVertexArrayObject(VertexArrayObjectHandle vertexArrayObject) override
void updateBuffer(BufferHandle bufferHandle, const void *data, size_t size) override
Replace contents of buffer with new data.
void setTexture(const StringView &name, unsigned int unit, TextureHandle textureHandle) final
Sets the texture slot given by unit with the given name to contain the given texture.
void setScalarVariable(const StringView &name, int value) override
Sets the scalar integer variable with the given name to the given value.
void setBuffer(const StringView &name, BufferHandle bufferHandle) final
Sets the given buffer to the buffer binding slot with the given name.
void setVector2Variable(const StringView &name, const float *value) override
Sets the vector variable with the given name to the given two-component value.
void setMatrixVariable(const StringView &name, const float *value) override
Sets the matrix variable with the given name in the current effect to value.
virtual void signal(FenceHandle) override
Insert a fence in the command stream that will signal when all commands before the fence are complete...
Represents a graphics device context which can receive rendering commands.
virtual void setTexture(const StringView &name, unsigned int unit, TextureHandle textureHandle)=0
Sets the texture slot given by unit with the given name to contain the given texture.
virtual void setConstantBuffer(const StringView &name, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0
Sets a constant buffer to be bound to the given name and slot.
virtual void setBuffer(const StringView &name, BufferHandle bufferHandle)=0
Sets the given buffer to the buffer binding slot with the given name.
virtual void setSamplerState(const StringView &name, unsigned int unit, SamplerStateHandle samplerStateHandle)=0
Sets the sampler slot given by unit with the given name to contain the given sampler state.
Provides effects and shader management functionality.
EPrimitiveType
Primitive type enumeration.