diff options
author | Jason Ekstrand <[email protected]> | 2016-02-05 14:21:13 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-05 14:21:13 -0800 |
commit | 9645b8eb1f1b79e537ad8ddb683507df7bc9da58 (patch) | |
tree | 8e554a43a136b5f7951ff8734d42deb5e81c262b /src/mesa/drivers | |
parent | 3eebf3686be3de10cbeda8acd884e82df3e1438a (diff) | |
parent | 41875ac4edd8c884225c44c0840bd20291b410ca (diff) |
Merge branch mesa-public/master into vulkan
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_blit.c | 35 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_copy_image.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_generate_mipmap.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/drirc | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/xmlpool/t_options.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_compiler.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_device_info.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 1 |
17 files changed, 83 insertions, 43 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 1ed0e4d1f59..5f2e79637c2 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3179,8 +3179,10 @@ decompress_texture_image(struct gl_context *ctx, /* restrict sampling to the texture level of interest */ if (target != GL_TEXTURE_RECTANGLE_ARB) { - _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, texImage->Level); - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, texImage->Level); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, + (GLint *) &texImage->Level, false); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + (GLint *) &texImage->Level, false); } /* render quad w/ texture into renderbuffer */ @@ -3190,8 +3192,10 @@ decompress_texture_image(struct gl_context *ctx, * be restored by _mesa_meta_end(). */ if (target != GL_TEXTURE_RECTANGLE_ARB) { - _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave); - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, + &baseLevelSave, false); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + &maxLevelSave, false); } } diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 3691e7d6123..074f70da6cd 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -469,7 +469,7 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, struct gl_sampler_object * _mesa_meta_setup_sampler(struct gl_context *ctx, - const struct gl_texture_object *texObj, + struct gl_texture_object *texObj, GLenum target, GLenum filter, GLuint srcLevel); extern GLbitfield diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index b414dce8819..5d80f7d8fe1 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -828,22 +828,29 @@ void _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, struct fb_tex_blit_state *blit) { + struct gl_texture_object *const texObj = + _mesa_get_current_tex_object(ctx, target); + /* Restore texture object state, the texture binding will * be restored by _mesa_meta_end(). */ if (target != GL_TEXTURE_RECTANGLE_ARB) { - _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, blit->baseLevelSave); - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, blit->maxLevelSave); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, + &blit->baseLevelSave, false); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + &blit->maxLevelSave, false); + } - if (ctx->Extensions.ARB_stencil_texturing) { - const struct gl_texture_object *texObj = - _mesa_get_current_tex_object(ctx, target); + /* If ARB_stencil_texturing is not supported, the mode won't have changed. */ + if (texObj->StencilSampling != blit->stencilSamplingSave) { + /* GLint so the compiler won't complain about type signedness mismatch + * in the call to _mesa_texture_parameteriv below. + */ + const GLint param = blit->stencilSamplingSave ? + GL_STENCIL_INDEX : GL_DEPTH_COMPONENT; - if (texObj->StencilSampling != blit->stencilSamplingSave) - _mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE, - blit->stencilSamplingSave ? - GL_STENCIL_INDEX : GL_DEPTH_COMPONENT); - } + _mesa_texture_parameteriv(ctx, texObj, GL_DEPTH_STENCIL_TEXTURE_MODE, + ¶m, false); } _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, blit->samp_obj_save); @@ -895,7 +902,7 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, struct gl_sampler_object * _mesa_meta_setup_sampler(struct gl_context *ctx, - const struct gl_texture_object *texObj, + struct gl_texture_object *texObj, GLenum target, GLenum filter, GLuint srcLevel) { struct gl_sampler_object *samp_obj; @@ -915,8 +922,10 @@ _mesa_meta_setup_sampler(struct gl_context *ctx, /* Prepare src texture state */ _mesa_BindTexture(target, texObj->Name); if (target != GL_TEXTURE_RECTANGLE_ARB) { - _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel); - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, + (GLint *) &srcLevel, false); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + (GLint *) &srcLevel, false); } return samp_obj; diff --git a/src/mesa/drivers/common/meta_copy_image.c b/src/mesa/drivers/common/meta_copy_image.c index 04b9cafe308..2c2b7ba6bf8 100644 --- a/src/mesa/drivers/common/meta_copy_image.c +++ b/src/mesa/drivers/common/meta_copy_image.c @@ -235,7 +235,7 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx, } if (src_view_tex_image) { - /* Prever the tex image because, even if we have a renderbuffer, we may + /* Prefer the tex image because, even if we have a renderbuffer, we may * have had to wrap it in a texture view. */ _mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, attachment, diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index f20fcac68d6..27435b2b722 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -185,6 +185,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, GLint swizzle[4]; GLboolean swizzleSaved = GL_FALSE; + /* GLint so the compiler won't complain about type signedness mismatch in + * the calls to _mesa_texture_parameteriv below. + */ + static const GLint always_false = GL_FALSE; + static const GLint always_true = GL_TRUE; + if (fallback_required(ctx, target, texObj)) { _mesa_generate_mipmap(ctx, target, texObj); return; @@ -248,13 +254,14 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, assert(mipmap->FBO != 0); _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO); - _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE); + _mesa_texture_parameteriv(ctx, texObj, GL_GENERATE_MIPMAP, &always_false, false); if (texObj->_Swizzle != SWIZZLE_NOOP) { static const GLint swizzleNoop[4] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA }; memcpy(swizzle, texObj->Swizzle, sizeof(swizzle)); swizzleSaved = GL_TRUE; - _mesa_TexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzleNoop); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_SWIZZLE_RGBA, + swizzleNoop, false); } /* Silence valgrind warnings about reading uninitialized stack. */ @@ -309,7 +316,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* Allocate storage for the destination mipmap image(s) */ /* Set MaxLevel large enough to hold the new level when we allocate it */ - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, dstLevel); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + (GLint *) &dstLevel, false); if (!prepare_mipmap_level(ctx, texObj, dstLevel, dstWidth, dstHeight, dstDepth, @@ -323,7 +331,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, dstImage = _mesa_select_tex_image(texObj, faceTarget, dstLevel); /* limit minification to src level */ - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + (GLint *) &srcLevel, false); /* setup viewport */ _mesa_set_viewport(ctx, 0, 0, 0, dstWidth, dstHeight); @@ -373,9 +382,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_meta_end(ctx); - _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, &maxLevelSave, + false); if (genMipmapSave) - _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave); + _mesa_texture_parameteriv(ctx, texObj, GL_GENERATE_MIPMAP, &always_true, + false); if (swizzleSaved) - _mesa_TexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle); + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_SWIZZLE_RGBA, swizzle, + false); } diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc index e1874c3f1dc..183a1dcabe8 100644 --- a/src/mesa/drivers/dri/common/drirc +++ b/src/mesa/drivers/dri/common/drirc @@ -37,26 +37,26 @@ TODO: document the other workarounds. <application name="Unigine Heaven (32-bit)" executable="heaven_x86"> <option name="allow_glsl_extension_directive_midshader" value="true" /> - <!-- remove disable_blend_func_extended if 4.1 ever comes out --> - <option name="disable_blend_func_extended" value="true" /> + <!-- remove dual_color_blend_by_location if 4.1 ever comes out --> + <option name="dual_color_blend_by_location" value="true" /> </application> <application name="Unigine Heaven (64-bit)" executable="heaven_x64"> <option name="allow_glsl_extension_directive_midshader" value="true" /> - <!-- remove disable_blend_func_extended if 4.1 ever comes out --> - <option name="disable_blend_func_extended" value="true" /> + <!-- remove dual_color_blend_by_location if 4.1 ever comes out --> + <option name="dual_color_blend_by_location" value="true" /> </application> <application name="Unigine Valley (32-bit)" executable="valley_x86"> <option name="allow_glsl_extension_directive_midshader" value="true" /> - <!-- remove disable_blend_func_extended if 1.1 ever comes out --> - <option name="disable_blend_func_extended" value="true" /> + <!-- remove dual_color_blend_by_location if 1.1 ever comes out --> + <option name="dual_color_blend_by_location" value="true" /> </application> <application name="Unigine Valley (64-bit)" executable="valley_x64"> <option name="allow_glsl_extension_directive_midshader" value="true" /> - <!-- remove disable_blend_func_extended if 1.1 ever comes out --> - <option name="disable_blend_func_extended" value="true" /> + <!-- remove dual_color_blend_by_location if 1.1 ever comes out --> + <option name="dual_color_blend_by_location" value="true" /> </application> <application name="Unigine OilRush (32-bit)" executable="OilRush_x86"> diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h index 4e5a7217ee2..55e926b239e 100644 --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -90,6 +90,11 @@ DRI_CONF_OPT_BEGIN_B(disable_blend_func_extended, def) \ DRI_CONF_DESC(en,gettext("Disable dual source blending")) \ DRI_CONF_OPT_END +#define DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(def) \ +DRI_CONF_OPT_BEGIN_B(dual_color_blend_by_location, def) \ + DRI_CONF_DESC(en,gettext("Identify dual color blending sources by location rather than index")) \ +DRI_CONF_OPT_END + #define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \ DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \ DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \ diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 3f429f25d10..e5a3f003eac 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -427,6 +427,8 @@ intelInitContext(struct intel_context *intel, return false; } + driContextSetFlags(&intel->ctx, flags); + driContextPriv->driverPrivate = intel; intel->driContext = driContextPriv; diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h index 62dcb4dad84..cd28bbb6bbf 100644 --- a/src/mesa/drivers/dri/i965/brw_compiler.h +++ b/src/mesa/drivers/dri/i965/brw_compiler.h @@ -249,6 +249,7 @@ struct brw_wm_prog_key { bool compute_sample_id:1; unsigned line_aa:2; bool high_quality_derivatives:1; + bool force_dual_color_blend:1; uint16_t drawable_height; uint64_t input_slots_valid; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 9ba33396d36..1032e5a8175 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -750,6 +750,9 @@ brw_process_driconf_options(struct brw_context *brw) ctx->Const.AllowGLSLExtensionDirectiveMidShader = driQueryOptionb(options, "allow_glsl_extension_directive_midshader"); + + brw->dual_color_blend_by_location = + driQueryOptionb(options, "dual_color_blend_by_location"); } GLboolean diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 2a29dfe5eec..55d6723eab7 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -836,6 +836,7 @@ struct brw_context bool always_flush_cache; bool disable_throttling; bool precompile; + bool dual_color_blend_by_location; driOptionCache optionCache; /** @} */ diff --git a/src/mesa/drivers/dri/i965/brw_device_info.c b/src/mesa/drivers/dri/i965/brw_device_info.c index e8af70cc571..05872255865 100644 --- a/src/mesa/drivers/dri/i965/brw_device_info.c +++ b/src/mesa/drivers/dri/i965/brw_device_info.c @@ -390,7 +390,7 @@ static const struct brw_device_info brw_device_info_bxt = { .max_hs_threads = 56, .max_ds_threads = 56, .max_gs_threads = 56, - .max_wm_threads = 32, + .max_wm_threads = 64 * 3, .max_cs_threads = 28, .urb = { .size = 64, diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 1ba5075731a..922f7200a30 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1671,12 +1671,6 @@ fs_visitor::assign_vs_urb_setup() brw_vs_prog_data *vs_prog_data = (brw_vs_prog_data *) prog_data; assert(stage == MESA_SHADER_VERTEX); - int count = _mesa_bitcount_64(vs_prog_data->inputs_read); - if (vs_prog_data->uses_vertexid || vs_prog_data->uses_instanceid || - vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) - count++; - if (vs_prog_data->uses_drawid) - count++; /* Each attribute is 4 regs. */ this->first_non_payload_grf += 4 * vs_prog_data->nr_attributes; diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 11e7c7dc102..48cdaf6d9c2 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -130,7 +130,11 @@ fs_visitor::nir_setup_outputs() break; } case MESA_SHADER_FRAGMENT: - if (var->data.index > 0) { + if (key->force_dual_color_blend && + var->data.location == FRAG_RESULT_DATA1) { + this->dual_src_output = reg; + this->do_dual_src = true; + } else if (var->data.index > 0) { assert(var->data.location == FRAG_RESULT_DATA0); assert(var->data.index == 1); this->dual_src_output = reg; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp index 3d83152d365..b7d02e90a86 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp @@ -544,7 +544,7 @@ brw_compile_tcs(const struct brw_compiler *compiler, assert(output_size_bytes >= 1); if (output_size_bytes > GEN7_MAX_HS_URB_ENTRY_SIZE_BYTES) - return false; + return NULL; /* URB entry sizes are stored as a multiple of 64 bytes. */ vue_prog_data->urb_entry_size = ALIGN(output_size_bytes, 64) / 64; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 39d644ea63a..78846dc3790 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -515,6 +515,10 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) /* _NEW_BUFFERS */ key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers; + /* _NEW_COLOR */ + key->force_dual_color_blend = brw->dual_color_blend_by_location && + (ctx->Color.BlendEnabled & 1) && ctx->Color.Blend[0]._UsesDualSrc; + /* _NEW_MULTISAMPLE, _NEW_COLOR, _NEW_BUFFERS */ key->replicate_alpha = ctx->DrawBuffer->_NumColorDrawBuffers > 1 && (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index e1e1e62d26a..bca783aea86 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -79,6 +79,7 @@ DRI_CONF_BEGIN DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false") DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false") DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false") + DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION("false") DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false") DRI_CONF_OPT_BEGIN_B(shader_precompile, "true") |