简体   繁体   English

使用计算着色器的错误结果

[英]Bad result using compute shader

I made 2 examples of rendering (here I only render traingles with a single texture).我制作了 2 个渲染示例(这里我只渲染带有单个纹理的三角形)。

The first uses forward rendering : I simply draw triangles directly to the swapchain with a simple fragment shader:第一个使用前向渲染:我只是使用简单的片段着色器将三角形直接绘制到交换链:

outColor = vec4(texture(texAlbedo, fragTexCoord).rgba);

The second uses deferred shading : a first pass draw the scene with the texture and a second pass copy the result pixels to another texture.第二个使用延迟着色:第一遍使用纹理绘制场景,第二遍将结果像素复制到另一个纹理。 The second pass only uses a compute shader.第二遍仅使用计算着色器。

imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), vec4(albedo.bgr, 1.0));

I think both results should be the same but the second get rendering problems.我认为这两个结果应该是相同的,但第二个结果会出现渲染问题。

The result of the first example :第一个例子的结果: 在此处输入图片说明

The result of the second example:第二个例子的结果: 在此处输入图片说明

I don't understand this problem.我不明白这个问题。 Thank you for your help !感谢您的帮助 ! :) :)

Thank you for your responses.谢谢你的回复。 The problem was that in the second example, I was creating image views without mipmap levels.问题是在第二个示例中,我创建了没有 mipmap 级别的图像视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM