hlsl - Which type sizes can I use for specific semantics -


microsoft provides list explaining input , output semantics of vertex , pixel shaders. i've seen code examples don't use documented data types. using float3 input color pixel shader or float2 input position vertex shader. though 2-component position or 3-component color make sense me, can't find documented, makes me wonder

  • can use float3 vertex shader input position (if know won't using w component) without expecting errors?

  • if can use data types other documented ones, there list available shows every allowed data type semantic or rule "as long used data type smaller or equally sized documented one, can use it"?


code examples not following documentation:

stackoverflow - passing colors through pixel shader in hlsl

c++ / directx11 tutorials - s02e05 - creating , loading shaders @ 9:33

in shader model 4.0 , later (dx10+), semantic names matter system-value semantics (those prefixed sv_). other semantics have no special treatment aside being used match shader parameters inputs. documentation regarding semantics such color being float4 purely convention, or legacy dx9. in dx10/sm4+, there's nothing stopping declaring color float2, or deciding use unicorn semantic name colors, though don't surprised if confuses other developers (or yourself) reviewing code in future.

to answer specific question, yes can use data type want non-sv_ semantics, or invent own names. make sure use consistent naming , channel counts between stages , input layout declaration.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -