Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / Game Design & Programming / Using dynamic arrays in Cg Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
McZonk

December 10, 2004, 12:00 PM

I try to use dynamic arrays in Cg, with the fp40 profile for Nvidia Geforce 6 cards. But if i compile the source program produce the following
Simple Loop in Cg, just to test it.
Should sum all lightcolors in lights[].

  1.  
  2. void main(
  3.  out float3 outcolor : COLOR,
  4.  uniform float3 lights[]
  5. ) {
  6.   for(int i = 0; i < lights.length; i++) {
  7.     outcolor += lights[i];
  8.   }
  9. }
  10.  

This is the output. There are no instructions left. But where is my loop?
Where the cgc thinks the array has a length of 0.
  1.  
  2. !!ARBfp1.0
  3. OPTION NV_fragment_program2;
  4. # cgc version 1.3.0001, build date Aug  4 2004 10:01:10
  5. # command line args: -profile fp40
  6. # source file: mlight.cg
  7. #vendor NVIDIA Corporation
  8. #version 1.0.02
  9. #profile fp40
  10. #program main
  11. #semantic main.lights
  12. #var float3 outcolor :  :  : 0 : 0
  13. PARAM c[1] = { program.local[0] };
  14. TEMP RC;
  15. TEMP HC;
  16. # 0 instructions, 0 R-regs, 0 H-regs
  17.  

I known I can use a constant array size, but this is not what i want.

 
This thread contains 1 message.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.