Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


#ActualMarkS

Posted 21 December 2012 - 01:10 AM

My understanding, although I have never done it personally, is that you can have as many shaders as you like, but only one main function.

 

So, you could have:

 

//shader1.fs <- Separate files
SomeShaderFunc1()
{
}

//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

//shader3.fs <- Separate files

SomeShaderFunc3()
{
}

//shader4.fs <- Separate files

main()
{
SomeShaderFunc1();
SomeShaderFunc2();
SomeShaderFunc3();
}

 

But not:

 

//shader1.fs <- Separate files

SomeShaderFunc1()
{
}

main()
{
SomeShaderFunc1();
}
 
//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

main()
{
SomeShaderFunc2();
}
 
//shader3.fs <- Separate files

SomeShaderFunc3()
{
}
 
main()
{
SomeShaderFunc3();
}

 

 

And that is one main function in your fragment shader(s) and one in your vertex shader(s).


#5MarkS

Posted 21 December 2012 - 01:09 AM

My understanding, although I have never done it personally, is that you can have as many shaders as you like, but only one main function.

 

So, you could have:

 

//shader1.fs <- Separate files
SomeShaderFunc1()
{
}

//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

//shader3.fs <- Separate files

SomeShaderFunc3()
{
}

//shader4.fs <- Separate files

main()
{
SomeShaderFunc1();
SomeShaderFunc2();
SomeShaderFunc3();
}

 

 

But not:

 

 

 

//shader1.fs <- Separate files

SomeShaderFunc1()
{
}

main()
{
SomeShaderFunc1();
}
 
//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

main()
{
SomeShaderFunc2();
}
 
//shader3.fs <- Separate files

SomeShaderFunc3()
{
}
 
main()
{
SomeShaderFunc3();
}

 

 

And that is one main function in your fragment shader(s) and one in your vertex shader(s).


#4MarkS

Posted 21 December 2012 - 01:09 AM

My understanding, although I have never done it personally, is that you can have as many shaders as you like, but only one main function.

 

So, you could have:

 

//shader1.fs <- Separate files
SomeShaderFunc1()
{
}

//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

//shader3.fs <- Separate files

SomeShaderFunc3()
{
}

//shader4.fs <- Separate files

main()
{
SomeShaderFunc1();
SomeShaderFunc2();
SomeShaderFunc3();
}

 

 

But not:

 

 

 

//shader1.fs <- Separate files

SomeShaderFunc1()
{
}

main()
{
SomeShaderFunc1();
}
 
//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

main()
{
SomeShaderFunc2();
}
 
//shader3.fs <- Separate files

SomeShaderFunc3()
{
}
 
main()
{
SomeShaderFunc3();
}

 

 

And that is one main function in your fragment shader(s) and one in your vertex shader(s).


#3MarkS

Posted 21 December 2012 - 01:08 AM

My understanding, although I have never done it personally, is that you can have as many shaders as you like, but only one main function.

 

So, you could have:

 

//shader1.fs <- Separate files
SomeShaderFunc1()
{
}

//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

//shader3.fs <- Separate files

SomeShaderFunc3()
{
}

//shader4.fs <- Separate files

main()
{
SomeShaderFunc1();
SomeShaderFunc2();
SomeShaderFunc3();
}

 

 

But not:

 

 

 

//shader1.fs <- Separate files

SomeShaderFunc1()
{
}

main()
{
SomeShaderFunc1();
}
 
//shader2.fs <- Separate files

SomeShaderFunc2()
{
}

main()
{
SomeShaderFunc2();
}
 
//shader3.fs <- Separate files

SomeShaderFunc3()
{
}
 
main()
{
SomeShaderFunc3();
}

 

 

And that is one main function in your fragment shader(s) and one in your vertex shader(s).


#2MarkS

Posted 21 December 2012 - 01:07 AM

My understanding, although I have never done it personally, is that you can have as many shaders as you like, but only one main function.

 

So, you could have:

 

//shader1.fs <- Separate files
SomeShaderFunc1()
{
}
 
 
//shader2.fs <- Separate files

SomeShaderFunc2()
{
}
 
 
//shader3.fs <- Separate files

SomeShaderFunc3()
{
}
 
 
//shader4.fs <- Separate files

main()
{
SomeShaderFunc1();
SomeShaderFunc2();
SomeShaderFunc3();
}

 

 

But not:

 

 

 

//shader1.fs <- Separate files

SomeShaderFunc1()
{
}
 
 
main()
{
SomeShaderFunc1();
}
 
//shader2.fs <- Separate files

SomeShaderFunc2()
{
}
 
 
main()
{
SomeShaderFunc2();
}
 
//shader3.fs <- Separate files

SomeShaderFunc3()
{
}
 
main()
{
SomeShaderFunc3();
}

 

 

And that is one main function in your fragment shader(s) and one in your vertex shader(s).


#1MarkS

Posted 21 December 2012 - 01:06 AM

My understanding, although I have never done it personally, is that you can have as many shaders as you like, but only one main function.

 

So, you could have:

//shader1.fs
SomeShaderFunc1()
{
}
 
 
//shader2.fs
SomeShaderFunc2()
{
}
 
 
//shader3.fs
SomeShaderFunc3()
{
}
 
 
//shader4.fs
main()
{
SomeShaderFunc1();
SomeShaderFunc2();
SomeShaderFunc3();
}

 

But not:

 

 

//shader1.fs
SomeShaderFunc1()
{
}
 
 
main()
{
SomeShaderFunc1();
}
 
//shader2.fs
SomeShaderFunc2()
{
}
 
 
main()
{
SomeShaderFunc2();
}
 
//shader3.fs
SomeShaderFunc3()
{
}
 
main()
{
SomeShaderFunc3();
}

 

And that is one main function in your fragment shader(s) and one in your vertex shader(s).


PARTNERS