Remove spv_opcode_flags_t and flags fields.
The flags fields in both spv_opcode_desc_t and spv_operand_desc_t are redundant with the capabilities mask field in the same structure.
This commit is contained in:
Родитель
725cc2a2df
Коммит
9db3a53897
|
@ -140,12 +140,6 @@ typedef enum spv_endianness_t {
|
|||
SPV_FORCE_32_BIT_ENUM(spv_endianness_t)
|
||||
} spv_endianness_t;
|
||||
|
||||
typedef enum spv_opcode_flags_t {
|
||||
SPV_OPCODE_FLAGS_NONE = 0,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES = 1,
|
||||
SPV_FORCE_32_BIT_ENUM(spv_opcode_flags_t)
|
||||
} spv_opcode_flags_t;
|
||||
|
||||
// The kinds of operands that an instruction may have.
|
||||
//
|
||||
// In addition to determining what kind of value an operand may be, certain
|
||||
|
@ -292,7 +286,6 @@ typedef struct spv_header_t {
|
|||
typedef struct spv_opcode_desc_t {
|
||||
const char *name;
|
||||
const Op opcode;
|
||||
const uint32_t flags; // Bitfield of spv_opcode_flags_t
|
||||
const spv_capability_mask_t
|
||||
capabilities; // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
|
||||
// operandTypes[0..numTypes-1] describe logical operands for the instruction.
|
||||
|
@ -315,7 +308,6 @@ typedef struct spv_opcode_table_t {
|
|||
typedef struct spv_operand_desc_t {
|
||||
const char *name;
|
||||
const uint32_t value;
|
||||
const uint32_t flags; // Bitfield of spv_opcode_flags_t
|
||||
const spv_capability_mask_t
|
||||
capabilities; // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
|
||||
const spv_operand_type_t operandTypes[16]; // TODO: Smaller/larger?
|
||||
|
|
|
@ -52,7 +52,6 @@ spv_opcode_desc_t opcodeTableEntries[] = {
|
|||
#define Instruction(Name,HasResult,HasType,NumLogicalOperands,NumCapabilities,CapabilityRequired,IsVariable,LogicalArgsList) \
|
||||
{ #Name, \
|
||||
Op##Name, \
|
||||
(NumCapabilities) ? SPV_OPCODE_FLAGS_CAPABILITIES : 0, \
|
||||
(NumCapabilities) ? (CapabilityRequired) : 0, \
|
||||
0, {}, /* Filled in later. Operand list, including result id and type id, if needed */ \
|
||||
HasResult, \
|
||||
|
@ -305,8 +304,7 @@ int16_t spvOpcodeResultIdIndex(spv_opcode_desc entry) {
|
|||
}
|
||||
|
||||
int32_t spvOpcodeRequiresCapabilities(spv_opcode_desc entry) {
|
||||
return SPV_OPCODE_FLAGS_CAPABILITIES ==
|
||||
(SPV_OPCODE_FLAGS_CAPABILITIES & entry->flags);
|
||||
return entry->capabilities != 0;
|
||||
}
|
||||
|
||||
void spvInstructionCopy(const uint32_t *words, const Op opcode,
|
||||
|
|
|
@ -88,7 +88,7 @@ spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
|
|||
/// the wordcount/opcode word.
|
||||
int16_t spvOpcodeResultIdIndex(spv_opcode_desc entry);
|
||||
|
||||
/// @brief Determine if the Opcode has capaspvity requirements
|
||||
/// @brief Determine if the Opcode has capability requirements.
|
||||
///
|
||||
/// This function does not check if @a entry is valid.
|
||||
///
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -33,8 +33,7 @@ class Requires : public ::testing::TestWithParam<Capability> {
|
|||
Requires()
|
||||
: entry({nullptr,
|
||||
(Op)0,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES,
|
||||
GetParam(),
|
||||
SPV_CAPABILITY_AS_MASK(GetParam()),
|
||||
0,
|
||||
{},
|
||||
false,
|
||||
|
@ -57,11 +56,20 @@ INSTANTIATE_TEST_CASE_P(Op, Requires,
|
|||
CapabilityGeometry,
|
||||
CapabilityTessellation,
|
||||
CapabilityAddresses,
|
||||
CapabilityLinkage, CapabilityKernel));
|
||||
CapabilityLinkage, CapabilityKernel,
|
||||
// ClipDistance has enum value 32.
|
||||
// So it tests that we are sensitive
|
||||
// to more than just the least
|
||||
// significant 32 bits of the
|
||||
// capability mask.
|
||||
CapabilityClipDistance,
|
||||
// Transformfeedback has value 53,
|
||||
// and is the last capability.
|
||||
CapabilityTransformFeedback));
|
||||
|
||||
TEST(OpcodeRequiresCapability, None) {
|
||||
spv_opcode_desc_t entry = {
|
||||
nullptr, (Op)0, SPV_OPCODE_FLAGS_NONE, 0, 0, {}, false, false, {}};
|
||||
nullptr, (Op)0, 0, 0, {}, false, false, {}};
|
||||
ASSERT_EQ(0, spvOpcodeRequiresCapabilities(&entry));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче