Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualtanzanite7

Posted 30 March 2012 - 06:14 AM

I do not know anything about HLSL, but i try to help anyway.

1. /.../ built-in variables such gl_fragColor and so on. /.../

Most of such build in variables have been deprecated. Might want to avoid using them (and use generic ones with whatever qualifiers make sense for your specific case). Also, yes, you can redeclare them with your own qualifiers too.

A few quick reference cards (always worth spreading around):
www.khronos.org/files/opengl-quick-reference-card.pdf
www.khronos.org/files/opengl4-quick-reference-card.pdf

/.../

3. I am trying to understand the difference between a struct and an interface block( in/out/uniform ).
I guess you can just create one instance of an interface so they will be just a set of global variables ?

Blocks are used to communicate between shader stages and with them (just convenience or efficiency [uniform blocks with std memory layout instead of separate uniforms]). A struct is just a sctuct as in any other programming language. Not sure what the confusion is :/

------
Edit: wait, what!? I must have been blind. "out struct test" !? You are mixing structs with interface blocks - they are not the same. Remove the struct part. (Do you have an nvidia card by any chance?)

Edit2: went to refresh my memory about "struct" usage/syntax, but realized another oddity: "layout location" does not really make any sense with centroid. Also, readding the note that: block is defined as "out", but the "red" with centroid qualifier in it is "in" - they should agree with each other.

#4tanzanite7

Posted 30 March 2012 - 05:54 AM

I do not know anything about HLSL, but i try to help anyway.

1. /.../ built-in variables such gl_fragColor and so on. /.../

Most of such build in variables have been deprecated. Might want to avoid using them (and use generic ones with whatever qualifiers make sense for your specific case). Also, yes, you can redeclare them with your own qualifiers too.

A few quick reference cards (always worth spreading around):
www.khronos.org/files/opengl-quick-reference-card.pdf
www.khronos.org/files/opengl4-quick-reference-card.pdf

/.../

3. I am trying to understand the difference between a struct and an interface block( in/out/uniform ).
I guess you can just create one instance of an interface so they will be just a set of global variables ?

Blocks are used to communicate between shader stages and with them (just convenience or efficiency [uniform blocks with std memory layout instead of separate uniforms]). A struct is just a sctuct as in any other programming language. Not sure what the confusion is :/

------
Edit: wait, what!? I must have been blind. "out struct test" !? You are mixing structs with interface blocks - they are not the same. Remove the struct part. (Do you have an nvidia card by any chance?)

#3tanzanite7

Posted 30 March 2012 - 05:45 AM

I do not know anything about HLSL, but i try to help anyway.

1. /.../ built-in variables such gl_fragColor and so on. /.../

Most of such build in variables have been deprecated. Might want to avoid using them (and use generic ones with whatever qualifiers make sense for your specific case). Also, yes, you can redeclare them with your own qualifiers too.

A few quick reference cards (always worth spreading around):
www.khronos.org/files/opengl-quick-reference-card.pdf
www.khronos.org/files/opengl4-quick-reference-card.pdf

2. I can`t use `location` qualifier and `centroid in/out` qualifier at the same time

out struct test {
   centroid in float red;
   ...

Wow. I did not even know one can mix in / out that way. Looks nonsensical. Can anyone dig out some relevant part of the specification?

out struct test {
   layout(location = 0) centroid in float red;
  } ;
  

Have you tried to use non-conflicting in/out qualifiers (struct and variable in struct agree on in/out)?

3. I am trying to understand the difference between a struct and an interface block( in/out/uniform ).
I guess you can just create one instance of an interface so they will be just a set of global variables ?

Blocks are used to communicate between shader stages and with them (just convenience or efficiency [uniform blocks with std memory layout instead of separate uniforms]). A struct is just a sctuct as in any other programming language. Not sure what the confusion is :/

------
Edit: wait, what!? I must have been blind. "out struct test" !? You are mixing structs with interface blocks - they are not the same. Remove the struct part. (Do you have an nvidia card by any chance?)

#2tanzanite7

Posted 30 March 2012 - 05:40 AM

I do not know anything about HLSL, but i try to help anyway.

1. /.../ built-in variables such gl_fragColor and so on. /.../

Most of such build in variables have been deprecated. Might want to avoid using them (and use generic ones with whatever qualifiers make sense for your specific case). Also, yes, you can redeclare them with your own qualifiers too.

A few quick reference cards (always worth spreading around):
www.khronos.org/files/opengl-quick-reference-card.pdf
www.khronos.org/files/opengl4-quick-reference-card.pdf

2. I can`t use `location` qualifier and `centroid in/out` qualifier at the same time

out struct test {
   centroid in float red;
   ...

Wow. I did not even know one can mix in / out that way. Looks nonsensical. Can anyone dig out some relevant part of the specification?

out struct test {
   layout(location = 0) centroid in float red;
  } ;
  

Have you tried to use non-conflicting in/out qualifiers (struct and variable in struct agree on in/out)?

3. I am trying to understand the difference between a struct and an interface block( in/out/uniform ).
I guess you can just create one instance of an interface so they will be just a set of global variables ?

Blocks are used to communicate between shader stages and with them (just convenience or efficiency [uniform blocks with std memory layout instead of separate uniforms]). A struct is just a sctuct as in any other programming language. Not sure what the confusion is :/

#1tanzanite7

Posted 30 March 2012 - 05:38 AM

I do not know anything about HLSL, but i try to help anyway.

1. /.../ built-in variables such gl_fragColor and so on. /.../

Most of such build in variables have been deprecated. Might want to avoid using them (and use generic ones with whatever qualifiers make sense for your specific case). Also, yes, you can redeclare them with your own qualifiers too.

A few quick reference cards (always worth spreading around):
www.khronos.org/files/opengl-quick-reference-card.pdf
www.khronos.org/files/opengl4-quick-reference-card.pdf

2. I can`t use `location` qualifier and `centroid in/out` qualifier at the same time

out struct test {
   centroid in float red;
   ...

Wow. I did not even know one can mix in / out that way. Look nonsensical. Can anyone dig out some relevant part of the specification?

out struct test {
   layout(location = 0) centroid in float red;
  } ;
  

Have you tried to use non-conflicting in/out qualifiers (struct and variable in struct agree on in/out)?

3. I am trying to understand the difference between a struct and an interface block( in/out/uniform ).
I guess you can just create one instance of an interface so they will be just a set of global variables ?

Blocks are used to communicate between shader stages and with them (just convenience or efficiency [uniform blocks with std memory layout instead of separate uniforms]). A struct is just a sctuct as in any other programming language. Not sure what the confusion is :/

PARTNERS