什么是最小的类型,可用于计算着色器中的渲染纹理

发布于 2025-02-08 19:25:36 字数 300 浏览 1 评论 0原文

我使用Unity的Compute着色器写入渲染纹理,以后将使用。我要输入的渲染纹理的值是0和1,因此避免使用大量无用的内存,我正在寻找可用于计算着色器中渲染纹理的较小类型。

我看到渲染纹理格式在他在CPU上的创建中可以设置为rendertextureformat.r8,我尝试使用它,但我不知道在Compute Shader中声明渲染纹理时要使用哪种类型(它不适用于_int8)。此外,我看到在计算着色器中声明渲染纹理时,我可以使用bool,但是我不知道要使用哪种渲染纹理格式...

I'm using unity's compute shader to write into a render texture that will be used later. The values I want to enter into my render texture are 0 and 1, therefore to avoid using a lot of useless memory, I'm looking for the smaller type that can be used for a render texture in a compute shader.

I saw that the render texture format at his creation on CPU can be set to RenderTextureFormat.R8, I try to used it but I don't know which type to use when declaring the render texture in compute shader (it doesn't work with _int8). Moreover, I saw that I can use the type bool when I declare the render texture in compute shader, but then I don't know which render texture format to use...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一百个冬季 2025-02-15 19:25:36

AS shingo 说,较小的类型是8位整数,在渲染纹理创建中通过rendertextextureformat.r8定义,然后在计算着色器中的呈现纹理声明中,Unorm float
有一个表/code>,并且在hlsl中为Compute着色器等效。

As Shingo said, the smaller type is a 8 bit integer which is defined in render texture creation by RenderTextureFormat.R8 and then in render texture declaration in compute shader by unorm float.
There is a table in Unity Manual that summarize the different RenderTextureFormat and there equivalent in HLSL for compute shader.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文