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