my compute shader program runs on samsung sm-g9200 android 5.1.1(api22) get this error output.
but it works well on qualcomm snapdragon.
in fact, i test my code on every mali or snapdragon, it happened the same.
// compute.glsl
layout(binding = 0) buffer VertexPositionOut { vec3 Position[]; }; layout(binding = 1) buffer VertexNormalCoordOut { vec2 NormalCoord[]; }; layout (r32f, binding = 0) mediump readonly uniform image2D height_data; layout(local_size_x = 8, local_size_z = 8) in; uniform float height_data_scale; uniform ivec2 vertex_map_size; void main(void) { ivec2 start = ivec2(gl_LocalInvocationID.x, gl_LocalInvocationID.z); ivec2 step = ivec2(gl_WorkGroupSize.x, gl_WorkGroupSize.z); ivec2 face_size = vertex_map_size - ivec2(1, 1); for (int j = start.y; j < vertex_map_size.y; j += step.y) { for (int i = start.x; i < vertex_map_size.x; i += step.x) { int position_index = i + j * vertex_map_size.x; vec3 position = vec3(i, 0.0, j); position.y = imageLoad(height_data, ivec2(position.xz)).r * height_data_scale; Position[position_index] = position; vec2 normal_coord = position.xz / vec2(face_size); NormalCoord[position_index] = normal_coord; } } }
// dispatch code
m_terrain_uncompress_compute_program->enable(); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_vbo_position); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_vbo_normal_coord); glBindImageTexture(0, m_height_map, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R32F); glBindImageTexture(1, m_normal_map, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32F); m_terrain_uncompress_compute_program->set_uniform("vertex_map_size", vertex_map_size); m_terrain_uncompress_compute_program->set_uniform("height_data_scale", m_heightmap_data->m_fHeightScale); glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, m_vbo_compute_indirect); glDispatchComputeIndirect(0); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, 0); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, 0); m_terrain_uncompress_compute_program->disable();
How big is the overall workspace for the compute shader, and what are the values of the input uniforms?
Thanks, Pete
workgroups= vec3(1, 1, 1);
vertex_map_size = ivec2(65, 65); // current value
i ever tried making workgroups equal to vertex_map_size. but it will be out the limit 128 of the workgroups on mali gpu.