aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Young <marky@lunarg.com>2017-05-09 10:31:12 -0600
committerMark Young <marky@lunarg.com>2017-05-09 11:01:03 -0600
commit1b9370ca411fc78c1912cd791a0d96b1b294c0d3 (patch)
treeff0b9199ad032028f00be5bf2356d63301f8f3cb
parent63154a3434160178ef0132a874db6e62a5b9d73f (diff)
downloadusermoji-1b9370ca411fc78c1912cd791a0d96b1b294c0d3.tar.xz
loader: Code review fixes
Fix some potential issues discovered by Karl in the code review. Also, fix CMake warning on newly added VkLayer_standard_layer. The CMake generation code I had been using expected a project with the same name as the JSON. Change-Id: I8738ff03ac08bcfc13aa8d11c570a0b507de450a
-rw-r--r--layers/CMakeLists.txt15
-rw-r--r--loader/loader.c11
2 files changed, 15 insertions, 11 deletions
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index 446b3b2b..1253ae6d 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -25,8 +25,7 @@ else()
message(FATAL_ERROR "Unsupported Platform!")
endif()
-set(LAYER_JSON_FILES
- VkLayer_standard_validation
+set(LAYER_JSON_FILES_WITH_DEPENDENCIES
VkLayer_core_validation
VkLayer_object_tracker
VkLayer_unique_objects
@@ -35,6 +34,12 @@ set(LAYER_JSON_FILES
VkLayer_threading
)
+set(LAYER_JSON_FILES_NO_DEPENDENCIES
+ VkLayer_standard_validation
+ )
+
+set(LAYER_JSON_FILES ${LAYER_JSON_FILES_WITH_DEPENDENCIES} ${LAYER_JSON_FILES_NO_DEPENDENCIES})
+
if (WIN32)
if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
if (CMAKE_GENERATOR MATCHES "^Visual Studio.*")
@@ -45,7 +50,6 @@ if (WIN32)
COMMAND copy ${src_json} ${dst_json}
VERBATIM
)
- add_dependencies(${config_file}-json ${config_file})
endforeach(config_file)
else()
foreach (config_file ${LAYER_JSON_FILES})
@@ -55,7 +59,6 @@ if (WIN32)
COMMAND copy ${src_json} ${dst_json}
VERBATIM
)
- add_dependencies(${config_file}-json ${config_file})
endforeach(config_file)
endif()
endif()
@@ -67,10 +70,12 @@ else()
COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json
VERBATIM
)
- add_dependencies(${config_file}-json ${config_file})
endforeach(config_file)
endif()
endif()
+foreach (config_file ${LAYER_JSON_FILES_WITH_DEPENDENCIES})
+ add_dependencies(${config_file}-json ${config_file})
+endforeach(config_file)
# Add targets for JSON file install on Linux.
# Need to remove the "./" from the library path before installing to /etc.
diff --git a/loader/loader.c b/loader/loader.c
index 2de36ef0..0e884c5d 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2017,7 +2017,7 @@ static bool verify_meta_layer_comp_layers(const struct loader_instance *inst, st
// Verify that all meta-layers in a layer list are valid.
static void verify_all_meta_layers(const struct loader_instance *inst, struct loader_layer_list *instance_layers) {
- for (uint32_t i = 0; i < instance_layers->count; i++) {
+ for (int32_t i = 0; i < (int32_t)instance_layers->count; i++) {
struct loader_layer_properties *prop = &instance_layers->list[i];
// If this is a meta-layer, make sure it is valid
@@ -2026,18 +2026,17 @@ static void verify_all_meta_layers(const struct loader_instance *inst, struct lo
"Removing meta-layer %s from instance layer list since it appears invalid.", prop->info.layerName);
// Delete the component layers
- prop->num_component_layers = 0;
loader_instance_heap_free(inst, prop->component_layer_names);
- prop->component_layer_names = NULL;
// Remove the current invalid meta-layer from the layer list
for (uint32_t j = i + 1; j < instance_layers->count; j++) {
- memcpy(&instance_layers->list[j - 1], &instance_layers->list[j], sizeof(struct loader_layer_properties));
+ // Use memmove since we are overlapping the source and destination addresses.
+ memmove(&instance_layers->list[j - 1], &instance_layers->list[j], sizeof(struct loader_layer_properties));
}
instance_layers->count--;
- // Re-verify the remaining list
- verify_all_meta_layers(inst, instance_layers);
+ // Decrement the loop index so we re-check this.
+ i--;
}
}
}