diff options
author | marha <marha@users.sourceforge.net> | 2013-08-01 13:25:23 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-08-01 13:25:23 +0200 |
commit | c3d3ea464f7f4e53e8fe3e11ecada36cb209ba4d (patch) | |
tree | f86937d9126b2d543ffd13f861a1271f48bd69e6 /mesalib/src/mesa | |
parent | acad661e29a4f09d06f829fdfea949814da57da6 (diff) | |
parent | 0659c77949b38440a2a9ba67e1ee9cacef1f3a7f (diff) | |
download | vcxsrv-c3d3ea464f7f4e53e8fe3e11ecada36cb209ba4d.tar.gz vcxsrv-c3d3ea464f7f4e53e8fe3e11ecada36cb209ba4d.tar.bz2 vcxsrv-c3d3ea464f7f4e53e8fe3e11ecada36cb209ba4d.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
libX11 mesa xserver xkeyboard-config git update 1 aug 2013
Diffstat (limited to 'mesalib/src/mesa')
22 files changed, 165 insertions, 61 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc index 556d1b599..ebc04cd9b 100644 --- a/mesalib/src/mesa/drivers/dri/common/drirc +++ b/mesalib/src/mesa/drivers/dri/common/drirc @@ -1,33 +1,75 @@ +<!-- + +============================================ +Application bugs worked around in this file: +============================================ + +* Various Unigine products don't use the #version and #extension GLSL + directives, meaning they only get GLSL 1.10 and no extensions for their + shaders. + Enabling all extensions for Unigine fixes most issues, but the GLSL version + is still 1.10. + +* Unigine Heaven 3.0 with ARB_texture_multisample uses a "ivec4 * vec4" + expression, which fails to compile with GLSL 1.10. + Adding "#version 130" fixes this. + +* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses the uint keyword, which + fails to compile with GLSL 1.10. + Adding "#version 130" fixes this. + +* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses a "uint & int" + expression, which fails (and should fail) to compile with any GLSL version. + Disabling ARB_shader_bit_encoding fixes this. + +TODO: document the other workarounds. + +--> + <driconf> - <device screen="0" driver="i965"> + <!-- Please always enable app-specific workarounds for all drivers and + screens. --> + <device> <application name="Unigine Sanctuary" executable="Sanctuary"> <option name="force_glsl_extensions_warn" value="true" /> <option name="disable_blend_func_extended" value="true" /> </application> + <application name="Unigine Tropics" executable="Tropics"> <option name="force_glsl_extensions_warn" value="true" /> <option name="disable_blend_func_extended" value="true" /> </application> + <application name="Unigine Heaven (32-bit)" executable="heaven_x86"> <option name="force_glsl_extensions_warn" value="true" /> <option name="disable_blend_func_extended" value="true" /> + <option name="force_glsl_version" value="130" /> + <option name="disable_shader_bit_encoding" value="true" /> </application> + <application name="Unigine Heaven (64-bit)" executable="heaven_x64"> <option name="force_glsl_extensions_warn" value="true" /> <option name="disable_blend_func_extended" value="true" /> + <option name="force_glsl_version" value="130" /> + <option name="disable_shader_bit_encoding" value="true" /> </application> + <application name="Unigine OilRush (32-bit)" executable="OilRush_x86"> <option name="disable_blend_func_extended" value="true" /> </application> + <application name="Unigine OilRush (64-bit)" executable="OilRush_x64"> <option name="disable_blend_func_extended" value="true" /> </application> + <application name="Savage 2" executable="savage2.bin"> <option name="disable_glsl_line_continuations" value="true" /> </application> + <application name="Topogun (32-bit)" executable="topogun32"> <option name="always_have_depth_buffer" value="true" /> </application> + <application name="Topogun (64-bit)" executable="topogun64"> <option name="always_have_depth_buffer" value="true" /> </application> diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c index 72483a42a..5c97c20fc 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -812,7 +812,9 @@ static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) { driOptionCache *cache = data->cache; GLuint opt = findOption (cache, name); if (cache->info[opt].name == NULL) - XML_WARNING ("undefined option: %s.", name); + /* don't use XML_WARNING, drirc defines options for all drivers, + * but not all drivers support them */ + return; else if (getenv (cache->info[opt].name)) /* don't use XML_WARNING, we want the user to see this! */ fprintf (stderr, "ATTENTION: option value of option %s ignored.\n", diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h index ca4772003..3bf804a17 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -95,6 +95,16 @@ DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \ DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \ DRI_CONF_OPT_END +#define DRI_CONF_DISABLE_SHADER_BIT_ENCODING(def) \ +DRI_CONF_OPT_BEGIN_B(disable_shader_bit_encoding, def) \ + DRI_CONF_DESC(en,gettext("Disable GL_ARB_shader_bit_encoding")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_FORCE_GLSL_VERSION(def) \ +DRI_CONF_OPT_BEGIN_V(force_glsl_version, int, def, "0:999") \ + DRI_CONF_DESC(en,gettext("Force a default GLSL version for shaders that lack an explicit #version line")) \ +DRI_CONF_OPT_END + /** @@ -266,15 +276,6 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \ DRI_CONF_DESC(en,gettext("Number of texture units used")) \ DRI_CONF_OPT_END -#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \ -DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \ - DRI_CONF_DESC_BEGIN(en,gettext("Support larger textures not guaranteed to fit into graphics memory")) \ - DRI_CONF_ENUM(0,gettext("No")) \ - DRI_CONF_ENUM(1,gettext("At least 1 texture must fit under worst-case assumptions")) \ - DRI_CONF_ENUM(2,gettext("Announce hardware limits")) \ - DRI_CONF_DESC_END \ -DRI_CONF_OPT_END - #define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \ DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \ DRI_CONF_DESC(en,gettext("Texture filtering quality vs. speed, AKA “brilinear” texture filtering")) \ diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 4e46cf095..1a040ee3b 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -275,6 +275,7 @@ static const struct extension extension_table[] = { { "GL_OES_stencil4", o(dummy_false), DISABLE, 2005 }, { "GL_OES_stencil8", o(dummy_true), ES1 | ES2, 2005 }, { "GL_OES_stencil_wrap", o(dummy_true), ES1, 2002 }, + { "GL_OES_surfaceless_context", o(dummy_true), ES1 | ES2, 2012 }, { "GL_OES_texture_3D", o(EXT_texture3D), ES2, 2005 }, { "GL_OES_texture_cube_map", o(ARB_texture_cube_map), ES1, 2007 }, { "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1, 2005 }, diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index a29f1ab13..bf7e85c88 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -2141,8 +2141,12 @@ _mesa_CheckFramebufferStatus(GLenum target) } if (_mesa_is_winsys_fbo(buffer)) { - /* The window system / default framebuffer is always complete */ - return GL_FRAMEBUFFER_COMPLETE_EXT; + /* EGL_KHR_surfaceless_context allows the winsys FBO to be incomplete. */ + if (buffer != &IncompleteFramebuffer) { + return GL_FRAMEBUFFER_COMPLETE_EXT; + } else { + return GL_FRAMEBUFFER_UNDEFINED; + } } /* No need to flush here */ diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index 583963232..180f89116 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -2024,7 +2024,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, GLubyte *temp_src = NULL, *temp_dst = NULL; GLenum temp_datatype; GLenum temp_base_format; - GLubyte **temp_src_slices, **temp_dst_slices; + GLubyte **temp_src_slices = NULL, **temp_dst_slices = NULL; /* only two types of compressed textures at this time */ assert(texObj->Target == GL_TEXTURE_2D || @@ -2063,11 +2063,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, temp_dst_slices = malloc(srcImage->Depth * sizeof(GLubyte *)); if (!temp_src || !temp_src_slices || !temp_dst_slices) { - free(temp_src); - free(temp_src_slices); - free(temp_dst_slices); _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); - return; + goto end; } /* decompress base image to the temporary src buffer */ @@ -2119,7 +2116,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, temp_dst = malloc(temp_dst_img_stride * dstDepth); if (!temp_dst) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); - break; + goto end; } } @@ -2127,8 +2124,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, dstImage = _mesa_get_tex_image(ctx, texObj, target, level + 1); if (!dstImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - free(temp_dst); - return; + goto end; } /* for 2D arrays, setup array[depth] of slice pointers */ @@ -2153,8 +2149,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, dstWidth, dstHeight, dstDepth, border, srcImage->InternalFormat, srcImage->TexFormat)) { - free(temp_dst); - return; + /* all done */ + goto end; } /* The image space was allocated above so use glTexSubImage now */ @@ -2173,6 +2169,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, } } /* loop over mipmap levels */ +end: free(temp_src); free(temp_dst); free(temp_src_slices); diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index aba7d845b..5bb680745 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2402,6 +2402,7 @@ struct gl_shader_program #define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */ #define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */ #define GLSL_REPORT_ERRORS 0x100 /**< Print compilation errors */ +#define GLSL_DUMP_ON_ERROR 0x200 /**< Dump shaders to stderr on compile error */ /** @@ -2873,6 +2874,12 @@ struct gl_constants GLboolean ForceGLSLExtensionsWarn; /** + * If non-zero, forces GLSL shaders without the #version directive to behave + * as if they began with "#version ForceGLSLVersion". + */ + GLuint ForceGLSLVersion; + + /** * Does the driver support real 32-bit integers? (Otherwise, integers are * simulated via floats.) */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 4cc0357b1..c349b0cb5 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -71,7 +71,9 @@ get_shader_flags(void) const char *env = _mesa_getenv("MESA_GLSL"); if (env) { - if (strstr(env, "dump")) + if (strstr(env, "dump_on_error")) + flags |= GLSL_DUMP_ON_ERROR; + else if (strstr(env, "dump")) flags |= GLSL_DUMP; if (strstr(env, "log")) flags |= GLSL_LOG; @@ -783,10 +785,17 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) } - if (sh->CompileStatus == GL_FALSE && - (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) { - _mesa_debug(ctx, "Error compiling shader %u:\n%s\n", - sh->Name, sh->InfoLog); + if (!sh->CompileStatus) { + if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) { + fprintf(stderr, "GLSL source for %s shader %d:\n", + _mesa_glsl_shader_target_name(sh->Type), sh->Name); + fprintf(stderr, "%s\n", sh->Source); + } + + if (ctx->Shader.Flags & GLSL_REPORT_ERRORS) { + _mesa_debug(ctx, "Error compiling shader %u:\n%s\n", + sh->Name, sh->InfoLog); + } } } diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 111849655..b719fc856 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1097,24 +1097,34 @@ _mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height, switch (target) { case GL_TEXTURE_1D: case GL_TEXTURE_1D_ARRAY: + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D_ARRAY: size = width; break; case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: ASSERT(width == height); size = width; break; case GL_TEXTURE_2D: case GL_TEXTURE_2D_ARRAY: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D_ARRAY: size = MAX2(width, height); break; case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: size = MAX3(width, height, depth); break; case GL_TEXTURE_RECTANGLE: case GL_TEXTURE_EXTERNAL_OES: case GL_TEXTURE_2D_MULTISAMPLE: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_RECTANGLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: return 1; default: assert(0); diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 2168bffb1..334dee77b 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -83,7 +83,7 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target ) struct gl_texture_object *obj; (void) ctx; obj = MALLOC_STRUCT(gl_texture_object); - _mesa_initialize_texture_object(obj, name, target); + _mesa_initialize_texture_object(ctx, obj, name, target); return obj; } @@ -95,7 +95,8 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target ) * \param target the texture target */ void -_mesa_initialize_texture_object( struct gl_texture_object *obj, +_mesa_initialize_texture_object( struct gl_context *ctx, + struct gl_texture_object *obj, GLuint name, GLenum target ) { ASSERT(target == 0 || @@ -146,7 +147,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->Sampler.MaxAnisotropy = 1.0; obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */ obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */ - obj->DepthMode = GL_LUMINANCE; + obj->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE; obj->Sampler.CubeMapSeamless = GL_FALSE; obj->Swizzle[0] = GL_RED; obj->Swizzle[1] = GL_GREEN; @@ -154,8 +155,8 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->Swizzle[3] = GL_ALPHA; obj->_Swizzle = SWIZZLE_NOOP; obj->Sampler.sRGBDecode = GL_DECODE_EXT; - obj->BufferObjectFormat = GL_LUMINANCE8; - obj->_BufferObjectFormat = MESA_FORMAT_L8; + obj->BufferObjectFormat = GL_R8; + obj->_BufferObjectFormat = MESA_FORMAT_R8; } diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index a99f45bfa..0df088ce4 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -50,7 +50,8 @@ extern struct gl_texture_object * _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target ); extern void -_mesa_initialize_texture_object( struct gl_texture_object *obj, +_mesa_initialize_texture_object( struct gl_context *ctx, + struct gl_texture_object *obj, GLuint name, GLenum target ); extern void diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 141cbe3ab..32109951c 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -1048,6 +1048,8 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target) return ctx->API == API_OPENGL_CORE && ctx->Version >= 31; case GL_TEXTURE_2D_MULTISAMPLE: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: return ctx->Extensions.ARB_texture_multisample; default: return GL_FALSE; diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 741985c46..afff01359 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -594,8 +594,8 @@ update_texture_state( struct gl_context *ctx ) /* Look for the highest priority texture target that's enabled (or used * by the vert/frag shaders) and "complete". That's the one we'll use - * for texturing. If we're using vert/frag program we're guaranteed - * that bitcount(enabledBits) <= 1. + * for texturing. + * * Note that the TEXTURE_x_INDEX values are in high to low priority. */ for (texIndex = 0; texIndex < NUM_TEXTURE_TARGETS; texIndex++) { @@ -624,8 +624,6 @@ update_texture_state( struct gl_context *ctx ) struct gl_texture_object *texObj; gl_texture_index texTarget; - assert(_mesa_bitcount(enabledTargets) == 1); - texTarget = (gl_texture_index) (ffs(enabledTargets) - 1); texObj = _mesa_get_fallback_texture(ctx, texTarget); diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index 0a53726fe..7bd8652b5 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -335,14 +335,14 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, /* non-default texture object check */ texObj = _mesa_get_current_tex_object(ctx, target); - if (!texObj || (texObj->Name == 0)) { + if (!_mesa_is_proxy_texture(target) && (!texObj || (texObj->Name == 0))) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(texture object 0)", dims); return GL_TRUE; } /* Check if texObj->Immutable is set */ - if (texObj->Immutable) { + if (!_mesa_is_proxy_texture(target) && texObj->Immutable) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)", dims); return GL_TRUE; diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 4af1c8241..f0fc1b9b1 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -3108,7 +3108,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) for (i = 0; i < prog->NumShaders; i++) { if (!prog->Shaders[i]->CompileStatus) { linker_error(prog, "linking with uncompiled shader"); - prog->LinkStatus = GL_FALSE; } } diff --git a/mesalib/src/mesa/program/program_lexer.l b/mesalib/src/mesa/program/program_lexer.l index 0947bb046..d5dbcf347 100644 --- a/mesalib/src/mesa/program/program_lexer.l +++ b/mesalib/src/mesa/program/program_lexer.l @@ -165,7 +165,7 @@ szf [HR]? cc C? sat (_SAT)? -%option prefix="_mesa_program_" +%option prefix="_mesa_program_lexer_" %option bison-bridge bison-locations reentrant noyywrap %% diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index e2da63347..a76db4e86 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -98,7 +98,7 @@ static struct asm_instruction *asm_instruction_copy_ctor( #define YYLLOC_DEFAULT(Current, Rhs, N) \ do { \ - if (YYID(N)) { \ + if (N) { \ (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ (Current).position = YYRHSLOC(Rhs, 1).position; \ @@ -112,16 +112,14 @@ static struct asm_instruction *asm_instruction_copy_ctor( (Current).position = YYRHSLOC(Rhs, 0).position \ + (Current).first_column; \ } \ - } while(YYID(0)) - -#define YYLEX_PARAM state->scanner + } while(0) %} %pure-parser %locations +%lex-param { struct asm_parser_state *state } %parse-param { struct asm_parser_state *state } %error-verbose -%lex-param { void *scanner } %union { struct asm_instruction *inst; @@ -269,8 +267,16 @@ static struct asm_instruction *asm_instruction_copy_ctor( %type <negate> optionalSign %{ -extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, - void *yyscanner); +extern int +_mesa_program_lexer_lex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, + void *yyscanner); + +static int +yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, + struct asm_parser_state *state) +{ + return _mesa_program_lexer_lex(yylval_param, yylloc_param, state->scanner); +} %} %% diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 826722be8..77aaccd04 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -37,6 +37,7 @@ #include "main/context.h" #include "main/fbobject.h" #include "main/framebuffer.h" +#include "main/glformats.h" #include "main/macros.h" #include "main/renderbuffer.h" @@ -132,6 +133,13 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, pipe_surface_reference( &strb->surface, NULL ); pipe_resource_reference( &strb->texture, NULL ); + /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear + * formats. + */ + if (!ctx->Extensions.EXT_framebuffer_sRGB) { + internalFormat = _mesa_get_linear_internalformat(internalFormat); + } + /* Handle multisample renderbuffers first. * * From ARB_framebuffer_object: diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index c167744f4..faa9ee3f6 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -141,7 +141,7 @@ st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object); DBG("%s\n", __FUNCTION__); - _mesa_initialize_texture_object(&obj->base, name, target); + _mesa_initialize_texture_object(ctx, &obj->base, name, target); return &obj->base; } diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index d01942967..0b7001bae 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -289,14 +289,6 @@ void st_init_limits(struct st_context *st) } -static GLboolean st_get_s3tc_override(void) -{ - const char *override = _mesa_getenv("force_s3tc_enable"); - if (override && !strcmp(override, "true")) - return GL_TRUE; - return GL_FALSE; -} - /** * Given a member \c x of struct gl_extensions, return offset of * \c x in bytes. @@ -606,16 +598,24 @@ void st_init_extensions(struct st_context *st) _mesa_override_glsl_version(st->ctx); + if (st->options.force_glsl_version > 0 && + st->options.force_glsl_version <= ctx->Const.GLSLVersion) { + ctx->Const.ForceGLSLVersion = st->options.force_glsl_version; + } + if (ctx->Const.GLSLVersion >= 130) { ctx->Const.NativeIntegers = GL_TRUE; ctx->Const.MaxClipPlanes = 8; /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */ ctx->Extensions.ARB_conservative_depth = GL_TRUE; - ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; ctx->Extensions.ARB_shading_language_packing = GL_TRUE; ctx->Extensions.OES_depth_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_shading_language_420pack = GL_TRUE; + + if (!st->options.disable_shader_bit_encoding) { + ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; + } } else { /* Optional integer support for GLSL 1.2. */ if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX, @@ -628,7 +628,7 @@ void st_init_extensions(struct st_context *st) /* Below are the cases which cannot be moved into tables easily. */ - if (!ctx->Mesa_DXTn && !st_get_s3tc_override()) { + if (!ctx->Mesa_DXTn && !st->options.force_s3tc_enable) { ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE; ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE; } @@ -710,9 +710,11 @@ void st_init_extensions(struct st_context *st) } else if (ctx->Const.MaxSamples >= 2) { ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; + ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE; } - if (ctx->Const.MaxDualSourceDrawBuffers > 0) + if (ctx->Const.MaxDualSourceDrawBuffers > 0 && + !st->options.disable_blend_func_extended) ctx->Extensions.ARB_blend_func_extended = GL_TRUE; st->has_time_elapsed = diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index 16d977fc9..64bfd1faa 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -1782,6 +1782,13 @@ st_QuerySamplesForFormat(struct gl_context *ctx, GLenum target, else bind = PIPE_BIND_RENDER_TARGET; + /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear + * formats. + */ + if (!ctx->Extensions.EXT_framebuffer_sRGB) { + internalFormat = _mesa_get_linear_internalformat(internalFormat); + } + /* Set sample counts in descending order. */ for (i = 16; i > 1; i--) { format = st_choose_format(st, internalFormat, GL_NONE, GL_NONE, 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 69c1b412b..3dfd5e5b3 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1832,10 +1832,17 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]); break; case ir_unop_bitcast_f2i: + result_src = op[0]; + result_src.type = GLSL_TYPE_INT; + break; case ir_unop_bitcast_f2u: + result_src = op[0]; + result_src.type = GLSL_TYPE_UINT; + break; case ir_unop_bitcast_i2f: case ir_unop_bitcast_u2f: result_src = op[0]; + result_src.type = GLSL_TYPE_FLOAT; break; case ir_unop_f2b: emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0)); |