[Mesa-dev] [PATCH 1/5] st/formats: split choose format into non-erroring internal version
Dave Airlie
airlied at gmail.com
Thu Apr 11 01:41:20 PDT 2013
>
> This allows us to reuse this for choosing formats for MSAA limits.
Self-review, this one has a bug, I've changed in the branch
gallium-texture-multisample in my tree to take a problem boolean and
only report the problem in that case, as PIPE_FORMAT_NONE wasn't
always indicative of a problem.
Dave.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/mesa/state_tracker/st_format.c | 24 +++++++++++++++++++-----
> src/mesa/state_tracker/st_format.h | 5 +++++
> 2 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
> index c9c6163..ee72bda 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -1614,10 +1614,10 @@ find_exact_format(GLint internalFormat, GLenum format, GLenum type)
> * when we're getting called from gl[Copy]TexImage().
> */
> enum pipe_format
> -st_choose_format(struct st_context *st, GLenum internalFormat,
> - GLenum format, GLenum type,
> - enum pipe_texture_target target, unsigned sample_count,
> - unsigned bindings, boolean allow_dxt)
> +st_choose_format_internal(struct st_context *st, GLenum internalFormat,
> + GLenum format, GLenum type,
> + enum pipe_texture_target target, unsigned sample_count,
> + unsigned bindings, boolean allow_dxt)
> {
> struct pipe_screen *screen = st->pipe->screen;
> int i, j;
> @@ -1651,10 +1651,24 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
> }
> }
>
> - _mesa_problem(NULL, "unhandled format!\n");
> return PIPE_FORMAT_NONE;
> }
>
> +enum pipe_format
> +st_choose_format(struct st_context *st, GLenum internalFormat,
> + GLenum format, GLenum type,
> + enum pipe_texture_target target, unsigned sample_count,
> + unsigned bindings, boolean allow_dxt)
> +{
> + enum pipe_format pformat;
> +
> + pformat = st_choose_format_internal(st, internalFormat, format, type,
> + target, sample_count, bindings,
> + allow_dxt);
> + if (pformat == PIPE_FORMAT_NONE)
> + _mesa_problem(NULL, "unhandled format!\n");
> + return pformat;
> +}
>
> /**
> * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces.
> diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h
> index 0a1c18d..9f1d4ef 100644
> --- a/src/mesa/state_tracker/st_format.h
> +++ b/src/mesa/state_tracker/st_format.h
> @@ -46,6 +46,11 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat);
> extern gl_format
> st_pipe_format_to_mesa_format(enum pipe_format pipeFormat);
>
> +extern enum pipe_format
> +st_choose_format_internal(struct st_context *st, GLenum internalFormat,
> + GLenum format, GLenum type,
> + enum pipe_texture_target target, unsigned sample_count,
> + unsigned bindings, boolean allow_dxt);
>
> extern enum pipe_format
> st_choose_format(struct st_context *st, GLenum internalFormat,
> --
> 1.8.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list