[Bug 106810] ProgramBinary does not switch program correctly when using transform feedback

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jun 4 11:00:14 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=106810

            Bug ID: 106810
           Summary: ProgramBinary does not switch program correctly when
                    using transform feedback
           Product: Mesa
           Version: git
          Hardware: Other
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Drivers/DRI/i965
          Assignee: intel-3d-bugs at lists.freedesktop.org
          Reporter: xinghua.cao at intel.com
        QA Contact: intel-3d-bugs at lists.freedesktop.org

Steps:
1. Download chrome and install it on your Ubuntu,
https://www.google.com/chrome/?platform=linux&extra=devchannel.
2. Open the link,
https://www.khronos.org/registry/webgl/sdk/tests/deqp/functional/gles3/negativeshaderapi.html?webglVersion=2&quiet=0
3. some cases fail, if not, please continuously press the "refresh"
button.(Because this issue happens when using ProgramBinary, not LinkProgram) 

Note:
This case only tests that "A INVALID_OPERATION error is generated by
LinkProgram if program is being used by one or more transform feedback
objects".
List main code of a case as below, with simple vertex shader and pixel shader,
and one output "gl_Position" of vertex shader, which used for transform
feedback.

var program = new gluShaderProgram.ShaderProgram(gl,
gluShaderProgram.makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
var buf;
var tfID;
var tfVarying = ['gl_Position'];
tfID = gl.createTransformFeedback();
buf = gl.createBuffer();
gl.useProgram(program.getProgram());
gl.transformFeedbackVaryings(program.getProgram(), tfVarying,
gl.INTERLEAVED_ATTRIBS);
gl.linkProgram(program.getProgram());
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tfID);
gl.bindBuffer(gl.TRANSFORM_FEEDBACK_BUFFER, buf);
gl.bufferData(gl.TRANSFORM_FEEDBACK_BUFFER, 32, gl.DYNAMIC_DRAW);
gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, buf);
gl.beginTransformFeedback(gl.TRIANGLES);
this.expectError(gl.NO_ERROR);            

gl.linkProgram(program.getProgram());
this.expectError(gl.INVALID_OPERATION);

ShaderProgram construct function also calls linkProgram to generate "program "
object. Above code totally calls linkProgram three times.
The first time runs this case, could pass.
In order to improve performance, chromium had cached program binary after
calling this first two linkProgram calls, so would cache two program binary
objects (programBinary1 and ProgramBinary2), programBinary1 without transform
feedback, programBinary2 with transform feedback. The second time run this
case, the code maybe as below,

gl.programBinary(programBinary1...);
var buf;
var tfID;
var tfVarying = ['gl_Position'];
tfID = gl.createTransformFeedback();
buf = gl.createBuffer();
gl.useProgram(program.getProgram());
gl.transformFeedbackVaryings(program.getProgram(), tfVarying,
gl.INTERLEAVED_ATTRIBS);
gl.programBinary(programBinary2...);
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tfID);
gl.bindBuffer(gl.TRANSFORM_FEEDBACK_BUFFER, buf);
gl.bufferData(gl.TRANSFORM_FEEDBACK_BUFFER, 32, gl.DYNAMIC_DRAW);
gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, buf);
gl.beginTransformFeedback(gl.TRIANGLES);
this.expectError(gl.NO_ERROR);       //!!!!!!! Error happens here,
glBeginTransformFeedback(no varyings to record)
gl.linkProgram(program.getProgram());
this.expectError(gl.INVALID_OPERATION);

When calling gl.programBinary(programBinary2...), Mesa did not implicitly call
useProgram to swich "gl_program" from programBinary1 to programBinary2, make
"gl_program" object of programBinary2 as current program, even these two
"gl_program" object shared the same "gl_shader_program".
Please help check whether this investigation is correct. Thank you.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20180604/9eed6d06/attachment.html>


More information about the intel-3d-bugs mailing list