GL-Slang more of a scripting language?

Discussion in 'Rendering Technology and APIs' started by K.I.L.E.R, Jun 11, 2005.

  1. KimB

    Legend

    Joined:
    May 28, 2002
    Messages:
    12,928
    Likes Received:
    230
    Location:
    Seattle, WA
    Well, since the hardware has no idea whether or not the code it is receiving came from unrolled loops, obviously. It just can't deal with very long shaders.
     
  2. skirst

    Newcomer

    Joined:
    Sep 19, 2003
    Messages:
    5
    Likes Received:
    0
    Location:
    Cincinnati, Ohio USA
    I've had enough problems using loops in GLSL shaders on ATI hardware that I stopped using them completely. For example, this code:
    Code:
    vec4 alpha = texture2D(sAlpha, alpha_texcoord);
    vec4 color = texture2D(sTexture[0], texcoord[0]);
    for(int i = 0; i < 4; ++i)
       color += texture2D(sTexture[i+1], texcoord[i+1]) * alpha[i];
    Would either cause my app to crash, or produce very atrifacted results. Unrolling the loop manually to this:
    Code:
    vec4 alpha = texture2D(sAlpha, alpha_texcoord);
    vec4 color = texture2D(sTexture[0], texcoord[0]);
    color += texture2D(sTexture[1], texcoord[1]) * alpha[0];
    color += texture2D(sTexture[2], texcoord[2]) * alpha[1];
    color += texture2D(sTexture[3], texcoord[3]) * alpha[2];
    color += texture2D(sTexture[4], texcoord[4]) * alpha[3];
    solved the problem completely. This is damn frustrating :evil:
     
  3. KimB

    Legend

    Joined:
    May 28, 2002
    Messages:
    12,928
    Likes Received:
    230
    Location:
    Seattle, WA
    Wow, that's just a bad compiler.
     
  4. bloodbob

    bloodbob Trollipop
    Veteran

    Joined:
    May 23, 2003
    Messages:
    1,630
    Likes Received:
    27
    Location:
    Australia
    The hardware isn't capable of doing any compiling BUT as I already said the drivers I'm fairly sure can unroll loops for 9700 as long as they are static loops and as long as the unrolled version stays within the instruction limit.
     
  5. K.I.L.E.R

    K.I.L.E.R Retarded moron
    Veteran

    Joined:
    Jun 17, 2002
    Messages:
    2,952
    Likes Received:
    50
    Location:
    Australia, Melbourne
    So in total a single shader file I cannot go above 96 instructions(for a 9700 Pro)?
    That's pretty disturbing considering some of my shaders have a lot of code.

    Unfortunately I'm so used to coding apps that I have no real idea of how I should do so with GLS.
     
  6. KimB

    Legend

    Joined:
    May 28, 2002
    Messages:
    12,928
    Likes Received:
    230
    Location:
    Seattle, WA
    Well, some instructions require multiple slots, so the actual number may end up being less.
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...