Skip to content
Open
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
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ if (SPIRV_REFLECT_EXECUTABLE)
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.cpp)
target_compile_options(spirv-reflect PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Werror>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -Werror>)
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -Wextra -Wpedantic -Werror>)
if (SPIRV_REFLECT_ENABLE_ASSERTS)
target_compile_definitions(spirv-reflect PRIVATE SPIRV_REFLECT_ENABLE_ASSERTS)
endif()
Expand Down Expand Up @@ -66,9 +66,9 @@ if (SPIRV_REFLECT_EXECUTABLE)
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.cpp)
target_compile_options(spirv-reflect-pp PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Werror>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -Werror>)
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -Wextra -Wpedantic -Werror>)
if (SPIRV_REFLECT_ENABLE_ASSERTS)
target_compile_definitions(spirv-reflect-pp PRIVATE SPIRV_REFLECT_ENABLE_ASSERTS)
endif()
Expand Down
6 changes: 3 additions & 3 deletions common/output_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,11 +1521,11 @@ void StreamWriteEntryPoint(std::ostream& os, const SpvReflectEntryPoint& obj, co
if (obj.shader_stage == SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT) {
os << "\n";
os << "local size : "
<< "(" << (obj.local_size.x == SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT ? "Spec Constant" : std::to_string(obj.local_size.x))
<< "(" << (obj.local_size.x == (uint32_t)SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT ? "Spec Constant" : std::to_string(obj.local_size.x))
<< ", "
<< (obj.local_size.y == SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT ? "Spec Constant" : std::to_string(obj.local_size.y))
<< (obj.local_size.y == (uint32_t)SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT ? "Spec Constant" : std::to_string(obj.local_size.y))
<< ", "
<< (obj.local_size.z == SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT ? "Spec Constant" : std::to_string(obj.local_size.z))
<< (obj.local_size.z == (uint32_t)SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT ? "Spec Constant" : std::to_string(obj.local_size.z))
<< ")";
}
}
Expand Down
26 changes: 13 additions & 13 deletions spirv_reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ enum {
};

enum {
INVALID_VALUE = 0xFFFFFFFF,
INVALID_VALUE = (int)0xFFFFFFFF,
};

enum {
MAX_NODE_NAME_LENGTH = 1024,
MAX_NODE_NAME_LENGTH = 1024,
// Number of unique PhysicalStorageBuffer structs tracked to detect recursion
MAX_RECURSIVE_PHYSICAL_POINTER_CHECK = 128,
};
Expand Down Expand Up @@ -1345,7 +1345,7 @@ static SpvReflectResult ParseMemberCounts(SpvReflectPrvParser* p_parser) {
continue;
}

