spirv: Remove dependencies on Environment when generating SPIR-V

This commit is contained in:
ReinUsesLisp 2021-03-27 03:08:31 -03:00 committed by ameerj
parent cb6039ccea
commit 675a82416d
5 changed files with 15 additions and 16 deletions

View file

@ -4,6 +4,7 @@
#pragma once
#include <array>
#include <string>
#include <boost/container/small_vector.hpp>
@ -19,6 +20,7 @@ struct Program {
BlockList post_order_blocks;
Info info;
Stage stage{};
std::array<u32, 3> workgroup_size{};
};
[[nodiscard]] std::string DumpProgram(const Program& program);

View file

@ -33,6 +33,9 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
program.blocks = VisitAST(inst_pool, block_pool, env, cfg);
program.post_order_blocks = PostOrder(program.blocks);
program.stage = env.ShaderStage();
if (program.stage == Stage::Compute) {
program.workgroup_size = env.WorkgroupSize();
}
RemoveUnreachableBlocks(program);
// Replace instructions before the SSA rewrite