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_cb_drawpixels.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c46
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp16
4 files changed, 54 insertions, 29 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 95805fd3c..912241b35 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1441,6 +1441,13 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
st_validate_state(st);
+ if (type == GL_DEPTH_STENCIL) {
+ /* XXX make this more efficient */
+ st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_STENCIL);
+ st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_DEPTH);
+ return;
+ }
+
if (type == GL_STENCIL) {
/* can't use texturing to do stencil */
copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index a351d1197..1e8ec0556 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -75,8 +75,18 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
enum pipe_format format;
struct pipe_surface surf_tmpl;
- format = st_choose_renderbuffer_format(screen, internalFormat,
- rb->NumSamples);
+ if (internalFormat == GL_RGBA16_SNORM && strb->software) {
+ /* Special case for software accum buffers. Otherwise, if the
+ * call to st_choose_renderbuffer_format() fails (because the
+ * driver doesn't support signed 16-bit/channel colors) we'd
+ * just return without allocating the software accum buffer.
+ */
+ format = PIPE_FORMAT_R16G16B16A16_SNORM;
+ }
+ else {
+ format = st_choose_renderbuffer_format(screen, internalFormat,
+ rb->NumSamples);
+ }
if (format == PIPE_FORMAT_NONE) {
return FALSE;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 3563e1d9b..25a6cdc75 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -113,14 +113,18 @@ void st_init_limits(struct st_context *st)
1, MAX_DRAW_BUFFERS);
c->MaxLineWidth
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_LINE_WIDTH));
c->MaxLineWidthAA
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_LINE_WIDTH_AA));
c->MaxPointSize
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_POINT_WIDTH));
c->MaxPointSizeAA
- = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
+ = _maxf(1.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_POINT_WIDTH_AA));
/* called after _mesa_create_context/_mesa_init_point, fix default user
* settable max point size up
*/
@@ -132,10 +136,11 @@ void st_init_limits(struct st_context *st)
c->MinPointSizeAA = 0.0f;
c->MaxTextureMaxAnisotropy
- = _maxf(2.0f, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
+ = _maxf(2.0f, screen->get_paramf(screen,
+ PIPE_CAPF_MAX_TEXTURE_ANISOTROPY));
c->MaxTextureLodBias
- = screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
+ = screen->get_paramf(screen, PIPE_CAPF_MAX_TEXTURE_LOD_BIAS);
c->MaxDrawBuffers
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
@@ -213,15 +218,10 @@ void st_init_limits(struct st_context *st)
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2;
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
- /* XXX we'll need a better query here someday */
- if (screen->get_param(screen, PIPE_CAP_GLSL)) {
- c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
- c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
+ c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
+ c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
- c->GLSLVersion = 120;
- _mesa_override_glsl_version(st->ctx);
- c->UniformBooleanTrue = ~0;
- }
+ c->UniformBooleanTrue = ~0;
c->StripTextureBorder = GL_TRUE;
}
@@ -249,16 +249,23 @@ void st_init_extensions(struct st_context *st)
struct gl_context *ctx = st->ctx;
int i;
+ ctx->Const.GLSLVersion = 120;
+ _mesa_override_glsl_version(st->ctx);
+
/*
* Extensions that are supported by all Gallium drivers:
*/
ctx->Extensions.ARB_copy_buffer = GL_TRUE;
ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
+ ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.ARB_fragment_program = GL_TRUE;
+ ctx->Extensions.ARB_fragment_shader = GL_TRUE;
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_sampler_objects = GL_TRUE;
+ ctx->Extensions.ARB_shader_objects = GL_TRUE;
+ ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
@@ -267,6 +274,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_texture_storage = GL_TRUE;
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
ctx->Extensions.ARB_vertex_program = GL_TRUE;
+ ctx->Extensions.ARB_vertex_shader = GL_TRUE;
ctx->Extensions.ARB_window_pos = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
@@ -281,6 +289,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_point_parameters = GL_TRUE;
ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
ctx->Extensions.EXT_secondary_color = GL_TRUE;
+ ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
@@ -317,15 +326,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_swizzle = GL_TRUE;
}
- if (screen->get_param(screen, PIPE_CAP_GLSL)) {
- ctx->Extensions.ARB_fragment_shader = GL_TRUE;
- ctx->Extensions.ARB_vertex_shader = GL_TRUE;
- ctx->Extensions.ARB_shader_objects = GL_TRUE;
- ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
- ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
- ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
- }
-
if (screen->get_param(screen, PIPE_CAP_BLEND_EQUATION_SEPARATE)) {
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
}
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 929c7af01..74b8fa7c7 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4803,6 +4803,8 @@ get_mesa_program(struct gl_context *ctx,
{
glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
struct gl_program *prog;
+ struct pipe_screen * screen = st_context(ctx)->pipe->screen;
+ unsigned pipe_shader_type;
GLenum target;
const char *target_string;
bool progress;
@@ -4813,14 +4815,17 @@ get_mesa_program(struct gl_context *ctx,
case GL_VERTEX_SHADER:
target = GL_VERTEX_PROGRAM_ARB;
target_string = "vertex";
+ pipe_shader_type = PIPE_SHADER_VERTEX;
break;
case GL_FRAGMENT_SHADER:
target = GL_FRAGMENT_PROGRAM_ARB;
target_string = "fragment";
+ pipe_shader_type = PIPE_SHADER_FRAGMENT;
break;
case GL_GEOMETRY_SHADER:
target = GL_GEOMETRY_PROGRAM_NV;
target_string = "geometry";
+ pipe_shader_type = PIPE_SHADER_GEOMETRY;
break;
default:
assert(!"should not be reached");
@@ -4889,10 +4894,13 @@ get_mesa_program(struct gl_context *ctx,
}
#endif
- /* Remove reads to output registers, and to varyings in vertex shaders. */
- v->remove_output_reads(PROGRAM_OUTPUT);
- if (target == GL_VERTEX_PROGRAM_ARB)
- v->remove_output_reads(PROGRAM_VARYING);
+ if (!screen->get_shader_param(screen, pipe_shader_type,
+ PIPE_SHADER_CAP_OUTPUT_READ)) {
+ /* Remove reads to output registers, and to varyings in vertex shaders. */
+ v->remove_output_reads(PROGRAM_OUTPUT);
+ if (target == GL_VERTEX_PROGRAM_ARB)
+ v->remove_output_reads(PROGRAM_VARYING);
+ }
/* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
v->simplify_cmp();