From: Christoph Bumiller Date: Sat, 14 Apr 2012 19:30:52 +0000 (+0200) Subject: nv50/ir: add isUniform query to Values X-Git-Tag: mesa-9.0~2441 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a765d7880f80d01be261a5d1f4b356a2b6fcfaad;p=platform%2Fupstream%2Fmesa.git nv50/ir: add isUniform query to Values --- diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp index cdf0a13..d80fc85 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp @@ -268,6 +268,16 @@ LValue::clone(ClonePolicy& pol) const return that; } +bool +LValue::isUniform() const +{ + if (defs.size() > 1) + return false; + Instruction *insn = getInsn(); + // let's not try too hard here for now ... + return !insn->srcExists(1) && insn->getSrc(0)->isUniform(); +} + Symbol::Symbol(Program *prog, DataFile f, ubyte fidx) { baseSym = NULL; @@ -297,6 +307,15 @@ Symbol::clone(ClonePolicy& pol) const return that; } +bool +Symbol::isUniform() const +{ + return + reg.file != FILE_SYSTEM_VALUE && + reg.file != FILE_MEMORY_LOCAL && + reg.file != FILE_SHADER_INPUT; +} + ImmediateValue::ImmediateValue(Program *prog, uint32_t uval) { memset(®, 0, sizeof(reg)); diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h index a52cc9a..c0a867d 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h @@ -460,6 +460,7 @@ public: virtual bool equals(const Value *, bool strict = false) const; virtual bool interfers(const Value *) const; + virtual bool isUniform() const { return true; } inline Value *rep() const { return join; } @@ -500,6 +501,8 @@ public: LValue(Function *, LValue *); ~LValue() { } + virtual bool isUniform() const; + virtual LValue *clone(ClonePolicy&) const; virtual int print(char *, size_t, DataType ty = TYPE_NONE) const; @@ -522,6 +525,8 @@ public: virtual bool equals(const Value *that, bool strict) const; + virtual bool isUniform() const; + virtual int print(char *, size_t, DataType ty = TYPE_NONE) const; // print with indirect values