aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-lex.l20
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y12
-rw-r--r--mesalib/src/glsl/linker.cpp1
-rw-r--r--mesalib/src/glsl/ralloc.c8
-rw-r--r--mesalib/src/glsl/ralloc.h9
-rw-r--r--mesalib/src/mapi/mapi/mapi_glapi.c4
-rw-r--r--mesalib/src/mapi/mapi/stub.c22
-rw-r--r--mesalib/src/mapi/mapi/stub.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c2
9 files changed, 56 insertions, 25 deletions
diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l
index 7ab58cb28..783c54549 100644
--- a/mesalib/src/glsl/glcpp/glcpp-lex.l
+++ b/mesalib/src/glsl/glcpp/glcpp-lex.l
@@ -67,7 +67,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner);
%option stack
%option never-interactive
-%x DONE COMMENT UNREACHABLE SKIP
+%x DONE COMMENT UNREACHABLE SKIP DEFINE
SPACE [[:space:]]
NONSPACE [^[:space:]]
@@ -184,14 +184,22 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
glcpp_error(yylloc, yyextra, "#error%s", p);
}
-{HASH}define{HSPACE}+/{IDENTIFIER}"(" {
+{HASH}define{HSPACE}+ {
yyextra->space_tokens = 0;
- return HASH_DEFINE_FUNC;
+ yy_push_state(DEFINE, yyscanner);
+ return HASH_DEFINE;
}
-{HASH}define {
- yyextra->space_tokens = 0;
- return HASH_DEFINE_OBJ;
+<DEFINE>{IDENTIFIER}/"(" {
+ yy_pop_state(yyscanner);
+ yylval->str = ralloc_strdup (yyextra, yytext);
+ return FUNC_IDENTIFIER;
+}
+
+<DEFINE>{IDENTIFIER} {
+ yy_pop_state(yyscanner);
+ yylval->str = ralloc_strdup (yyextra, yytext);
+ return OBJ_IDENTIFIER;
}
{HASH}undef {
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index fb9bc588e..ffb48e330 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -160,10 +160,10 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
%lex-param {glcpp_parser_t *parser}
%expect 0
-%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ 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 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 <str> IDENTIFIER INTEGER_STRING OTHER
+%type <str> IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER
%type <string_list> identifier_list
%type <token> preprocessing_token conditional_token
%type <token_list> pp_tokens replacement_list text_line conditional_tokens
@@ -227,13 +227,13 @@ expanded_line:
;
control_line:
- HASH_DEFINE_OBJ IDENTIFIER replacement_list NEWLINE {
+ HASH_DEFINE OBJ_IDENTIFIER replacement_list NEWLINE {
_define_object_macro (parser, & @2, $2, $3);
}
-| HASH_DEFINE_FUNC IDENTIFIER '(' ')' replacement_list NEWLINE {
+| HASH_DEFINE FUNC_IDENTIFIER '(' ')' replacement_list NEWLINE {
_define_function_macro (parser, & @2, $2, NULL, $5);
}
-| HASH_DEFINE_FUNC IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE {
+| HASH_DEFINE FUNC_IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE {
_define_function_macro (parser, & @2, $2, $4, $6);
}
| HASH_UNDEF IDENTIFIER NEWLINE {
@@ -1843,7 +1843,7 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser)
if (ret == NEWLINE)
parser->in_control_line = 0;
}
- else if (ret == HASH_DEFINE_OBJ || ret == HASH_DEFINE_FUNC ||
+ else if (ret == HASH_DEFINE ||
ret == HASH_UNDEF || ret == HASH_IF ||
ret == HASH_IFDEF || ret == HASH_IFNDEF ||
ret == HASH_ELIF || ret == HASH_ELSE ||
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 34ce13372..86371b5e6 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -882,6 +882,7 @@ move_non_declarations(exec_list *instructions, exec_node *last,
assert(inst->as_assignment()
|| inst->as_call()
+ || inst->as_if() /* for initializers with the ?: operator */
|| ((var != NULL) && (var->mode == ir_var_temporary)));
if (make_copies) {
diff --git a/mesalib/src/glsl/ralloc.c b/mesalib/src/glsl/ralloc.c
index 3da09b559..59e71c48b 100644
--- a/mesalib/src/glsl/ralloc.c
+++ b/mesalib/src/glsl/ralloc.c
@@ -41,14 +41,6 @@ _CRTIMP int _vscprintf(const char *format, va_list argptr);
#include "ralloc.h"
-#ifdef __GNUC__
-#define likely(x) __builtin_expect(!!(x),1)
-#define unlikely(x) __builtin_expect(!!(x),0)
-#else
-#define likely(x) !!(x)
-#define unlikely(x) !!(x)
-#endif
-
#ifndef va_copy
#ifdef __va_copy
#define va_copy(dest, src) __va_copy((dest), (src))
diff --git a/mesalib/src/glsl/ralloc.h b/mesalib/src/glsl/ralloc.h
index 86306b1f5..67eb93833 100644
--- a/mesalib/src/glsl/ralloc.h
+++ b/mesalib/src/glsl/ralloc.h
@@ -54,6 +54,7 @@ extern "C" {
#include <stddef.h>
#include <stdarg.h>
#include <stdbool.h>
+#include "main/compiler.h"
/**
* \def ralloc(ctx, type)
@@ -301,7 +302,7 @@ bool ralloc_strncat(char **dest, const char *str, size_t n);
*
* \return The newly allocated string.
*/
-char *ralloc_asprintf (const void *ctx, const char *fmt, ...);
+char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3);
/**
* Print to a string, given a va_list.
@@ -334,7 +335,8 @@ char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args);
* \return True unless allocation failed.
*/
bool ralloc_asprintf_rewrite_tail(char **str, size_t *start,
- const char *fmt, ...);
+ const char *fmt, ...)
+ PRINTFLIKE(3, 4);
/**
* Rewrite the tail of an existing string, starting at a given index.
@@ -376,7 +378,8 @@ bool ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt,
*
* \return True unless allocation failed.
*/
-bool ralloc_asprintf_append (char **str, const char *fmt, ...);
+bool ralloc_asprintf_append (char **str, const char *fmt, ...)
+ PRINTFLIKE(2, 3);
/**
* Append formatted text to the supplied string, given a va_list.
diff --git a/mesalib/src/mapi/mapi/mapi_glapi.c b/mesalib/src/mapi/mapi/mapi_glapi.c
index adfc0cbcc..4627c4de0 100644
--- a/mesalib/src/mapi/mapi/mapi_glapi.c
+++ b/mesalib/src/mapi/mapi/mapi_glapi.c
@@ -219,8 +219,8 @@ _glapi_get_proc_address(const char *funcName)
const char *
_glapi_get_proc_name(unsigned int offset)
{
- /* not implemented */
- return NULL;
+ const struct mapi_stub *stub = stub_find_by_slot(offset);
+ return stub ? stub_get_name(stub) : NULL;
}
unsigned long
diff --git a/mesalib/src/mapi/mapi/stub.c b/mesalib/src/mapi/mapi/stub.c
index 6fb8556d1..688dc8143 100644
--- a/mesalib/src/mapi/mapi/stub.c
+++ b/mesalib/src/mapi/mapi/stub.c
@@ -153,6 +153,28 @@ stub_find_dynamic(const char *name, int generate)
return stub;
}
+static const struct mapi_stub *
+search_table_by_slot(const struct mapi_stub *table, size_t num_entries,
+ int slot)
+{
+ size_t i;
+ for (i = 0; i < num_entries; ++i) {
+ if (table[i].slot == slot)
+ return &table[i];
+ }
+ return NULL;
+}
+
+const struct mapi_stub *
+stub_find_by_slot(int slot)
+{
+ const struct mapi_stub *stub =
+ search_table_by_slot(public_stubs, ARRAY_SIZE(public_stubs), slot);
+ if (stub)
+ return stub;
+ return search_table_by_slot(dynamic_stubs, num_dynamic_stubs, slot);
+}
+
void
stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias)
{
diff --git a/mesalib/src/mapi/mapi/stub.h b/mesalib/src/mapi/mapi/stub.h
index b2b6f1839..98e2553ec 100644
--- a/mesalib/src/mapi/mapi/stub.h
+++ b/mesalib/src/mapi/mapi/stub.h
@@ -42,6 +42,9 @@ stub_find_public(const char *name);
struct mapi_stub *
stub_find_dynamic(const char *name, int generate);
+const struct mapi_stub *
+stub_find_by_slot(int slot);
+
void
stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 4e2edd2e7..642011488 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -396,6 +396,8 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
+ return GL_R3_G3_B2;
+
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
return GL_RGBA4;