Re: [Piglit] [PATCH crucible] Add test for bug 108911

2018-12-04 Thread Lionel Landwerlin

On 04/12/2018 19:13, Lionel Landwerlin wrote:

+if (resolvedData[1][i] != 0xff00ff00) {
+printf("unexpected clear color in layer1: got 0x%x expected 
0x00ff00ff\n",
+   resolvedData[1][i]);
+t_fail();
+return;


Duh! fixed that error message locally

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH crucible] Add test for bug 108911

2018-12-04 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 Makefile.am|   1 +
 src/tests/bug/108911.c | 306 +
 2 files changed, 307 insertions(+)
 create mode 100644 src/tests/bug/108911.c

diff --git a/Makefile.am b/Makefile.am
index 528650a..6e99516 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,6 +75,7 @@ bin_crucible_SOURCES = \
src/qonos/qonos_pipeline.c \
src/tests/bug/104809.c \
src/tests/bug/108909.c \
+   src/tests/bug/108911.c \
src/tests/bench/copy-buffer.c \
src/tests/example/basic.c \
src/tests/example/images.c \
diff --git a/src/tests/bug/108911.c b/src/tests/bug/108911.c
new file mode 100644
index 000..cc94bf4
--- /dev/null
+++ b/src/tests/bug/108911.c
@@ -0,0 +1,306 @@
+// Copyright 2018 Intel Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice (including the next
+// paragraph) shall be included in all copies or substantial portions of the
+// Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#include 
+#include 
+#include "tapi/t.h"
+#include "util/misc.h"
+
+/* This is a test for https://bugs.freedesktop.org/show_bug.cgi?id=108911
+ *
+ * The wrong clear color was landing into the layer1+ of a multi-layered
+ * multi-sampled image.
+ */
+
+static VkImage
+create_image_and_bind_memory(const VkImageCreateInfo *info)
+{
+VkImage img;
+VkDeviceMemory mem;
+
+vkCreateImage(t_device, info, NULL, &img);
+mem = qoAllocImageMemory(t_device, img,
+ .properties = 
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+qoBindImageMemory(t_device, img, mem, 0);
+
+return img;
+}
+
+#define SIZE (8)
+
+static void
+test(void)
+{
+VkRenderPass renderPass;
+VkImage fbImage, imageLayers[2];
+VkImageView viewLayers[2];
+VkFramebuffer fbLayers[2];
+VkBuffer bufferLayers[2];
+VkDeviceMemory bufferMem[2];
+
+renderPass = qoCreateRenderPass(t_device,
+.attachmentCount = 1,
+.pAttachments = &(VkAttachmentDescription) 
{
+.format = VK_FORMAT_R8G8B8A8_UNORM,
+.samples = VK_SAMPLE_COUNT_4_BIT,
+.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
+.storeOp = 
VK_ATTACHMENT_STORE_OP_STORE,
+.stencilLoadOp = 
VK_ATTACHMENT_LOAD_OP_DONT_CARE,
+.stencilStoreOp = 
VK_ATTACHMENT_STORE_OP_DONT_CARE,
+.initialLayout = 
VK_IMAGE_LAYOUT_UNDEFINED,
+.finalLayout = 
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+},
+.subpassCount = 1,
+.pSubpasses = &(VkSubpassDescription) {
+.pipelineBindPoint = 
VK_PIPELINE_BIND_POINT_GRAPHICS,
+.colorAttachmentCount = 1,
+.pColorAttachments = 
&(VkAttachmentReference) {
+.attachment = 0,
+.layout = 
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+},
+});
+
+fbImage = create_image_and_bind_memory(&(VkImageCreateInfo) {
+.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+.imageType = VK_IMAGE_TYPE_2D,
+.format = VK_FORMAT_R8G8B8A8_UNORM,
+.extent = (VkExtent3D) {
+.width = SIZE,
+.height = SIZE,
+.depth = 1,
+},
+.mipLevels = 1,
+.arrayLayers = 2,
+.samples = VK_SAMPLE_COUNT_4_BIT,
+.tiling = VK_IMAGE_TILING_OPTIMAL,
+.usage = (VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
+  VK_IMAGE_USAGE_TRANSFE