<div dir="auto">Tgsi values should stay inside of from_tgsi. If there are leaks into the rest of codegen, let's plug them. I assume this is for assignslots?</div><div class="gmail_extra"><br><div class="gmail_quote">On Dec 21, 2017 11:26 AM, "Karol Herbst" <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Dec 21, 2017 at 5:21 PM, Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
> On Thu, Dec 21, 2017 at 10:51 AM, Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br>
>> this is more or less a todo list of things I should move elsewhere. Not all of<br>
>> it should be actually moved, but...<br>
>><br>
>> Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>><br>
>> ---<br>
>> src/gallium/drivers/nouveau/<wbr>Makefile.sources | 2 +<br>
>> .../nouveau/codegen/nv50_ir_<wbr>from_common.cpp | 145 ++++++++++++++++++++<br>
>> .../drivers/nouveau/codegen/<wbr>nv50_ir_from_common.h | 59 +++++++++<br>
>> .../drivers/nouveau/codegen/<wbr>nv50_ir_from_tgsi.cpp | 146 +--------------------<br>
>> src/gallium/drivers/nouveau/<wbr>meson.build | 2 +<br>
>> 5 files changed, 212 insertions(+), 142 deletions(-)<br>
>> create mode 100644 src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.<wbr>cpp<br>
>> create mode 100644 src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.h<br>
>><br>
>> diff --git a/src/gallium/drivers/nouveau/<wbr>Makefile.sources b/src/gallium/drivers/nouveau/<wbr>Makefile.sources<br>
>> index 65f08c7d8d..fee5e59522 100644<br>
>> --- a/src/gallium/drivers/nouveau/<wbr>Makefile.sources<br>
>> +++ b/src/gallium/drivers/nouveau/<wbr>Makefile.sources<br>
>> @@ -115,6 +115,8 @@ NV50_CODEGEN_SOURCES := \<br>
>> codegen/nv50_ir_build_util.h \<br>
>> codegen/nv50_ir_driver.h \<br>
>> codegen/nv50_ir_emit_nv50.cpp \<br>
>> + codegen/nv50_ir_from_common.<wbr>cpp \<br>
>> + codegen/nv50_ir_from_common.h \<br>
>> codegen/nv50_ir_from_tgsi.cpp \<br>
>> codegen/nv50_ir_graph.cpp \<br>
>> codegen/nv50_ir_graph.h \<br>
>> diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.<wbr>cpp b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.<wbr>cpp<br>
>> new file mode 100644<br>
>> index 0000000000..aa5f52fe81<br>
>> --- /dev/null<br>
>> +++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.<wbr>cpp<br>
>> @@ -0,0 +1,145 @@<br>
>> +/*<br>
>> + * Copyright 2011 Christoph Bumiller<br>
>> + *<br>
>> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
>> + * copy of this software and associated documentation files (the "Software"),<br>
>> + * to deal in the Software without restriction, including without limitation<br>
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
>> + * and/or sell copies of the Software, and to permit persons to whom the<br>
>> + * Software is furnished to do so, subject to the following conditions:<br>
>> + *<br>
>> + * The above copyright notice and this permission notice shall be included in<br>
>> + * all copies or substantial portions of the Software.<br>
>> + *<br>
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
>> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
>> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
>> + * OTHER DEALINGS IN THE SOFTWARE.<br>
>> + */<br>
>> +<br>
>> +#include "codegen/nv50_ir_from_common.<wbr>h"<br>
>> +<br>
>> +namespace nv50_ir {<br>
>> +<br>
>> +ConverterCommon::<wbr>ConverterCommon(Program *prog, nv50_ir_prog_info *info)<br>
>> + : BuildUtil(prog),<br>
>> + info(info) {}<br>
>> +<br>
>> +ConverterCommon::Subroutine *<br>
>> +ConverterCommon::<wbr>getSubroutine(unsigned ip)<br>
>> +{<br>
>> + std::map<unsigned, Subroutine>::iterator it = sub.map.find(ip);<br>
>> +<br>
>> + if (it == sub.map.end())<br>
>> + it = sub.map.insert(std::make_pair(<br>
>> + ip, Subroutine(new Function(prog, "SUB", ip)))).first;<br>
>> +<br>
>> + return &it->second;<br>
>> +}<br>
>> +<br>
>> +ConverterCommon::Subroutine *<br>
>> +ConverterCommon::<wbr>getSubroutine(Function *f)<br>
>> +{<br>
>> + unsigned ip = f->getLabel();<br>
>> + std::map<unsigned, Subroutine>::iterator it = sub.map.find(ip);<br>
>> +<br>
>> + if (it == sub.map.end())<br>
>> + it = sub.map.insert(std::make_pair(<wbr>ip, Subroutine(f))).first;<br>
>> +<br>
>> + return &it->second;<br>
>> +}<br>
>> +<br>
>> +uint8_t<br>
>> +ConverterCommon::<wbr>translateInterpMode(const nv50_ir_varying *var, operation& op)<br>
>> +{<br>
>> + uint8_t mode = NV50_IR_INTERP_PERSPECTIVE;<br>
>> +<br>
>> + if (var->flat)<br>
>> + mode = NV50_IR_INTERP_FLAT;<br>
>> + else<br>
>> + if (var->linear)<br>
>> + mode = NV50_IR_INTERP_LINEAR;<br>
>> + else<br>
>> + if (var->sc)<br>
>> + mode = NV50_IR_INTERP_SC;<br>
>> +<br>
>> + op = (mode == NV50_IR_INTERP_PERSPECTIVE || mode == NV50_IR_INTERP_SC)<br>
>> + ? OP_PINTERP : OP_LINTERP;<br>
>> +<br>
>> + if (var->centroid)<br>
>> + mode |= NV50_IR_INTERP_CENTROID;<br>
>> +<br>
>> + return mode;<br>
>> +}<br>
>> +<br>
>> +void<br>
>> +ConverterCommon::<wbr>handleUserClipPlanes()<br>
>> +{<br>
>> + Value *res[8];<br>
>> + int n, i, c;<br>
>> +<br>
>> + for (c = 0; c < 4; ++c) {<br>
>> + for (i = 0; i < info->io.genUserClip; ++i) {<br>
>> + Symbol *sym = mkSymbol(FILE_MEMORY_CONST, info->io.auxCBSlot,<br>
>> + TYPE_F32, info->io.ucpBase + i * 16 + c * 4);<br>
>> + Value *ucp = mkLoadv(TYPE_F32, sym, NULL);<br>
>> + if (c == 0)<br>
>> + res[i] = mkOp2v(OP_MUL, TYPE_F32, getScratch(), clipVtx[c], ucp);<br>
>> + else<br>
>> + mkOp3(OP_MAD, TYPE_F32, res[i], clipVtx[c], ucp, res[i]);<br>
>> + }<br>
>> + }<br>
>> +<br>
>> + const int first = info->numOutputs - (info->io.genUserClip + 3) / 4;<br>
>> +<br>
>> + for (i = 0; i < info->io.genUserClip; ++i) {<br>
>> + n = i / 4 + first;<br>
>> + c = i % 4;<br>
>> + Symbol *sym =<br>
>> + mkSymbol(FILE_SHADER_OUTPUT, 0, TYPE_F32, info->out[n].slot[c] * 4);<br>
>> + mkStore(OP_EXPORT, TYPE_F32, sym, NULL, res[i]);<br>
>> + }<br>
>> +}<br>
>> +<br>
>> +SVSemantic<br>
>> +ConverterCommon::<wbr>translateSysVal(uint sysval)<br>
><br>
> This seems *very* tgsi-specific. Why is this a "common" thing? TGSI<br>
> should have its mapping, and NIR should have its mapping, and they<br>
> should be separate...<br>
><br>
<br>
right, but for simplicity I kind of use the TGSI values, because parts<br>
of codegen depend on those anyway. I still plan to clean that up at<br>
some point...<br>
<br>
>> +{<br>
>> + switch (sysval) {<br>
>> + case TGSI_SEMANTIC_FACE: return nv50_ir::SV_FACE;<br>
>> + case TGSI_SEMANTIC_PSIZE: return nv50_ir::SV_POINT_SIZE;<br>
>> + case TGSI_SEMANTIC_PRIMID: return nv50_ir::SV_PRIMITIVE_ID;<br>
>> + case TGSI_SEMANTIC_INSTANCEID: return nv50_ir::SV_INSTANCE_ID;<br>
>> + case TGSI_SEMANTIC_VERTEXID: return nv50_ir::SV_VERTEX_ID;<br>
>> + case TGSI_SEMANTIC_GRID_SIZE: return nv50_ir::SV_NCTAID;<br>
>> + case TGSI_SEMANTIC_BLOCK_ID: return nv50_ir::SV_CTAID;<br>
>> + case TGSI_SEMANTIC_BLOCK_SIZE: return nv50_ir::SV_NTID;<br>
>> + case TGSI_SEMANTIC_THREAD_ID: return nv50_ir::SV_TID;<br>
>> + case TGSI_SEMANTIC_SAMPLEID: return nv50_ir::SV_SAMPLE_INDEX;<br>
>> + case TGSI_SEMANTIC_SAMPLEPOS: return nv50_ir::SV_SAMPLE_POS;<br>
>> + case TGSI_SEMANTIC_SAMPLEMASK: return nv50_ir::SV_SAMPLE_MASK;<br>
>> + case TGSI_SEMANTIC_INVOCATIONID: return nv50_ir::SV_INVOCATION_ID;<br>
>> + case TGSI_SEMANTIC_TESSCOORD: return nv50_ir::SV_TESS_COORD;<br>
>> + case TGSI_SEMANTIC_TESSOUTER: return nv50_ir::SV_TESS_OUTER;<br>
>> + case TGSI_SEMANTIC_TESSINNER: return nv50_ir::SV_TESS_INNER;<br>
>> + case TGSI_SEMANTIC_VERTICESIN: return nv50_ir::SV_VERTEX_COUNT;<br>
>> + case TGSI_SEMANTIC_HELPER_<wbr>INVOCATION: return nv50_ir::SV_THREAD_KILL;<br>
>> + case TGSI_SEMANTIC_BASEVERTEX: return nv50_ir::SV_BASEVERTEX;<br>
>> + case TGSI_SEMANTIC_BASEINSTANCE: return nv50_ir::SV_BASEINSTANCE;<br>
>> + case TGSI_SEMANTIC_DRAWID: return nv50_ir::SV_DRAWID;<br>
>> + case TGSI_SEMANTIC_WORK_DIM: return nv50_ir::SV_WORK_DIM;<br>
>> + case TGSI_SEMANTIC_SUBGROUP_<wbr>INVOCATION: return nv50_ir::SV_LANEID;<br>
>> + case TGSI_SEMANTIC_SUBGROUP_EQ_<wbr>MASK: return nv50_ir::SV_LANEMASK_EQ;<br>
>> + case TGSI_SEMANTIC_SUBGROUP_LT_<wbr>MASK: return nv50_ir::SV_LANEMASK_LT;<br>
>> + case TGSI_SEMANTIC_SUBGROUP_LE_<wbr>MASK: return nv50_ir::SV_LANEMASK_LE;<br>
>> + case TGSI_SEMANTIC_SUBGROUP_GT_<wbr>MASK: return nv50_ir::SV_LANEMASK_GT;<br>
>> + case TGSI_SEMANTIC_SUBGROUP_GE_<wbr>MASK: return nv50_ir::SV_LANEMASK_GE;<br>
>> + default:<br>
>> + assert(0);<br>
>> + return nv50_ir::SV_CLOCK;<br>
>> + }<br>
>> +}<br>
>> +<br>
>> +} // nv50_ir<br>
>> diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.h b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.h<br>
>> new file mode 100644<br>
>> index 0000000000..a520a3cfbc<br>
>> --- /dev/null<br>
>> +++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_common.h<br>
>> @@ -0,0 +1,59 @@<br>
>> +/*<br>
>> + * Copyright 2011 Christoph Bumiller<br>
>> + *<br>
>> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
>> + * copy of this software and associated documentation files (the "Software"),<br>
>> + * to deal in the Software without restriction, including without limitation<br>
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
>> + * and/or sell copies of the Software, and to permit persons to whom the<br>
>> + * Software is furnished to do so, subject to the following conditions:<br>
>> + *<br>
>> + * The above copyright notice and this permission notice shall be included in<br>
>> + * all copies or substantial portions of the Software.<br>
>> + *<br>
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
>> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
>> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
>> + * OTHER DEALINGS IN THE SOFTWARE.<br>
>> + */<br>
>> +<br>
>> +#include "codegen/nv50_ir.h"<br>
>> +#include "codegen/nv50_ir_build_util.h"<br>
>> +<br>
>> +namespace nv50_ir {<br>
>> +<br>
>> +class ConverterCommon : public BuildUtil<br>
>> +{<br>
>> +public:<br>
>> + ConverterCommon(Program *, nv50_ir_prog_info *);<br>
>> +protected:<br>
>> + struct Subroutine<br>
>> + {<br>
>> + Subroutine(Function *f) : f(f) { }<br>
>> + Function *f;<br>
>> + ValueMap values;<br>
>> + };<br>
>> +<br>
>> + Subroutine *getSubroutine(unsigned ip);<br>
>> + Subroutine *getSubroutine(Function *);<br>
>> +<br>
>> + uint8_t translateInterpMode(const nv50_ir_varying *var, operation& op);<br>
>> + SVSemantic translateSysVal(uint);<br>
>> +<br>
>> + void handleUserClipPlanes();<br>
>> +<br>
>> + struct {<br>
>> + std::map<unsigned, Subroutine> map;<br>
>> + Subroutine *cur;<br>
>> + } sub;<br>
>> +<br>
>> + struct nv50_ir_prog_info *info;<br>
>> + Value *fragCoord[4];<br>
>> + Value *clipVtx[4];<br>
>> + Value *outBase; // base address of vertex out patch (for TCP)<br>
>> +};<br>
>> +<br>
>> +} // unnamed endspace<br>
>> diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_tgsi.cpp<br>
>> index 34351dab51..4843fc021f 100644<br>
>> --- a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_tgsi.cpp<br>
>> +++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_from_tgsi.cpp<br>
>> @@ -27,8 +27,8 @@<br>
>> #include <set><br>
>><br>
>> #include "codegen/nv50_ir.h"<br>
>> +#include "codegen/nv50_ir_from_common.<wbr>h"<br>
>> #include "codegen/nv50_ir_util.h"<br>
>> -#include "codegen/nv50_ir_build_util.h"<br>
>><br>
>> namespace tgsi {<br>
>><br>
>> @@ -37,7 +37,6 @@ class Source;<br>
>> static nv50_ir::operation translateOpcode(uint opcode);<br>
>> static nv50_ir::DataFile translateFile(uint file);<br>
>> static nv50_ir::TexTarget translateTexture(uint texTarg);<br>
>> -static nv50_ir::SVSemantic translateSysVal(uint sysval);<br>
>> static nv50_ir::CacheMode translateCacheMode(uint qualifier);<br>
>> static nv50_ir::ImgFormat translateImgFormat(uint format);<br>
>><br>
>> @@ -419,43 +418,6 @@ static nv50_ir::DataFile translateFile(uint file)<br>
>> }<br>
>> }<br>
>><br>
>> -static nv50_ir::SVSemantic translateSysVal(uint sysval)<br>
>> -{<br>
>> - switch (sysval) {<br>
>> - case TGSI_SEMANTIC_FACE: return nv50_ir::SV_FACE;<br>
>> - case TGSI_SEMANTIC_PSIZE: return nv50_ir::SV_POINT_SIZE;<br>
>> - case TGSI_SEMANTIC_PRIMID: return nv50_ir::SV_PRIMITIVE_ID;<br>
>> - case TGSI_SEMANTIC_INSTANCEID: return nv50_ir::SV_INSTANCE_ID;<br>
>> - case TGSI_SEMANTIC_VERTEXID: return nv50_ir::SV_VERTEX_ID;<br>
>> - case TGSI_SEMANTIC_GRID_SIZE: return nv50_ir::SV_NCTAID;<br>
>> - case TGSI_SEMANTIC_BLOCK_ID: return nv50_ir::SV_CTAID;<br>
>> - case TGSI_SEMANTIC_BLOCK_SIZE: return nv50_ir::SV_NTID;<br>
>> - case TGSI_SEMANTIC_THREAD_ID: return nv50_ir::SV_TID;<br>
>> - case TGSI_SEMANTIC_SAMPLEID: return nv50_ir::SV_SAMPLE_INDEX;<br>
>> - case TGSI_SEMANTIC_SAMPLEPOS: return nv50_ir::SV_SAMPLE_POS;<br>
>> - case TGSI_SEMANTIC_SAMPLEMASK: return nv50_ir::SV_SAMPLE_MASK;<br>
>> - case TGSI_SEMANTIC_INVOCATIONID: return nv50_ir::SV_INVOCATION_ID;<br>
>> - case TGSI_SEMANTIC_TESSCOORD: return nv50_ir::SV_TESS_COORD;<br>
>> - case TGSI_SEMANTIC_TESSOUTER: return nv50_ir::SV_TESS_OUTER;<br>
>> - case TGSI_SEMANTIC_TESSINNER: return nv50_ir::SV_TESS_INNER;<br>
>> - case TGSI_SEMANTIC_VERTICESIN: return nv50_ir::SV_VERTEX_COUNT;<br>
>> - case TGSI_SEMANTIC_HELPER_<wbr>INVOCATION: return nv50_ir::SV_THREAD_KILL;<br>
>> - case TGSI_SEMANTIC_BASEVERTEX: return nv50_ir::SV_BASEVERTEX;<br>
>> - case TGSI_SEMANTIC_BASEINSTANCE: return nv50_ir::SV_BASEINSTANCE;<br>
>> - case TGSI_SEMANTIC_DRAWID: return nv50_ir::SV_DRAWID;<br>
>> - case TGSI_SEMANTIC_WORK_DIM: return nv50_ir::SV_WORK_DIM;<br>
>> - case TGSI_SEMANTIC_SUBGROUP_<wbr>INVOCATION: return nv50_ir::SV_LANEID;<br>
>> - case TGSI_SEMANTIC_SUBGROUP_EQ_<wbr>MASK: return nv50_ir::SV_LANEMASK_EQ;<br>
>> - case TGSI_SEMANTIC_SUBGROUP_LT_<wbr>MASK: return nv50_ir::SV_LANEMASK_LT;<br>
>> - case TGSI_SEMANTIC_SUBGROUP_LE_<wbr>MASK: return nv50_ir::SV_LANEMASK_LE;<br>
>> - case TGSI_SEMANTIC_SUBGROUP_GT_<wbr>MASK: return nv50_ir::SV_LANEMASK_GT;<br>
>> - case TGSI_SEMANTIC_SUBGROUP_GE_<wbr>MASK: return nv50_ir::SV_LANEMASK_GE;<br>
>> - default:<br>
>> - assert(0);<br>
>> - return nv50_ir::SV_CLOCK;<br>
>> - }<br>
>> -}<br>
>> -<br>
>> #define NV50_IR_TEX_TARG_CASE(a, b) \<br>
>> case TGSI_TEXTURE_##a: return nv50_ir::TEX_TARGET_##b;<br>
>><br>
>> @@ -1634,7 +1596,7 @@ namespace {<br>
>><br>
>> using namespace nv50_ir;<br>
>><br>
>> -class Converter : public BuildUtil<br>
>> +class Converter : public ConverterCommon<br>
>> {<br>
>> public:<br>
>> Converter(Program *, const tgsi::Source *);<br>
>> @@ -1643,13 +1605,6 @@ public:<br>
>> bool run();<br>
>><br>
>> private:<br>
>> - struct Subroutine<br>
>> - {<br>
>> - Subroutine(Function *f) : f(f) { }<br>
>> - Function *f;<br>
>> - ValueMap values;<br>
>> - };<br>
>> -<br>
>> Value *shiftAddress(Value *);<br>
>> Value *getVertexBase(int s);<br>
>> Value *getOutputBase(int s);<br>
>> @@ -1673,8 +1628,6 @@ private:<br>
>><br>
>> bool handleInstruction(const struct tgsi_full_instruction *);<br>
>> void exportOutputs();<br>
>> - inline Subroutine *getSubroutine(unsigned ip);<br>
>> - inline Subroutine *getSubroutine(Function *);<br>
>> inline bool isEndOfSubroutine(uint ip);<br>
>><br>
>> void loadProjTexCoords(Value *dst[4], Value *src[4], unsigned int mask);<br>
>> @@ -1686,7 +1639,6 @@ private:<br>
>> void handleTXQ(Value *dst0[4], enum TexQuery, int R);<br>
>> void handleFBFETCH(Value *dst0[4]);<br>
>> void handleLIT(Value *dst0[4]);<br>
>> - void handleUserClipPlanes();<br>
>><br>
>> // Symbol *getResourceBase(int r);<br>
>> void getImageCoords(std::vector<<wbr>Value *>&, int r, int s);<br>
>> @@ -1697,8 +1649,6 @@ private:<br>
>><br>
>> void handleINTERP(Value *dst0[4]);<br>
>><br>
>> - uint8_t translateInterpMode(const struct nv50_ir_varying *var,<br>
>> - operation& op);<br>
>> Value *interpolate(tgsi::<wbr>Instruction::SrcRegister, int c, Value *ptr);<br>
>><br>
>> void insertConvergenceOps(<wbr>BasicBlock *conv, BasicBlock *fork);<br>
>> @@ -1730,12 +1680,6 @@ private:<br>
>><br>
>> private:<br>
>> const tgsi::Source *code;<br>
>> - const struct nv50_ir_prog_info *info;<br>
>> -<br>
>> - struct {<br>
>> - std::map<unsigned, Subroutine> map;<br>
>> - Subroutine *cur;<br>
>> - } sub;<br>
>><br>
>> uint ip; // instruction pointer<br>
>><br>
>> @@ -1750,14 +1694,10 @@ private:<br>
>> DataArray oData; // TGSI_FILE_OUTPUT (if outputs in registers)<br>
>><br>
>> Value *zero;<br>
>> - Value *fragCoord[4];<br>
>> - Value *clipVtx[4];<br>
>><br>
>> Value *vtxBase[5]; // base address of vertex in primitive (for TP/GP)<br>
>> uint8_t vtxBaseValid;<br>
>><br>
>> - Value *outBase; // base address of vertex out patch (for TCP)<br>
>> -<br>
>> Stack condBBs; // fork BB, then else clause BB<br>
>> Stack joinBBs; // fork BB, for inserting join ops on ENDIF<br>
>> Stack loopBBs; // loop headers<br>
>> @@ -1823,7 +1763,7 @@ Converter::makeSym(uint tgsiFile, int fileIdx, int idx, int c, uint32_t address)<br>
>> sym->setOffset(info->out[idx].<wbr>slot[c] * 4);<br>
>> else<br>
>> if (sym->reg.file == FILE_SYSTEM_VALUE)<br>
>> - sym->setSV(tgsi::<wbr>translateSysVal(info->sv[idx].<wbr>sn), c);<br>
>> + sym->setSV(translateSysVal(<wbr>info->sv[idx].sn), c);<br>
>> else<br>
>> sym->setOffset(address);<br>
>> } else {<br>
>> @@ -1832,29 +1772,6 @@ Converter::makeSym(uint tgsiFile, int fileIdx, int idx, int c, uint32_t address)<br>
>> return sym;<br>
>> }<br>
>><br>
>> -uint8_t<br>
>> -Converter::<wbr>translateInterpMode(const struct nv50_ir_varying *var, operation& op)<br>
>> -{<br>
>> - uint8_t mode = NV50_IR_INTERP_PERSPECTIVE;<br>
>> -<br>
>> - if (var->flat)<br>
>> - mode = NV50_IR_INTERP_FLAT;<br>
>> - else<br>
>> - if (var->linear)<br>
>> - mode = NV50_IR_INTERP_LINEAR;<br>
>> - else<br>
>> - if (var->sc)<br>
>> - mode = NV50_IR_INTERP_SC;<br>
>> -<br>
>> - op = (mode == NV50_IR_INTERP_PERSPECTIVE || mode == NV50_IR_INTERP_SC)<br>
>> - ? OP_PINTERP : OP_LINTERP;<br>
>> -<br>
>> - if (var->centroid)<br>
>> - mode |= NV50_IR_INTERP_CENTROID;<br>
>> -<br>
>> - return mode;<br>
>> -}<br>
>> -<br>
>> Value *<br>
>> Converter::interpolate(tgsi::<wbr>Instruction::SrcRegister src, int c, Value *ptr)<br>
>> {<br>
>> @@ -3085,30 +3002,6 @@ Converter::handleINTERP(Value *dst[4])<br>
>> }<br>
>> }<br>
>><br>
>> -Converter::Subroutine *<br>
>> -Converter::getSubroutine(<wbr>unsigned ip)<br>
>> -{<br>
>> - std::map<unsigned, Subroutine>::iterator it = sub.map.find(ip);<br>
>> -<br>
>> - if (it == sub.map.end())<br>
>> - it = sub.map.insert(std::make_pair(<br>
>> - ip, Subroutine(new Function(prog, "SUB", ip)))).first;<br>
>> -<br>
>> - return &it->second;<br>
>> -}<br>
>> -<br>
>> -Converter::Subroutine *<br>
>> -Converter::getSubroutine(<wbr>Function *f)<br>
>> -{<br>
>> - unsigned ip = f->getLabel();<br>
>> - std::map<unsigned, Subroutine>::iterator it = sub.map.find(ip);<br>
>> -<br>
>> - if (it == sub.map.end())<br>
>> - it = sub.map.insert(std::make_pair(<wbr>ip, Subroutine(f))).first;<br>
>> -<br>
>> - return &it->second;<br>
>> -}<br>
>> -<br>
>> bool<br>
>> Converter::isEndOfSubroutine(<wbr>uint ip)<br>
>> {<br>
>> @@ -4149,35 +4042,6 @@ Converter::handleInstruction(<wbr>const struct tgsi_full_instruction *insn)<br>
>> return true;<br>
>> }<br>
>><br>
>> -void<br>
>> -Converter::<wbr>handleUserClipPlanes()<br>
>> -{<br>
>> - Value *res[8];<br>
>> - int n, i, c;<br>
>> -<br>
>> - for (c = 0; c < 4; ++c) {<br>
>> - for (i = 0; i < info->io.genUserClip; ++i) {<br>
>> - Symbol *sym = mkSymbol(FILE_MEMORY_CONST, info->io.auxCBSlot,<br>
>> - TYPE_F32, info->io.ucpBase + i * 16 + c * 4);<br>
>> - Value *ucp = mkLoadv(TYPE_F32, sym, NULL);<br>
>> - if (c == 0)<br>
>> - res[i] = mkOp2v(OP_MUL, TYPE_F32, getScratch(), clipVtx[c], ucp);<br>
>> - else<br>
>> - mkOp3(OP_MAD, TYPE_F32, res[i], clipVtx[c], ucp, res[i]);<br>
>> - }<br>
>> - }<br>
>> -<br>
>> - const int first = info->numOutputs - (info->io.genUserClip + 3) / 4;<br>
>> -<br>
>> - for (i = 0; i < info->io.genUserClip; ++i) {<br>
>> - n = i / 4 + first;<br>
>> - c = i % 4;<br>
>> - Symbol *sym =<br>
>> - mkSymbol(FILE_SHADER_OUTPUT, 0, TYPE_F32, info->out[n].slot[c] * 4);<br>
>> - mkStore(OP_EXPORT, TYPE_F32, sym, NULL, res[i]);<br>
>> - }<br>
>> -}<br>
>> -<br>
>> void<br>
>> Converter::exportOutputs()<br>
>> {<br>
>> @@ -4219,13 +4083,11 @@ Converter::exportOutputs()<br>
>> }<br>
>> }<br>
>><br>
>> -Converter::Converter(Program *ir, const tgsi::Source *code) : BuildUtil(ir),<br>
>> +Converter::Converter(Program *ir, const tgsi::Source *code) : ConverterCommon(ir, code->info),<br>
>> code(code),<br>
>> tgsi(NULL),<br>
>> tData(this), lData(this), aData(this), oData(this)<br>
>> {<br>
>> - info = code->info;<br>
>> -<br>
>> const unsigned tSize = code->fileSize(TGSI_FILE_<wbr>TEMPORARY);<br>
>> const unsigned aSize = code->fileSize(TGSI_FILE_<wbr>ADDRESS);<br>
>> const unsigned oSize = code->fileSize(TGSI_FILE_<wbr>OUTPUT);<br>
>> diff --git a/src/gallium/drivers/nouveau/<wbr>meson.build b/src/gallium/drivers/nouveau/<wbr>meson.build<br>
>> index 5d679e1c5a..87bbc3ca9b 100644<br>
>> --- a/src/gallium/drivers/nouveau/<wbr>meson.build<br>
>> +++ b/src/gallium/drivers/nouveau/<wbr>meson.build<br>
>> @@ -129,6 +129,8 @@ files_libnouveau = files(<br>
>> 'codegen/nv50_ir_build_util.h'<wbr>,<br>
>> 'codegen/nv50_ir_driver.h',<br>
>> 'codegen/nv50_ir_emit_nv50.<wbr>cpp',<br>
>> + 'codegen/nv50_ir_from_common.<wbr>cpp',<br>
>> + 'codegen/nv50_ir_from_common.<wbr>h',<br>
>> 'codegen/nv50_ir_from_tgsi.<wbr>cpp',<br>
>> 'codegen/nv50_ir_graph.cpp',<br>
>> 'codegen/nv50_ir_graph.h',<br>
>> --<br>
>> 2.14.3<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> mesa-dev mailing list<br>
>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>