summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-05-25 11:45:05 -0700
committerEric Anholt <eric@anholt.net>2010-06-10 00:40:00 -0700
commit638342858894293246400d95a90d153c7f66719a (patch)
tree63ae5ef53ba48a4a9202726df65a433cb0a90fa9 /src/mesa/drivers/dri/intel
parent262cdbd957b68878adf1fb3edcf478604ed9f171 (diff)
i965: Add support for GL_ALPHA framebuffer objects.
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c39
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c14
-rw-r--r--src/mesa/drivers/dri/intel/intel_reg.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c10
4 files changed, 50 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index fecf12763e..2c85ad3c36 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -64,6 +64,24 @@ static GLuint translate_raster_op(GLenum logicop)
}
}
+static uint32_t
+br13_for_cpp(int cpp)
+{
+ switch (cpp) {
+ case 4:
+ return BR13_8888;
+ break;
+ case 2:
+ return BR13_565;
+ break;
+ case 1:
+ return BR13_8;
+ break;
+ default:
+ assert(0);
+ return 0;
+ }
+}
/* Copy BitBlt
*/
@@ -131,18 +149,14 @@ intelEmitCopyBlit(struct intel_context *intel,
src_pitch *= cpp;
dst_pitch *= cpp;
- BR13 = translate_raster_op(logic_op) << 16;
+ BR13 = br13_for_cpp(cpp) | translate_raster_op(logic_op) << 16;
switch (cpp) {
case 1:
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
case 2:
- BR13 |= BR13_565;
CMD = XY_SRC_COPY_BLT_CMD;
break;
case 4:
- BR13 |= BR13_8888;
CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
break;
default:
@@ -265,12 +279,11 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
irb->region->buffer, (pitch * cpp),
x1, y1, x2 - x1, y2 - y1);
- BR13 = 0xf0 << 16;
+ BR13 = br13_for_cpp(cpp) | 0xf0 << 16;
CMD = XY_COLOR_BLT_CMD;
/* Setup the blit command */
if (cpp == 4) {
- BR13 |= BR13_8888;
if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
if (mask & BUFFER_BIT_DEPTH)
CMD |= XY_BLT_WRITE_RGB;
@@ -280,9 +293,6 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
/* clearing RGBA */
CMD |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
}
- } else {
- ASSERT(cpp == 2);
- BR13 |= BR13_565;
}
assert(irb->region->tiling != I915_TILING_Y);
@@ -323,6 +333,10 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
clear_val = PACK_COLOR_1555(clear[3], clear[0],
clear[1], clear[2]);
break;
+ case MESA_FORMAT_A8:
+ clear_val = PACK_COLOR_8888(clear[3], clear[3],
+ clear[3], clear[3]);
+ break;
default:
_mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
irb->Base.Format);
@@ -419,10 +433,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
#endif
br13 = dst_pitch | (translate_raster_op(logic_op) << 16) | (1 << 29);
- if (cpp == 2)
- br13 |= BR13_565;
- else
- br13 |= BR13_8888;
+ br13 |= br13_for_cpp(cpp);
blit_cmd = XY_TEXT_IMMEDIATE_BLIT_CMD | XY_TEXT_BYTE_PACKED; /* packing? */
if (dst_tiling != I915_TILING_NONE)
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 217be7ef6c..8f61f1f5b2 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -135,6 +135,11 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
rb->Format = MESA_FORMAT_ARGB8888;
rb->DataType = GL_UNSIGNED_BYTE;
break;
+ case GL_ALPHA:
+ case GL_ALPHA8:
+ rb->Format = MESA_FORMAT_A8;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ break;
case GL_STENCIL_INDEX:
case GL_STENCIL_INDEX1_EXT:
case GL_STENCIL_INDEX4_EXT:
@@ -346,6 +351,10 @@ intel_create_renderbuffer(gl_format format)
irb->Base._BaseFormat = GL_DEPTH_STENCIL;
irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
break;
+ case MESA_FORMAT_A8:
+ irb->Base._BaseFormat = GL_ALPHA;
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
default:
_mesa_problem(NULL,
"Unexpected intFormat in intel_create_renderbuffer");
@@ -451,6 +460,10 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to ARGB4444 texture OK\n");
}
+ else if (texImage->TexFormat == MESA_FORMAT_A8) {
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ DBG("Render to A8 texture OK\n");
+ }
else if (texImage->TexFormat == MESA_FORMAT_Z16) {
irb->Base.DataType = GL_UNSIGNED_SHORT;
DBG("Render to DEPTH16 texture OK\n");
@@ -660,6 +673,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
case MESA_FORMAT_RGB565:
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_A8:
break;
default:
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
diff --git a/src/mesa/drivers/dri/intel/intel_reg.h b/src/mesa/drivers/dri/intel/intel_reg.h
index 36d8180598..c1a281f261 100644
--- a/src/mesa/drivers/dri/intel/intel_reg.h
+++ b/src/mesa/drivers/dri/intel/intel_reg.h
@@ -239,6 +239,7 @@
#define XY_DST_TILED (1 << 11)
/* BR13 */
+#define BR13_8 (0x0 << 24)
#define BR13_565 (0x1 << 24)
#define BR13_8888 (0x3 << 24)
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 059f76f289..c30552c5a7 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -106,6 +106,13 @@ intel_set_span_functions(struct intel_context *intel,
#define TAG2(x,y) intel_##x##y##_xRGB8888
#include "spantmp2.h"
+/* a8 color span and pixel functions */
+#define SPANTMP_PIXEL_FMT GL_ALPHA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_BYTE
+#define TAG(x) intel_##x##_A8
+#define TAG2(x,y) intel_##x##y##_A8
+#include "spantmp2.h"
+
#define LOCAL_DEPTH_VARS \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = rb->Name ? 1 : -1; \
@@ -341,6 +348,9 @@ intel_set_span_functions(struct intel_context *intel,
struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
switch (irb->Base.Format) {
+ case MESA_FORMAT_A8:
+ intel_InitPointers_A8(rb);
+ break;
case MESA_FORMAT_RGB565:
intel_InitPointers_RGB565(rb);
break;