From a62a08041594c25c35ae9fedb321e1f6cc1fa378 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Wed, 16 Dec 2015 17:47:28 -0700 Subject: layers: Fix find-first-set bitscan util On win32, was using leading-zero count instead of find-first-set. Caused random failures on Windows release builds. --- layers/draw_state.cpp | 4 ---- layers/vk_layer_utils.h | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'layers') diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 9b999b7e..812b8fc8 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -1306,13 +1306,9 @@ static VkBool32 verifyPipelineCreateState(layer_data* my_data, const VkDevice de { VkBool32 skipCall = VK_FALSE; -#if 0 - // TODO: This call is causing a crash on Windows Release builds running the cube demo with DrawState enabled - // Root cause and fix. if (!validate_pipeline_shaders(my_data, device, pPipeline)) { skipCall = VK_TRUE; } -#endif // VS is required if (!(pPipeline->active_shaders & VK_SHADER_STAGE_VERTEX_BIT)) { diff --git a/layers/vk_layer_utils.h b/layers/vk_layer_utils.h index a4520505..52a615f6 100644 --- a/layers/vk_layer_utils.h +++ b/layers/vk_layer_utils.h @@ -63,9 +63,13 @@ size_t vk_format_get_size(VkFormat format); static inline int u_ffs(int val) { #ifdef WIN32 - return __lzcnt(val) + 1; + unsigned long bit_pos = 0; + if (_BitScanReverse(&bit_pos, val) != 0) { + bit_pos += 1; + } + return bit_pos; #else - return ffs(val); + return ffs(val); #endif } -- cgit v1.2.3