Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- name: Setup clang-format
run: |
sudo apt-get install -yqq clang-format-12
sudo apt-get install -yqq clang-format
- name: Checkout repository
uses: actions/checkout@v3
with:
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Run clang-format
run: |
git diff origin/${{ github.base_ref }} -U0 --no-color -- '**/*.cpp' '**/*.cc' '**/*.h' '**/*.hh' '**/*.hpp' \
| clang-format-diff-12 -p1 >not-formatted.diff 2>&1
| clang-format-diff -p1 >not-formatted.diff 2>&1
- name: Check formatting
run: |
if ! grep -q '[^[:space:]]' not-formatted.diff ; then
Expand Down
22 changes: 15 additions & 7 deletions spirv_reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -3569,14 +3569,22 @@ static SpvReflectResult ParseStaticallyUsedResources(SpvReflectPrvParser* p_pars
}
used_acessed_count += p_parser->functions[j].accessed_variable_count;
}
SpvReflectPrvAccessedVariable* p_used_accesses = NULL;
if (used_acessed_count > 0) {
p_used_accesses = (SpvReflectPrvAccessedVariable*)calloc(used_acessed_count, sizeof(SpvReflectPrvAccessedVariable));
if (IsNull(p_used_accesses)) {
SafeFree(p_called_functions);
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
}

// If there are no used accessed, this is something like an empty function/early return
// Basically there is going to be nothing to reflect, but everything after this expects |p_used_accesses| to be allocated with
// real memory, see https://github.com/KhronosGroup/SPIRV-Reflect/issues/319
if (used_acessed_count == 0) {
SafeFree(p_called_functions);
return SPV_REFLECT_RESULT_SUCCESS;
}

SpvReflectPrvAccessedVariable* p_used_accesses =
(SpvReflectPrvAccessedVariable*)calloc(used_acessed_count, sizeof(SpvReflectPrvAccessedVariable));
if (IsNull(p_used_accesses)) {
SafeFree(p_called_functions);
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
}

used_acessed_count = 0;
for (size_t i = 0, j = 0; i < called_function_count; ++i) {
while (p_parser->functions[j].id != p_called_functions[i]) {
Expand Down
Loading