[Mesa-dev] how mesa glsl compiler generate ir_texture

Liu Xin liuxin at icubecorp.com
Thu Aug 22 02:59:03 PDT 2013


Dear list,

i wonder if all vendors in mesa3d use intel's glsl compiler now? by 
browsing glsl source code, i still don't understand how it generates 
ir_texture.  in my idea, it treats it as normal function call.

for example, this is tiny fragment shader:
uniform sampler2D sampler2d;
varying mediump vec2  myTexCoord;
void main (void)
{
   gl_FragColor = texture2D(sampler2d,myTexCoord);
}

glsl_compiler will emit LIR/HIR like this. please note (call texture2D 
...). it's a normal ir_call instead of ir_texture.  i confirm that 
ast2hir doesn't new ir_texture in any case.

(function main
   (signature void
     (parameters
     )
     (
       (declare (temporary ) vec4 texture2D_retval at 0x94fc11c)
       (assign (constant bool (1)) (xyzw) (var_ref 
texture2D_retval at 0x94fc11c)  (call texture2D ((var_ref 
sampler2d at 0x955b114) (var_ref myTexCoord at 0x955b03c) ))
)
       (assign (constant bool (1)) (xyzw) (var_ref 
gl_FragColor at 0x92c2eb4)  (var_ref texture2D_retval at 0x94fc11c) )
     ))

)

do mesa glsl compiler can make use of ir_texture? i think it must be yes 
because all GPUs have texture unit and should handle tex commands. how 
does mesa do it?

thanks,
--lx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130822/84c84548/attachment.html>


More information about the mesa-dev mailing list