First version is returning a buffer that is allocated on the stack.You might 
want to read up on 'snprint' to avoid the 'memset' as well.(Believe it 
null-terminates if buffer is large enough and returns total characters written)
> Date: Tue, 18 Jun 2013 09:39:28 +0200
> From: [email protected]
> To: [email protected]
> Subject: [Nuke-dev] Problem with gpuEngine_decl()
> 
> Hi,
> I have problem after updating to Nuke 7. Using following code causes 
> Fragment shader error.
> 
> const char* Falloff2Op::gpuEngine_decl() const
> {
>       char sText[1024];
>       memset(sText, 0, 1024*sizeof(char));
>       sprintf(sText, "uniform float $$fXFall = 0.123f;\n");
>       return sText;
> }
> 
> Similar code works fine
> 
> const char* Falloff2Op::gpuEngine_decl() const
> {
>       char sText[1024];
>       memset(sText, 0, 1024*sizeof(char));
>       return "uniform float $$fXFall = 0.123;\n";
> }
> 
> I cannot use second version since 0.123 will be replaced with value 
> calculated inside _validate.
> 
> gpuEngine_body doen't use fXFall (just for testing purposes).
> 
> const char* Falloff2Op::gpuEngine_body() const
> {
>       return
>               "float $$lum = OUT.r * 0.2125 + OUT.g * 0.7154 + OUT.b * 
> 0.0721;\n"
>               "OUT = vec4($$lum, $$lum, $$lum, OUT.a);\n";
> }
> 
> I'm compiling with visual 2010 for Nuke 7.0v6 64bit. This code works in 
> 6.3v9. How can I solve this? I don't see any changes in shaders since 
> Nuke 6.
> 
> regards
> Adam
> _______________________________________________
> Nuke-dev mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
                                          
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to