diff options
author | dan sinclair <dj2@everburning.com> | 2019-04-11 13:49:37 -0400 |
---|---|---|
committer | David Neto <dneto@google.com> | 2019-04-11 13:49:37 -0400 |
commit | d26ee22dd7faab1845a531d410f7ec1db407402a (patch) | |
tree | 0c4f724e8a66083b778899e85a96af551269be7c /src/pipeline.cc | |
parent | dd5b5e6ff2ce45e00b5ea35a6d04eb432737f712 (diff) | |
download | amber-d26ee22dd7faab1845a531d410f7ec1db407402a.tar.gz |
Unify buffer sizes. (#465)
* Unify buffer sizes.
Currently the format buffer and data buffer count their size
differently. For data buffers we counted elements (so 1 vec4 was size 1)
and format buffers counted values (so 1 vec4 was size 4).
This CL unifies the two sizes and adds ElementCount and ValueCount to
make it explicit which version the user wants.
As part of this, the data types used for ssbo and uniform commands must
be consistent. The tests where we switched data formats part way through
are updated.
* build fix
Diffstat (limited to 'src/pipeline.cc')
-rw-r--r-- | src/pipeline.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pipeline.cc b/src/pipeline.cc index 7707dd2..956b15a 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -146,13 +146,13 @@ Result Pipeline::SetShaderType(const Shader* shader, ShaderType type) { Result Pipeline::Validate() const { size_t fb_size = fb_width_ * fb_height_; for (const auto& attachment : color_attachments_) { - if (attachment.buffer->GetSize() != fb_size) { + if (attachment.buffer->ElementCount() != fb_size) { return Result( "shared framebuffer must have same size over all PIPELINES"); } } - if (depth_buffer_.buffer && depth_buffer_.buffer->GetSize() != fb_size) + if (depth_buffer_.buffer && depth_buffer_.buffer->ElementCount() != fb_size) return Result("shared depth buffer must have same size over all PIPELINES"); if (pipeline_type_ == PipelineType::kGraphics) @@ -203,13 +203,13 @@ void Pipeline::UpdateFramebufferSizes() { for (auto& attachment : color_attachments_) { attachment.buffer->SetWidth(fb_width_); attachment.buffer->SetHeight(fb_height_); - attachment.buffer->SetSize(size); + attachment.buffer->SetElementCount(size); } if (depth_buffer_.buffer) { depth_buffer_.buffer->SetWidth(fb_width_); depth_buffer_.buffer->SetHeight(fb_height_); - depth_buffer_.buffer->SetSize(size); + depth_buffer_.buffer->SetElementCount(size); } } @@ -227,7 +227,7 @@ Result Pipeline::AddColorAttachment(Buffer* buf, uint32_t location) { info.location = location; buf->SetWidth(fb_width_); buf->SetHeight(fb_height_); - buf->SetSize(fb_width_ * fb_height_); + buf->SetElementCount(fb_width_ * fb_height_); return {}; } @@ -251,7 +251,7 @@ Result Pipeline::SetDepthBuffer(Buffer* buf) { depth_buffer_.buffer = buf; buf->SetWidth(fb_width_); buf->SetHeight(fb_height_); - buf->SetSize(fb_width_ * fb_height_); + buf->SetElementCount(fb_width_ * fb_height_); return {}; } |