diff options
author | Karol Herbst <[email protected]> | 2017-12-12 21:01:39 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-03-17 10:33:28 +0100 |
commit | 8379dc300d744b4878f3d6e064bf65c5efa18e8c (patch) | |
tree | 71788654312deca56aa3b164b1f89b37c75750a4 /src/gallium | |
parent | 88c909e9a767b89bbee8d5072c93bec551b2b058 (diff) |
nv50/ir/nir: implement nir_load_const_instr
v8: fix loading 8/16 bit constants
Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Pierre Moreau <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp index 3c5eac17cf9..3fa590a4655 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -123,6 +123,7 @@ private: bool visit(nir_if *); bool visit(nir_instr *); bool visit(nir_jump_instr *); + bool visit(nir_load_const_instr*); bool visit(nir_loop *); nir_shader *nir; @@ -1314,6 +1315,8 @@ Converter::visit(nir_instr *insn) switch (insn->type) { case nir_instr_type_jump: return visit(nir_instr_as_jump(insn)); + case nir_instr_type_load_const: + return visit(nir_instr_as_load_const(insn)); default: ERROR("unknown nir_instr type %u\n", insn->type); return false; @@ -1349,6 +1352,31 @@ Converter::visit(nir_jump_instr *insn) } bool +Converter::visit(nir_load_const_instr *insn) +{ + assert(insn->def.bit_size <= 64); + + LValues &newDefs = convert(&insn->def); + for (int i = 0; i < insn->def.num_components; i++) { + switch (insn->def.bit_size) { + case 64: + loadImm(newDefs[i], insn->value.u64[i]); + break; + case 32: + loadImm(newDefs[i], insn->value.u32[i]); + break; + case 16: + loadImm(newDefs[i], insn->value.u16[i]); + break; + case 8: + loadImm(newDefs[i], insn->value.u8[i]); + break; + } + } + return true; +} + +bool Converter::run() { bool progress; |