enum pipe_format format)
{
struct pipe_sampler_view **sv;
-
+ const struct st_texture_image *firstImage;
if (!stObj || !stObj->pt) {
return NULL;
}
sv = st_texture_get_sampler_view(st, stObj);
- if (stObj->base.StencilSampling &&
- util_format_is_depth_and_stencil(format))
- format = util_format_stencil_only(format);
+ if (util_format_is_depth_and_stencil(format)) {
+ if (stObj->base.StencilSampling)
+ format = util_format_stencil_only(format);
+ else {
+ firstImage = st_texture_image_const(_mesa_base_tex_image(&stObj->base));
+ if (firstImage->base._BaseFormat == GL_STENCIL_INDEX)
+ format = util_format_stencil_only(format);
+ }
+ }
/* if sampler view has changed dereference it */
if (*sv) {
ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
PIPE_BIND_VERTEX_BUFFER);
+ if (extensions->ARB_stencil_texturing)
+ extensions->ARB_texture_stencil8 = GL_TRUE;
+
/* Figure out GLSL support. */
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
GLint internalFormat,
GLenum format, GLenum type)
{
- const boolean want_renderable =
- internalFormat == 3 || internalFormat == 4 ||
- internalFormat == GL_RGB || internalFormat == GL_RGBA ||
- internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
- internalFormat == GL_BGRA;
struct st_context *st = st_context(ctx);
enum pipe_format pFormat;
unsigned bindings;
}
/* GL textures may wind up being render targets, but we don't know
- * that in advance. Specify potential render target flags now.
+ * that in advance. Specify potential render target flags now for formats
+ * that we know should always be renderable.
*/
bindings = PIPE_BIND_SAMPLER_VIEW;
- if (want_renderable) {
- if (_mesa_is_depth_or_stencil_format(internalFormat))
- bindings |= PIPE_BIND_DEPTH_STENCIL;
- else
+ if (_mesa_is_depth_or_stencil_format(internalFormat))
+ bindings |= PIPE_BIND_DEPTH_STENCIL;
+ else if (internalFormat == 3 || internalFormat == 4 ||
+ internalFormat == GL_RGB || internalFormat == GL_RGBA ||
+ internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+ internalFormat == GL_BGRA)
bindings |= PIPE_BIND_RENDER_TARGET;
- }
/* GLES allows the driver to choose any format which matches
* the format+type combo, because GLES only supports unsized internal