[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

vulkan: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit 9dd676095f7839a8ad1312765a791f193b65b0cd
Author: Lenny Komow <lenny@lunarg.com>
Date:   Fri Dec 8 13:52:26 2017 -0700

    winsdk: Move file copying into NSIS installer
    
    Change-Id: If01c5024af802be784d5ea0f897cebdcc604934d

diff --git a/windowsRuntimeInstaller/InstallerRT.nsi b/windowsRuntimeInstaller/InstallerRT.nsi
index 5bc2098..fd05914 100644
--- a/windowsRuntimeInstaller/InstallerRT.nsi
+++ b/windowsRuntimeInstaller/InstallerRT.nsi
@@ -216,6 +216,82 @@ Function .onInit
 
 FunctionEnd
 
+; Initialize Explode variables
+Var /GLOBAL explString
+Var /GLOBAL explSeparator
+Var /GLOBAL explStrLen
+Var /GLOBAL explSepLen
+Var /GLOBAL explOffset
+Var /GLOBAL explTmp
+Var /GLOBAL explTmp2
+Var /GLOBAL explTmp3
+Var /GLOBAL explArrCount
+
+!macro Func_Explode un
+Function ${un}Explode
+  ; Get input from user
+  Pop $explString
+  Pop $explSeparator
+
+  ; Calculates initial values
+  StrLen $explStrLen $explString
+  StrLen $explSepLen $explSeparator
+  StrCpy $explArrCount 1
+
+  ${If}   $explStrLen <= 1          ;   If we got a single character
+  ${OrIf} $explSepLen > $explStrLen ;   or separator is larger than the string,
+    Push    $explString             ;   then we return initial string with no change
+    Push    1                       ;   and set array's length to 1
+    Return
+  ${EndIf}
+
+  ; Set offset to the last symbol of the string
+  StrCpy $explOffset $explStrLen
+  IntOp  $explOffset $explOffset - 1
+
+  ; Clear temp string to exclude the possibility of appearance of occasional data
+  StrCpy $explTmp   ""
+  StrCpy $explTmp2  ""
+  StrCpy $explTmp3  ""
+
+  ; Loop until the offset becomes negative
+  ${Do}
+    ;   If offset becomes negative, it is time to leave the function
+    ${IfThen} $explOffset == -1 ${|} ${ExitDo} ${|}
+
+    ;   Remove everything before and after the searched part ("TempStr")
+    StrCpy $explTmp $explString $explSepLen $explOffset
+
+    ${If} $explTmp == $explSeparator
+        ;   Calculating offset to start copy from
+        IntOp   $explTmp2 $explOffset + $explSepLen ;   Offset equals to the current offset plus length of separator
+        StrCpy  $explTmp3 $explString "" $explTmp2
+
+        Push    $explTmp3                           ;   Throwing array item to the stack
+        IntOp   $explArrCount $explArrCount + 1     ;   Increasing array's counter
+
+        StrCpy  $explString $explString $explOffset 0   ;   Cutting all characters beginning with the separator entry
+        StrLen  $explStrLen $explString
+    ${EndIf}
+
+    ${If} $explOffset = 0                       ;   If the beginning of the line met and there is no separator,
+                                                ;   copying the rest of the string
+        ${If} $explSeparator == ""              ;   Fix for the empty separator
+            IntOp   $explArrCount   $explArrCount - 1
+        ${Else}
+            Push    $explString
+        ${EndIf}
+    ${EndIf}
+
+    IntOp   $explOffset $explOffset - 1
+  ${Loop}
+
+  Push $explArrCount
+FunctionEnd
+!macroend
+!insertmacro Func_Explode ""
+!insertmacro Func_Explode "un."
+
 AddBrandingImage left 150
 Caption "${PRODUCTNAME} ${PRODUCTVERSION} Setup"
 Name "${PRODUCTNAME} ${PRODUCTVERSION}"
@@ -255,6 +331,27 @@ Function ${un}ConfigLayersAndVulkanDLL
     Rename "configure_rt.log" "$TEMP\VulkanRT\configure_rt.log"
     pop $0
 
+    ${IF} $0 == 0
+        Pop $1
+        LogText "Output from ConfigureRT: $1"
+        Push ";"
+        Push "$1"
+        Call ${un}Explode
+        Pop $2
+        ${For} $4 1 $2
+            Pop $3
+            Push ">"
+            Push "$3"
+            Call ${un}Explode
+            Pop $5
+            ${IF} "$5" == "2"
+                Pop $6
+                Pop $7
+                CopyFiles /SILENT "$6" "$7"
+            ${ENDIF}
+        ${Next}
+    ${ENDIF}
+
     # Ignore errors. If something went wrong, the return value will indicate it.
     ClearErrors
 
diff --git a/windowsRuntimeInstaller/configure_runtime.c b/windowsRuntimeInstaller/configure_runtime.c
index df24a6f..ebf6774 100644
--- a/windowsRuntimeInstaller/configure_runtime.c
+++ b/windowsRuntimeInstaller/configure_runtime.c
@@ -697,20 +697,7 @@ int update_system_file(FILE* log, const char* name, const char* extension, const
         snprintf(output_filename, out_size, outPattern, path, name, extension);
     }
     
-    // Remove any older version of the output file
-    if(remove(output_filename) == 0) {
-        fprintf(log, "Removed file %s\n", output_filename);
-    } else {
-        fprintf(log, "Did not remove file %s\n", output_filename);
-    }
-    
-    fprintf(log, "Attempting to copy file %s to %s\n", latest_filename, output_filename);
-    if(CopyFile(latest_filename, output_filename, false) == 0) {
-        free(latest_filename);
-        free(output_filename);
-        return 215;
-    }
-    
+    fprintf(stdout, "%s>%s;", latest_filename, output_filename);
     free(latest_filename);
     free(output_filename);
     return 0;

commit 4569d5658bbba977aa35bed2f456572582debd27
Author: Mike Schuchardt <mikes@lunarg.com>
Date:   Wed Nov 1 16:16:22 2017 -0600

    demos: Clarify cube --present_mode option
    
    Change-Id: Ie53724c3612eb5bb9adfbb826149ef87916f0d84

diff --git a/demos/cube.c b/demos/cube.c
index f9cca74..dd7bd90 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -3925,14 +3925,19 @@ static void demo_init(struct demo *demo, int argc, char **argv) {
 #if defined(ANDROID)
         ERR_EXIT("Usage: cube [--validate]\n", "Usage");
 #else
-        fprintf(stderr, "Usage:\n  %s [--use_staging] [--validate] [--validate-checks-disabled] [--break] "
-                        "[--c <framecount>] [--suppress_popups] [--incremental_present] [--display_timing] [--present_mode <present mode enum>]\n"
-                        "VK_PRESENT_MODE_IMMEDIATE_KHR = %d\n"
-                        "VK_PRESENT_MODE_MAILBOX_KHR = %d\n"
-                        "VK_PRESENT_MODE_FIFO_KHR = %d\n"
-                        "VK_PRESENT_MODE_FIFO_RELAXED_KHR = %d\n",
-                APP_SHORT_NAME, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_MAILBOX_KHR,
-                VK_PRESENT_MODE_FIFO_KHR, VK_PRESENT_MODE_FIFO_RELAXED_KHR);
+        fprintf(stderr,
+                "Usage:\n  %s [--use_staging] [--validate] [--validate-checks-disabled]\n"
+                "       [--break] [--c <framecount>] [--suppress_popups]\n"
+                "       [--incremental_present] [--display_timing]\n"
+                "       [--present_mode {0,1,2,3}]\n"
+                "\n"
+                "Options for --present_mode:\n"
+                "  %d: VK_PRESENT_MODE_IMMEDIATE_KHR\n"
+                "  %d: VK_PRESENT_MODE_MAILBOX_KHR\n"
+                "  %d: VK_PRESENT_MODE_FIFO_KHR (default)\n"
+                "  %d: VK_PRESENT_MODE_FIFO_RELAXED_KHR\n",
+                APP_SHORT_NAME, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_FIFO_KHR,
+                VK_PRESENT_MODE_FIFO_RELAXED_KHR);
         fflush(stderr);
         exit(1);
 #endif
diff --git a/demos/cube.cpp b/demos/cube.cpp
index 8ef3942..9b6fe51 100644
--- a/demos/cube.cpp
+++ b/demos/cube.cpp
@@ -930,12 +930,14 @@ Demo::Demo()
             }
 
             fprintf(stderr,
-                    "Usage:\n  %s [--use_staging] [--validate] [--break] "
-                    "[--c <framecount>] [--suppress_popups] [--present_mode <present mode enum>]\n"
-                    "VK_PRESENT_MODE_IMMEDIATE_KHR = %d\n"
-                    "VK_PRESENT_MODE_MAILBOX_KHR = %d\n"
-                    "VK_PRESENT_MODE_FIFO_KHR = %d\n"
-                    "VK_PRESENT_MODE_FIFO_RELAXED_KHR = %d\n",
+                    "Usage:\n  %s [--use_staging] [--validate] [--break] [--c <framecount>] \n"
+                    "       [--suppress_popups] [--present_mode {0,1,2,3}]\n"
+                    "\n"
+                    "Options for --present_mode:\n"
+                    "  %d: VK_PRESENT_MODE_IMMEDIATE_KHR\n"
+                    "  %d: VK_PRESENT_MODE_MAILBOX_KHR\n"
+                    "  %d: VK_PRESENT_MODE_FIFO_KHR (default)\n"
+                    "  %d: VK_PRESENT_MODE_FIFO_RELAXED_KHR\n",
                     APP_SHORT_NAME, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_FIFO_KHR,
                     VK_PRESENT_MODE_FIFO_RELAXED_KHR);
             fflush(stderr);

commit 6c05ded58c2c77fcbe3f9cd0cb6dfb1053f23734
Author: Tobin Ehlis <tobine@google.com>
Date:   Fri Oct 27 12:40:32 2017 -0600

    icd:Fixes for Windows build

diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 6dbcab0..54e2b34 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -202,11 +202,8 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInst
 #define EXPORT
 #endif
 
-#ifdef WIN32
-    extern "C" __declspec(dllexport) {
-#else
-    extern "C" {
-#endif
+extern "C" {
+
 EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName) {
     if (!vkmock::negotiate_loader_icd_interface_called) {
         vkmock::loader_interface_version = 1;
@@ -412,11 +409,9 @@ EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
     return vkmock::CreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface);
 }
 #endif /* VK_USE_PLATFORM_MACOS_MVK */
-#ifdef WIN32
-    } // end extern "C"
-#else
-    } // end extern "C"
-#endif
+
+} // end extern "C"
+
 '''
 
 CUSTOM_C_INTERCEPTS = {
@@ -488,7 +483,7 @@ CUSTOM_C_INTERCEPTS = {
     // If requesting number of extensions, return that
     if (!pLayerName) {
         if (!pProperties) {
-            *pPropertyCount = instance_extension_map.size();
+            *pPropertyCount = (uint32_t)instance_extension_map.size();
         } else {
             uint32_t i = 0;
             for (const auto &name_ver_pair : instance_extension_map) {
@@ -512,7 +507,7 @@ CUSTOM_C_INTERCEPTS = {
     // If requesting number of extensions, return that
     if (!pLayerName) {
         if (!pProperties) {
-            *pPropertyCount = device_extension_map.size();
+            *pPropertyCount = (uint32_t)device_extension_map.size();
         } else {
             uint32_t i = 0;
             for (const auto &name_ver_pair : device_extension_map) {
@@ -649,7 +644,7 @@ CUSTOM_C_INTERCEPTS = {
     // TODO: Just hard-coding 4k whole size for now
     if (VK_WHOLE_SIZE == size)
         size = 4096;
-    void* map_addr = malloc(size);
+    void* map_addr = malloc((size_t)size);
     mapped_memory_map[memory].push_back(map_addr);
     *ppData = map_addr;
     return VK_SUCCESS;

commit bcaddfa0899c2df81e5e556de4ae5e63ceff5a05
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 18:09:12 2017 -0600

    icd:Add Windows def file

diff --git a/icd/VkICD_mock_icd.def b/icd/VkICD_mock_icd.def
new file mode 100644
index 0000000..490fb3e
--- /dev/null
+++ b/icd/VkICD_mock_icd.def
@@ -0,0 +1,36 @@
+
+;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+; Copyright (c) 2015-2017 The Khronos Group Inc.
+; Copyright (c) 2015-2017 Valve Corporation
+; Copyright (c) 2015-2017 LunarG, Inc.
+; Copyright (c) 2015-2017 Google Inc.
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;     http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+;  Author: Tobin Ehlis <tobine@google.com>
+;
+;;;;  End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+LIBRARY VkICD_mock_icd
+EXPORTS
+vk_icdGetInstanceProcAddr
+vk_icdGetPhysicalDeviceProcAddr
+vk_icdNegotiateLoaderICDInterfaceVersion
+vkDestroySurfaceKHR
+vkGetPhysicalDeviceSurfaceSupportKHR
+vkGetPhysicalDeviceSurfaceCapabilitiesKHR
+vkGetPhysicalDeviceSurfaceFormatsKHR
+vkGetPhysicalDeviceSurfacePresentModesKHR
+vkCreateDisplayPlaneSurfaceKHR
+vkCreateWin32SurfaceKHR

commit 6cf494517e51f56887fdabab7489dcaa0109ced1
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 18:03:12 2017 -0600

    tests:Fix EmptyDescriptorUpdateTest test
    
    Make sure that allocation for buffer is large enough to accommodate the
    buffer's device memory requirements.
    This fixes last failing test with mock. Also reran through all tests
    and updating unexpected error and skipped test lists.

diff --git a/icd/README.md b/icd/README.md
index 8905577..d16d7c6 100644
--- a/icd/README.md
+++ b/icd/README.md
@@ -61,32 +61,22 @@ capabilities.
 ## Status
 
 This is a temporary section used for tracking as the mock icd is being developed. Once all tests are passing with the mock, this section can be removed.
-Currently 324/332 tests are passing with the mock icd, but many passing tests have unexpected validation errors that need to be cleaned up.
+Currently 333/333 tests are passing with the mock icd, but many passing tests have unexpected validation errors that need to be cleaned up.
 
 ### Failing Tests
 
-VkPositiveLayerTest.EmptyDescriptorUpdateTest
+NONE
 
 ### Passing Tests With Unexpected Errors
 
-VkLayerTest.InvalidUsageBits
-VkLayerTest.ImageSampleCounts
 VkLayerTest.InvalidCmdBufferBufferDestroyed
 VkLayerTest.RenderPassInUseDestroyedSignaled
-VkLayerTest.BufferMemoryNotBound
 VkLayerTest.InvalidCmdBufferDescriptorSetBufferDestroyed
+VkLayerTest.InvalidDynamicOffsetCases
 VkLayerTest.DSUsageBitsErrors
 VkLayerTest.DSBufferInfoErrors
 VkLayerTest.DSBufferLimitErrors
 VkLayerTest.RenderPassIncompatible
-VkLayerTest.InvalidImageLayout
-VkLayerTest.CopyImageLayerCountMismatch
-VkLayerTest.MiscImageLayerTests
-VkLayerTest.CopyImageTypeExtentMismatchMaintenance1
-VkLayerTest.CopyImageFormatSizeMismatch
-VkLayerTest.CopyImageDepthStencilFormatMismatch
-VkLayerTest.CopyImageAspectMismatch
-
 
 ### Skipped Tests
 
@@ -95,9 +85,8 @@ VkLayerTest.CreatePipelineBadVertexAttributeFormat
 VkLayerTest.MiscBlitImageTests
 VkLayerTest.TemporaryExternalSemaphore
 VkLayerTest.TemporaryExternalFence
-VkLayerTest.InvalidDynamicOffsetCases
 VkLayerTest.PSOViewportScissorCountTests
-VkLayerTest.ImageBufferCopyTests
+VkLayerTest.InvalidBarriers
 VkLayerTest.CommandQueueFlags
 VkPositiveLayerTest.TwoQueuesEnsureCorrectRetirementWithWorkStolen
 VkPositiveLayerTest.ExternalSemaphore
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index b974dd9..c57e304 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -21135,6 +21135,10 @@ TEST_F(VkPositiveLayerTest, EmptyDescriptorUpdateTest) {
         vkDestroyBuffer(m_device->device(), buffer, NULL);
         return;
     }
+    // Make sure allocation is sufficiently large to accommodate buffer requirements
+    if (mem_reqs.size > mem_alloc.allocationSize) {
+        mem_alloc.allocationSize = mem_reqs.size;
+    }
 
     VkDeviceMemory mem;
     err = vkAllocateMemory(m_device->device(), &mem_alloc, NULL, &mem);

commit 4342278f56c212dfbda4e2034dbfd5a5b396ba71
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 17:25:05 2017 -0600

    icd:Get more tests passing on mock ICD
    
    Modifying hard-coded minImageTransferGranularity for the queue from
    {0,0,0}, which has special restrictions, to {1,1,1} which is more
    lenient and removes some unexpected errors, allowing six more tests to
    pass.

diff --git a/icd/README.md b/icd/README.md
index 6859fd1..8905577 100644
--- a/icd/README.md
+++ b/icd/README.md
@@ -65,12 +65,6 @@ Currently 324/332 tests are passing with the mock icd, but many passing tests ha
 
 ### Failing Tests
 
-VkLayerTest.ImageFormatLimits
-VkLayerTest.CopyImageTypeExtentMismatch
-VkLayerTest.CopyImageCompressedBlockAlignment
-VkLayerTest.CopyImageSrcSizeExceeded
-VkLayerTest.CopyImageDstSizeExceeded
-VkPositiveLayerTest.UncompressedToCompressedImageCopy
 VkPositiveLayerTest.EmptyDescriptorUpdateTest
 
 ### Passing Tests With Unexpected Errors
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index e9dda6f..6dbcab0 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -569,7 +569,7 @@ CUSTOM_C_INTERCEPTS = {
             pQueueFamilyProperties[0].queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT | VK_QUEUE_SPARSE_BINDING_BIT;
             pQueueFamilyProperties[0].queueCount = 1;
             pQueueFamilyProperties[0].timestampValidBits = 0;
-            pQueueFamilyProperties[0].minImageTransferGranularity = {0,0,0};
+            pQueueFamilyProperties[0].minImageTransferGranularity = {1,1,1};
         }
     }
 ''',

