Bug 93053 - GL_PROGRAM_BINARY_LENGTH always reports 0
Summary: GL_PROGRAM_BINARY_LENGTH always reports 0
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: All All
: medium major
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-21 04:18 UTC by Dale Weiler
Modified: 2015-11-30 22:58 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Dale Weiler 2015-11-21 04:18:42 UTC
shaderapi.c always stores 0 for GL_PROGRAM_BINARY_LENGTH when placing a ProgramParameter call. This unfortunately is not a valid value to store there unless GL_LINK_STATUS is GL_FALSE. The size returned by this call should be the amount of bytes required to place a call to GetProgramBinary. There seems to be no way in mesa to safely obtain a program binary without trying GetProgramBinary in a loop, reallocating the buffer as necessary to store the binary until it succeeds. Unfortunately there is no way to distinguish if the function call is failing because of lack of memory or because of something else.
Comment 1 Dale Weiler 2015-11-21 06:35:50 UTC
A minor quick fix may look something like this:

>> size_t size = 0;

>> case GL_PROGRAM_BINARY_LENGTH:
>>     free(mesa_program_serialize(shProg, &size));
>>     *params = size;
>>     return;

Though to be fair, mesa_program_serialize should have an option to query
just the size without allocating memory (using blob.position())
Comment 2 Tapani Pälli 2015-11-23 08:00:05 UTC
Mesa does not support program binary extension, you seem to be using a custom branch (?)
Comment 3 Ian Romanick 2015-11-30 22:58:35 UTC
The extension is supported, but there are no binary formats supported.  Since there is no binary format, there is no data in any binary format.  It's a bit of a dirty trick, but it is what it is.


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.