- Home /
Question by
UnityPlum · Jan 21 at 03:19 PM ·
error3dshader programmingbuffer
Image effect Shader giving weird error.
Hello, I am trying to make a 3d Renderer and after a kind of failure with Compute shaders, I have arrived at Image Effect Shaders. I am trying to send two RWStructuredBuffers one of type float3 and one of type int to the GPU. The first being vertices, and second being triangles of any desired mesh. This is my code:
RWStructuredBuffer <float> vertices;
RWStructuredBuffer <int> triangles;
int numVertices;
int numTriangles;
int width;
int height;
float4 frag (v2f i) : SV_Target
{
int colour = 1;
float2 coords = (
((float) round (i.uv.x * width)),
((float) round (i.uv.y * height))
);
float minDepth = 1000;
for (int i = 0; i < numTriangles; i += 3)
{
float3 v0 = vertices[triangles[i + 0]];
float3 v1 = vertices[triangles[i + 1]];
float3 v2 = vertices[triangles[i + 2]];
if(v0.x == v1.x && v0.y == v1.y)
{
return 0.5f;
}
float raster = isInside (
v0.x, v0.y,
v1.x, v1.y,
v2.x, v2.y,
coords.x, coords.y
);
minDepth = min (maxDepth, raster);
}
if(minDepth < 0.1f) {
colour = 0;
}
return colour;
}
However, this gives an error: Shader error in 'Hidden/GPU': maximum ps_4_0 UAV register index (0) exceeded - note that the target doesn't support UAVs at line 65 (on d3d11) What does this mean and how can I fix it?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613051951im_/https://answers.unity.com/themes/thub/images/avi.jpg)