/**
- * Create fragment shader that does a TEX() instruction to get a Z
- * value, then writes to FRAG_RESULT_DEPTH.
+ * Create fragment shader that does a TEX() instruction to get a Z and/or
+ * stencil value value, then writes to FRAG_RESULT_DEPTH/FRAG_RESULT_STENCIL.
+ * Used for glDrawPixels(GL_DEPTH_COMPONENT / GL_STENCIL_INDEX).
* Pass fragment color through as-is.
* \return pointer to the Gallium driver fragment shader
*/
static void *
-make_fragment_shader_z(struct st_context *st, GLboolean write_depth,
- GLboolean write_stencil)
+make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth,
+ GLboolean write_stencil)
{
struct gl_context *ctx = st->ctx;
struct gl_program *p;
}
+/**
+ * Software fallback to do glDrawPixels(GL_STENCIL_INDEX) when we
+ * can't use a fragment shader to write stencil values.
+ */
static void
draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height, GLenum format, GLenum type,
st_validate_state(st);
if (write_depth || write_stencil) {
- driver_fp = make_fragment_shader_z(st, write_depth, write_stencil);
+ driver_fp = make_fragment_shader_z_stencil(st, write_depth, write_stencil);
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
color = ctx->Current.RasterColor;
}
+/**
+ * Software fallback for glCopyPixels(GL_STENCIL).
+ */
static void
copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
assert(type == GL_DEPTH);
rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- driver_fp = make_fragment_shader_z(st, GL_TRUE, GL_FALSE);
+ driver_fp = make_fragment_shader_z_stencil(st, GL_TRUE, GL_FALSE);
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
}