+/**
+ * Put z into texel according to GL_DEPTH_MODE.
+ */
+static void
+apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4])
+{
+ switch (depthMode) {
+ case GL_LUMINANCE:
+ ASSIGN_4V(texel, z, z, z, 1.0F);
+ break;
+ case GL_INTENSITY:
+ ASSIGN_4V(texel, z, z, z, z);
+ break;
+ case GL_ALPHA:
+ ASSIGN_4V(texel, 0.0F, 0.0F, 0.0F, z);
+ break;
+ case GL_RED:
+ ASSIGN_4V(texel, z, 0.0F, 0.0F, 1.0F);
+ break;
+ default:
+ _mesa_problem(NULL, "Bad depth texture mode");
+ }
+}
+
+
+/**
+ * Is the given texture a depth (or depth/stencil) texture?
+ */
+static GLboolean
+is_depth_texture(const struct gl_texture_object *tObj)
+{
+ GLenum format = _mesa_texture_base_format(tObj);
+ return format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT;
+}
+
+