aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2019-04-09 17:07:38 -0400
committerGitHub <noreply@github.com>2019-04-09 17:07:38 -0400
commit539730372bb8145fa029759be17dff320c970895 (patch)
tree6e930b1a18047cf0c816a1f21aa0a3053a19e62e /src
parent77b90e8d22a2a6191f058adcfba51076b115f112 (diff)
downloadamber-539730372bb8145fa029759be17dff320c970895.tar.gz
Dawn engine: Adapt to latest Dawn API. (#454)
- Use to 64bit offsets for buffer lengths - Change CreateDefaultTextureView --> CreateDefaultView Also fix placement of method comment.
Diffstat (limited to 'src')
-rw-r--r--src/dawn/engine_dawn.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dawn/engine_dawn.cc b/src/dawn/engine_dawn.cc
index 39ce515..e89644b 100644
--- a/src/dawn/engine_dawn.cc
+++ b/src/dawn/engine_dawn.cc
@@ -118,7 +118,7 @@ Result MakeFramebufferBuffer(const ::dawn::Device& device,
struct MapResult {
Result result;
const void* data = nullptr;
- int dataLength = 0;
+ uint64_t dataLength = 0;
};
// Handles the update from an asynchronous buffer map request, updating the
@@ -128,7 +128,7 @@ struct MapResult {
// not changed.
void HandleBufferMapCallback(DawnBufferMapAsyncStatus status,
const void* data,
- uint32_t dataLength,
+ uint64_t dataLength,
DawnCallbackUserdata userdata) {
MapResult& map_result = *reinterpret_cast<MapResult*>(userdata);
switch (status) {
@@ -279,10 +279,13 @@ Result EngineDawn::DoClear(const ClearCommand* command) {
if (!result.IsSuccess())
return result;
+ // TODO(sarahM0): Refactor this code later. This backend is in transition
+ // between the old design and the new design of how Amber operates.
+
::dawn::RenderPassColorAttachmentDescriptor color_attachment =
::dawn::RenderPassColorAttachmentDescriptor();
color_attachment.attachment =
- render_pipeline_info_.fb_texture.CreateDefaultTextureView();
+ render_pipeline_info_.fb_texture.CreateDefaultView();
color_attachment.resolveTarget = nullptr;
color_attachment.clearColor = render_pipeline_info_.clear_color_value;
color_attachment.loadOp = ::dawn::LoadOp::Clear;
@@ -325,7 +328,8 @@ Result EngineDawn::DoClear(const ClearCommand* command) {
auto& info = out_color_attachment[i];
auto* values = info.buffer->ValuePtr();
values->resize(info.buffer->GetSizeInBytes());
- // assert map.size == info->buffer->GetSizeInBytes()
+ // TODO(sarahM0): Resolve the difference between the Dawn buffer's size
+ // and the Amber buffer's size.
std::memcpy(values->data(), img.data, info.buffer->GetSizeInBytes());
}