gpt4 book ai didi

android - OpenGL 着色器无法在设备上编译

转载 作者:行者123 更新时间:2023-12-05 00:21:53 24 4
gpt4 key购买 nike

我正在编写一个计算着色器,它应该在 PC 和 Android 上运行。它在 PC 上运行良好,但在 Android 上无法编译。

这是着色器:

#version 310 es

uniform vec2 lightPos; // passed from the app

layout (local_size_x = 512, local_size_y = 1) in;
layout (rgba8, binding = 0) uniform image2D img_output;
layout (rgba8, binding = 1) uniform readonly image2D colorTex;
layout (rgba8, binding = 2) uniform readonly image2D transpTex;

void main () {
imageStore(img_output, ivec2(3, 6), vec4(0.3 ,0.2 ,0.5 ,0.9));
}

错误是: Shader compile error: ERROR: '' : unsupported format on read/write image
如果我将最后一个参数更改为 ivec4uvec4我得到: ERROR: 'imageStore' : no matching overloaded function found GL.GetString(StringName.Version);返回 GL version:OpenGL ES 3.1 V@141.0 (GIT@I0bc8e21cf2)
这是在 Sony Xperia Z5 上(Android 模拟器似乎不支持 OpenGL ES 3.1)。

最佳答案

这是在 GLSL ES 3.10 spec 中指定的。 ,在第 72 页的“4.9 内存访问限定符”部分中:

Except for image variables qualified with the format qualifiers r32f, r32i, and r32ui, image variables must specify either memory qualifier readonly or the memory qualifier writeonly.



此限制仍然适用于 GLSL ES 3.20。

关于android - OpenGL 着色器无法在设备上编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38994785/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com