[Mesa-dev] [PATCH 13/17] glsl/lexer: Support double floats (was: add double support)
Matt Turner
mattst88 at gmail.com
Thu Feb 5 11:11:48 PST 2015
On Thu, Feb 5, 2015 at 3:05 AM, Topi Pohjolainen
<topi.pohjolainen at intel.com> wrote:
> From: Dave Airlie <airlied at gmail.com>
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/glsl/glsl_lexer.ll | 42 ++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
> index 57c46be..de58e73 100644
> --- a/src/glsl/glsl_lexer.ll
> +++ b/src/glsl/glsl_lexer.ll
> @@ -458,6 +458,27 @@ layout {
> return FLOATCONSTANT;
> }
>
> +[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?(lf|LF) {
> + yylval->dreal = _mesa_strtod(yytext, NULL);
> + return DOUBLECONSTANT;
> + }
> +\.[0-9]+([eE][+-]?[0-9]+)?(lf|LF) {
> + yylval->dreal = _mesa_strtod(yytext, NULL);
> + return DOUBLECONSTANT;
> + }
> +[0-9]+\.([eE][+-]?[0-9]+)?(lf|LF) {
> + yylval->dreal = _mesa_strtod(yytext, NULL);
> + return DOUBLECONSTANT;
> + }
> +[0-9]+[eE][+-]?[0-9]+(lf|LF) {
> + yylval->dreal = _mesa_strtod(yytext, NULL);
> + return DOUBLECONSTANT;
> + }
> +[0-9]+(lf|LF) {
> + yylval->dreal = _mesa_strtod(yytext, NULL);
> + return DOUBLECONSTANT;
> + }
The FLOATCONST code has been simplified. This code should do the new
thing as well.
> +
> true {
> yylval->n = 1;
> return BOOLCONSTANT;
> @@ -489,7 +510,7 @@ external KEYWORD(110, 100, 0, 0, EXTERNAL);
> interface KEYWORD(110, 100, 0, 0, INTERFACE);
> long KEYWORD(110, 100, 0, 0, LONG_TOK);
> short KEYWORD(110, 100, 0, 0, SHORT_TOK);
> -double KEYWORD(110, 100, 400, 0, DOUBLE_TOK);
> +double KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DOUBLE_TOK);
> half KEYWORD(110, 100, 0, 0, HALF);
> fixed KEYWORD(110, 100, 0, 0, FIXED_TOK);
> unsigned KEYWORD(110, 100, 0, 0, UNSIGNED);
> @@ -498,9 +519,22 @@ output KEYWORD(110, 100, 0, 0, OUTPUT);
> hvec2 KEYWORD(110, 100, 0, 0, HVEC2);
> hvec3 KEYWORD(110, 100, 0, 0, HVEC3);
> hvec4 KEYWORD(110, 100, 0, 0, HVEC4);
> -dvec2 KEYWORD(110, 100, 400, 0, DVEC2);
> -dvec3 KEYWORD(110, 100, 400, 0, DVEC3);
> -dvec4 KEYWORD(110, 100, 400, 0, DVEC4);
> +dvec2 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DVEC2);
> +dvec3 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DVEC3);
> +dvec4 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DVEC4);
> +dmat2 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT2X2);
> +dmat3 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT3X3);
> +dmat4 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT4X4);
> +dmat2x2 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT2X2);
> +dmat2x3 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT2X3);
> +dmat2x4 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT2X4);
> +dmat3x2 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT3X2);
> +dmat3x3 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT3X3);
> +dmat3x4 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT3X4);
> +dmat4x2 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT4X2);
> +dmat4x3 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT4X3);
> +dmat4x4 KEYWORD_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, DMAT4X4);
> +
Extra new line.
Shouldn't this and the previous hunk have been in the previous patch?
> fvec2 KEYWORD(110, 100, 0, 0, FVEC2);
> fvec3 KEYWORD(110, 100, 0, 0, FVEC3);
> fvec4 KEYWORD(110, 100, 0, 0, FVEC4);
More information about the mesa-dev
mailing list