aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/codegen
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-07-16 15:07:21 -0400
committerIlia Mirkin <[email protected]>2016-07-18 20:04:17 -0400
commit8e7893eb53213254997a1a3beb0575be11821f83 (patch)
treed1f351c22e27d5db3b8de297497abcaec3dbbf9b /src/gallium/drivers/nouveau/codegen
parent905d7dc4d164b7ccc287b390a5b2492da3e0fd8b (diff)
nvc0: add support for BGRA8 images
This is useful for pbo downloads, which are now accelerated with images. BGRA8 is a moderately common format to do that in. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/codegen')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir.cpp2
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir.h3
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp2
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp4
4 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
index 2caebe87efe..179ad0b7a97 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
@@ -1012,6 +1012,8 @@ const struct TexInstruction::ImgFormatDesc TexInstruction::formatTable[] =
{ "RG8_SNORM", 2, { 8, 8, 0, 0 }, SNORM },
{ "R16_SNORM", 1, { 16, 0, 0, 0 }, SNORM },
{ "R8_SNORM", 1, { 8, 0, 0, 0 }, SNORM },
+
+ { "BGRA8", 4, { 8, 8, 8, 8 }, UNORM, true },
};
void
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 41804b6344d..6d2ee8bce12 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -412,6 +412,8 @@ enum ImgFormat
FMT_R16_SNORM,
FMT_R8_SNORM,
+ FMT_BGRA8,
+
IMG_FORMAT_COUNT,
};
@@ -967,6 +969,7 @@ public:
uint8_t components;
uint8_t bits[4];
ImgType type;
+ bool bgra;
};
static const struct ImgFormatDesc formatTable[IMG_FORMAT_COUNT];
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 61eb7f5c256..7dff08a5ccc 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -508,6 +508,8 @@ static nv50_ir::ImgFormat translateImgFormat(uint format)
FMT_CASE(R8G8_SNORM, RG8_SNORM);
FMT_CASE(R16_SNORM, R16_SNORM);
FMT_CASE(R8_SNORM, R8_SNORM);
+
+ FMT_CASE(B8G8R8A8_UNORM, BGRA8);
}
assert(!"Unexpected format");
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index 18955eb2e18..92bc0bb0a1f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -1940,6 +1940,10 @@ NVC0LoweringPass::convertSurfaceFormat(TexInstruction *su)
bld.mkCvt(OP_CVT, TYPE_F32, typedDst[i], TYPE_F16, typedDst[i]);
}
}
+
+ if (format->bgra) {
+ std::swap(typedDst[0], typedDst[2]);
+ }
}
void