turnip: fix invalid VK_ERROR_OUT_OF_POOL_MEMORY
authorHyunjun Ko <zzoon@igalia.com>
Fri, 17 Jan 2020 07:23:03 +0000 (07:23 +0000)
committerEduardo Lima Mitev <elima@igalia.com>
Tue, 21 Jan 2020 09:29:16 +0000 (10:29 +0100)
When VK_DESCRIPTOR_TYPE_SAMPLER is provided, it doesn't need to be
counted as a buffer count. Otherwise it leads to mismatch of allocated
buffer size, hitting VK_ERROR_OUT_OF_POOL_MEMORY finally.

Fixes: c39afe68f0390d45130c1317b3b7e65f55542c36
Also fixes amber tests:
./tests/cases/address_modes_float.amber
./tests/cases/address_modes_int.amber
./tests/cases/magfilter_linear.amber
./tests/cases/magfilter_nearest.amber

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
src/freedreno/vulkan/tu_descriptor_set.c

index 55f8f5b8552e8881676bda339f7c06b60ca4515f..556373689ed41257eb12b2aa9e2426a6b3c6f8f1 100644 (file)
@@ -172,6 +172,9 @@ tu_CreateDescriptorSetLayout(
       unsigned binding_buffer_count = 1;
 
       switch (binding->descriptorType) {
+      case VK_DESCRIPTOR_TYPE_SAMPLER:
+         binding_buffer_count = 0;
+         break;
       case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
       case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
          assert(!(pCreateInfo->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));