continue;
} else if (insn.getOpcode() == ir::OP_GET_SAMPLER_INFO) {
/* change the src to sampler information register. */
- if (curbeRegs.find(ir::ocl::samplerinfo) == curbeRegs.end())
- insertCurbeReg(ir::ocl::samplerinfo, this->newCurbeEntry(GBE_CURBE_SAMPLER_INFO, 0, 32));
+ GBE_ASSERT(insn.getSrc(1) == ir::ocl::samplerinfo);
+ if (curbeRegs.find(insn.getSrc(1)) == curbeRegs.end())
+ insertCurbeReg(insn.getSrc(1), this->newCurbeEntry(GBE_CURBE_SAMPLER_INFO, 0, 32));
continue;
}
if (fn.isSpecialReg(reg) == false) continue;
class ALIGNED_INSTRUCTION GetSamplerInfoInstruction :
public BasePolicy,
- public NSrcPolicy<GetSamplerInfoInstruction, 1>,
+ public NSrcPolicy<GetSamplerInfoInstruction, 2>,
public NDstPolicy<GetSamplerInfoInstruction, 1>
{
public:
GetSamplerInfoInstruction( Register dst,
- Register src)
+ Register src,
+ Register samplerInfo)
{
this->opcode = OP_GET_SAMPLER_INFO;
this->dst[0] = dst;
this->src[0] = src;
+ this->src[1] = samplerInfo;
}
INLINE bool wellFormed(const Function &fn, std::string &why) const;
INLINE void out(std::ostream &out, const Function &fn) const {
this->outOpcode(out);
- out << " sampler id %" << this->getSrc(fn, 0)
- << " %" << this->getDst(fn, 0);
+ out << " %" << this->getDst(fn, 0)
+ << " sampler id %" << this->getSrc(fn, 0);
}
- Register src[1]; //!< Surface to get info
+ Register src[2]; //!< Surface to get info
Register dst[1]; //!< return value
static const uint32_t dstNum = 1;
};
INLINE void out(std::ostream &out, const Function &fn) const {
this->outOpcode(out);
out << "." << this->getInfoType()
+ << " %" << this->getDst(fn, 0)
<< " surface id %" << this->getSrc(fn, 0)
- << " %" << this->getDst(fn, 0);
+ << " info reg %" << this->getSrc(fn, 1);
}
uint8_t infoType; //!< Type of the requested information.
return internal::GetImageInfoInstruction(infoType, dst, src, infoReg).convert();
}
- Instruction GET_SAMPLER_INFO(Register dst, Register src) {
- return internal::GetSamplerInfoInstruction(dst, src).convert();
+ Instruction GET_SAMPLER_INFO(Register dst, Register src, Register samplerInfo) {
+ return internal::GetSamplerInfoInstruction(dst, src, samplerInfo).convert();
}
std::ostream &operator<< (std::ostream &out, const Instruction &insn) {
/*! get image information , such as width/height/depth/... */
Instruction GET_IMAGE_INFO(int infoType, Register dst, Register src, Register infoReg);
/*! get sampler information */
- Instruction GET_SAMPLER_INFO(Register dst, Register src);
+ Instruction GET_SAMPLER_INFO(Register dst, Register src, Register samplerInfo);
/*! label labelIndex */
Instruction LABEL(LabelIndex labelIndex);