Skeleton SPIRV translator.

This commit is contained in:
Ben Vanik
2015-11-29 19:45:55 -08:00
parent d2f7cc1602
commit cd50aac6d2
6 changed files with 301 additions and 14 deletions

View File

@@ -15,6 +15,7 @@
#include <vector>
#include "xenia/gpu/shader_translator.h"
#include "xenia/ui/spirv/spirv_emitter.h"
namespace xe {
namespace gpu {
@@ -25,7 +26,41 @@ class SpirvShaderTranslator : public ShaderTranslator {
~SpirvShaderTranslator() override;
protected:
void StartTranslation() override;
std::vector<uint8_t> CompleteTranslation() override;
void ProcessLabel(uint32_t cf_index) override;
void ProcessControlFlowNopInstruction() override;
void ProcessExecInstructionBegin(const ParsedExecInstruction& instr) override;
void ProcessExecInstructionEnd(const ParsedExecInstruction& instr) override;
void ProcessLoopStartInstruction(
const ParsedLoopStartInstruction& instr) override;
void ProcessLoopEndInstruction(
const ParsedLoopEndInstruction& instr) override;
void ProcessCallInstruction(const ParsedCallInstruction& instr) override;
void ProcessReturnInstruction(const ParsedReturnInstruction& instr) override;
void ProcessJumpInstruction(const ParsedJumpInstruction& instr) override;
void ProcessAllocInstruction(const ParsedAllocInstruction& instr) override;
void ProcessVertexFetchInstruction(
const ParsedVertexFetchInstruction& instr) override;
void ProcessTextureFetchInstruction(
const ParsedTextureFetchInstruction& instr) override;
void ProcessAluInstruction(const ParsedAluInstruction& instr) override;
private:
void ProcessVectorAluInstruction(const ParsedAluInstruction& instr);
void ProcessScalarAluInstruction(const ParsedAluInstruction& instr);
// Loads an operand into a value.
// The value returned will be in the form described in the operand (number of
// components, etc).
spv::Id LoadFromOperand(const InstructionOperand& op);
// Stores a value based on the specified result information.
// The value will be transformed into the appropriate form for the result and
// the proper components will be selected.
void StoreToResult(spv::Id source_value_id, const InstructionResult& result);
xe::ui::spirv::SpirvEmitter emitter_;
};
} // namespace gpu