} while (0)
# endif
+#elif (SPANTMP_PIXEL_FMT == GL_ALPHA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_BYTE)
+
+/**
+ ** GL_ALPHA, GL_UNSIGNED_BYTE
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) ( buf + (_x) + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color) \
+ p = color[3]
+
+# define WRITE_RGBA(_x, _y, r, g, b, a) \
+ PUT_VALUE(_x, _y, a | (r & 0 /* quiet warnings */))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLubyte p = GET_VALUE(_x, _y); \
+ rgba[0] = 0; \
+ rgba[1] = 0; \
+ rgba[2] = 0; \
+ rgba[3] = p; \
+ } while (0)
+
#else
#error SPANTMP_PIXEL_FMT must be set to a valid value!
#endif
case MESA_FORMAT_ARGB4444:
key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
break;
+ case MESA_FORMAT_A8:
+ key.surface_format = BRW_SURFACEFORMAT_A8_UNORM;
+ break;
default:
_mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format);
}
}
}
+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
*/
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:
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;
/* 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);
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);
#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)
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:
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");
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");
case MESA_FORMAT_RGB565:
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_A8:
break;
default:
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
#define XY_DST_TILED (1 << 11)
/* BR13 */
+#define BR13_8 (0x0 << 24)
#define BR13_565 (0x1 << 24)
#define BR13_8888 (0x3 << 24)
#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; \
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;