diff options
author | Eric Anholt <[email protected]> | 2013-04-18 09:20:55 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-04-30 11:59:23 -0700 |
commit | e34c857639380303a43146a50cdd724774f59a2f (patch) | |
tree | 919d6ab25240cf3f46ebc452b0d682fa1a4c92e8 /src/mesa/drivers | |
parent | db31bc5cfb7c08c1a32067b09d769c880bc4e954 (diff) |
mesa: Make a Mesa core function for sRGB render encoding handling.
v2: const-qualify ctx, and add a comment about the function (recommended
by Brian and Kenneth).
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]> (v1)
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 27 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 29 |
2 files changed, 15 insertions, 41 deletions
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 f1976391b1a..ee2c9f17c1e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -31,6 +31,7 @@ #include "main/context.h" +#include "main/blend.h" #include "main/mtypes.h" #include "main/samplerobj.h" #include "program/prog_parameter.h" @@ -1229,7 +1230,8 @@ brw_update_renderbuffer_surface(struct brw_context *brw, uint32_t *surf; uint32_t tile_x, tile_y; uint32_t format = 0; - gl_format rb_format = intel_rb_format(irb); + /* _NEW_BUFFERS */ + gl_format rb_format = _mesa_get_render_format(ctx, intel_rb_format(irb)); if (irb->tex_image && !brw->has_surface_tile_offset) { intel_renderbuffer_tile_offsets(irb, &tile_x, &tile_y); @@ -1251,25 +1253,10 @@ brw_update_renderbuffer_surface(struct brw_context *brw, surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 6 * 4, 32, &brw->wm.surf_offset[unit]); - switch (rb_format) { - case MESA_FORMAT_SARGB8: - /* _NEW_BUFFERS - * - * Without GL_EXT_framebuffer_sRGB we shouldn't bind sRGB surfaces to the - * blend/update as sRGB. - */ - if (ctx->Color.sRGBEnabled) - format = brw_format_for_mesa_format(rb_format); - else - format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - break; - default: - format = brw->render_target_format[rb_format]; - if (unlikely(!brw->format_supported_as_render_target[rb_format])) { - _mesa_problem(ctx, "%s: renderbuffer format %s unsupported\n", - __FUNCTION__, _mesa_get_format_name(rb_format)); - } - break; + format = brw->render_target_format[rb_format]; + if (unlikely(!brw->format_supported_as_render_target[rb_format])) { + _mesa_problem(ctx, "%s: renderbuffer format %s unsupported\n", + __FUNCTION__, _mesa_get_format_name(rb_format)); } surf[0] = (BRW_SURFACE_2D << BRW_SURFACE_TYPE_SHIFT | diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index 761ceb07d12..435f9dc0041 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -21,6 +21,7 @@ * IN THE SOFTWARE. */ #include "main/mtypes.h" +#include "main/blend.h" #include "main/samplerobj.h" #include "program/prog_parameter.h" @@ -529,7 +530,8 @@ gen7_update_renderbuffer_surface(struct brw_context *brw, struct intel_region *region = irb->mt->region; uint32_t tile_x, tile_y; uint32_t format; - gl_format rb_format = intel_rb_format(irb); + /* _NEW_BUFFERS */ + gl_format rb_format = _mesa_get_render_format(ctx, intel_rb_format(irb)); uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 8 * 4, 32, &brw->wm.surf_offset[unit]); @@ -538,26 +540,11 @@ gen7_update_renderbuffer_surface(struct brw_context *brw, /* Render targets can't use IMS layout */ assert(irb->mt->msaa_layout != INTEL_MSAA_LAYOUT_IMS); - switch (rb_format) { - case MESA_FORMAT_SARGB8: - /* _NEW_BUFFERS - * - * Without GL_EXT_framebuffer_sRGB we shouldn't bind sRGB surfaces to the - * blend/update as sRGB. - */ - if (ctx->Color.sRGBEnabled) - format = brw_format_for_mesa_format(rb_format); - else - format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - break; - default: - assert(brw_render_target_supported(intel, rb)); - format = brw->render_target_format[rb_format]; - if (unlikely(!brw->format_supported_as_render_target[rb_format])) { - _mesa_problem(ctx, "%s: renderbuffer format %s unsupported\n", - __FUNCTION__, _mesa_get_format_name(rb_format)); - } - break; + assert(brw_render_target_supported(intel, rb)); + format = brw->render_target_format[rb_format]; + if (unlikely(!brw->format_supported_as_render_target[rb_format])) { + _mesa_problem(ctx, "%s: renderbuffer format %s unsupported\n", + __FUNCTION__, _mesa_get_format_name(rb_format)); } surf[0] = BRW_SURFACE_2D << BRW_SURFACE_TYPE_SHIFT | |