GLSL: How to check the number of instructions

Started by
3 comments, last by ndhb 16 years, 6 months ago
Hello, I'm new to GLSL. I just started learning about it last week. I need to know how I can check the number of instructions I used with my shader codes. Is there a specific way or formula like a '+' operation is 1 instruction? For example, how many instruction sets does this code use? void main (void) { float initial = dot(normal,lightdir)*0.3+0.7 ; vec3 raypos = vec3(globalpos); vec3 raydir = reflect(normalize(cameragpos-raypos),normalize(normal)); gl_FragColor = color * (initial); } Also, how do I check in my code about how many instructions set the graphics card support? Thanks.
Advertisement
There is not realy a way check this. You can't query the number of instructions used. For Nvidia hardware you might he able to use the nvemulate too to dump the shaders assembly, but it might be different for each gfx card and won't work for ATI. Maybe Nvidia also has other tools I'm not aware of.
ATI has tools for analyzing shaders either on their developers website
Yes, it's their shaderperf studio, which tells exactly how much registers, instructions, and performance is going to be expected.

Previously "Krohm"

Hi. If on Windows, try and take a look at OpenGL Extension Viewer. There's a registry tab, which allows writing the GLSL assembly code to disk.

http://www.realtech-vr.com

kind regards,
Nicolai

This topic is closed to new replies.

Advertisement