diff options
| author | Mike Stroyan <mike@LunarG.com> | 2015-04-02 11:59:05 -0600 |
|---|---|---|
| committer | Chia-I Wu <olv@lunarg.com> | 2015-04-16 17:48:21 +0800 |
| commit | 9d217fe18be21bdedf36e14237e717240daed1fb (patch) | |
| tree | fba49adacae0868a981e9e597bf4728e1814b191 /layers | |
| parent | 411a5237821fb6d150708d65289d0aae5393501f (diff) | |
| download | usermoji-9d217fe18be21bdedf36e14237e717240daed1fb.tar.xz | |
layers: Add threading checking layer
New layer checks for use of objects from multiple threads.
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | layers/README.md | 3 | ||||
| -rw-r--r-- | layers/threading.h | 32 |
3 files changed, 37 insertions, 0 deletions
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index 92f6b2dc..f5ad8f99 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -90,6 +90,7 @@ add_custom_target(generate_vk_layer_helpers DEPENDS run_vk_layer_generate(Generic generic_layer.c) run_vk_layer_generate(APIDump api_dump.cpp) run_vk_layer_generate(ObjectTracker object_track.c) +run_vk_layer_generate(Threading threading.cpp) add_library(layer_utils SHARED layers_config.cpp) if (WIN32) @@ -108,3 +109,4 @@ add_vk_layer(Generic generic_layer.c) add_vk_layer(APIDump api_dump.cpp) add_vk_layer(ObjectTracker object_track.c) add_vk_layer(ParamChecker param_checker.cpp) +add_vk_layer(ThreadingChecker threading.cpp) diff --git a/layers/README.md b/layers/README.md index 449f8926..8198e985 100644 --- a/layers/README.md +++ b/layers/README.md @@ -53,6 +53,9 @@ layer/mem\_tracker.c (name=MemTracker) - MemTracker functions mostly as a valida ### Check parameters <build dir>/layer/param_checker.c (name=ParamChecker) - Check the input parameters to API calls for validity. Currently this only checks ENUM params directly passed to API calls and ENUMs embedded in struct params. If a Dbg callback function is registered, this layer will use callback function(s) for reporting, otherwise uses stdout. +### Check threading +<build dir>/layer/threading.c (name=Threading) - Check multithreading of API calls for validity. Currently this checks that only one thread at a time uses an object in free-threaded API calls. If a Dbg callback function is registered, this layer will use callback function(s) for reporting, otherwise uses stdout. + ## Using Layers 1. Build VK loader and i965 icd driver using normal steps (cmake and make) diff --git a/layers/threading.h b/layers/threading.h new file mode 100644 index 00000000..8426e396 --- /dev/null +++ b/layers/threading.h @@ -0,0 +1,32 @@ +/* + * Vulkan + * + * Copyright (C) 2015 LunarG, Inc. + * + * 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 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. + */ + +// Draw State ERROR codes +typedef enum _THREADING_CHECKER_ERROR +{ + THREADING_CHECKER_NONE, // Used for INFO & other non-error messages + THREADING_CHECKER_MULTIPLE_THREADS, // Object used simultaneously by multiple threads + THREADING_CHECKER_SINGLE_THREAD_REUSE, // Object used simultaneously by recursion in single thread +} THREADING_CHECKER_ERROR; + |
