"{\n"
" gl_FragColor = color;\n"
"}\n";
- const char *vs_int_source =
- "#version 130\n"
- "in vec4 position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = position;\n"
- "}\n";
- const char *fs_int_source =
- "#version 130\n"
- "uniform ivec4 color;\n"
- "out ivec4 out_color;\n"
- "\n"
- "void main()\n"
- "{\n"
- " out_color = color;\n"
- "}\n";
GLuint vs, fs;
if (clear->ArrayObj != 0)
clear->ColorLocation = _mesa_GetUniformLocation(clear->ShaderProg,
"color");
- if (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130) {
+ bool has_integer_textures = _mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130);
+
+ if (has_integer_textures) {
+ void *shader_source_mem_ctx = ralloc_context(NULL);
+ const char *vs_int_source =
+ ralloc_asprintf(shader_source_mem_ctx,
+ "#version %s\n"
+ "in vec4 position;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = position;\n"
+ "}\n",
+ _mesa_is_desktop_gl(ctx) ? "130" : "300 es");
+ const char *fs_int_source =
+ ralloc_asprintf(shader_source_mem_ctx,
+ "#version %s\n"
+ "uniform ivec4 color;\n"
+ "out ivec4 out_color;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " out_color = color;\n"
+ "}\n",
+ _mesa_is_desktop_gl(ctx) ? "130" : "300 es");
+
vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source);
fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source);
+ ralloc_free(shader_source_mem_ctx);
clear->IntegerShaderProg = _mesa_CreateProgramObjectARB();
_mesa_AttachShader(clear->IntegerShaderProg, fs);