commit 0ab3663ce33a0b45a6331c2c0bc28305177d6168
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 15:21:51 2017 -0600

    icd:Limit image properties for linear images
    
    If an image is linear, return max mips, layers, and sample count of 1.

diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index f959788..e9dda6f 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -599,7 +599,12 @@ CUSTOM_C_INTERCEPTS = {
 ''',
 'vkGetPhysicalDeviceImageFormatProperties': '''
     // TODO: Just hard-coding some values for now
-    *pImageFormatProperties = { { 4096, 4096, 256 }, 12, 256, 0x7F, 4294967296 };
+    // TODO: If tiling is linear, limit the mips, levels, & sample count
+    if (VK_IMAGE_TILING_LINEAR == tiling) {
+        *pImageFormatProperties = { { 4096, 4096, 256 }, 1, 1, VK_SAMPLE_COUNT_1_BIT, 4294967296 };
+    } else {
+        *pImageFormatProperties = { { 4096, 4096, 256 }, 12, 256, 0x7F, 4294967296 };
+    }
     return VK_SUCCESS;
 ''',
 'vkGetPhysicalDeviceImageFormatProperties2KHR': '''

commit bcfa6291ab3061cdfbc6913662efcc4398a970e3
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 14:47:51 2017 -0600

    scripts:Skip some extensions in mock ICD
    
    Mock ICD doesn't need to implement validation cache extension. Add
    simple list of excluded exceptions so we can kill any cases that we
    don't want in mock ICD. Initially only excludes validation cache.

diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index e351d70..f959788 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -832,9 +832,13 @@ class MockICDOutputGenerator(OutputGenerator):
             # } VkExtensionProperties;
             device_exts = []
             instance_exts = []
+            # Ignore extensions that ICDs should not implement
+            ignore_exts = ['VK_EXT_validation_cache']
             for ext in self.registry.tree.findall("extensions/extension"):
                 if '0' != ext[0][0].attrib['value']: # Only include implemented extensions
-                    if (ext.attrib.get('type') and 'instance' == ext.attrib['type']):
+                    if (ext.attrib['name'] in ignore_exts):
+                        pass
+                    elif (ext.attrib.get('type') and 'instance' == ext.attrib['type']):
                         instance_exts.append('    {"%s", %s},' % (ext.attrib['name'], ext[0][0].attrib['value']))
                     else:
                         device_exts.append('    {"%s", %s},' % (ext.attrib['name'], ext[0][0].attrib['value']))

commit 0380a06f6f05270e4ed7995245e4691d67669337
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 13:44:46 2017 -0600

    tests:Fix InvalidBarriers test
    
    InvalidBarriers test made invalid assumption that internal size of
    buffer memory was same as requested size. Update test so that when we
    exceed buffer size we do that based on internal size instead of
    requested size.

diff --git a/icd/README.md b/icd/README.md
index 7504228..6859fd1 100644
--- a/icd/README.md
+++ b/icd/README.md
@@ -65,7 +65,6 @@ Currently 324/332 tests are passing with the mock icd, but many passing tests ha
 
 ### Failing Tests
 
-VkLayerTest.InvalidBarriers
 VkLayerTest.ImageFormatLimits
 VkLayerTest.CopyImageTypeExtentMismatch
 VkLayerTest.CopyImageCompressedBlockAlignment
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 5fb3bb9..b974dd9 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -10950,7 +10950,8 @@ TEST_F(VkLayerTest, InvalidBarriers) {
     buf_barrier.size = VK_WHOLE_SIZE;
 
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "which is not less than total size");
-    buf_barrier.offset = 257;
+    // Exceed the internal memory size
+    buf_barrier.offset = buffer.memory_requirements().size + 1;
     // Offset greater than total size
     vkCmdPipelineBarrier(m_commandBuffer->handle(), VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
                          VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 1, &buf_barrier, 0,
@@ -10959,7 +10960,7 @@ TEST_F(VkLayerTest, InvalidBarriers) {
     buf_barrier.offset = 0;
 
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "whose sum is greater than total size");
-    buf_barrier.size = 257;
+    buf_barrier.size = buffer.memory_requirements().size + 1;
     // Size greater than total size
     vkCmdPipelineBarrier(m_commandBuffer->handle(), VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
                          VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 1, &buf_barrier, 0,

commit b716a42ec48b120b1e32f178883c12be48541240
Author: Tobin Ehlis <tobine@google.com>
Date:   Thu Oct 26 13:01:28 2017 -0600

    layers:Kill extra whitespace in CMakeLists.txt

diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index 7049c97..9567d71 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -94,8 +94,6 @@ foreach (config_file ${LAYER_JSON_FILES_NO_DEPENDENCIES})
 endforeach(config_file)
 
 
-
-
 # Add targets for JSON file install on Linux.
 # Need to remove the "./" from the library path before installing to /etc.
 if(UNIX)

commit b7b545b22c337d783a28918e0b663144883b9ef5
Author: Tobin Ehlis <tobine@google.com>
Date:   Fri Oct 13 09:26:20 2017 -0600

    icd: Adding generated mock icd
    
    Initial check-in for mock icd which is being built to allow validation
    testing without the need for an actual Vulkan device.
    
    ICD is currently building and passing 324/332 tests. It creates ptr
    handles for dispatchable objects and unique id handles for
    non-dispatchable objects. It currently has some hard-coded values for
    various Get* device-query functions in order to allow forward progress.
    The long-term intention is to allow the device configuration to be set
    by the test itself.
    
    See the ICD README.md file for more info.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba1a0c6..0d3b157 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,6 +119,7 @@ option(BUILD_TESTS "Build tests" ON)
 option(BUILD_LAYERS "Build layers" ON)
 option(BUILD_DEMOS "Build demos" ON)
 option(BUILD_VKJSON "Build vkjson" ON)
+option(BUILD_ICD "Build icd" ON)
 option(CUSTOM_GLSLANG_BIN_ROOT "Use the user defined GLSLANG_BINARY_ROOT" OFF)
 option(CUSTOM_SPIRV_TOOLS_BIN_ROOT "Use the user defined SPIRV_TOOLS*BINARY_ROOT paths" OFF)
 
@@ -380,3 +381,7 @@ endif()
 if(BUILD_VKJSON)
     add_subdirectory(libs/vkjson)
 endif()
+
+if(BUILD_ICD)
+    add_subdirectory(icd)
+endif()
diff --git a/README.md b/README.md
index 5a834df..e678e68 100644
--- a/README.md
+++ b/README.md
@@ -17,13 +17,14 @@ how Vulkan is used often result in a crash. This project provides standard valid
 to ease development by helping developers verify their applications correctly use the Vulkan API.
 
 Vulkan supports multiple GPUs and multiple global contexts (VkInstance). The ICD loader is necessary to
-support multiple GPUs  and the VkInstance level Vulkan commands.  Additionally, the loader manages inserting
+support multiple GPUs and the VkInstance level Vulkan commands.  Additionally, the loader manages inserting
 Vulkan layer libraries, including validation layers between the application and the ICD.
 
 The following components are available in this repository:
 - Vulkan header files
 - [*ICD Loader*](loader/)
 - [*Validation Layers*](layers/)
+- [*Mock ICD*](icd/)
 - Demos and tests for the loader and validation layers
 
 ## Contributing
diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt
new file mode 100644
index 0000000..6216268
--- /dev/null
+++ b/icd/CMakeLists.txt
@@ -0,0 +1,173 @@
+cmake_minimum_required (VERSION 2.8.11)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+    add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN)
+    set(DisplayServer Win32)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
+    add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR -DVK_USE_PLATFORM_ANDROID_KHX)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    if (BUILD_WSI_XCB_SUPPORT)
+        add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XCB_KHX)
+    endif()
+
+    if (BUILD_WSI_XLIB_SUPPORT)
+       add_definitions(-DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_KHX -DVK_USE_PLATFORM_XLIB_XRANDR_EXT)
+    endif()
+
+    if (BUILD_WSI_WAYLAND_SUPPORT)
+       add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR -DVK_USE_PLATFORM_WAYLAND_KHX)
+    endif()
+
+    if (BUILD_WSI_MIR_SUPPORT)
+        add_definitions(-DVK_USE_PLATFORM_MIR_KHR -DVK_USE_PLATFORM_MIR_KHX)
+        include_directories(${MIR_INCLUDE_DIR})
+    endif()
+else()
+    message(FATAL_ERROR "Unsupported Platform!")
+endif()
+
+set(ICD_JSON_FILES VkICD_mock_icd)
+
+if (WIN32)
+    if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
+        if (CMAKE_GENERATOR MATCHES "^Visual Studio.*")
+            foreach (config_file ${ICD_JSON_FILES})
+                FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${config_file}.json src_json)
+                FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${config_file}.json dst_json)
+                add_custom_target(${config_file}-json ALL
+                    COMMAND copy ${src_json} ${dst_json}
+                    VERBATIM
+                    )
+            endforeach(config_file)
+        else()
+            foreach (config_file ${ICD_JSON_FILES})
+                FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${config_file}.json src_json)
+                FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${config_file}.json dst_json)
+                add_custom_target(${config_file}-json ALL
+                    COMMAND copy ${src_json} ${dst_json}
+                    VERBATIM
+                    )
+            endforeach(config_file)
+        endif()
+    endif()
+else()
+    # extra setup for out-of-tree builds
+    if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
+        foreach (config_file ${ICD_JSON_FILES})
+            add_custom_target(${config_file}-json ALL
+                COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/${config_file}.json
+                VERBATIM
+                )
+        endforeach(config_file)
+    endif()
+endif()
+# For ICD with a direct dependency on a project with the same name, use it.
+foreach (config_file ${ICD_JSON_FILES})
+    add_dependencies(${config_file}-json ${config_file})
+endforeach(config_file)
+
+add_custom_target(generate_icd_files DEPENDS
+    mock_icd.h
+    mock_icd.cpp
+    )
+
+# Add targets for JSON file install on Linux.
+# Need to remove the "./" from the library path before installing to /etc.
+if(UNIX)
+    if(INSTALL_LVL_FILES)
+        foreach (config_file ${ICD_JSON_FILES})
+            add_custom_target(${config_file}-staging-json ALL
+                COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+                COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${config_file}.json ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+                COMMAND sed -i -e "/\"library_path\":/s$./libVkICD$libVkICD$" ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json
+                VERBATIM
+                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${config_file}.json
+                )
+            install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/vulkan/icd.d)
+        endforeach(config_file)
+    endif()
+endif()
+
+if (WIN32)
+    macro(add_vk_icd target)
+    FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/VkICD_${target}.def DEF_FILE)
+    add_custom_target(copy-${target}-def-file ALL
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} VkICD_${target}.def
+        VERBATIM
+    )
+    add_library(VkICD_${target} SHARED ${ARGN} VkICD_${target}.def)
+    add_dependencies(VkICD_${target} generate_icd_files)
+    #target_link_Libraries(VkICD_${target} VkICD_utils)
+    #add_dependencies(VkICD_${target} generate_helper_files VkICD_utils)
+    endmacro()
+else()
+    macro(add_vk_icd target)
+    add_library(VkICD_${target} SHARED ${ARGN})
+    #target_link_Libraries(VkICD_${target} VkICD_utils)
+    add_dependencies(VkICD_${target} generate_icd_files)
+    set_target_properties(VkICD_${target} PROPERTIES LINK_FLAGS "-Wl,-export-dynamic,-Bsymbolic,--exclude-libs,ALL")
+    if(INSTALL_ICD_FILES)
+        install(TARGETS VkICD_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endif()
+    endmacro()
+endif()
+
+include_directories(
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}/../loader
+    ${CMAKE_CURRENT_SOURCE_DIR}/../include/vulkan
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_PROJECT_BINARY_DIR}
+    ${CMAKE_BINARY_DIR}
+)
+
+if (WIN32)
+    set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
+    set (CMAKE_C_FLAGS_RELEASE   "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
+    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
+    set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
+    set (CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
+    set (CMAKE_C_FLAGS_DEBUG     "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
+    # Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015.
+    # The changed behavior is that constructor initializers are now fixed to clear the struct members.
+    add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,19>>:/wd4351>")
+else()
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
+endif()
+
+if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "mips64")
+    if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+        set_source_files_properties(mock_icd.cpp PROPERTIES COMPILE_FLAGS -mxgot)
+    endif()
+endif()
+
+run_vk_xml_generate(mock_icd_generator.py mock_icd.h)
+run_vk_xml_generate(mock_icd_generator.py mock_icd.cpp)
+
+# Layer Utils Library
+# For Windows, we use a static lib because the Windows loader has a fairly restrictive loader search
+# path that can't be easily modified to point it to the same directory that contains the layers.
+#if (WIN32)
+#    add_library(VkLayer_utils STATIC vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp vk_format_utils.cpp)
+#else()
+#    add_library(VkLayer_utils SHARED vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp vk_format_utils.cpp)
+#    if(INSTALL_LVL_FILES)
+#        install(TARGETS VkLayer_utils DESTINATION ${CMAKE_INSTALL_LIBDIR})
+#    endif()
+#endif()
+#add_dependencies(VkLayer_utils generate_helper_files)
+
+#add_vk_layer(core_validation core_validation.cpp vk_layer_table.cpp descriptor_sets.cpp buffer_validation.cpp shader_validation.cpp)
+#add_vk_layer(object_tracker object_tracker.cpp object_tracker_utils.cpp vk_layer_table.cpp)
+# generated
+#add_vk_layer(threading threading.cpp thread_check.h vk_layer_table.cpp)
+#add_vk_layer(unique_objects unique_objects.cpp unique_objects_wrappers.h vk_layer_table.cpp)
+#add_vk_layer(parameter_validation parameter_validation.cpp parameter_validation_utils.cpp parameter_validation.h vk_layer_table.cpp vk_validation_error_messages.h)
+#add_vk_layer(mock_layer mock_layer.cpp mock_layer.h vk_layer_table.cpp)
+
+add_vk_icd(mock_icd mock_icd.cpp mock_icd.h)
+
+# Core validation has additional dependencies
+#target_include_directories(VkLayer_core_validation PRIVATE ${GLSLANG_SPIRV_INCLUDE_DIR})
+#target_include_directories(VkLayer_core_validation PRIVATE ${SPIRV_TOOLS_INCLUDE_DIR})
+#target_link_libraries(VkLayer_core_validation ${SPIRV_TOOLS_LIBRARIES})
diff --git a/icd/README.md b/icd/README.md
new file mode 100644
index 0000000..7504228
--- /dev/null
+++ b/icd/README.md
@@ -0,0 +1,113 @@
+# Vulkan Mock ICD
+
+This directory contains a mock ICD driver designed for validation layer testing.
+
+## Introduction
+
+The mock ICD is focused on enabling validation testing apart from an actual device. Because the validation layers
+sit on top of the ICD and don't depend upon the results of Vulkan rendering, they can be tested without having actual
+GPU hardware backing the ICD. The final mock driver will be composed of three main features: a null driver, flexible
+device configuration, and entrypoint tracking & verification.
+
+### Null Driver
+The intial mock driver features just the null driver capability. This allows all of the validation tests to be run
+on a fixed device configuration that is hard-coded into the ICD.
+
+### Device Configuration
+Device configuration can be added by running the DevSim layer below the validation layers, but above the mock driver.
+The current plan is that if device customization beyond DevSim's capabilities are required for validation layer testing
+then the DevSim layer will be enhanced with the required features. The mock layer itself is just planned to have some
+hard-coded device settings that will enable it to run all of the validation tests.
+
+### Entrypoint Tracking & Verification
+Entrypoint tracking and verification will be added to the mock layer as a later feature. The idea is that all expected
+Vulkan function calls and their parameters can be stored in the ICD and then a separate call can be made to verify that
+the exepected calls and parameters actually entered the ICD. This allows verification that the validation layers are
+correctly passing calls and their parameters through to the ICD unchanged.
+
+## Using the Mock ICD
+
+To enable the mock ICD, set VK\_ICD\_FILENAMES environment variable to point to your {BUILD_DIR}/icd/VkICD\_mock\_icd.json.
+
+## Plans
+
+The initial mock ICD is just the null driver which can be used in combination with DevSim to test validation layers on
+simulated devices. Here's a rough sequence of tasks planned for the mock driver going forward:
+- Get all LVL tests passing on the bare null driver
+ - Get failing tests passing
+ - Get skipped tests passing as able
+- Get all LVL tests to run without unexpected errors
+- Develop automated test flow using mock ICD (alternative to or replacement for run\_all\_tests.sh)
+- Get all LVL tests to pass on a selection of device profiles using DevSim layer
+- Update LVL tests with device dependencies to target specific device profiles
+- Add entrypoint tracking & verification
+ - Initially track expected calls
+ - Update some tests to verify expected capability
+ - Expand tracking to include parameters
+
+## Beyond Validation Layer Testing
+
+The focus of the mock icd is for validation testing, but the code is available to use and enhance for anyone wishing to apply it for alternative
+purposes.
+With the following enhancements, the mock driver state available to the app should very closely mimic an actual ICD:
+- Update various function return codes
+- Simulated synchronization objects
+- Simulated query with mock data
+- Basic command buffer state tracking to note synch object transitions and query state updates
+
+Beyond that it's certainly possible that the mock icd could be hooked up to a SW renderer and serve as a virtual GPU with complete rendering/compute
+capabilities.
+
+## Status
+
+This is a temporary section used for tracking as the mock icd is being developed. Once all tests are passing with the mock, this section can be removed.
+Currently 324/332 tests are passing with the mock icd, but many passing tests have unexpected validation errors that need to be cleaned up.
+
+### Failing Tests
+
+VkLayerTest.InvalidBarriers
+VkLayerTest.ImageFormatLimits
+VkLayerTest.CopyImageTypeExtentMismatch
+VkLayerTest.CopyImageCompressedBlockAlignment
+VkLayerTest.CopyImageSrcSizeExceeded
+VkLayerTest.CopyImageDstSizeExceeded
+VkPositiveLayerTest.UncompressedToCompressedImageCopy
+VkPositiveLayerTest.EmptyDescriptorUpdateTest
+
+### Passing Tests With Unexpected Errors
+
+VkLayerTest.InvalidUsageBits
+VkLayerTest.ImageSampleCounts
+VkLayerTest.InvalidCmdBufferBufferDestroyed
+VkLayerTest.RenderPassInUseDestroyedSignaled
+VkLayerTest.BufferMemoryNotBound
+VkLayerTest.InvalidCmdBufferDescriptorSetBufferDestroyed
+VkLayerTest.DSUsageBitsErrors
+VkLayerTest.DSBufferInfoErrors
+VkLayerTest.DSBufferLimitErrors
+VkLayerTest.RenderPassIncompatible
+VkLayerTest.InvalidImageLayout
+VkLayerTest.CopyImageLayerCountMismatch
+VkLayerTest.MiscImageLayerTests
+VkLayerTest.CopyImageTypeExtentMismatchMaintenance1
+VkLayerTest.CopyImageFormatSizeMismatch
+VkLayerTest.CopyImageDepthStencilFormatMismatch
+VkLayerTest.CopyImageAspectMismatch
+
+
+### Skipped Tests
+
+VkLayerTest.BindImageInvalidMemoryType
+VkLayerTest.CreatePipelineBadVertexAttributeFormat
+VkLayerTest.MiscBlitImageTests
+VkLayerTest.TemporaryExternalSemaphore
+VkLayerTest.TemporaryExternalFence
+VkLayerTest.InvalidDynamicOffsetCases
+VkLayerTest.PSOViewportScissorCountTests
+VkLayerTest.ImageBufferCopyTests
+VkLayerTest.CommandQueueFlags
+VkPositiveLayerTest.TwoQueuesEnsureCorrectRetirementWithWorkStolen
+VkPositiveLayerTest.ExternalSemaphore
+VkPositiveLayerTest.ExternalFence
+
+
diff --git a/icd/VkICD_mock_icd.json b/icd/VkICD_mock_icd.json
new file mode 100644
index 0000000..88876d0
--- /dev/null
+++ b/icd/VkICD_mock_icd.json
@@ -0,0 +1,12 @@
+{
+    "file_format_version" : "1.0.1",
+    "ICD": {
+        "library_path": "./libVkICD_mock_icd.so",
+        "api_version": "1.0.63"
+    }
+}
+
+
+
+
+
diff --git a/scripts/lvl_genvk.py b/scripts/lvl_genvk.py
index 194106e..09554db 100644
--- a/scripts/lvl_genvk.py
+++ b/scripts/lvl_genvk.py
@@ -26,6 +26,7 @@ from object_tracker_generator import ObjectTrackerGeneratorOptions, ObjectTracke
 from dispatch_table_helper_generator import DispatchTableHelperOutputGenerator, DispatchTableHelperOutputGeneratorOptions
 from helper_file_generator import HelperFileOutputGenerator, HelperFileOutputGeneratorOptions
 from loader_extension_generator import LoaderExtensionOutputGenerator, LoaderExtensionGeneratorOptions
+from mock_icd_generator import MockICDGeneratorOptions, MockICDOutputGenerator
 
 # Simple timer functions
 startTime = None
@@ -122,7 +123,6 @@ def makeGenOpts(extensions = [], removeExtensions = [], protect = True, director
             alignFuncParam    = 48)
         ]
 
-
     # Options for parameter validation layer
     genOpts['parameter_validation.cpp'] = [
           ParameterValidationOutputGenerator,
@@ -424,6 +424,49 @@ def makeGenOpts(extensions = [], removeExtensions = [], protect = True, director
             helper_file_type  = 'extension_helper_header')
         ]
 
+    # Options for mock ICD header
+    genOpts['mock_icd.h'] = [
+          MockICDOutputGenerator,
+          MockICDGeneratorOptions(
+            filename          = 'mock_icd.h',
+            directory         = directory,
+            apiname           = 'vulkan',
+            profile           = None,
+            versions          = allVersions,
+            emitversions      = allVersions,
+            defaultExtensions = 'vulkan',
+            addExtensions     = addExtensions,
+            removeExtensions  = removeExtensions,
+            prefixText        = prefixStrings + vkPrefixStrings,
+            protectFeature    = False,
+            apicall           = 'VKAPI_ATTR ',
+            apientry          = 'VKAPI_CALL ',
+            apientryp         = 'VKAPI_PTR *',
+            alignFuncParam    = 48,
+            helper_file_type  = 'mock_icd_header')
+        ]
+
+    # Options for mock ICD cpp
+    genOpts['mock_icd.cpp'] = [
+          MockICDOutputGenerator,


Reply to: