RelocEntry entry[0];
};
-struct InterpEntry
-{
- InterpEntry(int ipa, int reg, int loc) : ipa(ipa), reg(reg), loc(loc) {}
- uint32_t ipa:4; // SC mode used to identify colors
- uint32_t reg:8; // The reg used for perspective division
- uint32_t loc:20; // Let's hope we don't have more than 1M-sized shaders
+struct FixupData {
+ FixupData(bool force, bool flat, uint8_t alphatest) :
+ force_persample_interp(force), flatshade(flat), alphatest(alphatest) {}
+ bool force_persample_interp;
+ bool flatshade;
+ uint8_t alphatest;
};
-typedef void (*InterpApply)(const InterpEntry*, uint32_t*, bool, bool);
+struct FixupEntry;
+typedef void (*FixupApply)(const FixupEntry*, uint32_t*, const FixupData&);
+
+struct FixupEntry
+{
+ FixupEntry(FixupApply apply, int ipa, int reg, int loc) :
+ apply(apply), ipa(ipa), reg(reg), loc(loc) {}
+
+ FixupApply apply;
+ union {
+ struct {
+ uint32_t ipa:4; // SC mode used to identify colors
+ uint32_t reg:8; // The reg used for perspective division
+ uint32_t loc:20; // Let's hope we don't have more than 1M-sized shaders
+ };
+ uint32_t val;
+ };
+};
-struct InterpInfo
+struct FixupInfo
{
uint32_t count;
- InterpApply apply;
- InterpEntry entry[0];
+ FixupEntry entry[0];
};
class CodeEmitter
inline void *getRelocInfo() const { return relocInfo; }
- bool addInterp(int ipa, int reg, InterpApply apply);
- inline void *getInterpInfo() const { return interpInfo; }
+ bool addInterp(int ipa, int reg, FixupApply apply);
+ inline void *getFixupInfo() const { return fixupInfo; }
virtual void prepareEmission(Program *);
virtual void prepareEmission(Function *);
uint32_t codeSizeLimit;
RelocInfo *relocInfo;
- InterpInfo *interpInfo;
+ FixupInfo *fixupInfo;
};
// The address chosen is supplied to the relocation routine.
virtual void getBuiltinCode(const uint32_t **code, uint32_t *size) const = 0;
- virtual void parseDriverInfo(const struct nv50_ir_prog_info *info) { }
+ virtual void parseDriverInfo(const struct nv50_ir_prog_info *info) {
+ if (info->type == PIPE_SHADER_COMPUTE) {
+ threads = info->prop.cp.numThreads[0] *
+ info->prop.cp.numThreads[1] *
+ info->prop.cp.numThreads[2];
+ if (threads == 0)
+ threads = info->target >= NVISA_GK104_CHIPSET ? 1024 : 512;
+ } else {
+ threads = 32; // doesn't matter, just not too big.
+ }
+ }
virtual bool runLegalizePass(Program *, CGStage stage) const = 0;
virtual bool insnCanLoad(const Instruction *insn, int s,
const Instruction *ld) const = 0;
+ virtual bool insnCanLoadOffset(const Instruction *insn, int s,
+ int offset) const = 0;
virtual bool isOpSupported(operation, DataType) const = 0;
virtual bool isAccessSupported(DataFile, DataType) const = 0;
virtual bool isModSupported(const Instruction *,
protected:
uint32_t chipset;
+ uint32_t threads;
DataFile nativeFileMap[DATA_FILE_COUNT];