Bug 42461

Summary: Render error when there is no vertex shader
Product: Mesa Reporter: zhao jian <jian.j.zhao>
Component: Mesa coreAssignee: mesa-dev
Status: VERIFIED NOTOURBUG QA Contact:
Severity: major    
Priority: medium CC: eric, idr
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: piglit test case

Description zhao jian 2011-11-01 02:25:55 UTC
I tested on Piketon and found it will fail in rendering when there is no vertex shader specified. But according to the GL spec about glLinkProgram it says: 
"If program contains shader objects
	of type GL_VERTEX_SHADER but does not
	contain shader objects of type
	GL_FRAGMENT_SHADER, the vertex shader will
	be linked against the implicit interface for fixed functionality
	fragment processing. Similarly, if
	program contains shader objects of type
	GL_FRAGMENT_SHADER but it does not contain
	shader objects of type GL_VERTEX_SHADER,
	the fragment shader will be linked against the implicit
	interface for fixed functionality vertex processing. "

This issue existed on both Mesa master branch(56d30bb00d40cd391d7a469604792a27ddcc459c) and 7.11 branch(4464ee1a9aa3745109cee23531e3fb2323234d07). I have made a piglit case to reproduce it.
Comment 1 zhao jian 2011-11-01 04:00:16 UTC
Created attachment 52989 [details]
piglit test case
Comment 2 Ian Romanick 2011-11-01 17:38:26 UTC
It looks like some state is going wrong somewhere.  It acts like the drawing operation never happens.  MESA_GLSL=dump shows the expected IR being generated:

GLSL IR for linked fragment program 2:
(
(declare (out ) vec4 gl_FragColor)
(function main
  (signature void
    (parameters
    )
    (
      (assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 (0.200000 0.800000 0.200000 1.000000)) ) 
    ))

)


)

Mesa IR for linked fragment program 2:
  0: (assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 (0.200000 0.800000 0.200000 1.000000)) ) 
     MOV OUTPUT[2], CONST[0];
  1: END

I'll dig into this more tomorrow.
Comment 3 Ian Romanick 2011-11-02 13:19:34 UTC
The test also fails with (classic) swrast.
Comment 4 Ian Romanick 2011-11-02 14:19:34 UTC
The test fails because it is completely broken.  It calls piglit_ortho_projection, then it draws a rectangle from (0, 0)-(0.5, 0.5).  That rectangle covers a quarter of the pixels in the lower-left corner of the window.  This is clearly not what was wanted.

Deleting the call to piglit_ortho_projection causes the test to pass.
Comment 5 zhao jian 2011-11-04 06:21:48 UTC
(In reply to comment #4)
> The test fails because it is completely broken.  It calls
> piglit_ortho_projection, then it draws a rectangle from (0, 0)-(0.5, 0.5). 
> That rectangle covers a quarter of the pixels in the lower-left corner of the
> window.  This is clearly not what was wanted.
> Deleting the call to piglit_ortho_projection causes the test to pass.

Ian, thanks very much for your explaination. I will close it now.

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.