[Mesa-dev] [RFC PATCH] ARB_vp/ARB_fp: accept duplicate precision options
Ian Romanick
idr at freedesktop.org
Tue May 21 14:33:59 PDT 2013
On 05/18/2013 11:18 PM, Chris Forbes wrote:
> Relaxes the validation of
>
> OPTION ARB_precision_hint_{nicest,fastest};
>
> to allow duplicate options. The spec says that both /nicest/ and
> /fastest/ cannot be specified together, but could be interpreted
> either way for respecification of the same option.
>
> Other drivers (NVIDIA etc) accept this, and at least one Unity3D game
> expects it to succeed (Kerbal Space Program).
NOTE: This is a candidate for stable release branches.
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
> src/mesa/program/program_parse_extra.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/program/program_parse_extra.c b/src/mesa/program/program_parse_extra.c
> index 4d92848..eb1fccc 100644
> --- a/src/mesa/program/program_parse_extra.c
> +++ b/src/mesa/program/program_parse_extra.c
> @@ -194,15 +194,13 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option)
> } else if (strncmp(option, "precision_hint_", 15) == 0) {
> option += 15;
>
> - if (state->option.PrecisionHint == OPTION_NONE) {
> - if (strcmp(option, "nicest") == 0) {
> - state->option.PrecisionHint = OPTION_NICEST;
> - return 1;
> - } else if (strcmp(option, "fastest") == 0) {
> - state->option.PrecisionHint = OPTION_FASTEST;
> - return 1;
> - }
> - }
I think it's worth quoting the bit of spec that Eric mentioned in a
comment here. With or without that change, this patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> + if (strcmp(option, "nicest") == 0 && state->option.PrecisionHint != OPTION_FASTEST) {
> + state->option.PrecisionHint = OPTION_NICEST;
> + return 1;
> + } else if (strcmp(option, "fastest") == 0 && state->option.PrecisionHint != OPTION_NICEST) {
> + state->option.PrecisionHint = OPTION_FASTEST;
> + return 1;
> + }
>
> return 0;
> } else if (strcmp(option, "draw_buffers") == 0) {
>
More information about the mesa-dev
mailing list