mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-11-14 20:15:37 +00:00
Updated spirv-tools.
This commit is contained in:
+15
-2
@@ -190,6 +190,7 @@ class Parser {
|
||||
struct NumberType {
|
||||
spv_number_kind_t type;
|
||||
uint32_t bit_width;
|
||||
spv_fp_encoding_t encoding;
|
||||
};
|
||||
|
||||
// The state used to parse a single SPIR-V binary module.
|
||||
@@ -385,8 +386,6 @@ spv_result_t Parser::parseInstruction() {
|
||||
assert(_.requires_endian_conversion ||
|
||||
(_.endian_converted_words.size() == 1));
|
||||
|
||||
recordNumberType(inst_offset, &inst);
|
||||
|
||||
if (_.requires_endian_conversion) {
|
||||
// We must wait until here to set this pointer, because the vector might
|
||||
// have been be resized while we accumulated its elements.
|
||||
@@ -398,6 +397,8 @@ spv_result_t Parser::parseInstruction() {
|
||||
}
|
||||
inst.num_words = inst_word_count;
|
||||
|
||||
recordNumberType(inst_offset, &inst);
|
||||
|
||||
// We must wait until here to set this pointer, because the vector might
|
||||
// have been be resized while we accumulated its elements.
|
||||
inst.operands = _.operands.data();
|
||||
@@ -833,6 +834,7 @@ spv_result_t Parser::setNumericTypeInfoForType(
|
||||
|
||||
parsed_operand->number_kind = info.type;
|
||||
parsed_operand->number_bit_width = info.bit_width;
|
||||
parsed_operand->fp_encoding = info.encoding;
|
||||
// Round up the word count.
|
||||
parsed_operand->num_words = static_cast<uint16_t>((info.bit_width + 31) / 32);
|
||||
return SPV_SUCCESS;
|
||||
@@ -850,6 +852,17 @@ void Parser::recordNumberType(size_t inst_offset,
|
||||
} else if (spv::Op::OpTypeFloat == opcode) {
|
||||
info.type = SPV_NUMBER_FLOATING;
|
||||
info.bit_width = peekAt(inst_offset + 2);
|
||||
if (inst->num_words >= 4) {
|
||||
const spvtools::OperandDesc* desc;
|
||||
spv_result_t status = spvtools::LookupOperand(
|
||||
SPV_OPERAND_TYPE_FPENCODING, peekAt(inst_offset + 3), &desc);
|
||||
if (status == SPV_SUCCESS) {
|
||||
info.encoding = spvFPEncodingFromOperandFPEncoding(
|
||||
static_cast<spv::FPEncoding>(desc->value));
|
||||
} else {
|
||||
info.encoding = SPV_FP_ENCODING_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The *result* Id of a type generating instruction is the type Id.
|
||||
_.type_id_to_number_type_info[inst->result_id] = info;
|
||||
|
||||
Reference in New Issue
Block a user