diff options
Diffstat (limited to 'mesalib/src')
25 files changed, 289 insertions, 178 deletions
diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc index e70a1363e..73d65a4d1 100644 --- a/mesalib/src/gallium/Automake.inc +++ b/mesalib/src/gallium/Automake.inc @@ -26,19 +26,6 @@ GALLIUM_DRIVER_CXXFLAGS = \ $(DEFINES) \ $(VISIBILITY_CXXFLAGS) -GALLIUM_DRI_CFLAGS = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/gallium/include \ - -I$(top_srcdir)/src/gallium/auxiliary \ - -I$(top_srcdir)/src/gallium/drivers \ - -I$(top_srcdir)/src/gallium/winsys \ - -I$(top_srcdir)/src/mesa \ - -I$(top_srcdir)/src/mapi \ - $(DEFINES) \ - $(PTHREAD_CFLAGS) \ - $(LIBDRM_CFLAGS) \ - $(VISIBILITY_CFLAGS) - GALLIUM_TARGET_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/loader \ @@ -51,35 +38,12 @@ GALLIUM_TARGET_CFLAGS = \ $(LIBDRM_CFLAGS) \ $(VISIBILITY_CFLAGS) - -GALLIUM_DRI_LINKER_FLAGS = \ - -shared \ - -shrext .so \ - -module \ - -avoid-version \ - $(GC_SECTIONS) - -if HAVE_LD_VERSION_SCRIPT -GALLIUM_DRI_LINKER_FLAGS += \ - -Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri/dri.sym - -endif - - GALLIUM_COMMON_LIB_DEPS = \ -lm \ $(CLOCK_LIB) \ $(PTHREAD_LIBS) \ $(DLOPEN_LIBS) -GALLIUM_DRI_LIB_DEPS = \ - $(top_builddir)/src/mesa/libmesagallium.la \ - $(top_builddir)/src/gallium/auxiliary/libgallium.la \ - $(SELINUX_LIBS) \ - $(LIBDRM_LIBS) \ - $(EXPAT_LIBS) \ - $(GALLIUM_COMMON_LIB_DEPS) - GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/gallium/include \ @@ -87,11 +51,6 @@ GALLIUM_WINSYS_CFLAGS = \ $(DEFINES) \ $(VISIBILITY_CFLAGS) -if HAVE_MESA_LLVM -GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS) -GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS) -endif - GALLIUM_PIPE_LOADER_WINSYS_LIBS = \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript index df71b9aea..8d9849e00 100644 --- a/mesalib/src/gallium/SConscript +++ b/mesalib/src/gallium/SConscript @@ -107,7 +107,6 @@ if not env['embedded']: if env['dri']: SConscript([ - 'targets/dri-swrast/SConscript', 'targets/dri/SConscript', ]) diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index db0d1b894..20fbd80d5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -383,6 +383,15 @@ void util_blitter_destroy(struct blitter_context *blitter) if (ctx->fs_texfetch_stencil[i]) ctx->delete_fs_state(pipe, ctx->fs_texfetch_stencil[i]); + if (ctx->fs_texfetch_col_msaa[i]) + ctx->delete_fs_state(pipe, ctx->fs_texfetch_col_msaa[i]); + if (ctx->fs_texfetch_depth_msaa[i]) + ctx->delete_fs_state(pipe, ctx->fs_texfetch_depth_msaa[i]); + if (ctx->fs_texfetch_depthstencil_msaa[i]) + ctx->delete_fs_state(pipe, ctx->fs_texfetch_depthstencil_msaa[i]); + if (ctx->fs_texfetch_stencil_msaa[i]) + ctx->delete_fs_state(pipe, ctx->fs_texfetch_stencil_msaa[i]); + for (j = 0; j< Elements(ctx->fs_resolve[i]); j++) for (f = 0; f < 2; f++) if (ctx->fs_resolve[i][j][f]) diff --git a/mesalib/src/gallium/auxiliary/util/u_transfer.c b/mesalib/src/gallium/auxiliary/util/u_transfer.c index 7804f2a82..71da35d6d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_transfer.c +++ b/mesalib/src/gallium/auxiliary/util/u_transfer.c @@ -25,8 +25,8 @@ void u_default_transfer_inline_write( struct pipe_context *pipe, usage |= PIPE_TRANSFER_WRITE; /* transfer_inline_write implicitly discards the rewritten buffer range */ - /* XXX this looks very broken for non-buffer resources having more than one dim. */ - if (box->x == 0 && box->width == resource->width0) { + if (resource->target == PIPE_BUFFER && + box->x == 0 && box->width == resource->width0) { usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE; } else { usage |= PIPE_TRANSFER_DISCARD_RANGE; diff --git a/mesalib/src/glsl/ast_type.cpp b/mesalib/src/glsl/ast_type.cpp index de4c1a410..b596cd59e 100644 --- a/mesalib/src/glsl/ast_type.cpp +++ b/mesalib/src/glsl/ast_type.cpp @@ -168,6 +168,16 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, this->max_vertices = q.max_vertices; } + if (q.flags.q.invocations) { + if (this->flags.q.invocations && this->invocations != q.invocations) { + _mesa_glsl_error(loc, state, + "geometry shader set conflicting invocations " + "(%d and %d)", this->invocations, q.invocations); + return false; + } + this->invocations = q.invocations; + } + if (state->stage == MESA_SHADER_GEOMETRY && state->has_explicit_attrib_stream()) { if (q.flags.q.stream && q.stream >= state->ctx->Const.MaxVertexStreams) { diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l index 188e45466..a1a8e76af 100644 --- a/mesalib/src/glsl/glcpp/glcpp-lex.l +++ b/mesalib/src/glsl/glcpp/glcpp-lex.l @@ -76,6 +76,7 @@ NEWLINE [\n] HSPACE [ \t] HASH ^{HSPACE}*#{HSPACE}* IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]* +PP_NUMBER [.]?[0-9]([._a-zA-Z0-9]|[eEpP][-+])* PUNCTUATION [][(){}.&*~!/%<>^|;,=+-] /* The OTHER class is simply a catch-all for things that the CPP @@ -137,14 +138,15 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? * 2. The skip_stack is NULL meaning that we've reached * the last #endif. * - * 3. The lexing_if bit is set. This indicates that we - * are lexing the expression following an "#if" of - * "#elif". Even inside an "#if 0" we need to lex this - * expression so the parser can correctly update the - * skip_stack state. + * 3. The lexing_directive bit is set. This indicates that we are + * lexing a pre-processor directive, (such as #if, #elif, or + * #else). For the #if and #elif directives we always need to + * parse the conditions, (even if otherwise within an #if + * 0). And for #else, we want to be able to generate an error + * if any garbage follows #else. */ if (YY_START == INITIAL || YY_START == SKIP) { - if (parser->lexing_if || + if (parser->lexing_directive || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) { @@ -178,7 +180,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* glcpp doesn't handle #extension, #version, or #pragma directives. * Simply pass them through to the main compiler's lexer/parser. */ -{HASH}(extension|pragma)[^\n]+ { +{HASH}(extension|pragma)[^\n]* { if (parser->commented_newlines) BEGIN NEWLINE_CATCHUP; yylval->str = ralloc_strdup (yyextra, yytext); @@ -193,25 +195,25 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? <SKIP,INITIAL>{ {HASH}ifdef { - yyextra->lexing_if = 1; + yyextra->lexing_directive = 1; yyextra->space_tokens = 0; return HASH_IFDEF; } {HASH}ifndef { - yyextra->lexing_if = 1; + yyextra->lexing_directive = 1; yyextra->space_tokens = 0; return HASH_IFNDEF; } {HASH}if/[^_a-zA-Z0-9] { - yyextra->lexing_if = 1; + yyextra->lexing_directive = 1; yyextra->space_tokens = 0; return HASH_IF; } {HASH}elif/[^_a-zA-Z0-9] { - yyextra->lexing_if = 1; + yyextra->lexing_directive = 1; yyextra->space_tokens = 0; return HASH_ELIF; } @@ -329,6 +331,11 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return IDENTIFIER; } +{PP_NUMBER} { + yylval->str = ralloc_strdup (yyextra, yytext); + return OTHER; +} + {PUNCTUATION} { return yytext[0]; } @@ -348,7 +355,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? if (parser->commented_newlines) { BEGIN NEWLINE_CATCHUP; } - yyextra->lexing_if = 0; + yyextra->lexing_directive = 0; yylineno++; yycolumn = 0; return NEWLINE; @@ -357,7 +364,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* Handle missing newline at EOF. */ <INITIAL><<EOF>> { BEGIN DONE; /* Don't keep matching this rule forever. */ - yyextra->lexing_if = 0; + yyextra->lexing_directive = 0; return NEWLINE; } diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index ccf810559..084078eb0 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -166,7 +166,8 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); %expect 0 %token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE FUNC_IDENTIFIER OBJ_IDENTIFIER HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_LINE HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE %token PASTE -%type <ival> expression INTEGER operator SPACE integer_constant +%type <ival> INTEGER operator SPACE integer_constant +%type <expression_value> expression %type <str> IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER %type <string_list> identifier_list %type <token> preprocessing_token conditional_token @@ -216,10 +217,14 @@ line: expanded_line: IF_EXPANDED expression NEWLINE { - _glcpp_parser_skip_stack_push_if (parser, & @1, $2); + if (parser->is_gles && $2.undefined_macro) + glcpp_error(& @1, parser, "undefined macro %s in expression (illegal in GLES)", $2.undefined_macro); + _glcpp_parser_skip_stack_push_if (parser, & @1, $2.value); } | ELIF_EXPANDED expression NEWLINE { - _glcpp_parser_skip_stack_change_if (parser, & @1, "elif", $2); + if (parser->is_gles && $2.undefined_macro) + glcpp_error(& @1, parser, "undefined macro %s in expression (illegal in GLES)", $2.undefined_macro); + _glcpp_parser_skip_stack_change_if (parser, & @1, "elif", $2.value); } | LINE_EXPANDED integer_constant NEWLINE { parser->has_new_line_number = 1; @@ -260,7 +265,14 @@ control_line: | HASH_UNDEF { glcpp_parser_resolve_implicit_version(parser); } IDENTIFIER NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $3); + macro_t *macro; + if (strcmp("__LINE__", $3) == 0 + || strcmp("__FILE__", $3) == 0 + || strcmp("__VERSION__", $3) == 0) + glcpp_error(& @1, parser, "Built-in (pre-defined)" + " macro names can not be undefined."); + + macro = hash_table_find (parser->defines, $3); if (macro) { hash_table_remove (parser->defines, $3); ralloc_free (macro); @@ -358,7 +370,7 @@ control_line: glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); } } -| HASH_ELSE { +| HASH_ELSE { parser->lexing_directive = 1; } NEWLINE { if (parser->skip_stack && parser->skip_stack->has_else) { @@ -370,7 +382,7 @@ control_line: if (parser->skip_stack) parser->skip_stack->has_else = true; } - } NEWLINE + } | HASH_ENDIF { _glcpp_parser_skip_stack_pop (parser, & @1); } NEWLINE @@ -406,87 +418,176 @@ integer_constant: } expression: - integer_constant + integer_constant { + $$.value = $1; + $$.undefined_macro = NULL; + } | IDENTIFIER { + $$.value = 0; if (parser->is_gles) - glcpp_error(& @1, parser, "undefined macro %s in expression (illegal in GLES)", $1); - $$ = 0; + $$.undefined_macro = ralloc_strdup (parser, $1); + else + $$.undefined_macro = NULL; } | expression OR expression { - $$ = $1 || $3; + $$.value = $1.value || $3.value; + + /* Short-circuit: Only flag undefined from right side + * if left side evaluates to false. + */ + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else if (! $1.value) + $$.undefined_macro = $3.undefined_macro; } | expression AND expression { - $$ = $1 && $3; + $$.value = $1.value && $3.value; + + /* Short-circuit: Only flag undefined from right-side + * if left side evaluates to true. + */ + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else if ($1.value) + $$.undefined_macro = $3.undefined_macro; } | expression '|' expression { - $$ = $1 | $3; + $$.value = $1.value | $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '^' expression { - $$ = $1 ^ $3; + $$.value = $1.value ^ $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '&' expression { - $$ = $1 & $3; + $$.value = $1.value & $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression NOT_EQUAL expression { - $$ = $1 != $3; + $$.value = $1.value != $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression EQUAL expression { - $$ = $1 == $3; + $$.value = $1.value == $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression GREATER_OR_EQUAL expression { - $$ = $1 >= $3; + $$.value = $1.value >= $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression LESS_OR_EQUAL expression { - $$ = $1 <= $3; + $$.value = $1.value <= $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '>' expression { - $$ = $1 > $3; + $$.value = $1.value > $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '<' expression { - $$ = $1 < $3; + $$.value = $1.value < $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression RIGHT_SHIFT expression { - $$ = $1 >> $3; + $$.value = $1.value >> $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression LEFT_SHIFT expression { - $$ = $1 << $3; + $$.value = $1.value << $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '-' expression { - $$ = $1 - $3; + $$.value = $1.value - $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '+' expression { - $$ = $1 + $3; + $$.value = $1.value + $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '%' expression { - if ($3 == 0) { + if ($3.value == 0) { yyerror (& @1, parser, "zero modulus in preprocessor directive"); } else { - $$ = $1 % $3; + $$.value = $1.value % $3.value; } + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '/' expression { - if ($3 == 0) { + if ($3.value == 0) { yyerror (& @1, parser, "division by 0 in preprocessor directive"); } else { - $$ = $1 / $3; + $$.value = $1.value / $3.value; } + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | expression '*' expression { - $$ = $1 * $3; + $$.value = $1.value * $3.value; + if ($1.undefined_macro) + $$.undefined_macro = $1.undefined_macro; + else + $$.undefined_macro = $3.undefined_macro; } | '!' expression %prec UNARY { - $$ = ! $2; + $$.value = ! $2.value; + $$.undefined_macro = $2.undefined_macro; } | '~' expression %prec UNARY { - $$ = ~ $2; + $$.value = ~ $2.value; + $$.undefined_macro = $2.undefined_macro; } | '-' expression %prec UNARY { - $$ = - $2; + $$.value = - $2.value; + $$.undefined_macro = $2.undefined_macro; } | '+' expression %prec UNARY { - $$ = + $2; + $$.value = + $2.value; + $$.undefined_macro = $2.undefined_macro; } | '(' expression ')' { $$ = $2; @@ -525,7 +626,7 @@ replacement_list: junk: /* empty */ | pp_tokens { - glcpp_warning(&@1, parser, "extra tokens at end of directive"); + glcpp_error(&@1, parser, "extra tokens at end of directive"); } ; @@ -933,14 +1034,16 @@ _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b) if (node_a == NULL || node_b == NULL) return 0; - - if (node_a->token->type == SPACE) { - node_a = node_a->next; - continue; - } - - if (node_b->token->type == SPACE) { - node_b = node_b->next; + /* Make sure whitespace appears in the same places in both. + * It need not be exactly the same amount of whitespace, + * though. + */ + if (node_a->token->type == SPACE + && node_b->token->type == SPACE) { + while (node_a->token->type == SPACE) + node_a = node_a->next; + while (node_b->token->type == SPACE) + node_b = node_b->next; continue; } @@ -1203,7 +1306,7 @@ glcpp_parser_create (const struct gl_extensions *extensions, gl_api api) parser->defines = hash_table_ctor (32, hash_table_string_hash, hash_table_string_compare); parser->active = NULL; - parser->lexing_if = 0; + parser->lexing_directive = 0; parser->space_tokens = 1; parser->newline_as_space = 0; parser->in_control_line = 0; diff --git a/mesalib/src/glsl/glcpp/glcpp.h b/mesalib/src/glsl/glcpp/glcpp.h index 79ccb234f..64b487202 100644 --- a/mesalib/src/glsl/glcpp/glcpp.h +++ b/mesalib/src/glsl/glcpp/glcpp.h @@ -37,6 +37,12 @@ /* Some data types used for parser values. */ +typedef struct expression_value { + intmax_t value; + char *undefined_macro; +} expression_value_t; + + typedef struct string_node { const char *str; struct string_node *next; @@ -53,6 +59,7 @@ typedef struct token_list token_list_t; typedef union YYSTYPE { intmax_t ival; + expression_value_t expression_value; char *str; string_list_t *string_list; token_t *token; @@ -168,7 +175,7 @@ struct glcpp_parser { yyscan_t scanner; struct hash_table *defines; active_list_t *active; - int lexing_if; + int lexing_directive; int space_tokens; int newline_as_space; int in_control_line; diff --git a/mesalib/src/glsl/list.h b/mesalib/src/glsl/list.h index 0cffaee7b..9f08d45f7 100644 --- a/mesalib/src/glsl/list.h +++ b/mesalib/src/glsl/list.h @@ -573,9 +573,9 @@ inline void exec_node::insert_before(exec_list *before) !(__inst)->is_tail_sentinel(); \ (__inst) = (__type *)(__inst)->next) -#define foreach_in_list_reverse(__type, __inst, __list) \ - for (__type *(__inst) = (__type *)(__list)->head; \ - !(__inst)->is_head_sentinel(); \ +#define foreach_in_list_reverse(__type, __inst, __list) \ + for (__type *(__inst) = (__type *)(__list)->tail_pred; \ + !(__inst)->is_head_sentinel(); \ (__inst) = (__type *)(__inst)->prev) /** diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index f1f57297c..89d7a157c 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -217,6 +217,7 @@ _mesa_meta_compile_and_link_program(struct gl_context *ctx, fs_source); *program = _mesa_CreateProgram(); + _mesa_ObjectLabel(GL_PROGRAM, *program, -1, name); _mesa_AttachShader(*program, fs); _mesa_DeleteShader(fs); _mesa_AttachShader(*program, vs); @@ -224,7 +225,6 @@ _mesa_meta_compile_and_link_program(struct gl_context *ctx, _mesa_BindAttribLocation(*program, 0, "position"); _mesa_BindAttribLocation(*program, 1, "texcoords"); _mesa_meta_link_program_with_debug(ctx, *program); - _mesa_ObjectLabel(GL_PROGRAM, *program, -1, name); _mesa_UseProgram(*program); } diff --git a/mesalib/src/mesa/drivers/dri/common/SConscript b/mesalib/src/mesa/drivers/dri/common/SConscript index 41f6356c3..d003139bf 100644 --- a/mesalib/src/mesa/drivers/dri/common/SConscript +++ b/mesalib/src/mesa/drivers/dri/common/SConscript @@ -27,58 +27,50 @@ drienv.Replace(CPPPATH = [ '#src/egl/drivers/dri', ]) -driswenv = drienv.Clone() -driswenv.Append(CPPDEFINES = [ - '__NOT_HAVE_DRM_H', - 'HAVE_DLADDR', +drienv.AppendUnique(LIBS = [ + 'expat', ]) +# if HAVE_DRI2 drienv.PkgUseModules('DRM') +# else +#env.Append(CPPDEFINES = ['__NOT_HAVE_DRM_H']) -dri_common_utils = drienv.SharedObject( - target = 'utils.o', - source = '#src/mesa/drivers/dri/common/utils.c' -) +sources = drienv.ParseSourceList('Makefile.sources', 'DRI_COMMON_FILES') -dri_common_xmlconfig = drienv.SharedObject( - target = 'xmlconfig.o', - source = '#src/mesa/drivers/dri/common/xmlconfig.c' +dri_common = drienv.ConvenienceLibrary( + target = 'dri_common', + source = sources, ) -dri_common_dri_util = drienv.SharedObject( - target = 'dri_util.o', - source = '#src/mesa/drivers/dri/common/dri_util.c' -) - -dri_common_drisw_util = driswenv.SharedObject( - target = 'drisw_util.o', - source = '#src/mesa/drivers/dri/common/dri_util.c' -) +# +# megadrivers_stub +# +env = env.Clone() +env.Append(CPPPATH = [ + '#/include', + '#/src/', + '#/src/mapi', + '#/src/mesa', +]) -COMMON_DRI_SW_OBJECTS = [ - dri_common_utils, - dri_common_xmlconfig, - dri_common_drisw_util, -] +env.Append(CPPDEFINES = [ + '__NOT_HAVE_DRM_H', + 'HAVE_DLADDR', +]) -COMMON_DRI_DRM_OBJECTS = [ - dri_common_utils, - dri_common_xmlconfig, - dri_common_dri_util, -] +sources = env.ParseSourceList('Makefile.sources', 'megadriver_stub_FILES') -drienv.AppendUnique(LIBS = [ - 'expat', -]) +megadrivers_stub = env.ConvenienceLibrary( + target = 'megadrivers_stub', + source = sources, +) -driswenv.AppendUnique(LIBS = [ - 'expat', -]) +env.Alias('megadrivers_stub', megadrivers_stub) Export([ 'drienv', - 'driswenv', - 'COMMON_DRI_SW_OBJECTS', - 'COMMON_DRI_DRM_OBJECTS', + 'dri_common', + 'megadrivers_stub', ]) diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index b08215950..50aae8bf6 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1215,6 +1215,9 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL); + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL); + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 2c4f3d7df..8758b5e9d 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -914,54 +914,54 @@ static void load_texture( texenv_fragment_program *p, GLuint unit ) switch (texTarget) { case TEXTURE_1D_INDEX: if (p->state->unit[unit].shadow) - sampler_type = p->shader->symbols->get_type("sampler1DShadow"); + sampler_type = glsl_type::sampler1DShadow_type; else - sampler_type = p->shader->symbols->get_type("sampler1D"); + sampler_type = glsl_type::sampler1D_type; coords = 1; break; case TEXTURE_1D_ARRAY_INDEX: if (p->state->unit[unit].shadow) - sampler_type = p->shader->symbols->get_type("sampler1DArrayShadow"); + sampler_type = glsl_type::sampler1DArrayShadow_type; else - sampler_type = p->shader->symbols->get_type("sampler1DArray"); + sampler_type = glsl_type::sampler1DArray_type; coords = 2; break; case TEXTURE_2D_INDEX: if (p->state->unit[unit].shadow) - sampler_type = p->shader->symbols->get_type("sampler2DShadow"); + sampler_type = glsl_type::sampler2DShadow_type; else - sampler_type = p->shader->symbols->get_type("sampler2D"); + sampler_type = glsl_type::sampler2D_type; coords = 2; break; case TEXTURE_2D_ARRAY_INDEX: if (p->state->unit[unit].shadow) - sampler_type = p->shader->symbols->get_type("sampler2DArrayShadow"); + sampler_type = glsl_type::sampler2DArrayShadow_type; else - sampler_type = p->shader->symbols->get_type("sampler2DArray"); + sampler_type = glsl_type::sampler2DArray_type; coords = 3; break; case TEXTURE_RECT_INDEX: if (p->state->unit[unit].shadow) - sampler_type = p->shader->symbols->get_type("sampler2DRectShadow"); + sampler_type = glsl_type::sampler2DRectShadow_type; else - sampler_type = p->shader->symbols->get_type("sampler2DRect"); + sampler_type = glsl_type::sampler2DRect_type; coords = 2; break; case TEXTURE_3D_INDEX: assert(!p->state->unit[unit].shadow); - sampler_type = p->shader->symbols->get_type("sampler3D"); + sampler_type = glsl_type::sampler3D_type; coords = 3; break; case TEXTURE_CUBE_INDEX: if (p->state->unit[unit].shadow) - sampler_type = p->shader->symbols->get_type("samplerCubeShadow"); + sampler_type = glsl_type::samplerCubeShadow_type; else - sampler_type = p->shader->symbols->get_type("samplerCube"); + sampler_type = glsl_type::samplerCube_type; coords = 3; break; case TEXTURE_EXTERNAL_INDEX: assert(!p->state->unit[unit].shadow); - sampler_type = p->shader->symbols->get_type("samplerExternalOES"); + sampler_type = glsl_type::samplerExternalOES_type; coords = 2; break; } @@ -1241,7 +1241,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key) state->symbols->add_function(main_f); ir_function_signature *main_sig = - new(p.mem_ctx) ir_function_signature(p.shader->symbols->get_type("void")); + new(p.mem_ctx) ir_function_signature(glsl_type::void_type); main_sig->is_defined = true; main_f->add_signature(main_sig); diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c index 599cdee74..1f3fa0c15 100644 --- a/mesalib/src/mesa/main/multisample.c +++ b/mesalib/src/mesa/main/multisample.c @@ -89,7 +89,7 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) /* winsys FBOs are upside down */ if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) - val[1] = 1 - val[1]; + val[1] = 1.0f - val[1]; return; } diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index dc22025c2..5ae7014b1 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -312,6 +312,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) _mesa_DeleteHashTable(shared->Programs); _mesa_reference_vertprog(ctx, &shared->DefaultVertexProgram, NULL); + _mesa_reference_geomprog(ctx, &shared->DefaultGeometryProgram, NULL); _mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL); _mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx); diff --git a/mesalib/src/mesa/state_tracker/st_atom_blend.c b/mesalib/src/mesa/state_tracker/st_atom_blend.c index 50d240a7b..064e0c14f 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_blend.c +++ b/mesalib/src/mesa/state_tracker/st_atom_blend.c @@ -263,16 +263,13 @@ update_blend( struct st_context *st ) blend->rt[i].colormask |= PIPE_MASK_A; } - if (ctx->Color.DitherFlag) - blend->dither = 1; + blend->dither = ctx->Color.DitherFlag; if (ctx->Multisample.Enabled) { /* unlike in gallium/d3d10 these operations are only performed if msaa is enabled */ - if (ctx->Multisample.SampleAlphaToCoverage) - blend->alpha_to_coverage = 1; - if (ctx->Multisample.SampleAlphaToOne) - blend->alpha_to_one = 1; + blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage; + blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne; } cso_set_blend(st->cso_context, blend); diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index ee5e9e574..2bad64334 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -245,7 +245,7 @@ static void update_raster_state( struct st_context *st ) } /* _NEW_TRANSFORM */ - raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE; + raster->depth_clip = !ctx->Transform.DepthClamp; raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; cso_set_rasterizer(st->cso_context, raster); diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c index 67c615713..6515a98a3 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_shader.c +++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c @@ -89,6 +89,10 @@ update_fp( struct st_context *st ) key.clamp_color = st->clamp_frag_color_in_shader && st->ctx->Color._ClampFragmentColor; + /* Ignore sample qualifier while computing this flag. */ + key.persample_shading = + _mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1; + st->fp_variant = st_get_fp_variant(st, stfp, &key); st_reference_fragprog(st, &st->fp, stfp); @@ -108,7 +112,7 @@ update_fp( struct st_context *st ) const struct st_tracked_state st_update_fp = { "st_update_fp", /* name */ { /* dirty */ - _NEW_BUFFERS, /* mesa */ + _NEW_BUFFERS | _NEW_MULTISAMPLE, /* mesa */ ST_NEW_FRAGMENT_PROGRAM /* st */ }, update_fp /* update */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_msaa.c b/mesalib/src/mesa/state_tracker/st_cb_msaa.c index bbf2b2c5c..e9955b62b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_msaa.c +++ b/mesalib/src/mesa/state_tracker/st_cb_msaa.c @@ -40,7 +40,7 @@ static void st_GetSamplePosition(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint index, - GLfloat *outValue) + GLfloat *outPos) { struct st_context *st = st_context(ctx); @@ -48,7 +48,9 @@ st_GetSamplePosition(struct gl_context *ctx, if (st->pipe->get_sample_position) st->pipe->get_sample_position(st->pipe, (unsigned) fb->Visual.samples, - index, outValue); + index, outPos); + else + outPos[0] = outPos[1] = 0.5f; } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index c7f3ec6be..c805a094b 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -307,6 +307,7 @@ void st_destroy_context( struct st_context *st ) cso_release_all(st->cso_context); st_reference_fragprog(st, &st->fp, NULL); + st_reference_geomprog(st, &st->gp, NULL); st_reference_vertprog(st, &st->vp, NULL); /* release framebuffer surfaces */ diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index 38d4ccfea..409079bd4 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -83,6 +83,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_B2G3R3_UNORM; case MESA_FORMAT_B10G10R10A2_UNORM: return PIPE_FORMAT_B10G10R10A2_UNORM; + case MESA_FORMAT_R10G10B10A2_UNORM: + return PIPE_FORMAT_R10G10B10A2_UNORM; case MESA_FORMAT_L4A4_UNORM: return PIPE_FORMAT_L4A4_UNORM; case MESA_FORMAT_L8A8_UNORM: @@ -439,6 +441,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_B2G3R3_UNORM; case PIPE_FORMAT_B10G10R10A2_UNORM: return MESA_FORMAT_B10G10R10A2_UNORM; + case PIPE_FORMAT_R10G10B10A2_UNORM: + return MESA_FORMAT_R10G10B10A2_UNORM; case PIPE_FORMAT_L4A4_UNORM: return MESA_FORMAT_L4A4_UNORM; case PIPE_FORMAT_L8A8_UNORM: @@ -857,7 +861,8 @@ static const struct format_mapping format_map[] = { }, { { GL_RGB10_A2, 0 }, - { PIPE_FORMAT_B10G10R10A2_UNORM, DEFAULT_RGBA_FORMATS } + { PIPE_FORMAT_B10G10R10A2_UNORM, PIPE_FORMAT_R10G10B10A2_UNORM, + DEFAULT_RGBA_FORMATS } }, { { 4, GL_RGBA, GL_RGBA8, 0 }, diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 9e1943139..f47cd7d53 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4848,6 +4848,7 @@ emit_edgeflags(struct st_translate *t) * \param inputSemanticIndex the semantic index (ex: which texcoord) for * each input * \param interpMode the TGSI_INTERPOLATE_LINEAR/PERSP mode for each input + * \param interpLocation the TGSI_INTERPOLATE_LOC_* location for each input * \param numOutputs number of output registers used * \param outputMapping maps Mesa fragment program outputs to TGSI * generic outputs @@ -4869,7 +4870,7 @@ st_translate_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], - const GLboolean is_centroid[], + const GLuint interpLocation[], GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], @@ -4915,7 +4916,7 @@ st_translate_program( inputSemanticName[i], inputSemanticIndex[i], interpMode[i], 0, - is_centroid[i]); + interpLocation[i]); } if (proginfo->InputsRead & VARYING_BIT_POS) { diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h index a3fe91f7e..2e7cb78d5 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h @@ -45,7 +45,7 @@ enum pipe_error st_translate_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], - const GLboolean is_centroid[], + const GLuint interpLocation[], GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 3570557fe..9d7b7c475 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -351,7 +351,7 @@ st_translate_vertex_program(struct st_context *st, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, /* interp mode */ - NULL, /* is centroid */ + NULL, /* interp location */ /* outputs */ num_outputs, stvp->result_to_output, @@ -481,6 +481,7 @@ st_translate_fragment_program(struct st_context *st, GLuint outputMapping[FRAG_RESULT_MAX]; GLuint inputMapping[VARYING_SLOT_MAX]; GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ + GLuint interpLocation[PIPE_MAX_SHADER_INPUTS]; GLuint attr; GLbitfield64 inputsRead; struct ureg_program *ureg; @@ -489,7 +490,6 @@ st_translate_fragment_program(struct st_context *st, ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; - GLboolean is_centroid[PIPE_MAX_SHADER_INPUTS]; uint fs_num_inputs = 0; ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; @@ -541,7 +541,15 @@ st_translate_fragment_program(struct st_context *st, const GLuint slot = fs_num_inputs++; inputMapping[attr] = slot; - is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0; + if (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) + interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTROID; + else if (stfp->Base.IsSample & BITFIELD64_BIT(attr)) + interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE; + else + interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER; + + if (key->persample_shading) + interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE; switch (attr) { case VARYING_SLOT_POS: @@ -768,7 +776,7 @@ st_translate_fragment_program(struct st_context *st, input_semantic_name, input_semantic_index, interpMode, - is_centroid, + interpLocation, /* outputs */ fs_num_outputs, outputMapping, diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h index ce9174f67..9a5b6a847 100644 --- a/mesalib/src/mesa/state_tracker/st_program.h +++ b/mesalib/src/mesa/state_tracker/st_program.h @@ -58,6 +58,9 @@ struct st_fp_variant_key /** for ARB_color_buffer_float */ GLuint clamp_color:1; + + /** for ARB_sample_shading */ + GLuint persample_shading:1; }; |