diff options
author | Chia-I Wu <[email protected]> | 2011-08-21 21:36:40 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2011-09-09 12:06:17 +0800 |
commit | 9fe197c62611815ebe74248033271ad9fd07ae06 (patch) | |
tree | 726d0a74027ffc673f3ae1b0dea2fa2cdb592fe6 | |
parent | e3cf7b69f24c186310eb3be4c462cccea028e6f2 (diff) |
intel: add support for __DRI_IMAGE_FORMAT_ABGR8888
It maps to MESA_FORMAT_RGBA8888_REV. Surfaces of the format can only be
sampled from but not render to.
Only i915 is tested.
Reviewed-by: Eric Anholt <[email protected]>
[olv: add a check in intel_image_target_renderbuffer_storage]
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_texstate.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 10 |
4 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 7cd6820cd51..5e789c4ee91 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -60,6 +60,8 @@ translate_texture_format(gl_format mesa_format, GLenum DepthMode) return MAPSURF_32BIT | MT_32BIT_ARGB8888; case MESA_FORMAT_XRGB8888: return MAPSURF_32BIT | MT_32BIT_XRGB8888; + case MESA_FORMAT_RGBA8888_REV: + return MAPSURF_32BIT | MT_32BIT_ABGR8888; case MESA_FORMAT_YCBCR_REV: return (MAPSURF_422 | MT_422_YCRCB_NORMAL); case MESA_FORMAT_YCBCR: diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index ad909789d82..7528952f71d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -190,6 +190,10 @@ translate_tex_format(gl_format mesa_format, else if (srgb_decode == GL_SKIP_DECODE_EXT) return brw_format_for_mesa_format(_mesa_get_srgb_format_linear(mesa_format)); + case MESA_FORMAT_RGBA8888_REV: + /* This format is not renderable? */ + return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; + case MESA_FORMAT_RGBA_FLOAT32: /* The value of this BRW_SURFACEFORMAT is 0, which tricks the * assertion below. diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 754f9f202d1..22c5ac2d2fc 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -269,6 +269,17 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx, if (image == NULL) return; + /* __DRIimage is opaque to the core so it has to be checked here */ + switch (image->format) { + case MESA_FORMAT_RGBA8888_REV: + _mesa_error(&intel->ctx, GL_INVALID_OPERATION, + "glEGLImageTargetRenderbufferStorage(unsupported image format"); + return; + break; + default: + break; + } + irb = intel_renderbuffer(rb); intel_region_reference(&irb->region, image->region); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index bd8d574a29e..29094866622 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -152,6 +152,11 @@ intel_create_image_from_name(__DRIscreen *screen, image->internal_format = GL_RGBA; image->data_type = GL_UNSIGNED_BYTE; break; + case __DRI_IMAGE_FORMAT_ABGR8888: + image->format = MESA_FORMAT_RGBA8888_REV; + image->internal_format = GL_RGBA; + image->data_type = GL_UNSIGNED_BYTE; + break; default: free(image); return NULL; @@ -246,6 +251,11 @@ intel_create_image(__DRIscreen *screen, image->internal_format = GL_RGBA; image->data_type = GL_UNSIGNED_BYTE; break; + case __DRI_IMAGE_FORMAT_ABGR8888: + image->format = MESA_FORMAT_RGBA8888_REV; + image->internal_format = GL_RGBA; + image->data_type = GL_UNSIGNED_BYTE; + break; default: free(image); return NULL; |