[Mesa-dev] [PATCH 1/3] mesa: remove unneeded error check in create_textures()
Mark Janes
mark.a.janes at intel.com
Wed Oct 7 15:47:40 PDT 2015
Brian Paul <brianp at vmware.com> writes:
> On 10/05/2015 05:18 PM, Mark Janes wrote:
>> I tested this patch and found:
>>
>> regressions:
>> spec.arb_shader_storage_buffer_object.layout-std140-write-shader (BDW only)
>> expected[1] = 1.00. Read value: 0.00
>>
>> spec.arb_copy_image.arb_copy_image-srgb-copy (assertion)
>> arb_copy_image-srgb-copy: src/mesa/main/texobj.c:1739:
>> _mesa_BindTexture: Assertion `newTexObj->TargetIndex == targetIndex'
>> failed.
>
> Can you provide the stack trace from gdb at least?
#0 0x00007ffff58e0107 in __GI_raise (sig=sig at entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff58e14e8 in __GI_abort () at abort.c:89
#2 0x00007ffff58d9226 in __assert_fail_base (fmt=0x7ffff5a0fd08 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion at entry=0x7ffff22a1bea "index < NUM_TEXTURE_TARGETS", file=file at entry=0x7ffff22a2048 "/home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/main/texobj.c", line=line at entry=1368, function=function at entry=0x7ffff22a2770 <__PRETTY_FUNCTION__.37205> "unbind_texobj_from_texunits") at assert.c:92
#3 0x00007ffff58d92d2 in __GI___assert_fail (assertion=assertion at entry=0x7ffff22a1bea "index < NUM_TEXTURE_TARGETS", file=file at entry=0x7ffff22a2048 "/home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/main/texobj.c", line=line at entry=1368, function=function at entry=0x7ffff22a2770 <__PRETTY_FUNCTION__.37205> "unbind_texobj_from_texunits") at assert.c:101
#4 0x00007ffff1f6119f in unbind_texobj_from_texunits (ctx=0x7ffff7fce040, texObj=0x956470) at /home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/main/texobj.c:1368
#5 0x00007ffff1f62195 in _mesa_DeleteTextures (n=n at entry=1, textures=textures at entry=0x7fffffffd24c) at /home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/main/texobj.c:1483
#6 0x00007ffff201e2ff in _mesa_meta_CopyImageSubData_uncompressed (ctx=ctx at entry=0x7ffff7fce040, src_tex_image=src_tex_image at entry=0x95de80, src_renderbuffer=src_renderbuffer at entry=0x0, src_x=src_x at entry=0, src_y=src_y at entry=0, src_z=src_z at entry=0, dst_tex_image=0x956bc0, dst_renderbuffer=0x0, dst_x=0, dst_y=0, dst_z=0, src_width=32, src_height=32) at /home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/drivers/common/meta_copy_image.c:289
#7 0x00007ffff2251275 in intel_copy_image_sub_data (ctx=0x7ffff7fce040, src_image=0x95de80, src_renderbuffer=0x0, src_x=0, src_y=0, src_z=0, dst_image=0x956bc0, dst_renderbuffer=0x0, dst_x=0, dst_y=0, dst_z=0, src_width=32, src_height=32) at /home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/drivers/dri/i965/intel_copy_image.c:216
#8 0x00007ffff1e7ae38 in _mesa_CopyImageSubData (srcName=<optimized out>, srcTarget=<optimized out>, srcLevel=0, srcX=0, srcY=0, srcZ=<optimized out>, dstName=3, dstTarget=3553, dstLevel=0, dstX=0, dstY=0, dstZ=0, srcWidth=32, srcHeight=32, srcDepth=1) at /home/majanes/src/mesa_jenkins/repos/mesa/src/mesa/main/copyimage.c:528
#9 0x00007ffff7ab3933 in stub_glCopyImageSubData (srcName=2, srcTarget=3553, srcLevel=0, srcX=0, srcY=0, srcZ=0, dstName=3, dstTarget=3553, dstLevel=0, dstX=0, dstY=0, dstZ=0, srcWidth=32, srcHeight=32, srcDepth=1) at /home/majanes/src/mesa_jenkins/repos/piglit/build_m64/tests/util/piglit-dispatch-gen.c:7769
#10 0x0000000000401001 in test_srgb_copy () at /home/majanes/src/mesa_jenkins/repos/piglit/tests/spec/arb_copy_image/srgb-copy.c:80
#11 0x0000000000401111 in piglit_display () at /home/majanes/src/mesa_jenkins/repos/piglit/tests/spec/arb_copy_image/srgb-copy.c:115
#12 0x00007ffff7b42de7 in run_test (gl_fw=0x613c20, argc=1, argv=0x7fffffffe728) at /home/majanes/src/mesa_jenkins/repos/piglit/tests/util/piglit-framework-gl/piglit_fbo_framework.c:52
#13 0x00007ffff7b2962c in piglit_gl_test_run (argc=1, argv=0x7fffffffe728, config=0x7fffffffe5f0) at /home/majanes/src/mesa_jenkins/repos/piglit/tests/util/piglit-framework-gl.c:199
#14 0x0000000000400e80 in main (argc=1, argv=0x7fffffffe728) at /home/majanes/src/mesa_jenkins/repos/piglit/tests/spec/arb_copy_image/srgb-copy.c:43
in "assert(index < NUM_TEXTURE_TARGETS);", index = NUM_TEXTURE_TARGETS.
-Mark
>
> I didn't hit this because GL_ARB_copy_image isn't yet enabled for the
> llvmpipe/vmware drivers.
>
> This is weird because that piglit test uses no textures. Many other
> piglit tests don't use textures either and none of them hit that
> assertion for me.
>
> -Brian
>
>
>>
>> fixes:
>> spec.!opengl 1_0.gl-1.0-beginend-coverage
>> spec.!opengl 1_0.gl-1.0-no-op-paths
>> spec.arb_copy_image.arb_copy_image-formats
>> -Mark
>>
>> Brian Paul <brianp at vmware.com> writes:
>>
>>> Callers of create_texture() will either pass target=0 or a validated
>>> GL texture target enum so no need to do another error check inside
>>> the loop.
>>> ---
>>> src/mesa/main/texobj.c | 11 ++---------
>>> 1 file changed, 2 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
>>> index 173e43c..aa4b38c 100644
>>> --- a/src/mesa/main/texobj.c
>>> +++ b/src/mesa/main/texobj.c
>>> @@ -1211,6 +1211,7 @@ _mesa_create_nameless_texture(struct gl_context *ctx, GLenum target)
>>> * glCreateTextures should throw errors if target = 0. This is not exposed to
>>> * the rest of Mesa to encourage Mesa internals to use nameless textures,
>>> * which do not require expensive hash lookups.
>>> + * \param target either 0 or a a valid / error-checked texture target enum
>>> */
>>> static void
>>> create_textures(struct gl_context *ctx, GLenum target,
>>> @@ -1219,6 +1220,7 @@ create_textures(struct gl_context *ctx, GLenum target,
>>> GLuint first;
>>> GLint i;
>>> const char *func = dsa ? "Create" : "Gen";
>>> + const GLint targetIndex = _mesa_tex_target_to_index(ctx, target);
>>>
>>> if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
>>> _mesa_debug(ctx, "gl%sTextures %d\n", func, n);
>>> @@ -1241,7 +1243,6 @@ create_textures(struct gl_context *ctx, GLenum target,
>>> /* Allocate new, empty texture objects */
>>> for (i = 0; i < n; i++) {
>>> struct gl_texture_object *texObj;
>>> - GLint targetIndex;
>>> GLuint name = first + i;
>>> texObj = ctx->Driver.NewTextureObject(ctx, name, target);
>>> if (!texObj) {
>>> @@ -1252,14 +1253,6 @@ create_textures(struct gl_context *ctx, GLenum target,
>>>
>>> /* Initialize the target index if target is non-zero. */
>>> if (target != 0) {
>>> - targetIndex = _mesa_tex_target_to_index(ctx, texObj->Target);
>>> - if (targetIndex < 0) { /* Bad Target */
>>> - mtx_unlock(&ctx->Shared->Mutex);
>>> - _mesa_error(ctx, GL_INVALID_ENUM, "gl%sTextures(target = %s)",
>>> - func, _mesa_enum_to_string(texObj->Target));
>>> - return;
>>> - }
>>> - assert(targetIndex < NUM_TEXTURE_TARGETS);
>>> texObj->TargetIndex = targetIndex;
>>> }
>>>
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=KpeMsnk17EmmpfJI_fFwUFd4a4OQr-PY_FpYFGfZtP8&s=A_rBTSsTU1hVOFc3OVxJFMGSTfUzZ65dscavwCyECyU&e=
More information about the mesa-dev
mailing list