[SPIR-V] Main program counter switch

This commit is contained in:
Triang3l
2020-10-18 15:36:02 +03:00
parent 1de144938c
commit 7846245b66
2 changed files with 114 additions and 22 deletions

View File

@@ -12,6 +12,7 @@
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
#include "third_party/glslang/SPIRV/SpvBuilder.h"
@@ -32,6 +33,8 @@ class SpirvShaderTranslator : public ShaderTranslator {
std::vector<uint8_t> CompleteTranslation() override;
void ProcessLabel(uint32_t cf_index) override;
private:
// TODO(Triang3l): Depth-only pixel shader.
bool IsSpirvVertexOrTessEvalShader() const { return is_vertex_shader(); }
@@ -104,6 +107,10 @@ class SpirvShaderTranslator : public ShaderTranslator {
spv::Block* main_loop_continue_;
spv::Block* main_loop_merge_;
spv::Id main_loop_pc_next_;
spv::Block* main_switch_header_;
std::unique_ptr<spv::Instruction> main_switch_op_;
spv::Block* main_switch_merge_;
std::vector<spv::Id> main_switch_next_pc_phi_operands_;
};
} // namespace gpu