• 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 /
avatar image
0
Question by uoksana · Dec 08, 2012 at 04:19 AM ·

Shader on MacOs and Window - D3D shader assembly failed with: (15): error X5204:

I wrote shader that draw circle.

 Shader "CrossSircleShader2" {
 Properties {
     _Color ("Main Color", Color) = (1,1,1,1)
     _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     _Radius("Radius", Range(0,1)) = 0.5
     _Thickness("Thickness", Range(0, 0.1)) = 0.05
 }
 
 SubShader {
     Tags{"Queue" = "Transparent"}
     Pass {
         Blend One One
         ZWrite off
           
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         
         #include "UnityCG.cginc"
         
         float4 _Color;
         float4 _CrossColor;
         float _Radius;
         float _Thickness;
         sampler2D _MainTex;
         
         struct v2f {
             float4  pos : SV_POSITION;
             float2  uv : TEXCOORD0;
             float2 uniformUV : TEXCOORD1;
             float4 color : COLOR;
             float2 normal : TEXCOORD2;
         };
         
         float4 _MainTex_ST;
         
         float Intersect(float4 circle, float2 uv) 
         {
             if (length(uv - circle.xy) < circle.z) 
             {
                 return 1;
             }
             
             return 0;
         }
         
         v2f vert (appdata_full v)
         {
             v2f o;
             o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
             o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);
             o.uniformUV = v.texcoord;
             o.normal = float2(1,1);
             return o;
         }
         
         half4 frag (v2f i) : COLOR
         {
             //float3 worldNormal = cross(ddy(i.pos.xyz), ddx(i.pos.xyz));
             //worldNormal = normalize(worldNormal);
             
             float4 maintex = tex2D(_MainTex, i.uv);
             float2 uv = i.uniformUV;
             uv -= float2(0.5, 0.5);
               
               float l = length(uv);
             
             if (l > _Radius) 
                 return maintex * 0;    
                     
            return maintex * maintex.a;
         }
         ENDCG
 
     }
 }
 
 Fallback "Transparent/VertexLit"
 }




 Shader error in 'CrossSircleShader2': D3D shader assembly failed with: (14): error X5204: Read of uninitialized components(*) in r1: *r/x/0 *g/y/1 *b/z/2 *a/w/3
 Shader Assembly: ps_2_0
 ; 11 ALU, 1 TEX
 dcl_2d s0
 def c1, -0.50000000, 1.00000000, 0.00000000, 0
 dcl t0.xy
 dcl t1.xy
 texld r2, t0, s0
 add r0.xy, t1, c1.x
 mul r0.xy, r0, r0
 add r0.x, r0, r0.y
 rsq r0.x, r0.x
 rcp r0.x, r0.x
 add r0.x, r0, -c0
 cmp_pp r1, -r0.x, r1, c1.z
 mul r2, r2, r2.w
 cmp_pp r0.x, -r0, c1.y, c1.z
 cmp_pp r0, -r0.x, r1, r2
 mov_pp oC0, r0

What wrong?

Comment
Add comment
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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

A node in a childnode? 1 Answer

How to perform a task in a specified time 2 Answers

Unity on Google TV?? 3 Answers

ARCamera Issue when migrating to Qualcomm Augmented Reality vuforia-unity-android-ios-3-0-6 1 Answer

Z-index issues 2 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