- set_vertex_shader(st);
- cso_set_geometry_shader_handle(st->cso_context, NULL);
-
- if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
- GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
-
- st_translate_color(&ctx->Color.ClearColor,
- &clearColor,
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- is_integer);
+ cso_set_tessctrl_shader_handle(cso, NULL);
+ cso_set_tesseval_shader_handle(cso, NULL);
+
+ if (num_layers > 1)
+ set_vertex_shader_layered(st);
+ else
+ set_vertex_shader(st);
+
+ /* draw quad matching scissor rect.
+ *
+ * Note: if we're only clearing depth/stencil we still setup vertices
+ * with color, but they'll be ignored.
+ *
+ * We can't translate the clear color to the colorbuffer format,
+ * because different colorbuffers may have different formats.
+ */
+ if (!st_draw_quad(st, x0, y0, x1, y1,
+ ctx->Depth.Clear * 2.0f - 1.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ (const float *) &ctx->Color.ClearColor.f,
+ num_layers)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glClear");