summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2013-04-06 14:52:05 +0200
committerChristoph Bumiller <[email protected]>2013-04-12 13:02:18 +0200
commit4da54c91d24da891c56957f29274e7821c8254f6 (patch)
tree8bd4fa434f7494a3bc9049d7304f49bb8dd7f264 /src/gallium/drivers/nv50
parent71c1c8a9b89ca1ecca1857c53cd8c648c9c9a871 (diff)
nvc0: implement multisample textures
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r--src/gallium/drivers/nv50/codegen/nv50_ir.h2
-rw-r--r--src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp26
-rw-r--r--src/gallium/drivers/nv50/nv50_resource.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c1
4 files changed, 24 insertions, 6 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h
index 236673c2489..ae365af7855 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h
@@ -824,6 +824,8 @@ public:
int isArray() const { return descTable[target].array ? 1 : 0; }
int isCube() const { return descTable[target].cube ? 1 : 0; }
int isShadow() const { return descTable[target].shadow ? 1 : 0; }
+ int isMS() const {
+ return target == TEX_TARGET_2D_MS || target == TEX_TARGET_2D_MS_ARRAY; }
Target& operator=(TexTarget targ)
{
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index b546429922d..68976914240 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -358,11 +358,13 @@ static nv50_ir::TexTarget translateTexture(uint tex)
switch (tex) {
NV50_IR_TEX_TARG_CASE(1D, 1D);
NV50_IR_TEX_TARG_CASE(2D, 2D);
+ NV50_IR_TEX_TARG_CASE(2D_MSAA, 2D_MS);
NV50_IR_TEX_TARG_CASE(3D, 3D);
NV50_IR_TEX_TARG_CASE(CUBE, CUBE);
NV50_IR_TEX_TARG_CASE(RECT, RECT);
NV50_IR_TEX_TARG_CASE(1D_ARRAY, 1D_ARRAY);
NV50_IR_TEX_TARG_CASE(2D_ARRAY, 2D_ARRAY);
+ NV50_IR_TEX_TARG_CASE(2D_ARRAY_MSAA, 2D_MS_ARRAY);
NV50_IR_TEX_TARG_CASE(CUBE_ARRAY, CUBE_ARRAY);
NV50_IR_TEX_TARG_CASE(SHADOW1D, 1D_SHADOW);
NV50_IR_TEX_TARG_CASE(SHADOW2D, 2D_SHADOW);
@@ -581,6 +583,8 @@ static nv50_ir::operation translateOpcode(uint opcode)
NV50_IR_OPCODE_CASE(SAMPLE_C_LZ, TEX);
NV50_IR_OPCODE_CASE(SAMPLE_D, TXD);
NV50_IR_OPCODE_CASE(SAMPLE_L, TXL);
+ NV50_IR_OPCODE_CASE(SAMPLE_I, TXF);
+ NV50_IR_OPCODE_CASE(SAMPLE_I_MS, TXF);
NV50_IR_OPCODE_CASE(GATHER4, TXG);
NV50_IR_OPCODE_CASE(SVIEWINFO, TXQ);
@@ -1134,7 +1138,7 @@ private:
// R,S,L,C,Dx,Dy encode TGSI sources for respective values (0xSf for auto)
void setTexRS(TexInstruction *, unsigned int& s, int R, int S);
void handleTEX(Value *dst0[4], int R, int S, int L, int C, int Dx, int Dy);
- void handleTXF(Value *dst0[4], int R);
+ void handleTXF(Value *dst0[4], int R, int L_M);
void handleTXQ(Value *dst0[4], enum TexQuery);
void handleLIT(Value *dst0[4]);
void handleUserClipPlanes();
@@ -1689,25 +1693,29 @@ Converter::handleTEX(Value *dst[4], int R, int S, int L, int C, int Dx, int Dy)
bb->insertTail(texi);
}
-// 1st source: xyz = coordinates, w = lod
+// 1st source: xyz = coordinates, w = lod/sample
// 2nd source: offset
void
-Converter::handleTXF(Value *dst[4], int R)
+Converter::handleTXF(Value *dst[4], int R, int L_M)
{
TexInstruction *texi = new_TexInstruction(func, tgsi.getOP());
+ int ms;
unsigned int c, d, s;
texi->tex.target = tgsi.getTexture(code, R);
+ ms = texi->tex.target.isMS() ? 1 : 0;
+ texi->tex.levelZero = ms; /* MS textures don't have mip-maps */
+
for (c = 0, d = 0; c < 4; ++c) {
if (dst[c]) {
texi->setDef(d++, dst[c]);
texi->tex.mask |= 1 << c;
}
}
- for (c = 0; c < texi->tex.target.getArgCount(); ++c)
+ for (c = 0; c < (texi->tex.target.getArgCount() - ms); ++c)
texi->setSrc(c, fetchSrc(0, c));
- texi->setSrc(c++, fetchSrc(0, 3)); // lod
+ texi->setSrc(c++, fetchSrc(L_M >> 4, L_M & 3)); // lod or ms
setTexRS(texi, c, R, -1);
@@ -2392,7 +2400,13 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
handleTEX(dst0, 1, 2, 0x30, 0x30, 0x30, 0x40);
break;
case TGSI_OPCODE_TXF:
- handleTXF(dst0, 1);
+ handleTXF(dst0, 1, 0x03);
+ break;
+ case TGSI_OPCODE_SAMPLE_I:
+ handleTXF(dst0, 1, 0x03);
+ break;
+ case TGSI_OPCODE_SAMPLE_I_MS:
+ handleTXF(dst0, 1, 0x20);
break;
case TGSI_OPCODE_TXQ:
case TGSI_OPCODE_SVIEWINFO:
diff --git a/src/gallium/drivers/nv50/nv50_resource.h b/src/gallium/drivers/nv50/nv50_resource.h
index 469d812098f..6b924634f7c 100644
--- a/src/gallium/drivers/nv50/nv50_resource.h
+++ b/src/gallium/drivers/nv50/nv50_resource.h
@@ -62,6 +62,7 @@ nv50_miptree(struct pipe_resource *pt)
#define NV50_TEXVIEW_SCALED_COORDS (1 << 0)
#define NV50_TEXVIEW_FILTER_MSAA8 (1 << 1)
+#define NV50_TEXVIEW_ACCESS_RESOLVE (1 << 2)
/* Internal functions:
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index 5d0b31321a0..530832f1f78 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -750,6 +750,7 @@ nv50_blit_set_src(struct nv50_blitctx *blit,
}
flags = res->last_level ? 0 : NV50_TEXVIEW_SCALED_COORDS;
+ flags |= NV50_TEXVIEW_ACCESS_RESOLVE;
if (filter && res->nr_samples == 8)
flags |= NV50_TEXVIEW_FILTER_MSAA8;