- Home /
Question by
OliverAnthony · May 07, 2014 at 03:28 PM ·
shadermaterialgraphics
"Shader has errors or is not supported by your graphics card."
I have the following shader, which shows the above line when I look at it in the inspector. It does not generate any errors/warnings if I right click the asset and do a reimport, though.
Shader "Architect/Bezier Line"
{
// Bound with the inspector.
Properties
{
_Color ("Main Color", Color) = (1.0, 1.0, 1.0,1.0)
_Start ("Start", Vector) = (0.0, 0.0, 0.0)
_End ("End", Vector) = (0.0, 0.0, 0.0)
}
SubShader
{
Pass
{
Blend SrcAlpha one
CGPROGRAM
#pragma target 5.0
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
// The same point data structure used by both the compute shader and the shader.
// struct Point
// {
// float t;
// };
// structure linking the data between the vertex and the fragment shader
struct FragInput
{
float4 color : COLOR;
float4 position : SV_POSITION;
};
// The buffer holding the points shared with the compute shader.
StructuredBuffer<float> pointBuffer;
// variables from the properties.
float4 _Color;
float3 _Start;
float3 _End;
FragInput vert (uint id : SV_VertexID, uint inst : SV_InstanceID)
{
FragInput fragInput;
// apply color
fragInput.color = _Color;
// position computation
float t = pointBuffer[inst];
//
float3 p0 = _Start;
float3 p3 = _End;
//
float dist = distance(p0, p3);
//
float3 p1 = float3(p0.x + clamp(dist, 0.0, 400), p0.y, 0);
float3 p2 = float3(p3.x - min(dist,200), p3.y, 0);
float3 final = (pow(1.0-t,3.0) * p0) + (3.0 * pow(1.0-t,2.0) * t * p1) + (3.0 * (1.0-t) * pow(t,2.0) * p2) + (pow(t,3.0) * p3);
fragInput.position = mul (UNITY_MATRIX_MVP, float4(final, 1));
return fragInput;
}
// this just passes through the color from the properties
float4 frag (FragInput fragInput) : COLOR
{
return fragInput.color;
}
ENDCG
}
}
Fallback Off
}
Can anyone help me out here?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613144450im_/https://answers.unity.com/themes/thub/images/avi.jpg)