if (member_index == INVALID_VALUE) {
if (member_index == (uint32_t)INVALID_VALUE) {
return SPV_REFLECT_RESULT_ERROR_RANGE_EXCEEDED;
}

Expand Down Expand Up @@ -1779,7 +1779,7 @@ static SpvReflectResult ParseType(SpvReflectPrvParser* p_parser, SpvReflectPrvNo
SpvReflectTypeDescription* p_member_type = &(p_type->members[i]);
p_member_type->id = (uint32_t)INVALID_VALUE;
p_member_type->op = (SpvOp)INVALID_VALUE;
p_member_type->storage_class = (SpvStorageClass)INVALID_VALUE;
p_member_type->storage_class = INVALID_VALUE;
}
} else {
result = SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
Expand All @@ -1789,7 +1789,7 @@ static SpvReflectResult ParseType(SpvReflectPrvParser* p_parser, SpvReflectPrvNo
if (result == SPV_REFLECT_RESULT_SUCCESS) {
// Since the parse descends on type information, these will get overwritten
// if not guarded against assignment. Only assign if the id is invalid.
if (p_type->id == INVALID_VALUE) {
if (p_type->id == (uint32_t)INVALID_VALUE) {
p_type->id = p_node->result_id;
p_type->op = p_node->op;
p_type->decoration_flags = 0;
Expand Down Expand Up @@ -2058,7 +2058,7 @@ static SpvReflectResult ParseTypes(SpvReflectPrvParser* p_parser, SpvReflectShad
SpvReflectTypeDescription* p_type = &(p_module->_internal->type_descriptions[i]);
p_type->id = (uint32_t)INVALID_VALUE;
p_type->op = (SpvOp)INVALID_VALUE;
p_type->storage_class = (SpvStorageClass)INVALID_VALUE;
p_type->storage_class = INVALID_VALUE;
}

size_t type_index = 0;
Expand Down Expand Up @@ -2144,7 +2144,7 @@ static SpvReflectResult ParseDescriptorBindings(SpvReflectPrvParser* p_parser, S
(p_node->storage_class != SpvStorageClassUniformConstant))) {
continue;
}
if ((p_node->decorations.set.value == INVALID_VALUE) || (p_node->decorations.binding.value == INVALID_VALUE)) {
if ((p_node->decorations.set.value == (uint32_t)INVALID_VALUE) || (p_node->decorations.binding.value == (uint32_t)INVALID_VALUE)) {
continue;
}

Expand Down Expand Up @@ -2179,7 +2179,7 @@ static SpvReflectResult ParseDescriptorBindings(SpvReflectPrvParser* p_parser, S
(p_node->storage_class != SpvStorageClassUniformConstant))) {
continue;
}
if ((p_node->decorations.set.value == INVALID_VALUE) || (p_node->decorations.binding.value == INVALID_VALUE)) {
if ((p_node->decorations.set.value == (uint32_t)INVALID_VALUE) || (p_node->decorations.binding.value == (uint32_t)INVALID_VALUE)) {
continue;
}

Expand Down Expand Up @@ -3446,7 +3446,7 @@ static SpvReflectResult ParseByteAddressBuffer(SpvReflectPrvParser* p_parser, Sp
// All arithmetic ops takes 2 operands, assumption is the 2nd operand has the constant
UNCHECKED_READU32(p_parser, p_next_node->word_offset + 4, base_id);
uint32_t value = GetUint32Constant(p_parser, base_id);
if (value == INVALID_VALUE) {
if (value == (uint32_t)INVALID_VALUE) {
return not_found;
}

Expand Down Expand Up @@ -5022,7 +5022,7 @@ const SpvReflectDescriptorSet* spvReflectGetEntryPointDescriptorSet(const SpvRef

const SpvReflectInterfaceVariable* spvReflectGetInputVariableByLocation(const SpvReflectShaderModule* p_module, uint32_t location,
SpvReflectResult* p_result) {
if (location == INVALID_VALUE) {
if (location == (uint32_t)INVALID_VALUE) {
if (IsNotNull(p_result)) {
*p_result = SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND;
}
Expand Down Expand Up @@ -5052,7 +5052,7 @@ const SpvReflectInterfaceVariable* spvReflectGetInputVariable(const SpvReflectSh
const SpvReflectInterfaceVariable* spvReflectGetEntryPointInputVariableByLocation(const SpvReflectShaderModule* p_module,
const char* entry_point, uint32_t location,
SpvReflectResult* p_result) {
if (location == INVALID_VALUE) {
if (location == (uint32_t)INVALID_VALUE) {
if (IsNotNull(p_result)) {
*p_result = SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND;
}
Expand Down Expand Up @@ -5155,7 +5155,7 @@ const SpvReflectInterfaceVariable* spvReflectGetEntryPointInputVariableBySemanti

const SpvReflectInterfaceVariable* spvReflectGetOutputVariableByLocation(const SpvReflectShaderModule* p_module, uint32_t location,
SpvReflectResult* p_result) {
if (location == INVALID_VALUE) {
if (location == (uint32_t)INVALID_VALUE) {
if (IsNotNull(p_result)) {
*p_result = SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND;
}
Expand Down Expand Up @@ -5185,7 +5185,7 @@ const SpvReflectInterfaceVariable* spvReflectGetOutputVariable(const SpvReflectS
const SpvReflectInterfaceVariable* spvReflectGetEntryPointOutputVariableByLocation(const SpvReflectShaderModule* p_module,
const char* entry_point, uint32_t location,
SpvReflectResult* p_result) {
if (location == INVALID_VALUE) {
if (location == (uint32_t)INVALID_VALUE) {
if (IsNotNull(p_result)) {
*p_result = SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND;
}
Expand Down
2 changes: 1 addition & 1 deletion spirv_reflect.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ typedef struct SpvReflectDescriptorSet {
} SpvReflectDescriptorSet;

typedef enum SpvReflectExecutionModeValue {
SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT = 0xFFFFFFFF // specialization constant
SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT = (int)0xFFFFFFFF // specialization constant
} SpvReflectExecutionModeValue;

/*! @struct SpvReflectEntryPoint
Expand Down