From 7138d939764b7b4732005ee16e1144a2dcc603d8 Mon Sep 17 00:00:00 2001 From: Sarah <9856269+sarahM0@users.noreply.github.com> Date: Mon, 15 Jul 2019 11:51:28 -0400 Subject: [PATCH] [Dawn] Implement doBuffer in Dawn backend (#564) Add doBuffer support and update run_tests.py --- src/dawn/engine_dawn.cc | 147 +++++++++++++----- src/dawn/pipeline_info.h | 22 ++- .../cases/draw_array_after_draw_rect.vkscript | 5 +- .../cases/draw_rect_after_draw_array.vkscript | 5 +- .../draw_rect_and_draw_array_mixed.vkscript | 5 +- tests/cases/draw_rectangles.vkscript | 3 +- tests/cases/draw_rectangles_once.vkscript | 5 +- .../draw_rectangles_without_probe.vkscript | 5 +- tests/cases/draw_triangle_list.vkscript | 60 +++---- .../draw_triangle_list_with_depth.vkscript | 62 ++++---- ...w_triangle_list_with_index_buffer.vkscript | 44 +++--- ...th_index_buffer_and_vertex_offset.vkscript | 56 +++---- ...aw_triangle_list_with_probe_point.vkscript | 110 ++++++------- .../draw_triangle_list_without_probe.vkscript | 18 +-- tests/cases/position_to_ssbo.amber | 3 - .../ssbo_with_graphics_pipeline.vkscript | 4 +- tests/run_tests.py | 54 ++++--- 17 files changed, 326 insertions(+), 282 deletions(-) diff --git a/src/dawn/engine_dawn.cc b/src/dawn/engine_dawn.cc index 446e2410c..296470175 100644 --- a/src/dawn/engine_dawn.cc +++ b/src/dawn/engine_dawn.cc @@ -44,6 +44,7 @@ static const float kLodMax = 1000.0; static const uint32_t kMaxColorAttachments = 4u; static const uint32_t kMaxVertexInputs = 16u; static const uint32_t kMaxVertexAttributes = 16u; +static const uint32_t kMaxDawnBindGroup = 4u; // This structure is a container for a few variables that are created during // CreateRenderPipelineDescriptor and CreateRenderPassDescriptor and we want to @@ -291,7 +292,7 @@ MapResult MapTextureToHostBuffer(const RenderPipelineInfo& render_pipeline, return map; } -// creates a dawn buffer for TransferDst +// Creates a dawn buffer of |size| bytes with TransferDst and the given usage // copied from Dawn utils source code ::dawn::Buffer CreateBufferFromData(const ::dawn::Device& device, const void* data, @@ -302,11 +303,12 @@ ::dawn::Buffer CreateBufferFromData(const ::dawn::Device& device, descriptor.usage = usage | ::dawn::BufferUsageBit::TransferDst; ::dawn::Buffer buffer = device.CreateBuffer(&descriptor); - buffer.SetSubData(0, size, reinterpret_cast(data)); + if (data != nullptr) + buffer.SetSubData(0, size, reinterpret_cast(data)); return buffer; } -// creates a default sampler descriptor. It does not set the sampling +// Creates a default sampler descriptor. It does not set the sampling // coordinates meaning it's set to default, normalized. // copied from Dawn utils source code ::dawn::SamplerDescriptor GetDefaultSamplerDescriptor() { @@ -402,15 +404,10 @@ ::dawn::BindGroupLayout MakeBindGroupLayout( // Copied from Dawn utils source code. ::dawn::PipelineLayout MakeBasicPipelineLayout( const ::dawn::Device& device, - const ::dawn::BindGroupLayout* bindGroupLayout) { + std::vector<::dawn::BindGroupLayout> bindingInitializer) { ::dawn::PipelineLayoutDescriptor descriptor; - if (bindGroupLayout) { - descriptor.bindGroupLayoutCount = 1; - descriptor.bindGroupLayouts = bindGroupLayout; - } else { - descriptor.bindGroupLayoutCount = 0; - descriptor.bindGroupLayouts = nullptr; - } + descriptor.bindGroupLayoutCount = bindingInitializer.size(); + descriptor.bindGroupLayouts = bindingInitializer.data(); return device.CreatePipelineLayout(&descriptor); } @@ -504,6 +501,9 @@ Result GetDawnVertexFormat(const ::amber::Format& amber_format, case FormatType::kR8G8B8A8_UNORM: dawn_format = ::dawn::VertexFormat::UChar4Norm; break; + case FormatType::kR8G8B8A8_SNORM: + dawn_format = ::dawn::VertexFormat::Char4Norm; + break; default: return Result( "Amber vertex format " + @@ -772,11 +772,8 @@ Result DawnPipelineHelper::CreateRenderPipelineDescriptor( depth_stencil_format = ::dawn::TextureFormat::D32FloatS8Uint; } - if (render_pipeline.bind_group) - renderPipelineDescriptor.layout = - MakeBasicPipelineLayout(device, &render_pipeline.bind_group_layout); - else - renderPipelineDescriptor.layout = MakeBasicPipelineLayout(device, nullptr); + renderPipelineDescriptor.layout = + MakeBasicPipelineLayout(device, render_pipeline.bind_group_layouts); renderPipelineDescriptor.primitiveTopology = ::dawn::PrimitiveTopology::TriangleList; @@ -1046,8 +1043,10 @@ Result EngineDawn::DoDrawRect(const DrawRectCommand* command) { ::dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPassDescriptor); pass.SetPipeline(pipeline); - if (render_pipeline->bind_group) { - pass.SetBindGroup(0, render_pipeline->bind_group, 0, nullptr); + for (uint32_t i = 0; i < render_pipeline->bind_groups.size(); i++) { + if (render_pipeline->bind_groups[i]) { + pass.SetBindGroup(i, render_pipeline->bind_groups[i], 0, nullptr); + } } pass.SetVertexBuffers(0, 1, &vertex_buffer, vertexBufferOffsets); pass.SetIndexBuffer(index_buffer, 0); @@ -1115,10 +1114,11 @@ Result EngineDawn::DoDrawArrays(const DrawArraysCommand* command) { ::dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPassDescriptor); pass.SetPipeline(pipeline); - if (render_pipeline->bind_group) { - pass.SetBindGroup(0, render_pipeline->bind_group, 0, nullptr); + for (uint32_t i = 0; i < render_pipeline->bind_groups.size(); i++) { + if (render_pipeline->bind_groups[i]) { + pass.SetBindGroup(i, render_pipeline->bind_groups[i], 0, nullptr); + } } - // TODO(sarahM0): figure out what are startSlot, count and offsets for (uint32_t i = 0; i < render_pipeline->vertex_buffers.size(); i++) { pass.SetVertexBuffers(i, /* startSlot */ @@ -1158,8 +1158,34 @@ Result EngineDawn::DoPatchParameterVertices( return Result("Dawn:DoPatch not implemented"); } -Result EngineDawn::DoBuffer(const BufferCommand*) { - return Result("Dawn:DoBuffer not implemented"); +Result EngineDawn::DoBuffer(const BufferCommand* command) { + Result result; + + // TODO(SarahM0): Make this work for compute pipeline + RenderPipelineInfo* render_pipeline = GetRenderPipeline(command); + if (!render_pipeline) + return Result("DoBuffer: invoked on invalid or missing render pipeline"); + if (!command->IsSSBO() && !command->IsUniform()) + return Result("DoBuffer: only supports SSBO and uniform buffer type"); + + if (render_pipeline->buffer_map_.find( + {command->GetDescriptorSet(), command->GetBinding()}) != + render_pipeline->buffer_map_.end()) { + auto dawn_buffer_index = + render_pipeline + ->buffer_map_[{command->GetDescriptorSet(), command->GetBinding()}]; + ::dawn::Buffer& dawn_buffer = render_pipeline->buffers[dawn_buffer_index]; + + Buffer* amber_buffer = command->GetBuffer(); + if (amber_buffer) { + amber_buffer->SetDataWithOffset(command->GetValues(), + command->GetOffset()); + + dawn_buffer.SetSubData(0, amber_buffer->GetSizeInBytes(), + amber_buffer->ValuePtr()->data()); + } + } + return {}; } Result EngineDawn::AttachBuffersAndTextures( @@ -1177,7 +1203,8 @@ Result EngineDawn::AttachBuffersAndTextures( auto* amber_format = render_pipeline->pipeline->GetColorAttachments()[0].buffer->GetFormat(); if (!amber_format) - return Result("Color attachment 0 has no format!"); + return Result( + "AttachBuffersAndTextures: Color attachment 0 has no format!"); ::dawn::TextureFormat fb_format{}; result = GetDawnTextureFormat(*amber_format, &fb_format); if (!result.IsSuccess()) @@ -1213,7 +1240,9 @@ Result EngineDawn::AttachBuffersAndTextures( if (!depth_stencil_texture_) { auto* amber_depth_stencil_format = depthBuffer->GetFormat(); if (!amber_depth_stencil_format) - return Result("The depth/stencil attachment has no format!"); + return Result( + "AttachBuffersAndTextures: The depth/stencil attachment has no " + "format!"); ::dawn::TextureFormat depth_stencil_format{}; result = GetDawnTextureFormat(*amber_depth_stencil_format, &depth_stencil_format); @@ -1248,14 +1277,19 @@ Result EngineDawn::AttachBuffersAndTextures( // Do not attach pushConstants if (render_pipeline->pipeline->GetPushConstantBuffer().buffer != nullptr) { - return Result("Dawn does not support push constants!"); + return Result( + "AttachBuffersAndTextures: Dawn does not support push constants!"); } ::dawn::ShaderStageBit kAllStages = ::dawn::ShaderStageBit::Vertex | ::dawn::ShaderStageBit::Fragment; - std::vector bindingInitalizerHelper; - std::vector<::dawn::BindGroupLayoutBinding> bindings; + std::vector> bindingInitalizerHelper( + kMaxDawnBindGroup); + std::vector> layouts_info( + kMaxDawnBindGroup); + uint32_t max_descriptor_set = 0; + // Attach storage/uniform buffers for (const auto& buf_info : render_pipeline->pipeline->GetBuffers()) { ::dawn::BufferUsageBit bufferUsage; ::dawn::BindingType bindingType; @@ -1271,35 +1305,62 @@ Result EngineDawn::AttachBuffersAndTextures( break; } default: { - return Result("Dawn: CreatePipeline - unknown buffer type: " + + return Result("AttachBuffersAndTextures: unknown buffer type: " + std::to_string(static_cast( buf_info.buffer->GetBufferType()))); break; } } - ::dawn::Buffer buffer = + if (buf_info.descriptor_set > kMaxDawnBindGroup - 1) { + return Result( + "AttachBuffersAndTextures: Dawn has maximum of 4 bindGroups " + "(descriptor sets)"); + } + + render_pipeline->buffers.emplace_back( CreateBufferFromData(*device_, buf_info.buffer->ValuePtr()->data(), buf_info.buffer->GetSizeInBytes(), bufferUsage | ::dawn::BufferUsageBit::TransferSrc | - ::dawn::BufferUsageBit::TransferDst); + ::dawn::BufferUsageBit::TransferDst)); - ::dawn::BindGroupLayoutBinding bglb; - bglb.binding = buf_info.binding; - bglb.visibility = kAllStages; - bglb.type = bindingType; - bindings.push_back(bglb); + render_pipeline->buffer_map_[{buf_info.descriptor_set, buf_info.binding}] = + render_pipeline->buffers.size() - 1; + + render_pipeline->used_descriptor_set.insert(buf_info.descriptor_set); + max_descriptor_set = std::max(max_descriptor_set, buf_info.descriptor_set); + + ::dawn::BindGroupLayoutBinding layout_info; + layout_info.binding = buf_info.binding; + layout_info.visibility = kAllStages; + layout_info.type = bindingType; + layouts_info[buf_info.descriptor_set].push_back(layout_info); BindingInitializationHelper tempBinding = BindingInitializationHelper( - buf_info.binding, buffer, 0, buf_info.buffer->GetSizeInBytes()); - bindingInitalizerHelper.push_back(tempBinding); + buf_info.binding, render_pipeline->buffers.back(), 0, + buf_info.buffer->GetSizeInBytes()); + bindingInitalizerHelper[buf_info.descriptor_set].push_back(tempBinding); } - if (bindings.size() > 0 && bindingInitalizerHelper.size() > 0) { - render_pipeline->bind_group_layout = - MakeBindGroupLayout(*device_, bindings); - render_pipeline->bind_group = MakeBindGroup( - *device_, render_pipeline->bind_group_layout, bindingInitalizerHelper); + // TODO(sarahM0): fix issue: Add support for doBuffer with sparse descriptor + // sets #573 + if (render_pipeline->used_descriptor_set.size() != 0 && + render_pipeline->used_descriptor_set.size() != max_descriptor_set + 1) { + return Result( + "AttachBuffersAndTextures: Sparse descriptor_set is not supported"); + } + + for (uint32_t i = 0; i < kMaxDawnBindGroup; i++) { + if (layouts_info[i].size() > 0 && bindingInitalizerHelper[i].size() > 0) { + ::dawn::BindGroupLayout bindGroupLayout = + MakeBindGroupLayout(*device_, layouts_info[i]); + render_pipeline->bind_group_layouts.push_back(bindGroupLayout); + + ::dawn::BindGroup bindGroup = + MakeBindGroup(*device_, render_pipeline->bind_group_layouts[i], + bindingInitalizerHelper[i]); + render_pipeline->bind_groups.push_back(bindGroup); + } } return {}; diff --git a/src/dawn/pipeline_info.h b/src/dawn/pipeline_info.h index 7825e9505..be4513626 100644 --- a/src/dawn/pipeline_info.h +++ b/src/dawn/pipeline_info.h @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include @@ -28,6 +30,15 @@ namespace amber { namespace dawn { +struct hash_pair { + template + size_t operator()(const std::pair& p) const { + auto hash1 = std::hash{}(p.first); + auto hash2 = std::hash{}(p.second); + return hash1 ^ hash2; + } +}; + /// Stores information relating to a graphics pipeline in Dawn. struct RenderPipelineInfo { RenderPipelineInfo() {} @@ -53,9 +64,16 @@ struct RenderPipelineInfo { ::dawn::Buffer fb_buffer; std::vector<::dawn::Buffer> vertex_buffers; ::dawn::Buffer index_buffer; + /// storage and uniform buffers + std::vector<::dawn::Buffer> buffers; + + std::vector<::dawn::BindGroup> bind_groups; + std::vector<::dawn::BindGroupLayout> bind_group_layouts; - ::dawn::BindGroup bind_group; - ::dawn::BindGroupLayout bind_group_layout; + // Mapping from the to dawn buffer index in buffers + std::unordered_map, uint32_t, hash_pair> + buffer_map_; + std::set used_descriptor_set; }; /// Stores information relating to a compute pipeline in Dawn. diff --git a/tests/cases/draw_array_after_draw_rect.vkscript b/tests/cases/draw_array_after_draw_rect.vkscript index 9f9dcc90b..4b9804946 100644 --- a/tests/cases/draw_array_after_draw_rect.vkscript +++ b/tests/cases/draw_array_after_draw_rect.vkscript @@ -12,16 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics - [vertex shader] #version 430 layout(location = 0) in vec4 position; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 in_color; }; diff --git a/tests/cases/draw_rect_after_draw_array.vkscript b/tests/cases/draw_rect_after_draw_array.vkscript index c1a1dec7d..2f9b34452 100644 --- a/tests/cases/draw_rect_after_draw_array.vkscript +++ b/tests/cases/draw_rect_after_draw_array.vkscript @@ -12,16 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics - [vertex shader] #version 430 layout(location = 0) in vec4 position; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 in_color; }; diff --git a/tests/cases/draw_rect_and_draw_array_mixed.vkscript b/tests/cases/draw_rect_and_draw_array_mixed.vkscript index 4452aad59..3fdc29bc9 100644 --- a/tests/cases/draw_rect_and_draw_array_mixed.vkscript +++ b/tests/cases/draw_rect_and_draw_array_mixed.vkscript @@ -12,16 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics - [vertex shader] #version 430 layout(location = 0) in vec4 position; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 in_color; }; diff --git a/tests/cases/draw_rectangles.vkscript b/tests/cases/draw_rectangles.vkscript index 58f9b5889..a35663da3 100644 --- a/tests/cases/draw_rectangles.vkscript +++ b/tests/cases/draw_rectangles.vkscript @@ -13,7 +13,6 @@ # limitations under the License. [require] -vertexPipelineStoresAndAtomics fbsize 800 600 [vertex shader] @@ -22,7 +21,7 @@ fbsize 800 600 layout(location = 0) in vec4 position; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 in_color; }; diff --git a/tests/cases/draw_rectangles_once.vkscript b/tests/cases/draw_rectangles_once.vkscript index 0a77382ff..039a75c70 100644 --- a/tests/cases/draw_rectangles_once.vkscript +++ b/tests/cases/draw_rectangles_once.vkscript @@ -12,16 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics - [vertex shader] #version 430 layout(location = 0) in vec4 position; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 in_color; }; diff --git a/tests/cases/draw_rectangles_without_probe.vkscript b/tests/cases/draw_rectangles_without_probe.vkscript index 70a843353..173e15412 100644 --- a/tests/cases/draw_rectangles_without_probe.vkscript +++ b/tests/cases/draw_rectangles_without_probe.vkscript @@ -12,16 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics - [vertex shader] #version 430 layout(location = 0) in vec4 position; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 in_color; }; diff --git a/tests/cases/draw_triangle_list.vkscript b/tests/cases/draw_triangle_list.vkscript index 356a0d79c..ee1ccab40 100644 --- a/tests/cases/draw_triangle_list.vkscript +++ b/tests/cases/draw_triangle_list.vkscript @@ -36,47 +36,47 @@ void main() { [vertex data] # position vert_color - 0/R8G8_SNORM 1/R8G8B8_UNORM + 0/R8G8_SNORM 1/R8G8B8A8_UNORM # Red for entire frame -# R8 G8 R8 G8 B8 - -128 -128 255 0 0 - 127 127 255 0 0 - -128 127 255 0 0 +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 0 + 127 127 255 0 0 0 + -128 127 255 0 0 0 - -128 -128 255 0 0 - 127 127 255 0 0 - 127 -128 255 0 0 + -128 -128 255 0 0 0 + 127 127 255 0 0 0 + 127 -128 255 0 0 0 # Green for half frame -# R8 G8 R8 G8 B8 - 0 -128 0 255 0 - 127 127 0 255 0 - 0 127 0 255 0 +# R8 G8 R8 G8 B8 A8 + 0 -128 0 255 0 0 + 127 127 0 255 0 0 + 0 127 0 255 0 0 - 0 -128 0 255 0 - 127 127 0 255 0 - 127 -128 0 255 0 + 0 -128 0 255 0 0 + 127 127 0 255 0 0 + 127 -128 0 255 0 0 # Blue for quarter frame -# R8 G8 R8 G8 B8 - -128 0 0 0 255 - 0 127 0 0 255 - -128 127 0 0 255 +# R8 G8 R8 G8 B8 A8 + -128 0 0 0 255 0 + 0 127 0 0 255 0 + -128 127 0 0 255 0 - -128 0 0 0 255 - 0 127 0 0 255 - 0 0 0 0 255 + -128 0 0 0 255 0 + 0 127 0 0 255 0 + 0 0 0 0 255 0 # Mixed color for quarter frame -# R8 G8 R8 G8 B8 - 0 0 127 127 127 - 127 127 127 127 127 - 0 127 127 127 127 - - 0 0 127 127 127 - 127 127 127 127 127 - 127 0 127 127 127 +# R8 G8 R8 G8 B8 A8 + 0 0 127 127 127 0 + 127 127 127 127 127 0 + 0 127 127 127 127 0 + + 0 0 127 127 127 0 + 127 127 127 127 127 0 + 127 0 127 127 127 0 [test] clear diff --git a/tests/cases/draw_triangle_list_with_depth.vkscript b/tests/cases/draw_triangle_list_with_depth.vkscript index 56677f503..bfa46d35b 100644 --- a/tests/cases/draw_triangle_list_with_depth.vkscript +++ b/tests/cases/draw_triangle_list_with_depth.vkscript @@ -39,44 +39,44 @@ void main() { [vertex data] # position vert_color - 0/R8G8B8_SNORM 1/R8G8B8_UNORM + 0/R8G8B8A8_SNORM 1/R8G8B8A8_UNORM # Red for entire frame -# R8 G8 B8 R8 G8 B8 - -128 -128 3 255 0 0 - 127 127 3 255 0 0 - -128 127 3 255 0 0 +# R8 G8 B8 A8 R8 G8 B8 A8 + -128 -128 3 127 255 0 0 0 + 127 127 3 127 255 0 0 0 + -128 127 3 127 255 0 0 0 - -128 -128 3 255 0 0 - 127 127 3 255 0 0 - 127 -128 3 255 0 0 + -128 -128 3 127 255 0 0 0 + 127 127 3 127 255 0 0 0 + 127 -128 3 127 255 0 0 0 # Green for half frame - 0 -128 2 0 255 0 - 127 127 2 0 255 0 - 0 127 2 0 255 0 + 0 -128 2 127 0 255 0 0 + 127 127 2 127 0 255 0 0 + 0 127 2 127 0 255 0 0 - 0 -128 2 0 255 0 - 127 127 2 0 255 0 - 127 -128 2 0 255 0 + 0 -128 2 127 0 255 0 0 + 127 127 2 127 0 255 0 0 + 127 -128 2 127 0 255 0 0 # Blue for quarter frame - -128 0 1 0 0 255 - 0 127 1 0 0 255 - -128 127 1 0 0 255 + -128 0 1 127 0 0 255 0 + 0 127 1 127 0 0 255 0 + -128 127 1 127 0 0 255 0 - -128 0 1 0 0 255 - 0 127 1 0 0 255 - 0 0 1 0 0 255 + -128 0 1 127 0 0 255 0 + 0 127 1 127 0 0 255 0 + 0 0 1 127 0 0 255 0 -# Mixed color for quarter frame - 0 0 0 127 127 127 - 127 127 0 127 127 127 - 0 127 0 127 127 127 +# Mixed color for quarter frame + 0 0 0 127 127 127 127 0 + 127 127 0 127 127 127 127 0 + 0 127 0 127 127 127 127 0 - 0 0 0 127 127 127 - 127 127 0 127 127 127 - 127 0 0 127 127 127 + 0 0 0 127 127 127 127 0 + 127 127 0 127 127 127 127 0 + 127 0 0 127 127 127 127 0 [test] clear @@ -95,7 +95,7 @@ draw arrays TRIANGLE_LIST 6 6 draw arrays TRIANGLE_LIST 0 6 # The final frame buffer shows all red, green, blue, and mixed color. -relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0) -relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0) -relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0) -relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5) +relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0, 0) +relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0, 0) +relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0, 0) +relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5, 0) diff --git a/tests/cases/draw_triangle_list_with_index_buffer.vkscript b/tests/cases/draw_triangle_list_with_index_buffer.vkscript index 3e0c2d1ec..b3f7f67a5 100644 --- a/tests/cases/draw_triangle_list_with_index_buffer.vkscript +++ b/tests/cases/draw_triangle_list_with_index_buffer.vkscript @@ -42,41 +42,41 @@ void main() { [vertex data] # position vert_color - 0/R8G8_SNORM 1/R8G8B8_UNORM + 0/R8G8_SNORM 1/R8G8B8A8_UNORM # Red for entire frame -# R8 G8 R8 G8 B8 - -128 -128 255 0 0 - 127 127 255 0 0 - -128 127 255 0 0 - 127 -128 255 0 0 +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + 127 -128 255 0 0 255 # Green for half frame # R8 G8 R8 G8 B8 - 0 -128 0 255 0 - 127 127 0 255 0 - 0 127 0 255 0 - 127 -128 0 255 0 + 0 -128 0 255 0 255 + 127 127 0 255 0 255 + 0 127 0 255 0 255 + 127 -128 0 255 0 255 # Blue for quarter frame # R8 G8 R8 G8 B8 - -128 0 0 0 255 - 0 127 0 0 255 - -128 127 0 0 255 - 0 0 0 0 255 + -128 0 0 0 255 255 + 0 127 0 0 255 255 + -128 127 0 0 255 255 + 0 0 0 0 255 255 # Mixed color for quarter frame # R8 G8 R8 G8 B8 - 0 0 127 127 127 - 127 127 127 127 127 - 0 127 127 127 127 - 127 0 127 127 127 + 0 0 127 127 127 255 + 127 127 127 127 127 255 + 0 127 127 127 127 255 + 127 0 127 127 127 255 [test] clear draw arrays indexed TRIANGLE_LIST 0 24 -relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0) -relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0) -relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0) -relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5) +relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0, 1.0) +relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0, 1.0) +relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0, 1.0) +relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5, 1.0) diff --git a/tests/cases/draw_triangle_list_with_index_buffer_and_vertex_offset.vkscript b/tests/cases/draw_triangle_list_with_index_buffer_and_vertex_offset.vkscript index aaae91e4d..4e6be2ee1 100644 --- a/tests/cases/draw_triangle_list_with_index_buffer_and_vertex_offset.vkscript +++ b/tests/cases/draw_triangle_list_with_index_buffer_and_vertex_offset.vkscript @@ -39,35 +39,35 @@ void main() { [vertex data] # position vert_color - 0/R8G8_SNORM 1/R8G8B8_UNORM + 0/R8G8_SNORM 1/R8G8B8A8_UNORM # Red for entire frame -# R8 G8 R8 G8 B8 - -128 -128 255 0 0 - 127 127 255 0 0 - -128 127 255 0 0 - 127 -128 255 0 0 +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + 127 -128 255 0 0 255 # Green for half frame # R8 G8 R8 G8 B8 - 0 -128 0 255 0 - 127 127 0 255 0 - 0 127 0 255 0 - 127 -128 0 255 0 + 0 -128 0 255 0 255 + 127 127 0 255 0 255 + 0 127 0 255 0 255 + 127 -128 0 255 0 255 # Blue for quarter frame # R8 G8 R8 G8 B8 - -128 0 0 0 255 - 0 127 0 0 255 - -128 127 0 0 255 - 0 0 0 0 255 + -128 0 0 0 255 255 + 0 127 0 0 255 255 + -128 127 0 0 255 255 + 0 0 0 0 255 255 # Mixed color for quarter frame # R8 G8 R8 G8 B8 - 0 0 127 127 127 - 127 127 127 127 127 - 0 127 127 127 127 - 127 0 127 127 127 + 0 0 127 127 127 255 + 127 127 127 127 127 255 + 0 127 127 127 127 255 + 127 0 127 127 127 255 [test] clear @@ -79,7 +79,7 @@ clear # | # V draw arrays indexed TRIANGLE_LIST 0 6 -relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0) +relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0, 1.0) # "4" means the fifth vertex among # vertices which is shown in line 53. @@ -88,8 +88,8 @@ relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0) # | # V draw arrays indexed TRIANGLE_LIST 4 6 -relative probe rect rgb (0.0, 0.0, 0.5, 1.0) (1.0, 0, 0) -relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0) +relative probe rect rgba (0.0, 0.0, 0.5, 1.0) (1.0, 0, 0, 1.0) +relative probe rect rgba (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0, 1.0) # "8" means the nineth vertex among # vertices which is shown in line 60. @@ -98,9 +98,9 @@ relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0) # | # V draw arrays indexed TRIANGLE_LIST 8 6 -relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0) -relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0) -relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0) +relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0, 1.0) +relative probe rect rgba (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0, 1.0) +relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0, 1.0) # "12" means the thirteenth vertex among # vertices which is shown in line 60. @@ -109,7 +109,7 @@ relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0) # | # V draw arrays indexed TRIANGLE_LIST 12 6 -relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0) -relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0) -relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0) -relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5) +relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0, 1.0) +relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0, 1.0) +relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0, 1.0) +relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5, 1.0) diff --git a/tests/cases/draw_triangle_list_with_probe_point.vkscript b/tests/cases/draw_triangle_list_with_probe_point.vkscript index bdbe2b0bc..c21020831 100644 --- a/tests/cases/draw_triangle_list_with_probe_point.vkscript +++ b/tests/cases/draw_triangle_list_with_probe_point.vkscript @@ -36,86 +36,74 @@ void main() { [vertex data] # position vert_color - 0/R8G8_SNORM 1/R8G8B8_UNORM + 0/R8G8_SNORM 1/R8G8B8A8_UNORM # Red for entire frame -# R8 G8 R8 G8 B8 - -128 -128 255 0 0 - 127 127 255 0 0 - -128 127 255 0 0 - - -128 -128 255 0 0 - 127 127 255 0 0 - 127 -128 255 0 0 +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + 127 -128 255 0 0 255 # Green for half frame # R8 G8 R8 G8 B8 - 0 -128 0 255 0 - 127 127 0 255 0 - 0 127 0 255 0 - - 0 -128 0 255 0 - 127 127 0 255 0 - 127 -128 0 255 0 + 0 -128 0 255 0 255 + 127 127 0 255 0 255 + 0 127 0 255 0 255 + 127 -128 0 255 0 255 # Blue for quarter frame # R8 G8 R8 G8 B8 - -128 0 0 0 255 - 0 127 0 0 255 - -128 127 0 0 255 - - -128 0 0 0 255 - 0 127 0 0 255 - 0 0 0 0 255 + -128 0 0 0 255 255 + 0 127 0 0 255 255 + -128 127 0 0 255 255 + 0 0 0 0 255 255 # Mixed color for quarter frame # R8 G8 R8 G8 B8 - 0 0 128 128 128 - 127 127 128 128 128 - 0 127 128 128 128 - - 0 0 128 128 128 - 127 127 128 128 128 - 127 0 128 128 128 + 0 0 127 127 127 255 + 127 127 127 127 127 255 + 0 127 127 127 127 255 + 127 0 127 127 127 255 [test] clear draw arrays TRIANGLE_LIST 0 6 -relative probe rgb (0.9, 0.9) (1.0, 0, 0) -relative probe rgb (0.5, 0.5) (1.0, 0, 0) -relative probe rgb (0.1, 0.7) (1.0, 0, 0) -relative probe rgb (0.8, 0.3) (1.0, 0, 0) +relative probe rgba (0.9, 0.9) (1.0, 0, 0, 1.0) +relative probe rgba (0.5, 0.5) (1.0, 0, 0, 1.0) +relative probe rgba (0.1, 0.7) (1.0, 0, 0, 1.0) +relative probe rgba (0.8, 0.3) (1.0, 0, 0, 1.0) draw arrays TRIANGLE_LIST 6 6 -relative probe rgb (0.0, 0.0) (1.0, 0, 0) -relative probe rgb (0.3, 0.7) (1.0, 0, 0) -relative probe rgb (0.4, 0.9) (1.0, 0, 0) -relative probe rgb (0.5, 0.0) (0, 1.0, 0) -relative probe rgb (0.8, 0.7) (0, 1.0, 0) -relative probe rgb (0.9, 0.9) (0, 1.0, 0) +relative probe rgba (0.0, 0.0) (1.0, 0, 0, 1.0) +relative probe rgba (0.3, 0.7) (1.0, 0, 0, 1.0) +relative probe rgba (0.4, 0.9) (1.0, 0, 0, 1.0) +relative probe rgba (0.5, 0.0) (0, 1.0, 0, 1.0) +relative probe rgba (0.8, 0.7) (0, 1.0, 0, 1.0) +relative probe rgba (0.9, 0.9) (0, 1.0, 0, 1.0) draw arrays TRIANGLE_LIST 12 6 -relative probe rgb (0.0, 0.0) (1.0, 0, 0) -relative probe rgb (0.3, 0.2) (1.0, 0, 0) -relative probe rgb (0.4, 0.4) (1.0, 0, 0) -relative probe rgb (0.5, 0.0) (0, 1.0, 0) -relative probe rgb (0.8, 0.7) (0, 1.0, 0) -relative probe rgb (0.9, 0.9) (0, 1.0, 0) -relative probe rgb (0.0, 0.5) (0, 0, 1.0) -relative probe rgb (0.3, 0.7) (0, 0, 1.0) -relative probe rgb (0.4, 0.9) (0, 0, 1.0) +relative probe rgba (0.0, 0.0) (1.0, 0, 0, 1.0) +relative probe rgba (0.3, 0.2) (1.0, 0, 0, 1.0) +relative probe rgba (0.4, 0.4) (1.0, 0, 0, 1.0) +relative probe rgba (0.5, 0.0) (0, 1.0, 0, 1.0) +relative probe rgba (0.8, 0.7) (0, 1.0, 0, 1.0) +relative probe rgba (0.9, 0.9) (0, 1.0, 0, 1.0) +relative probe rgba (0.0, 0.5) (0, 0, 1.0, 1.0) +relative probe rgba (0.3, 0.7) (0, 0, 1.0, 1.0) +relative probe rgba (0.4, 0.9) (0, 0, 1.0, 1.0) draw arrays TRIANGLE_LIST 18 6 -relative probe rgb (0.0, 0.0) (1.0, 0, 0) -relative probe rgb (0.3, 0.2) (1.0, 0, 0) -relative probe rgb (0.4, 0.4) (1.0, 0, 0) -relative probe rgb (0.5, 0.0) (0, 1.0, 0) -relative probe rgb (0.8, 0.2) (0, 1.0, 0) -relative probe rgb (0.9, 0.4) (0, 1.0, 0) -relative probe rgb (0.0, 0.5) (0, 0, 1.0) -relative probe rgb (0.3, 0.7) (0, 0, 1.0) -relative probe rgb (0.4, 0.9) (0, 0, 1.0) -relative probe rgb (0.5, 0.5) (0.5, 0.5, 0.5) -relative probe rgb (0.8, 0.7) (0.5, 0.5, 0.5) -relative probe rgb (0.9, 0.9) (0.5, 0.5, 0.5) +relative probe rgba (0.0, 0.0) (1.0, 0, 0, 1.0) +relative probe rgba (0.3, 0.2) (1.0, 0, 0, 1.0) +relative probe rgba (0.4, 0.4) (1.0, 0, 0, 1.0) +relative probe rgba (0.5, 0.0) (0, 1.0, 0, 1.0) +relative probe rgba (0.8, 0.2) (0, 1.0, 0, 1.0) +relative probe rgba (0.9, 0.4) (0, 1.0, 0, 1.0) +relative probe rgba (0.0, 0.5) (0, 0, 1.0, 1.0) +relative probe rgba (0.3, 0.7) (0, 0, 1.0, 1.0) +relative probe rgba (0.4, 0.9) (0, 0, 1.0, 1.0) +relative probe rgba (0.5, 0.5) (0.5, 0.5, 0.5, 1.0) +relative probe rgba (0.8, 0.7) (0.5, 0.5, 0.5, 1.0) +relative probe rgba (0.9, 0.9) (0.5, 0.5, 0.5, 1.0) diff --git a/tests/cases/draw_triangle_list_without_probe.vkscript b/tests/cases/draw_triangle_list_without_probe.vkscript index 646a0d28f..dbaac5b2e 100644 --- a/tests/cases/draw_triangle_list_without_probe.vkscript +++ b/tests/cases/draw_triangle_list_without_probe.vkscript @@ -36,17 +36,17 @@ void main() { [vertex data] # position vert_color - 0/R8G8_SNORM 1/R8G8B8_UNORM + 0/R8G8_SNORM 1/R8G8B8A8_UNORM # Red for entire frame -# R8 G8 R8 G8 B8 - -128 -128 255 0 0 - 127 127 255 0 0 - -128 127 255 0 0 - - -128 -128 255 0 0 - 127 127 255 0 0 - 127 -128 255 0 0 +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 0 + 127 127 255 0 0 0 + -128 127 255 0 0 0 + + -128 -128 255 0 0 0 + 127 127 255 0 0 0 + 127 -128 255 0 0 0 [test] draw arrays TRIANGLE_LIST 0 6 diff --git a/tests/cases/position_to_ssbo.amber b/tests/cases/position_to_ssbo.amber index 39f7aaeaf..c293bd1f3 100644 --- a/tests/cases/position_to_ssbo.amber +++ b/tests/cases/position_to_ssbo.amber @@ -13,9 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics - [vertex shader] #version 430 diff --git a/tests/cases/ssbo_with_graphics_pipeline.vkscript b/tests/cases/ssbo_with_graphics_pipeline.vkscript index bfeb8bbab..fab83d37f 100644 --- a/tests/cases/ssbo_with_graphics_pipeline.vkscript +++ b/tests/cases/ssbo_with_graphics_pipeline.vkscript @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -[require] -vertexPipelineStoresAndAtomics [vertex shader] #version 430 @@ -22,7 +20,7 @@ layout(location = 0) in vec4 position; layout(location = 1) in vec4 vert_color; layout(location = 0) out vec4 frag_color; -layout(set = 0, binding = 0) buffer block1 { +layout(set = 0, binding = 0) readonly buffer block1 { vec4 add_on; }; diff --git a/tests/run_tests.py b/tests/run_tests.py index 77535ca65..454fdb7f6 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -55,7 +55,14 @@ } SUPPRESSIONS_DAWN = [ - # not implemented in Dawn backend + # Dawn does not support push constants, tessellation, geometry shader + "graphics_push_constants.amber", + "graphics_push_constants.vkscript", + "draw_triangle_list_using_geom_shader.vkscript", + "draw_triangle_list_using_tessellation.vkscript", + # Dawn requires a fragmentStage now and in the medium term + "position_to_ssbo.amber", + # DoCompute is not implemented in Dawn backend "compute_accumulated_ubo_definition.amber", "compute_accumulated_ubo_definition.vkscript", "compute_mat2x2.amber", @@ -94,41 +101,32 @@ "compute_ssbo_with_tolerance.vkscript", "compute_ssbo_without_probe.vkscript", "compute_ubo_and_ssbo.vkscript", - "draw_array_after_draw_rect.vkscript", - "draw_rect_after_draw_array.vkscript", - "draw_rect_and_draw_array_mixed.vkscript", - "draw_rect_and_ortho.vkscript", - "draw_rect_multiple_color_attachment.amber", - "draw_rectangles.vkscript", - "draw_rectangles_once.vkscript", - "draw_rectangles_without_probe.vkscript", - "draw_triangle_list.amber", - "draw_triangle_list.vkscript", + "repeat.amber", + "scratch_ssbo.vkscript", + "shader_specialization.amber", + "ssbo_subdata_size.vkscript", + # Dawn DoCommands require a pipeline + "probe_no_compute_with_multiple_ssbo_commands.vkscript", + "probe_no_compute_with_ssbo.vkscript", + # Sparse descriptor sets are not supported in Dawn backend (issue #573) + "multiple_ssbo_update_with_graphics_pipeline.vkscript", + "multiple_ssbo_with_sparse_descriptor_set_in_compute_pipeline.vkscript", + "multiple_ubo_update_with_graphics_pipeline.vkscript", + # DoEntryPoint is not supported in Dawn backend + "entry_point.amber", + # framebuffer format is not supported according to table "Mandatory format + # support" in Vulkan spec: VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0 "draw_triangle_list_in_r16g16b16a16_snorm_color_frame.vkscript", "draw_triangle_list_in_r16g16b16a16_uint_color_frame.vkscript", "draw_triangle_list_in_r32g32b32a32_sfloat_color_frame.vkscript", "draw_triangle_list_in_r8g8b8a8_snorm_color_frame.vkscript", "draw_triangle_list_in_r8g8b8a8_srgb_color_frame.vkscript", - "draw_triangle_list_using_geom_shader.vkscript", - "draw_triangle_list_using_tessellation.vkscript", + # Currently not working, an issue is created + "draw_rect_multiple_color_attachment.amber", + # Currently not working, under investigation "draw_triangle_list_with_depth.vkscript", - "draw_triangle_list_with_index_buffer.vkscript", "draw_triangle_list_with_index_buffer_and_vertex_offset.vkscript", "draw_triangle_list_with_probe_point.vkscript", - "entry_point.amber", - "graphics_push_constants.amber", - "graphics_push_constants.vkscript", - "multiple_ssbo_update_with_graphics_pipeline.vkscript", - "multiple_ssbo_with_sparse_descriptor_set_in_compute_pipeline.vkscript", - "multiple_ubo_update_with_graphics_pipeline.vkscript", - "position_to_ssbo.amber", - "probe_no_compute_with_multiple_ssbo_commands.vkscript", - "probe_no_compute_with_ssbo.vkscript", - "repeat.amber", - "scratch_ssbo.vkscript", - "shader_specialization.amber", - "ssbo_subdata_size.vkscript", - "ssbo_with_graphics_pipeline.vkscript" ] class TestCase: