#ifndef SOURCE_TABLE_H_
#define SOURCE_TABLE_H_
#include "source/extensions.h"
#include "source/latest_version_spirv_header.h"
#include "spirv-tools/libspirv.hpp"
typedef struct spv_opcode_desc_t {
const char* name;
const spv::Op opcode;
const uint32_t numCapabilities;
const spv::Capability* capabilities;
const uint16_t numTypes;
spv_operand_type_t operandTypes[16];
const bool hasResult;
const bool hasType;
const uint32_t numExtensions;
const spvtools::Extension* extensions;
const uint32_t minVersion;
const uint32_t lastVersion;
} spv_opcode_desc_t;
typedef struct spv_operand_desc_t {
const char* name;
const uint32_t value;
const uint32_t numCapabilities;
const spv::Capability* capabilities;
const uint32_t numExtensions;
const spvtools::Extension* extensions;
const spv_operand_type_t operandTypes[16];
const uint32_t minVersion;
const uint32_t lastVersion;
} spv_operand_desc_t;
typedef struct spv_operand_desc_group_t {
const spv_operand_type_t type;
const uint32_t count;
const spv_operand_desc_t* entries;
} spv_operand_desc_group_t;
typedef struct spv_ext_inst_desc_t {
const char* name;
const uint32_t ext_inst;
const uint32_t numCapabilities;
const spv::Capability* capabilities;
const spv_operand_type_t operandTypes[16];
} spv_ext_inst_desc_t;
typedef struct spv_ext_inst_group_t {
const spv_ext_inst_type_t type;
const uint32_t count;
const spv_ext_inst_desc_t* entries;
} spv_ext_inst_group_t;
typedef struct spv_opcode_table_t {
const uint32_t count;
const spv_opcode_desc_t* entries;
} spv_opcode_table_t;
typedef struct spv_operand_table_t {
const uint32_t count;
const spv_operand_desc_group_t* types;
} spv_operand_table_t;
typedef struct spv_ext_inst_table_t {
const uint32_t count;
const spv_ext_inst_group_t* groups;
} spv_ext_inst_table_t;
typedef const spv_opcode_desc_t* spv_opcode_desc;
typedef const spv_operand_desc_t* spv_operand_desc;
typedef const spv_ext_inst_desc_t* spv_ext_inst_desc;
typedef const spv_opcode_table_t* spv_opcode_table;
typedef const spv_operand_table_t* spv_operand_table;
typedef const spv_ext_inst_table_t* spv_ext_inst_table;
struct spv_context_t {
const spv_target_env target_env;
const spv_opcode_table opcode_table;
const spv_operand_table operand_table;
const spv_ext_inst_table ext_inst_table;
spvtools::MessageConsumer consumer;
};
namespace spvtools {
void SetContextMessageConsumer(spv_context context, MessageConsumer consumer);
}
spv_result_t spvOpcodeTableGet(spv_opcode_table* table, spv_target_env env);
spv_result_t spvOperandTableGet(spv_operand_table* table, spv_target_env env);
spv_result_t spvExtInstTableGet(spv_ext_inst_table* table, spv_target_env env);
#endif