On 03/17/2015 04:20 PM, Ilia Mirkin wrote:
On Tue, Mar 17, 2015 at 5:13 AM, Tapani Pälli <tapani.pa...@intel.com> wrote:
On 03/16/2015 08:08 PM, Ilia Mirkin wrote:
On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli <tapani.pa...@intel.com>
wrote:
+/**
+ * Returns output index for dual source blending.
+ */
GLint GLAPIENTRY
_mesa_GetProgramResourceLocationIndex(GLuint program, GLenum
programInterface,
const GLchar *name)
{
- return -1;
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ lookup_linked_program(program,
"glGetProgramResourceLocationIndex");
+
+ if (!shProg || invalid_array_element_syntax(name))
+ return -1;
+
+ /* From the GL_ARB_program_interface_query spec:
+ *
+ * "For GetProgramResourceLocationIndex, <programInterface> must be
+ * PROGRAM_OUTPUT."
+ */
And presumably it must be a program with a fragment shader (which
might not be there for a no-rast or compute pipeline).
spec says that -1 is returned:
"If <program> has been successfully linked but contains no fragment shader,
no error will be generated but -1 will be returned."
this is what happens with the implementation.
Can you explain how the current implementation takes care of that?
My earlier suggestion for this was that
_mesa_program_resource_location_index returns -1 because resource cannot
be found. But now I see that one could call this for any output of any
stage and then it would likely return 0 or whatever is the uninitialized
state of ir_variable::data.index. Will have to fix this, thanks for
spotting this!
// Tapani
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev