aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c19
5 files changed, 27 insertions, 19 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index eff28fc6f..04ba86448 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -287,16 +287,22 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
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) {
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 6df430049..ca51eeee3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -152,7 +152,7 @@ void st_init_flush_functions(struct dd_function_table *functions)
* Finish() is identical to Flush() in all cases - no differences in
* rendering or ReadPixels are visible if we opt not to wait here.
*
- * Only set this up on windows to avoid suprise elsewhere.
+ * Only set this up on Windows to avoid surprise elsewhere.
*/
#ifdef PIPE_OS_WINDOWS
functions->Finish = st_glFlush;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index bdf236e82..7ea3846ff 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -950,7 +950,7 @@ st_GetTexImage(struct gl_context * ctx,
/* XXX Fallback to _mesa_GetTexImage_sw for depth-stencil formats
* due to an incomplete stencil blit implementation in some drivers. */
- if (format == GL_DEPTH_STENCIL) {
+ if (format == GL_DEPTH_STENCIL || format == GL_STENCIL_INDEX) {
goto fallback;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index bc20f7323..82e4a3009 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -650,12 +650,15 @@ void st_init_extensions(struct pipe_screen *screen,
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);
consts->GLSLVersion = glsl_feature_level;
- if (glsl_feature_level >= 330)
- consts->GLSLVersion = 330;
+ if (glsl_feature_level >= 410)
+ consts->GLSLVersion = 410;
_mesa_override_glsl_version(consts);
@@ -666,6 +669,8 @@ void st_init_extensions(struct pipe_screen *screen,
if (glsl_feature_level >= 400)
extensions->ARB_gpu_shader5 = GL_TRUE;
+ if (glsl_feature_level >= 410)
+ extensions->ARB_shader_precision = GL_TRUE;
/* This extension needs full OpenGL 3.2, but we don't know if that's
* supported at this point. Only check the GLSL version. */
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 72dbf3bd4..181465dd8 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1942,11 +1942,6 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
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;
@@ -1962,15 +1957,17 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
}
/* 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