diff options
author | Kenneth Graunke <[email protected]> | 2013-09-30 18:11:03 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-10-09 16:36:49 -0700 |
commit | 6f7c41dd1dcc6a636dd99e5d1a3c459918481938 (patch) | |
tree | a5805eacbba153ec8f67129278a73aa015bbdce9 | |
parent | 4b2e819e10138dba6961d44f07af6de13750a832 (diff) |
i965/blorp: Add support for non-render-target formats.
Once blorp gains the ability to do format conversions, it's conceivable
that the source format may be texturable but not supported as a render
target. This would break Paul's code, which assumes that it can use the
render_target_format array even for the source format.
There are three ways to convert MESA_FORMAT enums to BRW_SURFACEFORMAT
enums:
1. brw_format_for_mesa_format()
This translates the Mesa format to the most equivalent BRW format.
2. brw->render_target_format[]
This is used for renderbuffers, and handles the subset of formats
that are renderable. However, it's not always equivalent, since
it overrides a few non-renderable formats. For example, it
converts B8G8R8X8_UNORM to B8G8R8A8_UNORM so it can be rendered to.
3. translate_tex_format()
This is used for textures. It wraps brw_format_for_mesa_format(),
but overrides depth textures, and one sRGB case on Gen4.
BLORP has a fourth function, which uses brw->render_target_format[]
and overrides depth formats (differently than translate_tex_format).
This patch makes the BLORP function to use brw_format_for_mesa_format()
for textures/source data, since not everything will be a render target.
It continues using brw->render_target_format[] for render targets, since
it needs the format overrides that provides.
We don't use translate_tex_format() since the additional overrides are
not useful or simply redundant.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp index e519cd91d8f..f5731b6c0f9 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp @@ -26,6 +26,7 @@ #include "brw_blorp.h" #include "brw_defines.h" +#include "brw_state.h" #include "gen6_blorp.h" #include "gen7_blorp.h" @@ -103,13 +104,12 @@ brw_blorp_surface_info::set(struct brw_context *brw, this->brw_surfaceformat = BRW_SURFACEFORMAT_R8G8_UNORM; break; default: - /* Blorp blits don't support any sort of format conversion (except - * between sRGB and linear), so we can safely assume that the format is - * supported as a render target, even if this is the source image. So - * we can convert to a surface format using brw->render_target_format. - */ - assert(brw->format_supported_as_render_target[mt->format]); - this->brw_surfaceformat = brw->render_target_format[mt->format]; + if (is_render_target) { + assert(brw->format_supported_as_render_target[mt->format]); + this->brw_surfaceformat = brw->render_target_format[mt->format]; + } else { + this->brw_surfaceformat = brw_format_for_mesa_format(mt->format); + } break; } } |