I cannot get this empty compute shader to compile using OpenGL ES 3.1 on a Pixel C tablet running Android 8.1.0:
"shader.comp"
#version 310 es
void main()
{
}
I am using the Asset manager to reader this source from a file as follows and all my GL calls are using the Java bindings rather than native code and the NDK:
String shaderSource;
AssetManager assets = context.getAssets();
InputStream shaderStream;
try
{
shaderStream = assets.open("shader.comp");
} // catch etc...
shaderSource = shaderStream.toString();
// Compile source
int shaderObject = GLES31.glCreateShader(GLES31.GL_COMPUTE_SHADER);
GLES31.glShaderSource(shaderObject, shaderSource);
GLES31.glCompileShader(shaderObject);
// Get info about compilation
GLES31.glGetShaderiv(shaderObject, GLES31.GL_COMPILE_STATUS, status, 0);
if (status[0] != GLES31.GL_TRUE)
{
Log.e("ComputeShader",
"Compute Shader did not compile: " +
GLES31.glGetShaderInfoLog(shaderObject));
}
// Link etc..
The error I get is confusing:
Compute Shader did not compile: 0(1) : error C0000: syntax error, unexpected '.', expecting "::" at token "."
There is no "." in the shader source. Do you think this might be related to the encoding used by the .toString()
conversion of the input stream? The Java documentation for OpenGL ES on Android is largely incomplete so there is little help there. Is there any other potential reasons for this type of error?