Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by 15901519969 · Oct 04, 2016 at 05:14 AM · shadershader programmingshaderlab

What is the difference between Semantic POSITION and SV_POSITION both

All I hava a vertex and fragment shader:

 struct a2v
 {
     float4 vertex : POSITION;
     float3 normal : NORMAL;
     float4 texcoord : TEXCOORD0;
 };
 
 struct v2f
 {
     float4 sv_pos : SV_POSITION;
     fixed3 color : COLOR0;
 };
 
 /*Unity Report Error over here!!*/
 v2f vert(a2v v) : **SV_POSITION**
 {
     v2f o;
     o.sv_pos = mul(UNITY_MATRIX_MVP, v.vertex);
     o.color = v.normal * 0.5 + fixed3(0.5, 0.5, 0.5);
     return o;
 }
 
 fixed4 frag(v2f i) : SV_Target
 {
     fixed3 c = i.color;
     c *= _Color.rgb;
     return fixed4(c, 1.0);
 }

if I Complie with DX11 Unity will report the error: Shader error in 'Custom/Shader2': invalid output semantic 'SV_POSITION': Legal indices are in [0,0] at line 41 (on d3d11)

and the shader doesn't work well!

alt text

but when i change the graphic API to DX9, The Shader can work immediately

alt text

I can't explain the cause of this I do know is SV_POSITION can use after DX10

I want to know how to resolve the problem and the difference between SV_POSITION and POSITION

Very greatful!!!

38ae3d50dfa2d2f2b7f5628e7114f2a1-b.png (83.2 kB)
16df9cd12cafd8ece112e689d24ad0ae-r.png (96.1 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Namey5 · Oct 04, 2016 at 09:34 AM 0
Share

You shouldn't need to define the vertex function with a semantic, just remove the ": SV_POSITION" from that line.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

94 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Getting Color Generated from Shader to Script to Shader 0 Answers

_WorldSpacePosLight0 suddenly changes when change camera position or direction 0 Answers

_Time in Image Effects 0 Answers

How can I add Alpha to texture animation shader...? Actually i am noob.. Here is the shader . 0 Answers

Inverse Stencil Shader 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges