Mesa (master): i965: Drop support for the legacy SNORM -> Float equation.
Module: Mesa Branch: master Commit: 74e1d6e20c186bd1bdcb6624e379727c1e18b5a6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=74e1d6e20c186bd1bdcb6624e379727c1e18b5a6 Author: Kenneth GraunkeDate: Mon Dec 25 19:10:22 2017 -0800 i965: Drop support for the legacy SNORM -> Float equation. Older OpenGL defines two equations for converting from signed-normalized to floating point data. These are: f = (2c + 1)/(2^b - 1)(equation 2.2) f = max{c/2^(b-1) - 1), -1.0} (equation 2.3) Both OpenGL 4.2+ and OpenGL ES 3.0+ mandate that equation 2.3 is to be used in all scenarios, and remove equation 2.2. DirectX uses equation 2.3 as well. Intel hardware only supports equation 2.3, so Gen7.5+ systems that use the vertex fetcher hardware to do the conversions always get formula 2.3. This can make a big difference for 10-10-10-2 formats - the 2-bit value can represent 0 with equation 2.3, and cannot with equation 2.2. Ivybridge and older were using equation 2.2 for OpenGL, and 2.3 for ES. Now that Ivybridge supports OpenGL 4.2, this is wrong - we need to use the new rules, at least in core profile. That would leave Gen4-6 doing something different than all other hardware, which seems...lame. With context version promotion, applications that requested a pre-4.2 context may get promoted to 4.2, and thus get the new rules. Zero cases have been reported of this being a problem. However, we've received a report that following the old rules breaks expectations. SuperTuxKart apparently renders the cars red when following equation 2.2, and works correctly when following equation 2.3: https://github.com/supertuxkart/stk-code/issues/2885#issuecomment-353858405 So, this patch deletes the legacy equation 2.2 support entirely, making all hardware and APIs consistently use the new equation 2.3 rules. If we ever find an application that truly requires the old formula, then we'd likely want that application to work on modern hardware, too. We'd likely restore this support as a driconf option. Until then, drop it. This commit will regress Piglit's draw-vertices-2101010 test on pre-Haswell without the corresponding Piglit patch to accept either formula (commit 35daaa1695ea01eb85bc02f9be9b6ebd1a7113a1): draw-vertices-2101010: Accept either SNORM conversion formula. Reviewed-by: Jason Ekstrand Reviewed-by: Ian Romanick Reviewed-by: Chris Forbes --- src/intel/blorp/blorp.c| 3 +-- src/intel/compiler/brw_compiler.h | 1 - src/intel/compiler/brw_nir.c | 4 +-- src/intel/compiler/brw_nir.h | 2 -- src/intel/compiler/brw_nir_attribute_workarounds.c | 29 ++ src/intel/compiler/brw_vec4.cpp| 7 ++ src/intel/compiler/brw_vec4_vs.h | 5 +--- src/intel/compiler/brw_vec4_vs_visitor.cpp | 6 ++--- src/intel/vulkan/anv_pipeline.c| 2 +- src/mesa/drivers/dri/i965/brw_vs.c | 1 - 10 files changed, 15 insertions(+), 45 deletions(-) diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c index 8a9d2fd3b9..e8a2c6135f 100644 --- a/src/intel/blorp/blorp.c +++ b/src/intel/blorp/blorp.c @@ -223,8 +223,7 @@ blorp_compile_vs(struct blorp_context *blorp, void *mem_ctx, const unsigned *program = brw_compile_vs(compiler, blorp->driver_ctx, mem_ctx, - _key, vs_prog_data, nir, - false, -1, NULL); + _key, vs_prog_data, nir, -1, NULL); return program; } diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 28aed83324..0060c381c0 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -1123,7 +1123,6 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data, const struct brw_vs_prog_key *key, struct brw_vs_prog_data *prog_data, const struct nir_shader *shader, - bool use_legacy_snorm_formula, int shader_time_index, char **error_str); diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 265c63efdd..dbddef0d04 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -211,7 +211,6 @@ remap_patch_urb_offsets(nir_block *block, nir_builder *b, void brw_nir_lower_vs_inputs(nir_shader *nir, -bool use_legacy_snorm_formula, const uint8_t *vs_attrib_wa_flags) { /* Start with the location of the variable's base. */ @@ -230,8 +229,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir, add_const_offset_to_base(nir, nir_var_shader_in); - brw_nir_apply_attribute_workarounds(nir, use_legacy_snorm_formula, -
Mesa (master): meta/blit: Don't restore state of the temporary texture
Module: Mesa Branch: master Commit: 9de64d0baa0d4404721aa09fd665252b759a8f28 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9de64d0baa0d4404721aa09fd665252b759a8f28 Author: Ian RomanickDate: Tue Jan 12 17:39:54 2016 -0800 meta/blit: Don't restore state of the temporary texture It's about to be destroyed, so there's no point. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta_blit.c | 48 + 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 6322b64696..66714b1ea5 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -841,30 +841,36 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, 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 the target restricts values for base level or max level, we assume -* that the original values were valid. -*/ - if (blit->baseLevelSave != texObj->BaseLevel) - _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, ->baseLevelSave, false); - - if (blit->maxLevelSave != texObj->MaxLevel) - _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, ->maxLevelSave, false); + /* Either there is no temporary texture or the temporary texture is bound. */ + assert(blit->tempTex == 0 || texObj->Name == blit->tempTex); - /* 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. + /* Restore texture object state, the texture binding will be restored by +* _mesa_meta_end(). If the texture is the temporary texture that is about +* to be destroyed, don't bother restoring its state. +*/ + if (blit->tempTex == 0) { + /* If the target restricts values for base level or max level, we assume + * that the original values were valid. */ - const GLint param = blit->stencilSamplingSave ? - GL_STENCIL_INDEX : GL_DEPTH_COMPONENT; + if (blit->baseLevelSave != texObj->BaseLevel) + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, + >baseLevelSave, false); + + if (blit->maxLevelSave != texObj->MaxLevel) + _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, + >maxLevelSave, false); + + /* 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; - _mesa_texture_parameteriv(ctx, texObj, GL_DEPTH_STENCIL_TEXTURE_MODE, -, false); + _mesa_texture_parameteriv(ctx, texObj, GL_DEPTH_STENCIL_TEXTURE_MODE, + , false); + } } _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, blit->samp_obj_save); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta: Don't pollute the texture namespace
Module: Mesa Branch: master Commit: bd32d4d0671777d9b7d6e3a592abb67563a8063c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd32d4d0671777d9b7d6e3a592abb67563a8063c Author: Ian RomanickDate: Tue Jan 19 17:43:05 2016 -0800 meta: Don't pollute the texture namespace tl;dr: For many types of GL object, we can *NEVER* use the Gen function. In OpenGL ES (all versions!) and OpenGL compatibility profile, applications don't have to call Gen functions. The GL spec is very clear about how you can mix-and-match generated names and non-generated names: you can use any name you want for a particular object type until you call the Gen function for that object type. Here's the problem scenario: - Application calls a meta function that generates a name. The first Gen will probably return 1. - Application decides to use the same name for an object of the same type without calling Gen. Many demo programs use names 1, 2, 3, etc. without calling Gen. - Application calls the meta function again, and the meta function replaces the data. The application's data is lost, and the app fails. Have fun debugging that. Signed-off-by: Ian Romanick Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363 Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.c | 21 ++--- src/mesa/drivers/common/meta_blit.c | 18 -- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 55d803fd5b..f4830ec28a 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -98,7 +98,8 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl); static struct blit_shader * choose_blit_shader(GLenum target, struct blit_shader_table *table); -static void cleanup_temp_texture(struct temp_texture *tex); +static void cleanup_temp_texture(struct gl_context *ctx, + struct temp_texture *tex); static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear); static void meta_decompress_cleanup(struct gl_context *ctx, @@ -418,7 +419,7 @@ _mesa_meta_free(struct gl_context *ctx) _mesa_meta_glsl_blit_cleanup(ctx, >Meta->Blit); meta_glsl_clear_cleanup(ctx, >Meta->Clear); _mesa_meta_glsl_generate_mipmap_cleanup(ctx, >Meta->Mipmap); - cleanup_temp_texture(>Meta->TempTex); + cleanup_temp_texture(ctx, >Meta->TempTex); meta_decompress_cleanup(ctx, >Meta->Decompress); meta_drawpix_cleanup(ctx, >Meta->DrawPix); if (old_context) @@ -1228,8 +1229,6 @@ invert_z(GLfloat normZ) static void init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) { - GLuint texObj; - /* prefer texture rectangle */ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle) { tex->Target = GL_TEXTURE_RECTANGLE; @@ -1245,21 +1244,13 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) tex->MinSize = 16; /* 16 x 16 at least */ assert(tex->MaxSize > 0); - _mesa_CreateTextures(tex->Target, 1, ); - tex->tex_obj = NULL; - - if (texObj == 0) - return; - - tex->tex_obj = _mesa_lookup_texture(ctx, texObj); + tex->tex_obj = ctx->Driver.NewTextureObject(ctx, 0xDEADBEEF, tex->Target); } static void -cleanup_temp_texture(struct temp_texture *tex) +cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex) { - if (tex->tex_obj == NULL) - return; - _mesa_DeleteTextures(1, >tex_obj->Name); + _mesa_delete_nameless_texture(ctx, tex->tex_obj); tex->tex_obj = NULL; } diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 95dfa64c05..496ef285d0 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -879,9 +879,7 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, blit->samp_obj_save); _mesa_reference_sampler_object(ctx, >samp_obj_save, NULL); _mesa_reference_sampler_object(ctx, >samp_obj, NULL); - - if (blit->temp_tex_obj) - _mesa_DeleteTextures(1, >temp_tex_obj->Name); + _mesa_delete_nameless_texture(ctx, blit->temp_tex_obj); } struct gl_texture_object * @@ -890,20 +888,14 @@ _mesa_meta_texture_object_from_renderbuffer(struct gl_context *ctx, { struct gl_texture_image *texImage; struct gl_texture_object *texObj; - GLuint tempTex; const GLenum target = rb->NumSamples > 1 ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D; - tempTex = 0; - _mesa_CreateTextures(target, 1, ); - if (tempTex == 0) - return NULL; - - texObj = _mesa_lookup_texture(ctx, tempTex); + texObj = ctx->Driver.NewTextureObject(ctx, 0xDEADBEEF, target); texImage = _mesa_get_tex_image(ctx, texObj, target, 0); if
Mesa (master): meta/blit: Use _mesa_bind_texture instead of _mesa_BindTexture
Module: Mesa Branch: master Commit: 05f4be96418b23abb3dc23666d5fa200696b1d4e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=05f4be96418b23abb3dc23666d5fa200696b1d4e Author: Ian RomanickDate: Wed Jan 13 01:25:59 2016 -0800 meta/blit: Use _mesa_bind_texture instead of _mesa_BindTexture Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta_blit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index ee48582944..ea0bd3fead 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -937,7 +937,7 @@ _mesa_meta_setup_sampler(struct gl_context *ctx, samp_obj->WrapR); /* Prepare src texture state */ - _mesa_BindTexture(target, texObj->Name); + _mesa_bind_texture(ctx, target, texObj); if (target != GL_TEXTURE_RECTANGLE_ARB) { _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, (GLint *) , false); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Fold _mesa_record_error into its only caller
Module: Mesa Branch: master Commit: d80be517750ba5e89432f962175bf996a6f52ce0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d80be517750ba5e89432f962175bf996a6f52ce0 Author: Ian RomanickDate: Tue Dec 12 09:05:46 2017 -0800 mesa: Fold _mesa_record_error into its only caller Also, the comment on _mesa_record_error was wrong. dd_function_table::Error was not called because that function does not exist. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/main/context.c | 25 - src/mesa/main/context.h | 4 src/mesa/main/errors.c | 3 ++- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 3fa9f69f88..53261fea51 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1829,31 +1829,6 @@ _mesa_get_dispatch(struct gl_context *ctx) /** \name Miscellaneous functions */ /**/ /*@{*/ - -/** - * Record an error. - * - * \param ctx GL context. - * \param error error code. - * - * Records the given error code and call the driver's dd_function_table::Error - * function if defined. - * - * \sa - * This is called via _mesa_error(). - */ -void -_mesa_record_error(struct gl_context *ctx, GLenum error) -{ - if (!ctx) - return; - - if (ctx->ErrorValue == GL_NO_ERROR) { - ctx->ErrorValue = error; - } -} - - /** * Flush commands. */ diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 309d25cf3b..17fb86c323 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -154,10 +154,6 @@ _mesa_set_context_lost_dispatch(struct gl_context *ctx); /*@{*/ extern void -_mesa_record_error( struct gl_context *ctx, GLenum error ); - - -extern void _mesa_flush(struct gl_context *ctx); extern void GLAPIENTRY diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 35a2f66c31..a968791362 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -327,7 +327,8 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) } /* Set the GL context error state for glGetError. */ - _mesa_record_error(ctx, error); + if (ctx->ErrorValue == GL_NO_ERROR) + ctx->ErrorValue = error; } void ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta/blit: Check the values instead of the target before restoring
Module: Mesa Branch: master Commit: a232df15235ca0e7d4c36762cfb5b51038d71849 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a232df15235ca0e7d4c36762cfb5b51038d71849 Author: Ian RomanickDate: Tue Jan 12 17:37:02 2016 -0800 meta/blit: Check the values instead of the target before restoring Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta_blit.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 7adad469ac..6322b64696 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -843,13 +843,17 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, /* Restore texture object state, the texture binding will * be restored by _mesa_meta_end(). +* +* If the target restricts values for base level or max level, we assume +* that the original values were valid. */ - if (target != GL_TEXTURE_RECTANGLE_ARB) { + if (blit->baseLevelSave != texObj->BaseLevel) _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL, >baseLevelSave, false); + + if (blit->maxLevelSave != texObj->MaxLevel) _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL, >maxLevelSave, false); - } /* If ARB_stencil_texturing is not supported, the mode won't have changed. */ if (texObj->StencilSampling != blit->stencilSamplingSave) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta: Use _mesa_CreateTextures instead of _mesa_GenTextures
Module: Mesa Branch: master Commit: e0ad314568349e24e5fe44dc6cac8b98a14213d6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0ad314568349e24e5fe44dc6cac8b98a14213d6 Author: Ian RomanickDate: Tue Jan 19 16:38:20 2016 -0800 meta: Use _mesa_CreateTextures instead of _mesa_GenTextures Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index be490d565b..5bad17d76b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1245,7 +1245,7 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) tex->MinSize = 16; /* 16 x 16 at least */ assert(tex->MaxSize > 0); - _mesa_GenTextures(1, ); + _mesa_CreateTextures(tex->Target, 1, ); tex->tex_obj = NULL; if (texObj == 0) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Add _mesa_bind_texture method
Module: Mesa Branch: master Commit: 594d02892e794b585df31ee75d5c1e2a0e312c25 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=594d02892e794b585df31ee75d5c1e2a0e312c25 Author: Ian RomanickDate: Wed Jan 13 01:20:09 2016 -0800 mesa: Add _mesa_bind_texture method Light-weight glBindTexture for internal use. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/main/texobj.c | 24 +++- src/mesa/main/texobj.h | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index db40598823..5dc5cb8e1a 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1692,6 +1692,29 @@ bind_texture_object(struct gl_context *ctx, unsigned unit, } } +/** + * Light-weight bind texture for internal users + * + * This is really just \c finish_texture_init plus \c bind_texture_object. + * This is intended to be used by internal Mesa functions that use + * \c _mesa_CreateTexture and need to bind textures (e.g., meta). + */ +void +_mesa_bind_texture(struct gl_context *ctx, GLenum target, + struct gl_texture_object *tex_obj) +{ + const GLint targetIndex = _mesa_tex_target_to_index(ctx, target); + + assert(targetIndex >= 0 && targetIndex < NUM_TEXTURE_TARGETS); + + if (tex_obj->Target == 0) + finish_texture_init(ctx, target, tex_obj, targetIndex); + + assert(tex_obj->Target == target); + assert(tex_obj->TargetIndex == targetIndex); + + bind_texture_object(ctx, ctx->Texture.CurrentUnit, tex_obj); +} /** * Implement glBindTexture(). Do error checking, look-up or create a new @@ -1764,7 +1787,6 @@ bind_texture(struct gl_context *ctx, GLenum target, GLuint texName, bind_texture_object(ctx, ctx->Texture.CurrentUnit, newTexObj); } - void GLAPIENTRY _mesa_BindTexture_no_error(GLenum target, GLuint texName) { diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 8dea85303d..f2d78aca0d 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -175,7 +175,9 @@ extern void _mesa_delete_nameless_texture(struct gl_context *ctx, struct gl_texture_object *texObj); - +extern void +_mesa_bind_texture(struct gl_context *ctx, GLenum target, + struct gl_texture_object *tex_obj); /*@}*/ /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta/blit: Track source texture using gl_texture_object instead of GL API object handle
Module: Mesa Branch: master Commit: 7609d54e4a891c5d101404c8b291e5f0aebfb926 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7609d54e4a891c5d101404c8b291e5f0aebfb926 Author: Ian RomanickDate: Wed Jan 13 01:22:43 2016 -0800 meta/blit: Track source texture using gl_texture_object instead of GL API object handle Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.h | 1 + src/mesa/drivers/common/meta_blit.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index a41de8bfea..1b1672e03c 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -312,6 +312,7 @@ struct fb_tex_blit_state GLint baseLevelSave, maxLevelSave; struct gl_sampler_object *samp_obj; struct gl_sampler_object *samp_obj_save; + struct gl_texture_object *tex_obj; GLuint stencilSamplingSave; GLuint tempTex; }; diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index d33624d174..27996f9daf 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -694,6 +694,7 @@ blitframebuffer_texture(struct gl_context *ctx, } target = texObj->Target; + fb_tex_blit.tex_obj = texObj; fb_tex_blit.baseLevelSave = texObj->BaseLevel; fb_tex_blit.maxLevelSave = texObj->MaxLevel; fb_tex_blit.stencilSamplingSave = texObj->StencilSampling; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Revert "mesa: remove unused _mesa_delete_nameless_texture() "
Module: Mesa Branch: master Commit: e6cef4b0818d014e140f3b17e8603c384066bcf8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6cef4b0818d014e140f3b17e8603c384066bcf8 Author: Ian RomanickDate: Tue Dec 12 19:41:49 2017 -0800 Revert "mesa: remove unused _mesa_delete_nameless_texture()" Changes in this series use this function. This reverts commit 048de9e34a2214371481143cddcaa53f52468c6b. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli Cc: Samuel Pitoiset Cc: Timothy Arceri --- src/mesa/main/texobj.c | 41 + src/mesa/main/texobj.h | 5 + 2 files changed, 46 insertions(+) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 02c4767788..db40598823 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1511,6 +1511,47 @@ delete_textures(struct gl_context *ctx, GLsizei n, const GLuint *textures) } } +/** + * This deletes a texObj without altering the hash table. + */ +void +_mesa_delete_nameless_texture(struct gl_context *ctx, + struct gl_texture_object *texObj) +{ + if (!texObj) + return; + + FLUSH_VERTICES(ctx, 0); + + _mesa_lock_texture(ctx, texObj); + { + /* Check if texture is bound to any framebuffer objects. + * If so, unbind. + * See section 4.4.2.3 of GL_EXT_framebuffer_object. + */ + unbind_texobj_from_fbo(ctx, texObj); + + /* Check if this texture is currently bound to any texture units. + * If so, unbind it. + */ + unbind_texobj_from_texunits(ctx, texObj); + + /* Check if this texture is currently bound to any shader + * image unit. If so, unbind it. + * See section 3.9.X of GL_ARB_shader_image_load_store. + */ + unbind_texobj_from_image_units(ctx, texObj); + } + _mesa_unlock_texture(ctx, texObj); + + ctx->NewState |= _NEW_TEXTURE_OBJECT; + + /* Unreference the texobj. If refcount hits zero, the texture +* will be deleted. +*/ + _mesa_reference_texobj(, NULL); +} + void GLAPIENTRY _mesa_DeleteTextures_no_error(GLsizei n, const GLuint *textures) diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index e67ce3ff9d..8dea85303d 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -171,6 +171,11 @@ _mesa_unlock_context_textures( struct gl_context *ctx ); extern void _mesa_lock_context_textures( struct gl_context *ctx ); +extern void +_mesa_delete_nameless_texture(struct gl_context *ctx, + struct gl_texture_object *texObj); + + /*@}*/ /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta: Track temporary textures using gl_texture_object instead of GL API object handle
Module: Mesa Branch: master Commit: 173e3045a9a176d95be1b4d3fbf7ba0230293842 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=173e3045a9a176d95be1b4d3fbf7ba0230293842 Author: Ian RomanickDate: Thu Jan 14 12:07:02 2016 -0800 meta: Track temporary textures using gl_texture_object instead of GL API object handle Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.c | 43 ++--- src/mesa/drivers/common/meta.h | 2 +- src/mesa/drivers/common/meta_blit.c | 8 --- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 52d959a710..be490d565b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1228,6 +1228,8 @@ invert_z(GLfloat normZ) static void init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) { + GLuint texObj; + /* prefer texture rectangle */ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle) { tex->Target = GL_TEXTURE_RECTANGLE; @@ -1243,16 +1245,22 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) tex->MinSize = 16; /* 16 x 16 at least */ assert(tex->MaxSize > 0); - _mesa_GenTextures(1, >TexObj); + _mesa_GenTextures(1, ); + tex->tex_obj = NULL; + + if (texObj == 0) + return; + + tex->tex_obj = _mesa_lookup_texture(ctx, texObj); } static void cleanup_temp_texture(struct temp_texture *tex) { - if (!tex->TexObj) + if (tex->tex_obj == NULL) return; - _mesa_DeleteTextures(1, >TexObj); - tex->TexObj = 0; + _mesa_DeleteTextures(1, >tex_obj->Name); + tex->tex_obj = NULL; } @@ -1265,7 +1273,7 @@ _mesa_meta_get_temp_texture(struct gl_context *ctx) { struct temp_texture *tex = >Meta->TempTex; - if (!tex->TexObj) { + if (tex->tex_obj == NULL) { init_temp_texture(ctx, tex); } @@ -1283,7 +1291,7 @@ get_bitmap_temp_texture(struct gl_context *ctx) { struct temp_texture *tex = >Meta->Bitmap.Tex; - if (!tex->TexObj) { + if (tex->tex_obj == NULL) { init_temp_texture(ctx, tex); } @@ -1299,7 +1307,7 @@ _mesa_meta_get_temp_depth_texture(struct gl_context *ctx) { struct temp_texture *tex = >Meta->Blit.depthTex; - if (!tex->TexObj) { + if (tex->tex_obj == NULL) { init_temp_texture(ctx, tex); } @@ -1378,9 +1386,11 @@ _mesa_meta_setup_copypix_texture(struct gl_context *ctx, { bool newTex; - _mesa_BindTexture(tex->Target, tex->TexObj); - _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter); - _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter); + _mesa_BindTexture(tex->Target, tex->tex_obj->Name); + _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MIN_FILTER, + (GLint *) , false); + _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MAG_FILTER, + (GLint *) , false); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); newTex = _mesa_meta_alloc_texture(tex, width, height, intFormat); @@ -1422,9 +1432,16 @@ _mesa_meta_setup_drawpix_texture(struct gl_context *ctx, GLenum format, GLenum type, const GLvoid *pixels) { - _mesa_BindTexture(tex->Target, tex->TexObj); - _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + /* GLint so the compiler won't complain about type signedness mismatch in +* the call to _mesa_texture_parameteriv below. +*/ + static const GLint filter = GL_NEAREST; + + _mesa_BindTexture(tex->Target, tex->tex_obj->Name); + _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MIN_FILTER, , + false); + _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MAG_FILTER, , + false); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); /* copy pixel data to texture */ diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 252b236716..6d5185492d 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -200,7 +200,7 @@ struct save_state */ struct temp_texture { - GLuint TexObj; + struct gl_texture_object *tex_obj; GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */ GLsizei MinSize; /**< Min texture size to allocate */ GLsizei MaxSize; /**< Max possible texture size */ diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 0c08109e10..95dfa64c05 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -674,7 +674,7 @@ blitframebuffer_texture(struct gl_context *ctx, }
Mesa (master): meta: Use _mesa_bind_texture instead of _mesa_BindTexture
Module: Mesa Branch: master Commit: 5325a34ed78e2ffc3bd3d05fbdb49c8002853a77 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5325a34ed78e2ffc3bd3d05fbdb49c8002853a77 Author: Ian RomanickDate: Tue Jan 19 17:15:08 2016 -0800 meta: Use _mesa_bind_texture instead of _mesa_BindTexture Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.c | 6 +++--- src/mesa/drivers/common/meta_generate_mipmap.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 5bad17d76b..55d803fd5b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1386,7 +1386,7 @@ _mesa_meta_setup_copypix_texture(struct gl_context *ctx, { bool newTex; - _mesa_BindTexture(tex->Target, tex->tex_obj->Name); + _mesa_bind_texture(ctx, tex->Target, tex->tex_obj); _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MIN_FILTER, (GLint *) , false); _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MAG_FILTER, @@ -1437,7 +1437,7 @@ _mesa_meta_setup_drawpix_texture(struct gl_context *ctx, */ static const GLint filter = GL_NEAREST; - _mesa_BindTexture(tex->Target, tex->tex_obj->Name); + _mesa_bind_texture(ctx, tex->Target, tex->tex_obj); _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MIN_FILTER, , false); _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MAG_FILTER, , @@ -3176,7 +3176,7 @@ decompress_texture_image(struct gl_context *ctx, _mesa_buffer_sub_data(ctx, decompress->buf_obj, 0, sizeof(verts), verts); /* setup texture state */ - _mesa_BindTexture(target, texObj->Name); + _mesa_bind_texture(ctx, target, texObj); if (!use_glsl_version) _mesa_set_enable(ctx, target, GL_TRUE); diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 55093e9553..99d0931694 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -201,10 +201,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* We may have been called from glGenerateTextureMipmap with CurrentUnit * still set to 0, so we don't know when we can skip binding the texture. -* Assume that _mesa_BindTexture will be fast if we're rebinding the same +* Assume that _mesa_bind_texture will be fast if we're rebinding the same * texture. */ - _mesa_BindTexture(target, texObj->Name); + _mesa_bind_texture(ctx, target, texObj); if (mipmap->samp_obj == NULL) { mipmap->samp_obj = ctx->Driver.NewSamplerObject(ctx, 0xDEADBEEF); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta/blit: Since _mesa_meta_bind_rb_as_tex_image has only one output, return it
Module: Mesa Branch: master Commit: 29a948e06d49ef113014020b74434b1223ba44f2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29a948e06d49ef113014020b74434b1223ba44f2 Author: Ian RomanickDate: Tue Jan 12 18:21:18 2016 -0800 meta/blit: Since _mesa_meta_bind_rb_as_tex_image has only one output, return it Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.h | 5 ++--- src/mesa/drivers/common/meta_blit.c | 23 --- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 128c342fba..a41de8bfea 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -462,10 +462,9 @@ extern void _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, struct fb_tex_blit_state *blit); -extern GLboolean +extern struct gl_texture_object * _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, -struct gl_renderbuffer *rb, -struct gl_texture_object **texObj); +struct gl_renderbuffer *rb); struct gl_sampler_object * _mesa_meta_setup_sampler(struct gl_context *ctx, diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 4e660d2a57..d33624d174 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -640,7 +640,8 @@ blitframebuffer_texture(struct gl_context *ctx, srcLevel = readAtt->TextureLevel; texObj = readAtt->Texture; } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) { - if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, )) + texObj = _mesa_meta_bind_rb_as_tex_image(ctx, rb); + if (texObj == NULL) return false; fb_tex_blit.tempTex = texObj->Name; @@ -882,12 +883,12 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, _mesa_DeleteTextures(1, >tempTex); } -GLboolean +struct gl_texture_object * _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, -struct gl_renderbuffer *rb, -struct gl_texture_object **texObj) +struct gl_renderbuffer *rb) { struct gl_texture_image *texImage; + struct gl_texture_object *texObj; GLuint tempTex; const GLenum target = rb->NumSamples > 1 ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D; @@ -895,15 +896,15 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, tempTex = 0; _mesa_GenTextures(1, ); if (tempTex == 0) - return false; + return NULL; _mesa_BindTexture(target, tempTex); - *texObj = _mesa_lookup_texture(ctx, tempTex); - texImage = _mesa_get_tex_image(ctx, *texObj, target, 0); + texObj = _mesa_lookup_texture(ctx, tempTex); + texImage = _mesa_get_tex_image(ctx, texObj, target, 0); if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) { _mesa_DeleteTextures(1, ); - return false; + return NULL; } if (ctx->Driver.FinishRenderTexture && !rb->NeedsFinishRenderTexture) { @@ -911,9 +912,9 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, ctx->Driver.FinishRenderTexture(ctx, rb); } - assert(target == (*texObj)->Target); - assert(tempTex == (*texObj)->Name); - return true; + assert(target == texObj->Target); + assert(tempTex == texObj->Name); + return texObj; } struct gl_sampler_object * ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta/blit: Track temporary texture using gl_texture_object instead of GL API object handle
Module: Mesa Branch: master Commit: c36e3d30169da668e6185fbdd135e1b67297815f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c36e3d30169da668e6185fbdd135e1b67297815f Author: Ian RomanickDate: Thu Jan 14 11:14:49 2016 -0800 meta/blit: Track temporary texture using gl_texture_object instead of GL API object handle Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.h | 2 +- src/mesa/drivers/common/meta_blit.c | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 863997e9cc..252b236716 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -313,8 +313,8 @@ struct fb_tex_blit_state struct gl_sampler_object *samp_obj; struct gl_sampler_object *samp_obj_save; struct gl_texture_object *tex_obj; + struct gl_texture_object *temp_tex_obj; GLuint stencilSamplingSave; - GLuint tempTex; }; diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index ea0bd3fead..0c08109e10 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -644,7 +644,7 @@ blitframebuffer_texture(struct gl_context *ctx, if (texObj == NULL) return false; - fb_tex_blit.tempTex = texObj->Name; + fb_tex_blit.temp_tex_obj = texObj; srcLevel = 0; if (_mesa_is_winsys_fbo(readFb)) { @@ -834,7 +834,7 @@ _mesa_meta_fb_tex_blit_begin(struct gl_context *ctx, blit->samp_obj_save = NULL; _mesa_reference_sampler_object(ctx, >samp_obj_save, ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler); - blit->tempTex = 0; + blit->temp_tex_obj = NULL; } void @@ -845,13 +845,13 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, _mesa_get_current_tex_object(ctx, target); /* Either there is no temporary texture or the temporary texture is bound. */ - assert(blit->tempTex == 0 || texObj->Name == blit->tempTex); + assert(blit->temp_tex_obj == NULL || blit->temp_tex_obj == texObj); /* Restore texture object state, the texture binding will be restored by * _mesa_meta_end(). If the texture is the temporary texture that is about * to be destroyed, don't bother restoring its state. */ - if (blit->tempTex == 0) { + if (blit->temp_tex_obj == NULL) { /* If the target restricts values for base level or max level, we assume * that the original values were valid. */ @@ -880,8 +880,8 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, _mesa_reference_sampler_object(ctx, >samp_obj_save, NULL); _mesa_reference_sampler_object(ctx, >samp_obj, NULL); - if (blit->tempTex) - _mesa_DeleteTextures(1, >tempTex); + if (blit->temp_tex_obj) + _mesa_DeleteTextures(1, >temp_tex_obj->Name); } struct gl_texture_object * ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta/blit: Don' t bind texture in _mesa_meta_bind_rb_as_tex_image
Module: Mesa Branch: master Commit: d17e6bc48eaf20898ae34059372d58b6c8190f0f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d17e6bc48eaf20898ae34059372d58b6c8190f0f Author: Ian RomanickDate: Thu Jan 14 10:33:14 2016 -0800 meta/blit: Don't bind texture in _mesa_meta_bind_rb_as_tex_image All of the callers of _mesa_meta_bind_rb_as_tex_image call _mesa_meta_setup_sampler shortly after. _mesa_meta_setup_sampler also binds the texture. This is necessary because not all paths that lead to _mesa_meta_setup_sampler some through _mesa_meta_bind_rb_as_tex_image. Rename the function _mesa_meta_texture_object_from_renderbuffer to reflect its true purpose. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.h | 4 ++-- src/mesa/drivers/common/meta_blit.c | 9 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 1b1672e03c..863997e9cc 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -464,8 +464,8 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, struct fb_tex_blit_state *blit); extern struct gl_texture_object * -_mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, -struct gl_renderbuffer *rb); +_mesa_meta_texture_object_from_renderbuffer(struct gl_context *ctx, +struct gl_renderbuffer *rb); struct gl_sampler_object * _mesa_meta_setup_sampler(struct gl_context *ctx, diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 27996f9daf..ee48582944 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -640,7 +640,7 @@ blitframebuffer_texture(struct gl_context *ctx, srcLevel = readAtt->TextureLevel; texObj = readAtt->Texture; } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) { - texObj = _mesa_meta_bind_rb_as_tex_image(ctx, rb); + texObj = _mesa_meta_texture_object_from_renderbuffer(ctx, rb); if (texObj == NULL) return false; @@ -885,8 +885,8 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, } struct gl_texture_object * -_mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, -struct gl_renderbuffer *rb) +_mesa_meta_texture_object_from_renderbuffer(struct gl_context *ctx, +struct gl_renderbuffer *rb) { struct gl_texture_image *texImage; struct gl_texture_object *texObj; @@ -895,11 +895,10 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D; tempTex = 0; - _mesa_GenTextures(1, ); + _mesa_CreateTextures(target, 1, ); if (tempTex == 0) return NULL; - _mesa_BindTexture(target, tempTex); texObj = _mesa_lookup_texture(ctx, tempTex); texImage = _mesa_get_tex_image(ctx, texObj, target, 0); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta/blit: Don' t return the texture handle from _mesa_meta_bind_rb_as_tex_image
Module: Mesa Branch: master Commit: 44e153616d5f6b02a527510c196dee9ca368542f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44e153616d5f6b02a527510c196dee9ca368542f Author: Ian RomanickDate: Tue Jan 12 18:17:33 2016 -0800 meta/blit: Don't return the texture handle from _mesa_meta_bind_rb_as_tex_image It's always the same as *texObj->Name. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.h | 1 - src/mesa/drivers/common/meta_blit.c | 15 +++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 16dd8e293d..128c342fba 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -465,7 +465,6 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, extern GLboolean _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, struct gl_renderbuffer *rb, -GLuint *tex, struct gl_texture_object **texObj); struct gl_sampler_object * diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index f7e29bcfc6..4e660d2a57 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -640,10 +640,11 @@ blitframebuffer_texture(struct gl_context *ctx, srcLevel = readAtt->TextureLevel; texObj = readAtt->Texture; } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) { - if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, _tex_blit.tempTex, - )) + if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, )) return false; + fb_tex_blit.tempTex = texObj->Name; + srcLevel = 0; if (_mesa_is_winsys_fbo(readFb)) { GLint temp = srcY0; @@ -884,7 +885,6 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target, GLboolean _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, struct gl_renderbuffer *rb, -GLuint *tex, struct gl_texture_object **texObj) { struct gl_texture_image *texImage; @@ -897,14 +897,12 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, if (tempTex == 0) return false; - *tex = tempTex; - - _mesa_BindTexture(target, *tex); - *texObj = _mesa_lookup_texture(ctx, *tex); + _mesa_BindTexture(target, tempTex); + *texObj = _mesa_lookup_texture(ctx, tempTex); texImage = _mesa_get_tex_image(ctx, *texObj, target, 0); if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) { - _mesa_DeleteTextures(1, tex); + _mesa_DeleteTextures(1, ); return false; } @@ -914,6 +912,7 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, } assert(target == (*texObj)->Target); + assert(tempTex == (*texObj)->Name); return true; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit