Bug 93796 - glGetActiveAtomicCounterBufferiv is broken
Summary: glGetActiveAtomicCounterBufferiv is broken
Status: RESOLVED INVALID
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Tapani Pälli
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-20 16:51 UTC by Nicolas Koch
Modified: 2016-01-21 14:53 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Fragment shader to reproduce bug (504 bytes, text/plain)
2016-01-20 16:51 UTC, Nicolas Koch
Details
piglit test (5.00 KB, patch)
2016-01-21 06:53 UTC, Tapani Pälli
Details | Splinter Review

Description Nicolas Koch 2016-01-20 16:51:28 UTC
Created attachment 121154 [details]
Fragment shader to reproduce bug

glGetActiveAtomicCounterBufferiv returns strange values for every <pname> I tested so far. Using the attached fragment shader, I get the following outputs (The atomic counter buffers have the ids 0 and 1, queried with glGetProgramiv):

glGetActiveAtomicCounterBufferiv(program, 0, GL_ATOMIC_COUNTER_BUFFER_BINDING, &binding) -> binding is 1 (should be 0)

glGetActiveAtomicCounterBufferiv(program, 1, GL_ATOMIC_COUNTER_BUFFER_BINDING, &binding) -> binding is 1 (correct)


glGetActiveAtomicCounterBufferiv(program, 0, GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE, &size) -> size is 1 (correct I think)

glGetActiveAtomicCounterBufferiv(program, 1, GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE, &size) -> size is 4294967297 (obviously not correct, should be 1)


glGetActiveAtomicCounterBufferiv(program, 0, ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS, &no_uniforms) -> no_uniforms is 1 (correct)

glGetActiveAtomicCounterBufferiv(program, 1, ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS, &no_uniforms) -> no_uniforms is 4294967297 (obviously not correct, should be 1)

I'm using latest git mesa, dmesg does not output anything.
Comment 1 Timothy Arceri 2016-01-21 01:07:28 UTC
This was broken by the following commit:

commit 34df5ebd778fd3027db0f380eab71a95cfa298c0
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Thu Mar 12 07:58:48 2015 +0200

    mesa: mesa_bufferiv utility function for buffer objects
    
    Patch adds new function 'mesa_bufferiv' and refactors existing
    GetActiveUniformBlockiv and GetActiveAtomicCounterBufferiv to
    use it.
    
    corresponding Piglit tests:
       arb_uniform_buffer_object*
       arb_shader_atomic_counters*
    
    (Many tests hit the corresponding queries.)
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Comment 2 Tapani Pälli 2016-01-21 04:53:18 UTC
Would it be possible to attach the test application?

> (The atomic counter buffers have the ids 0 and 1, queried with glGetProgramiv)

Can you paste how do you query the indices of the counters?
Comment 3 Tapani Pälli 2016-01-21 05:53:02 UTC
(In reply to Tapani Pälli from comment #2)
> Would it be possible to attach the test application?
> 
> > (The atomic counter buffers have the ids 0 and 1, queried with glGetProgramiv)
> 
> Can you paste how do you query the indices of the counters?

Forget about this question, I see now that you only query properties of buffers, not the counters. I'd still like the testapp as we have quite extensive one already in Piglit (arb_shader_atomic_counters-active-counters) that makes these same calls and has several buffers in use, this test is currently passing fine. My guess is that there is some particular difference between these your app and Piglit one which could be used to debug this.
Comment 4 Tapani Pälli 2016-01-21 06:16:18 UTC
I made a small app that compiles your shader and makes the same queries as in comment 1, test results for queries are following:

binding 0: 0
binding 1: 1
data size 0 : 4
data size 1: 4
counters 0: 1
counters 1: 1

I'm changing status to NEEDINFO based on this.
Comment 5 Timothy Arceri 2016-01-21 06:50:46 UTC
Hmm, seems I didn't read the code properly when I pointed out what I thought was the offending commit. On second look it does look like it *should* work.
Comment 6 Tapani Pälli 2016-01-21 06:53:58 UTC
Created attachment 121167 [details] [review]
piglit test

Attaching here a patch to Piglit that exercises these queries. Nicolas, please also attach information about your system. I'm testing this on HSW myself.
Comment 7 Nicolas Koch 2016-01-21 14:50:57 UTC
Hey guys, thanks for the replies.

I just triple checked my program and figured out I made a really big mistake somewhere else in the program (basically, the results of the openGL output where overwritten).

Turns out glGetActiveAtomicCounterBufferiv is working as intended and this bug can be closed. Sorry for the inconvenience this caused.
Comment 8 Tapani Pälli 2016-01-21 14:53:13 UTC
No problem, good to hear that you found the issue.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.