diff options
author | David Neto <dneto@google.com> | 2019-04-09 17:07:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-09 17:07:38 -0400 |
commit | 539730372bb8145fa029759be17dff320c970895 (patch) | |
tree | 6e930b1a18047cf0c816a1f21aa0a3053a19e62e | |
parent | 77b90e8d22a2a6191f058adcfba51076b115f112 (diff) | |
download | amber-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.
-rw-r--r-- | samples/config_helper_dawn.cc | 7 | ||||
-rw-r--r-- | src/dawn/engine_dawn.cc | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/samples/config_helper_dawn.cc b/samples/config_helper_dawn.cc index 32c4869..f3577b7 100644 --- a/samples/config_helper_dawn.cc +++ b/samples/config_helper_dawn.cc @@ -16,12 +16,17 @@ #include <iostream> #include "samples/dawn_device_metal.h" namespace sample { + ConfigHelperDawn::ConfigHelperDawn() = default; ConfigHelperDawn::~ConfigHelperDawn() = default; -namespace { // Callback which prints a message from a Dawn device operation. + +namespace { + +// Callback which prints a message from a Dawn device operation. void PrintDeviceError(const char* message, ::dawn::CallbackUserdata) { std::cout << "Device error: " << message << std::endl; } + } // namespace amber::Result ConfigHelperDawn::CreateConfig( 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()); } |