Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syntax of GlUniformBuffer to match that of GlUniformInput #1683 #1690

Merged
merged 5 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions copying.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ _the openage authors_ are:
| Haoyang Bi | AyiStar | ayistar à outlook dawt com |
| Michael Seibt | RoboSchmied | github à roboschmie dawt de |
| Nikhil Ghosh | NikhilGhosh75 | nghosh606 à gmail dawt com |
| Edvin Lindholm | EdvinLndh | edvinlndh à gmail dawt com |

If you're a first-time committer, add yourself to the above list. This is not
just for legal reasons, but also to keep an overview of all those nicknames.
Expand Down
84 changes: 49 additions & 35 deletions libopenage/renderer/opengl/uniform_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ GlUniformBuffer::GlUniformBuffer(const std::shared_ptr<GlContext> &context,
this->bind();
glBufferData(GL_UNIFORM_BUFFER, this->data_size, NULL, usage);

uniform_id_t unif_id = 0;
for (auto &uniform : uniforms) {
this->uniforms_by_name.insert(std::make_pair(uniform.first, unif_id));
unif_id += 1;
}

glBindBufferRange(GL_UNIFORM_BUFFER, this->binding_point, *this->handle, 0, this->data_size);

log::log(MSG(dbg) << "Created OpenGL uniform buffer (size: "
Expand All @@ -51,21 +57,28 @@ void GlUniformBuffer::set_binding_point(GLuint binding_point) {

void GlUniformBuffer::update_uniforms(std::shared_ptr<UniformBufferInput> const &unif_in) {
auto glunif_in = std::dynamic_pointer_cast<GlUniformBufferInput>(unif_in);
ENSURE(glunif_in->get_buffer() == this->shared_from_this(), "Uniform input passed to different buffer than it was created with.");
ENSURE(glunif_in->get_buffer().get() == this, "Uniform input passed to different buffer than it was created with.");

this->bind();

const auto &update_offs = glunif_in->update_offs;
uint8_t const *data = glunif_in->update_data.data();
for (auto const &pair : glunif_in->update_offs) {
uint8_t const *ptr = data + pair.second;
auto unif_def = this->uniforms[pair.first];
for (auto const &pair : this->uniforms_by_name) {
auto id = pair.second;
auto offset = update_offs[id];
uint8_t const *ptr = data + offset.offset;
auto unif_def = this->uniforms.find(pair.first)->second;
Copy link
Member

@heinezen heinezen Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not iterate through this->uniforms_by_name here and instead use glunif_in->used_uniforms. Reasons for this are:

  • UniformBufferInput can be partial updates where only a few uniforms in the buffer are updated and not all. If you iterate on this->uniforms_by_name, this could then read some uninitialized data into the buffer.
  • Iterating on a std::unordered_map like this->uniforms_by_name will be very slow compared to iterating on a std::vector (because of their memory layout). This is part of the reason why we want to "vectorize" these parameters: The vectors are much faster in our renderer.

You can check out the update for the regular UniformInput in this code sample for inspiration:

const auto &update_offs = unif_in->update_offs;
const auto &used_uniforms = unif_in->used_uniforms;
const auto &uniforms = this->uniforms;
uint8_t const *data = unif_in->update_data.data();
size_t unif_count = used_uniforms.size();
for (size_t i = 0; i < unif_count; ++i) {
uniform_id_t unif_id = used_uniforms[i];
const auto &update_off = update_offs[unif_id];
uint8_t const *ptr = data + update_off.offset;
const auto &unif = uniforms[unif_id];
auto loc = unif.location;

The syntax of your code can be roughly the same I think :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I think one of the reasons I went with that approach was in order to be able to lookup the GlBlockInUniform in the uniforms map. When iterating over the id's I'm not really sure how I should retrieve the correct value from the uniforms map. Do you think the uniforms attribute should be kept as a std::unordered_map?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this might be a good opportunity to change the type of GlUniformBuffer::uniforms to std::vector. That's already something we do for the uniforms in shader_program.h for uniforms outside of blocks:

/// Uniforms in the shader program. Contains only
/// uniforms in the default block, i.e. not within named blocks.
std::vector<GlUniform> uniforms;
/// Maps uniform names to their ID (the index in the uniform vector).
std::unordered_map<std::string, uniform_id_t> uniforms_by_name;

The change should be pretty straight-forward I hope. Apart from the type of uniforms, you'll have to change the constructor of GlUniformBuffer and the Renderer::add_uniform_buffer methods:

std::shared_ptr<UniformBuffer> GlRenderer::add_uniform_buffer(resources::UniformBufferInfo const &info) {

std::shared_ptr<UniformBuffer> GlRenderer::add_uniform_buffer(std::shared_ptr<ShaderProgram> const &prog,

Copy link
Member

@heinezen heinezen Sep 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shader_data.h also needs to be changed for the GlInBlockUniform:

/**
* Maps uniform names within this block to their descriptions.
*/
std::unordered_map<std::string, GlInBlockUniform> uniforms;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now changed from std::unordered_map to std::vector. I did add a name attribute in the GlInBlockUniform. the name is used instead of the the key that was stored with the map previously, mostly debugging and for creating the uniforms_by_name map. I'm not sure if this is how it should be, but I suppose some performance was gained, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I'll check it out now.

auto loc = unif_def.offset;
auto size = unif_def.size;

glBufferSubData(GL_UNIFORM_BUFFER, loc, size, ptr);
}
}

const std::unordered_map<std::string, GlInBlockUniform> &GlUniformBuffer::get_uniforms() const {
return this->uniforms;
}

bool GlUniformBuffer::has_uniform(const char *unif) {
return this->uniforms.count(unif) != 0;
}
Expand All @@ -80,8 +93,12 @@ std::shared_ptr<UniformBufferInput> GlUniformBuffer::new_unif_in() {
return in;
}

void GlUniformBuffer::set_unif(std::shared_ptr<UniformBufferInput> const &in, const char *unif, void const *val, GLenum type) {
auto unif_in = std::dynamic_pointer_cast<GlUniformBufferInput>(in);
void GlUniformBuffer::set_unif(UniformBufferInput &in, const char *unif, void const *val, GLenum type) {
auto &unif_in = dynamic_cast<GlUniformBufferInput &>(in);

auto unif_id = this->uniforms_by_name.find(unif)->second;
ENSURE(unif_id < this->uniforms.size(),
"Tried to set uniform with invalid ID " << unif_id);

auto uniform = this->uniforms.find(unif);
ENSURE(uniform != std::end(this->uniforms),
Expand All @@ -96,83 +113,80 @@ void GlUniformBuffer::set_unif(std::shared_ptr<UniformBufferInput> const &in, co
ENSURE(size == unif_data.size,
"Tried to set uniform " << unif << " to a value of the wrong size.");

auto update_off = unif_in->update_offs.find(unif);
if (update_off != std::end(unif_in->update_offs)) [[likely]] { // always used after the uniform value is written once
// already wrote to this uniform since last upload
size_t off = update_off->second;
memcpy(unif_in->update_data.data() + off, val, size);
}
else {
// first time writing to this uniform since last upload, so
// extend the buffer before storing the uniform value
size_t prev_size = unif_in->update_data.size();
unif_in->update_data.resize(prev_size + size);
memcpy(unif_in->update_data.data() + prev_size, val, size);
unif_in->update_offs.emplace(unif, prev_size);
auto &update_off = unif_in.update_offs[unif_id];
auto offset = update_off.offset;
memcpy(unif_in.update_data.data() + offset, val, size);
if (not update_off.used) [[unlikely]] { // only true if the uniform value was not set before
auto lower_bound = std::lower_bound(
std::begin(unif_in.used_uniforms),
std::end(unif_in.used_uniforms),
unif_id);
unif_in.used_uniforms.insert(lower_bound, unif_id);
update_off.used = true;
}
}

void GlUniformBuffer::set_i32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, int32_t val) {
void GlUniformBuffer::set_i32(UniformBufferInput &in, const char *unif, int32_t val) {
this->set_unif(in, unif, &val, GL_INT);
}

void GlUniformBuffer::set_u32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, uint32_t val) {
void GlUniformBuffer::set_u32(UniformBufferInput &in, const char *unif, uint32_t val) {
this->set_unif(in, unif, &val, GL_UNSIGNED_INT);
}

void GlUniformBuffer::set_f32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, float val) {
void GlUniformBuffer::set_f32(UniformBufferInput &in, const char *unif, float val) {
this->set_unif(in, unif, &val, GL_FLOAT);
}

void GlUniformBuffer::set_f64(std::shared_ptr<UniformBufferInput> const &in, const char *unif, double val) {
void GlUniformBuffer::set_f64(UniformBufferInput &in, const char *unif, double val) {
this->set_unif(in, unif, &val, GL_DOUBLE);
}

void GlUniformBuffer::set_bool(std::shared_ptr<UniformBufferInput> const &in, const char *unif, bool val) {
void GlUniformBuffer::set_bool(UniformBufferInput &in, const char *unif, bool val) {
this->set_unif(in, unif, &val, GL_BOOL);
}

void GlUniformBuffer::set_v2f32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector2f const &val) {
void GlUniformBuffer::set_v2f32(UniformBufferInput &in, const char *unif, Eigen::Vector2f const &val) {
this->set_unif(in, unif, val.data(), GL_FLOAT_VEC2);
}

void GlUniformBuffer::set_v3f32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector3f const &val) {
void GlUniformBuffer::set_v3f32(UniformBufferInput &in, const char *unif, Eigen::Vector3f const &val) {
this->set_unif(in, unif, val.data(), GL_FLOAT_VEC3);
}

void GlUniformBuffer::set_v4f32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector4f const &val) {
void GlUniformBuffer::set_v4f32(UniformBufferInput &in, const char *unif, Eigen::Vector4f const &val) {
this->set_unif(in, unif, val.data(), GL_FLOAT_VEC4);
}

void GlUniformBuffer::set_v2i32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector2i const &val) {
void GlUniformBuffer::set_v2i32(UniformBufferInput &in, const char *unif, Eigen::Vector2i const &val) {
this->set_unif(in, unif, val.data(), GL_INT_VEC2);
}

void GlUniformBuffer::set_v3i32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector3i const &val) {
void GlUniformBuffer::set_v3i32(UniformBufferInput &in, const char *unif, Eigen::Vector3i const &val) {
this->set_unif(in, unif, val.data(), GL_INT_VEC3);
}

void GlUniformBuffer::set_v4i32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector4i const &val) {
void GlUniformBuffer::set_v4i32(UniformBufferInput &in, const char *unif, Eigen::Vector4i const &val) {
this->set_unif(in, unif, val.data(), GL_INT_VEC4);
}

void GlUniformBuffer::set_v2ui32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector2<uint32_t> const &val) {
void GlUniformBuffer::set_v2ui32(UniformBufferInput &in, const char *unif, Eigen::Vector2<uint32_t> const &val) {
this->set_unif(in, unif, val.data(), GL_UNSIGNED_INT_VEC2);
}

void GlUniformBuffer::set_v3ui32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector3<uint32_t> const &val) {
void GlUniformBuffer::set_v3ui32(UniformBufferInput &in, const char *unif, Eigen::Vector3<uint32_t> const &val) {
this->set_unif(in, unif, val.data(), GL_UNSIGNED_INT_VEC3);
}

void GlUniformBuffer::set_v4ui32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Vector4<uint32_t> const &val) {
void GlUniformBuffer::set_v4ui32(UniformBufferInput &in, const char *unif, Eigen::Vector4<uint32_t> const &val) {
this->set_unif(in, unif, val.data(), GL_UNSIGNED_INT_VEC4);
}

void GlUniformBuffer::set_m4f32(std::shared_ptr<UniformBufferInput> const &in, const char *unif, Eigen::Matrix4f const &val) {
void GlUniformBuffer::set_m4f32(UniformBufferInput &in, const char *unif, Eigen::Matrix4f const &val) {
this->set_unif(in, unif, val.data(), GL_FLOAT_MAT4);
}

void GlUniformBuffer::set_tex(std::shared_ptr<UniformBufferInput> const &in, const char *unif, std::shared_ptr<Texture2d> const &val) {
void GlUniformBuffer::set_tex(UniformBufferInput &in, const char *unif, std::shared_ptr<Texture2d> const &val) {
auto tex = std::dynamic_pointer_cast<GlTexture2d>(val);
GLuint handle = tex->get_handle();
this->set_unif(in, unif, &handle, GL_SAMPLER_2D);
Expand Down
46 changes: 29 additions & 17 deletions libopenage/renderer/opengl/uniform_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ class GlUniformBuffer final : public UniformBuffer
*/
GLuint get_binding_point() const;

/**
* Get the uniform buffers uniforms.
*
* @return Uniforms in the shader program.
*/
const std::unordered_map<std::string, GlInBlockUniform> &get_uniforms() const;

/**
* Set the binding point of the buffer.
*
Expand All @@ -51,22 +58,22 @@ class GlUniformBuffer final : public UniformBuffer

protected:
std::shared_ptr<UniformBufferInput> new_unif_in() override;
void set_i32(std::shared_ptr<UniformBufferInput> const &, const char *, int32_t) override;
void set_u32(std::shared_ptr<UniformBufferInput> const &, const char *, uint32_t) override;
void set_f32(std::shared_ptr<UniformBufferInput> const &, const char *, float) override;
void set_f64(std::shared_ptr<UniformBufferInput> const &, const char *, double) override;
void set_bool(std::shared_ptr<UniformBufferInput> const &, const char *, bool) override;
void set_v2f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector2f const &) override;
void set_v3f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector3f const &) override;
void set_v4f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector4f const &) override;
void set_v2i32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector2i const &) override;
void set_v3i32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector3i const &) override;
void set_v4i32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector4i const &) override;
void set_v2ui32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector2<uint32_t> const &) override;
void set_v3ui32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector3<uint32_t> const &) override;
void set_v4ui32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector4<uint32_t> const &) override;
void set_m4f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Matrix4f const &) override;
void set_tex(std::shared_ptr<UniformBufferInput> const &, const char *, std::shared_ptr<Texture2d> const &) override;
void set_i32(UniformBufferInput &in, const char *, int32_t) override;
void set_u32(UniformBufferInput &in, const char *, uint32_t) override;
void set_f32(UniformBufferInput &in, const char *, float) override;
void set_f64(UniformBufferInput &in, const char *, double) override;
void set_bool(UniformBufferInput &in, const char *, bool) override;
void set_v2f32(UniformBufferInput &in, const char *, Eigen::Vector2f const &) override;
void set_v3f32(UniformBufferInput &in, const char *, Eigen::Vector3f const &) override;
void set_v4f32(UniformBufferInput &in, const char *, Eigen::Vector4f const &) override;
void set_v2i32(UniformBufferInput &in, const char *, Eigen::Vector2i const &) override;
void set_v3i32(UniformBufferInput &in, const char *, Eigen::Vector3i const &) override;
void set_v4i32(UniformBufferInput &in, const char *, Eigen::Vector4i const &) override;
void set_v2ui32(UniformBufferInput &in, const char *, Eigen::Vector2<uint32_t> const &) override;
void set_v3ui32(UniformBufferInput &in, const char *, Eigen::Vector3<uint32_t> const &) override;
void set_v4ui32(UniformBufferInput &in, const char *, Eigen::Vector4<uint32_t> const &) override;
void set_m4f32(UniformBufferInput &in, const char *, Eigen::Matrix4f const &) override;
void set_tex(UniformBufferInput &in, const char *, std::shared_ptr<Texture2d> const &) override;

private:
/**
Expand All @@ -80,7 +87,7 @@ class GlUniformBuffer final : public UniformBuffer
* @param val Pointer to the value to update the uniform with.
* @param type Type of the uniform.
*/
void set_unif(std::shared_ptr<UniformBufferInput> const &in,
void set_unif(UniformBufferInput &in,
const char *name,
void const *val,
GLenum type);
Expand All @@ -90,6 +97,11 @@ class GlUniformBuffer final : public UniformBuffer
*/
std::unordered_map<std::string, GlInBlockUniform> uniforms;

/**
* Maps uniform names to their ID (the index in the uniform vector).
*/
std::unordered_map<std::string, uniform_id_t> uniforms_by_name;

/**
* Size of the buffer (in bytes).
*/
Expand Down
23 changes: 21 additions & 2 deletions libopenage/renderer/opengl/uniform_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "renderer/opengl/lookup.h"
#include "renderer/opengl/shader_program.h"
#include "renderer/opengl/uniform_buffer.h"
#include "renderer/opengl/util.h"


Expand All @@ -28,7 +29,25 @@ GlUniformInput::GlUniformInput(const std::shared_ptr<ShaderProgram> &prog) :
this->update_data.resize(offset);
}

GlUniformBufferInput::GlUniformBufferInput(std::shared_ptr<UniformBuffer> const &buffer) :
UniformBufferInput{buffer} {}
GlUniformBufferInput::GlUniformBufferInput(const std::shared_ptr<UniformBuffer> &buffer) :
UniformBufferInput{buffer} {
auto glBuf = std::dynamic_pointer_cast<GlUniformBuffer>(buffer);

auto uniforms = glBuf->get_uniforms();

// Reserve space for the used uniforms.
this->used_uniforms.reserve(uniforms.size());

// Calculate the byte-wise offsets of all uniforms.
size_t offset = 0;
this->update_offs.reserve(uniforms.size());
for (auto &uniform : uniforms) {
this->update_offs.push_back({uniform.second.offset, false});
offset += GL_UNIFORM_TYPE_SIZE.get(uniform.second.type);
}

// Resize the update data buffer to the total size of all uniforms.
this->update_data.resize(offset);
}

} // namespace openage::renderer::opengl
27 changes: 19 additions & 8 deletions libopenage/renderer/opengl/uniform_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class UniformBuffer;
namespace opengl {

class GlShaderProgram;
class GlUniformBuffer;

/**
* Describes OpenGL-specific uniform valuations.
Expand Down Expand Up @@ -57,18 +58,28 @@ class GlUniformInput final : public UniformInput {
* Describes OpenGL-specific uniform buffer valuations.
*/
class GlUniformBufferInput final : public UniformBufferInput {
private:
struct GlUniformOffset {
// Offset in the update_data buffer.
size_t offset;
/// Dtermine whether the uniform value has been set.
bool used;
};


public:
GlUniformBufferInput(std::shared_ptr<UniformBuffer> const &);
GlUniformBufferInput(const std::shared_ptr<UniformBuffer> &buffer);

/**
* We store uniform updates lazily. They are only actually uploaded to GPU
* when a draw call is made.
*
* \p update_offs maps the uniform names to where their
* value is in \p update_data in terms of a byte-wise offset. This is only a partial
* valuation, so not all uniforms have to be present here.
* Store the IDs of the uniforms from the shader set by this uniform input.
*/
std::unordered_map<std::string, size_t> update_offs;
std::vector<uniform_id_t> used_uniforms;

/**
* Store offsets of uniforms in the update_data buffer and
* whether the uniform value has been set.
*/
std::vector<GlUniformOffset> update_offs;

/**
* Buffer containing untyped uniform update data.
Expand Down
32 changes: 16 additions & 16 deletions libopenage/renderer/uniform_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ class UniformBuffer : public std::enable_shared_from_this<UniformBuffer> {
protected:
virtual std::shared_ptr<UniformBufferInput> new_unif_in() = 0;

virtual void set_i32(std::shared_ptr<UniformBufferInput> const &, const char *, int32_t) = 0;
virtual void set_u32(std::shared_ptr<UniformBufferInput> const &, const char *, uint32_t) = 0;
virtual void set_f32(std::shared_ptr<UniformBufferInput> const &, const char *, float) = 0;
virtual void set_f64(std::shared_ptr<UniformBufferInput> const &, const char *, double) = 0;
virtual void set_bool(std::shared_ptr<UniformBufferInput> const &, const char *, bool) = 0;
virtual void set_v2f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector2f const &) = 0;
virtual void set_v3f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector3f const &) = 0;
virtual void set_v4f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector4f const &) = 0;
virtual void set_v2i32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector2i const &) = 0;
virtual void set_v3i32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector3i const &) = 0;
virtual void set_v4i32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector4i const &) = 0;
virtual void set_v2ui32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector2<uint32_t> const &) = 0;
virtual void set_v3ui32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector3<uint32_t> const &) = 0;
virtual void set_v4ui32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Vector4<uint32_t> const &) = 0;
virtual void set_m4f32(std::shared_ptr<UniformBufferInput> const &, const char *, Eigen::Matrix4f const &) = 0;
virtual void set_tex(std::shared_ptr<UniformBufferInput> const &, const char *, std::shared_ptr<Texture2d> const &) = 0;
virtual void set_i32(UniformBufferInput &in, const char *, int32_t) = 0;
virtual void set_u32(UniformBufferInput &in, const char *, uint32_t) = 0;
virtual void set_f32(UniformBufferInput &in, const char *, float) = 0;
virtual void set_f64(UniformBufferInput &in, const char *, double) = 0;
virtual void set_bool(UniformBufferInput &in, const char *, bool) = 0;
virtual void set_v2f32(UniformBufferInput &in, const char *, Eigen::Vector2f const &) = 0;
virtual void set_v3f32(UniformBufferInput &in, const char *, Eigen::Vector3f const &) = 0;
virtual void set_v4f32(UniformBufferInput &in, const char *, Eigen::Vector4f const &) = 0;
virtual void set_v2i32(UniformBufferInput &in, const char *, Eigen::Vector2i const &) = 0;
virtual void set_v3i32(UniformBufferInput &in, const char *, Eigen::Vector3i const &) = 0;
virtual void set_v4i32(UniformBufferInput &in, const char *, Eigen::Vector4i const &) = 0;
virtual void set_v2ui32(UniformBufferInput &in, const char *, Eigen::Vector2<uint32_t> const &) = 0;
virtual void set_v3ui32(UniformBufferInput &in, const char *, Eigen::Vector3<uint32_t> const &) = 0;
virtual void set_v4ui32(UniformBufferInput &in, const char *, Eigen::Vector4<uint32_t> const &) = 0;
virtual void set_m4f32(UniformBufferInput &in, const char *, Eigen::Matrix4f const &) = 0;
virtual void set_tex(UniformBufferInput &in, const char *, std::shared_ptr<Texture2d> const &) = 0;
};

} // namespace openage::renderer
Loading
Loading