[Mesa-dev] [PATCH 1/2] i965: in brw_link_shader() react to low memory
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Thu Feb 4 15:16:43 UTC 2016
On Wed, 2016-02-03 at 10:56 +0200, Juha-Pekka Heikkila wrote:
> Check _mesa_new_parameter_list() returned other than null.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
> src/mesa/drivers/dri/i965/brw_link.cpp | 4 ++++
> src/mesa/main/ff_fragment_shader.cpp | 6 ++++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp
> b/src/mesa/drivers/dri/i965/brw_link.cpp
> index db4ba88..5411fb8 100644
> --- a/src/mesa/drivers/dri/i965/brw_link.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_link.cpp
> @@ -221,6 +221,10 @@ brw_link_shader(struct gl_context *ctx, struct
> gl_shader_program *shProg)
> if (!prog)
> return false;
> prog->Parameters = _mesa_new_parameter_list();
> + if (!prog->Parameters) {
> + _mesa_error(ctx, GL_OUT_OF_MEMORY, "brw_link_shader");
> + return false;
> + }
>
> _mesa_copy_linked_program_data((gl_shader_stage) stage,
> shProg, prog);
>
> diff --git a/src/mesa/main/ff_fragment_shader.cpp
> b/src/mesa/main/ff_fragment_shader.cpp
> index b0ce8c4..611deff 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -1264,9 +1264,11 @@ create_new_program(struct gl_context *ctx,
> struct state_key *key)
>
> _mesa_glsl_link_shader(ctx, p.shader_program);
>
> - if (!p.shader_program->LinkStatus)
> + if (!p.shader_program->LinkStatus) {
> _mesa_problem(ctx, "Failed to link fixed function fragment
> shader: %s\n",
> - p.shader_program->InfoLog);
> + (p.shader_program->InfoLog)?p.shader_program-
> >InfoLog:
> + "Out of Memory");
> + }
>
Please add whitespace after '?' and also before ':'. There is no need
of enclosing p.shader_program->InfoLog with parenthesis.
Other than that,
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Sam
> ralloc_free(p.mem_ctx);
> return p.shader_program;
More information about the mesa-dev
mailing list