aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-01-31 05:36:33 +0000
committerJosé Fonseca <[email protected]>2010-01-31 05:36:33 +0000
commitbee9964b29b2428ee75e2d1efc0e1d2c2518a417 (patch)
treefd733f886743b31f2ac2727e57f05d1a0918a977 /src/mesa/state_tracker
parent36a0819ff4ede1af91dcf909106cf20659856384 (diff)
parent12eb32e34244db9923cacaaed9ba951b7ac274a4 (diff)
Merge remote branch 'origin/master' into lp-binning
Conflicts: Makefile src/gallium/auxiliary/util/u_surface.c src/gallium/drivers/llvmpipe/lp_flush.c src/gallium/drivers/llvmpipe/lp_setup.c src/gallium/drivers/llvmpipe/lp_state_derived.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/gallium/drivers/llvmpipe/lp_state_surface.c src/gallium/drivers/llvmpipe/lp_tex_cache.c src/gallium/drivers/llvmpipe/lp_texture.c src/gallium/drivers/llvmpipe/lp_tile_cache.c src/mesa/state_tracker/st_cb_condrender.c
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_blend.c107
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c1
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c1
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c1
-rw-r--r--src/mesa/state_tracker/st_atom_scissor.c17
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c3
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c2
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c15
-rw-r--r--src/mesa/state_tracker/st_cb_blit.c4
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c27
-rw-r--r--src/mesa/state_tracker/st_cb_condrender.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c12
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c1
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c3
-rw-r--r--src/mesa/state_tracker/st_cb_program.c1
-rw-r--r--src/mesa/state_tracker/st_cb_queryobj.c1
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c1
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c2
-rw-r--r--src/mesa/state_tracker/st_cb_strings.c1
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c64
-rw-r--r--src/mesa/state_tracker/st_cb_viewport.c3
-rw-r--r--src/mesa/state_tracker/st_context.c15
-rw-r--r--src/mesa/state_tracker/st_context.h2
-rw-r--r--src/mesa/state_tracker/st_draw.c3
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c3
-rw-r--r--src/mesa/state_tracker/st_extensions.c17
-rw-r--r--src/mesa/state_tracker/st_format.c3
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c4
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c2
-rw-r--r--src/mesa/state_tracker/st_inlines.h10
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c91
31 files changed, 281 insertions, 138 deletions
diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 43e62c29f3e..1511b88dd1f 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -152,14 +152,54 @@ translate_logicop(GLenum logicop)
}
}
+/**
+ * Figure out if colormasks are different per rt.
+ */
+static GLboolean
+colormask_per_rt(GLcontext *ctx)
+{
+ /* a bit suboptimal have to compare lots of values */
+ unsigned i;
+ for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
+ if (memcmp(ctx->Color.ColorMask[0], ctx->Color.ColorMask[i], 4)) {
+ return GL_TRUE;
+ }
+ }
+ return GL_FALSE;
+}
+
+/**
+ * Figure out if blend enables are different per rt.
+ */
+static GLboolean
+blend_per_rt(GLcontext *ctx)
+{
+ if (ctx->Color.BlendEnabled &&
+ (ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+}
static void
update_blend( struct st_context *st )
{
struct pipe_blend_state *blend = &st->state.blend;
+ unsigned num_state = 1;
+ unsigned i;
memset(blend, 0, sizeof(*blend));
+ if (blend_per_rt(st->ctx) || colormask_per_rt(st->ctx)) {
+ num_state = st->ctx->Const.MaxDrawBuffers;
+ blend->independent_blend_enable = 1;
+ }
+ /* Note it is impossible to correctly deal with EXT_blend_logic_op and
+ EXT_draw_buffers2/EXT_blend_equation_separate at the same time.
+ These combinations would require support for per-rt logicop enables
+ and separate alpha/rgb logicop/blend support respectively. Neither
+ possible in gallium nor most hardware. Assume these combinations
+ don't happen. */
if (st->ctx->Color.ColorLogicOpEnabled ||
(st->ctx->Color.BlendEnabled &&
st->ctx->Color.BlendEquationRGB == GL_LOGIC_OP)) {
@@ -169,30 +209,33 @@ update_blend( struct st_context *st )
}
else if (st->ctx->Color.BlendEnabled) {
/* blending enabled */
- blend->blend_enable = 1;
-
- blend->rgb_func = translate_blend(st->ctx->Color.BlendEquationRGB);
- if (st->ctx->Color.BlendEquationRGB == GL_MIN ||
- st->ctx->Color.BlendEquationRGB == GL_MAX) {
- /* Min/max are special */
- blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE;
- blend->rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
- }
- else {
- blend->rgb_src_factor = translate_blend(st->ctx->Color.BlendSrcRGB);
- blend->rgb_dst_factor = translate_blend(st->ctx->Color.BlendDstRGB);
- }
+ for (i = 0; i < num_state; i++) {
- blend->alpha_func = translate_blend(st->ctx->Color.BlendEquationA);
- if (st->ctx->Color.BlendEquationA == GL_MIN ||
- st->ctx->Color.BlendEquationA == GL_MAX) {
- /* Min/max are special */
- blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
- blend->alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
- }
- else {
- blend->alpha_src_factor = translate_blend(st->ctx->Color.BlendSrcA);
- blend->alpha_dst_factor = translate_blend(st->ctx->Color.BlendDstA);
+ blend->rt[i].blend_enable = (st->ctx->Color.BlendEnabled >> i) & 0x1;
+
+ blend->rt[i].rgb_func = translate_blend(st->ctx->Color.BlendEquationRGB);
+ if (st->ctx->Color.BlendEquationRGB == GL_MIN ||
+ st->ctx->Color.BlendEquationRGB == GL_MAX) {
+ /* Min/max are special */
+ blend->rt[i].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend->rt[i].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
+ }
+ else {
+ blend->rt[i].rgb_src_factor = translate_blend(st->ctx->Color.BlendSrcRGB);
+ blend->rt[i].rgb_dst_factor = translate_blend(st->ctx->Color.BlendDstRGB);
+ }
+
+ blend->rt[i].alpha_func = translate_blend(st->ctx->Color.BlendEquationA);
+ if (st->ctx->Color.BlendEquationA == GL_MIN ||
+ st->ctx->Color.BlendEquationA == GL_MAX) {
+ /* Min/max are special */
+ blend->rt[i].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend->rt[i].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
+ }
+ else {
+ blend->rt[i].alpha_src_factor = translate_blend(st->ctx->Color.BlendSrcA);
+ blend->rt[i].alpha_dst_factor = translate_blend(st->ctx->Color.BlendDstA);
+ }
}
}
else {
@@ -200,14 +243,16 @@ update_blend( struct st_context *st )
}
/* Colormask - maybe reverse these bits? */
- if (st->ctx->Color.ColorMask[0][0])
- blend->colormask |= PIPE_MASK_R;
- if (st->ctx->Color.ColorMask[0][1])
- blend->colormask |= PIPE_MASK_G;
- if (st->ctx->Color.ColorMask[0][2])
- blend->colormask |= PIPE_MASK_B;
- if (st->ctx->Color.ColorMask[0][3])
- blend->colormask |= PIPE_MASK_A;
+ for (i = 0; i < num_state; i++) {
+ if (st->ctx->Color.ColorMask[i][0])
+ blend->rt[i].colormask |= PIPE_MASK_R;
+ if (st->ctx->Color.ColorMask[i][1])
+ blend->rt[i].colormask |= PIPE_MASK_G;
+ if (st->ctx->Color.ColorMask[i][2])
+ blend->rt[i].colormask |= PIPE_MASK_B;
+ if (st->ctx->Color.ColorMask[i][3])
+ blend->rt[i].colormask |= PIPE_MASK_A;
+ }
if (st->ctx->Color.DitherFlag)
blend->dither = 1;
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 8ca4335e330..8d045f2c6c0 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -37,7 +37,6 @@
#include "st_public.h"
#include "st_texture.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
#include "util/u_rect.h"
#include "util/u_math.h"
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 6a5854e9ba5..0b2e3f53812 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -43,7 +43,6 @@
#include "st_context.h"
#include "st_format.h"
-#include "st_program.h"
#include "st_texture.h"
#include "st_inlines.h"
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 7b84a86ba48..9d63f1c6ab6 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -37,7 +37,6 @@
#include "st_context.h"
#include "st_cb_texture.h"
#include "st_atom.h"
-#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c
index 3fd59e1945c..5e0c51cff0a 100644
--- a/src/mesa/state_tracker/st_atom_scissor.c
+++ b/src/mesa/state_tracker/st_atom_scissor.c
@@ -31,6 +31,7 @@
*/
+#include "main/macros.h"
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
@@ -52,15 +53,19 @@ update_scissor( struct st_context *st )
scissor.maxy = fb->Height;
if (st->ctx->Scissor.Enabled) {
- if ((GLuint)st->ctx->Scissor.X > scissor.minx)
+ /* need to be careful here with xmax or ymax < 0 */
+ GLint xmax = MAX2(0, st->ctx->Scissor.X + st->ctx->Scissor.Width);
+ GLint ymax = MAX2(0, st->ctx->Scissor.Y + st->ctx->Scissor.Height);
+
+ if (st->ctx->Scissor.X > (GLint)scissor.minx)
scissor.minx = st->ctx->Scissor.X;
- if ((GLuint)st->ctx->Scissor.Y > scissor.miny)
+ if (st->ctx->Scissor.Y > (GLint)scissor.miny)
scissor.miny = st->ctx->Scissor.Y;
- if ((GLuint)st->ctx->Scissor.X + st->ctx->Scissor.Width < scissor.maxx)
- scissor.maxx = st->ctx->Scissor.X + st->ctx->Scissor.Width;
- if ((GLuint)st->ctx->Scissor.Y + st->ctx->Scissor.Height < scissor.maxy)
- scissor.maxy = st->ctx->Scissor.Y + st->ctx->Scissor.Height;
+ if (xmax < (GLint) scissor.maxx)
+ scissor.maxx = xmax;
+ if (ymax < (GLint) scissor.maxy)
+ scissor.maxy = ymax;
/* check for null space */
if (scissor.minx >= scissor.maxx || scissor.miny >= scissor.maxy)
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 176f3ea68d7..181f88a3348 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -51,7 +51,6 @@
#include "st_atom.h"
#include "st_program.h"
#include "st_atom_shader.h"
-#include "st_mesa_to_tgsi.h"
@@ -79,7 +78,7 @@ translate_fp(struct st_context *st,
stfp->num_input_slots = numIn;
- assert(stfp->Base.Base.NumInstructions > 1);
+ assert(stfp->Base.Base.NumInstructions > 0);
st_translate_fragment_program(st, stfp, stfp->input_to_slot);
}
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index da7b97d3253..798081ec899 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -38,9 +38,7 @@
#include "st_context.h"
#include "st_cb_accum.h"
#include "st_cb_fbo.h"
-#include "st_draw.h"
#include "st_public.h"
-#include "st_format.h"
#include "st_texture.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 1bdeaccda3e..d1b35f796ec 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -34,9 +34,7 @@
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
-#include "main/texformat.h"
#include "shader/program.h"
-#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "st_context.h"
@@ -44,15 +42,12 @@
#include "st_atom_constbuf.h"
#include "st_program.h"
#include "st_cb_bitmap.h"
-#include "st_cb_program.h"
-#include "st_mesa_to_tgsi.h"
#include "st_texture.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "util/u_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
#include "shader/prog_instruction.h"
@@ -386,11 +381,11 @@ setup_bitmap_vertex_data(struct st_context *st,
}
/* put vertex data into vbuf */
- st_no_flush_pipe_buffer_write(st,
- st->bitmap.vbuf,
- st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
- sizeof st->bitmap.vertices,
- st->bitmap.vertices);
+ st_no_flush_pipe_buffer_write_nooverlap(st,
+ st->bitmap.vbuf,
+ st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
+ sizeof st->bitmap.vertices,
+ st->bitmap.vertices);
return st->bitmap.vbuf_slot++ * sizeof st->bitmap.vertices;
}
diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c
index 563615ed0d1..65aa2a28ac2 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -33,14 +33,10 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "main/texformat.h"
#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
#include "st_context.h"
#include "st_texture.h"
-#include "st_program.h"
#include "st_cb_blit.h"
#include "st_cb_fbo.h"
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 192d765f453..94693d91f39 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -42,10 +42,8 @@
#include "st_cb_accum.h"
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
-#include "st_draw.h"
#include "st_program.h"
#include "st_public.h"
-#include "st_mesa_to_tgsi.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
@@ -53,7 +51,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_format.h"
-#include "util/u_pack_color.h"
#include "util/u_simple_shaders.h"
#include "util/u_draw_quad.h"
@@ -166,10 +163,10 @@ draw_quad(GLcontext *ctx,
}
/* put vertex data into vbuf */
- st_no_flush_pipe_buffer_write(st, st->clear.vbuf,
- st->clear.vbuf_slot * sizeof(st->clear.vertices),
- sizeof(st->clear.vertices),
- st->clear.vertices);
+ st_no_flush_pipe_buffer_write_nooverlap(st, st->clear.vbuf,
+ st->clear.vbuf_slot * sizeof(st->clear.vertices),
+ sizeof(st->clear.vertices),
+ st->clear.vertices);
/* draw */
util_draw_vertex_buffer(pipe,
@@ -227,19 +224,19 @@ clear_with_quad(GLcontext *ctx,
{
struct pipe_blend_state blend;
memset(&blend, 0, sizeof(blend));
- blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
- blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
- blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
- blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
+ blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+ blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
+ blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
if (color) {
if (ctx->Color.ColorMask[0][0])
- blend.colormask |= PIPE_MASK_R;
+ blend.rt[0].colormask |= PIPE_MASK_R;
if (ctx->Color.ColorMask[0][1])
- blend.colormask |= PIPE_MASK_G;
+ blend.rt[0].colormask |= PIPE_MASK_G;
if (ctx->Color.ColorMask[0][2])
- blend.colormask |= PIPE_MASK_B;
+ blend.rt[0].colormask |= PIPE_MASK_B;
if (ctx->Color.ColorMask[0][3])
- blend.colormask |= PIPE_MASK_A;
+ blend.rt[0].colormask |= PIPE_MASK_A;
if (st->ctx->Color.DitherFlag)
blend.dither = 1;
}
diff --git a/src/mesa/state_tracker/st_cb_condrender.c b/src/mesa/state_tracker/st_cb_condrender.c
index e2cd80b4046..8483b93bd85 100644
--- a/src/mesa/state_tracker/st_cb_condrender.c
+++ b/src/mesa/state_tracker/st_cb_condrender.c
@@ -69,7 +69,7 @@ st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q,
break;
default:
assert(0 && "bad mode in st_BeginConditionalRender");
- return;
+ m = PIPE_RENDER_COND_WAIT;
}
pipe->render_condition(pipe, stq->pq, m);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 7c664267d4e..7afdc31ede9 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -36,24 +36,18 @@
#include "main/macros.h"
#include "main/texformat.h"
#include "main/texstore.h"
-#include "main/state.h"
#include "shader/program.h"
-#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "st_debug.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_atom_constbuf.h"
-#include "st_draw.h"
#include "st_program.h"
#include "st_cb_drawpixels.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
-#include "st_cb_texture.h"
-#include "st_draw.h"
#include "st_format.h"
-#include "st_mesa_to_tgsi.h"
#include "st_texture.h"
#include "st_inlines.h"
@@ -1138,6 +1132,8 @@ st_destroy_drawpix(struct st_context *st)
{
st_reference_fragprog(st, &st->drawpix.z_shader, NULL);
st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
- st_reference_vertprog(st, &st->drawpix.vert_shaders[0], NULL);
- st_reference_vertprog(st, &st->drawpix.vert_shaders[1], NULL);
+ if (st->drawpix.vert_shaders[0])
+ free(st->drawpix.vert_shaders[0]);
+ if (st->drawpix.vert_shaders[1])
+ free(st->drawpix.vert_shaders[1]);
}
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 45ce34a85f7..f7350ef1e3c 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -44,7 +44,6 @@
#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_cb_fbo.h"
-#include "st_cb_texture.h"
#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 93f71452192..17261f8321b 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -45,14 +45,11 @@
#include "vbo/vbo.h"
#include "st_context.h"
-#include "st_atom.h"
#include "st_draw.h"
#include "st_cb_feedback.h"
-#include "st_cb_bufferobjects.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "cso_cache/cso_cache.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 8c276f8128e..5138e596a9c 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -36,7 +36,6 @@
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/program.h"
-#include "shader/programopt.h"
#include "shader/shader_api.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index 10629e92254..2281d10e999 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -41,7 +41,6 @@
#include "pipe/p_defines.h"
#include "st_context.h"
#include "st_cb_queryobj.h"
-#include "st_public.h"
static struct gl_query_object *
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index d82b2a2035f..42a1377809a 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -47,7 +47,6 @@
#include "st_draw.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
-#include "shader/prog_instruction.h"
#include "vbo/vbo.h"
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 6fa7bb64f2e..8eb825a6a41 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -45,10 +45,8 @@
#include "st_debug.h"
#include "st_context.h"
-#include "st_cb_bitmap.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
-#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
#include "st_inlines.h"
diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c
index bb931f17c4e..f22c5369e43 100644
--- a/src/mesa/state_tracker/st_cb_strings.c
+++ b/src/mesa/state_tracker/st_cb_strings.c
@@ -33,7 +33,6 @@
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/version.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "st_context.h"
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index f01053cdacc..cee2452eafe 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -31,15 +31,14 @@
#include "main/convolve.h"
#endif
#include "main/enums.h"
+#include "main/fbobject.h"
#include "main/formats.h"
#include "main/image.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mipmap.h"
-#include "main/pixel.h"
#include "main/texcompress.h"
#include "main/texfetch.h"
-#include "main/texformat.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
#include "main/texobj.h"
@@ -687,9 +686,11 @@ st_TexImage(GLcontext * ctx,
{
char *dst = texImage->Data;
const char *src = pixels;
- int i;
+ GLuint i, bw, bh, lines;
+ _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+ lines = (height + bh - 1) / bh;
- for(i = 0; i < height; ++i)
+ for(i = 0; i < lines; ++i)
{
memcpy(dst, src, srcImageStride);
dst += dstRowStride;
@@ -1368,33 +1369,64 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
}
+
+/**
+ * If the format of the src renderbuffer and the format of the dest
+ * texture are compatible (in terms of blitting), return a TGSI writemask
+ * to be used during the blit.
+ * If the src/dest are incompatible, return 0.
+ */
static unsigned
-compatible_src_dst_formats(const struct gl_renderbuffer *src,
+compatible_src_dst_formats(GLcontext *ctx,
+ const struct gl_renderbuffer *src,
const struct gl_texture_image *dst)
{
- const GLenum srcFormat = _mesa_get_format_base_format(src->Format);
- const GLenum dstLogicalFormat = _mesa_get_format_base_format(dst->TexFormat);
+ /* Get logical base formats for the src and dest.
+ * That is, use the user-requested formats and not the actual, device-
+ * chosen formats.
+ * For example, the user may have requested an A8 texture but the
+ * driver may actually be using an RGBA texture format. When we
+ * copy/blit to that texture, we only want to copy the Alpha channel
+ * and not the RGB channels.
+ *
+ * Similarly, when the src FBO was created an RGB format may have been
+ * requested but the driver actually chose an RGBA format. In that case,
+ * we don't want to copy the undefined Alpha channel to the dest texture
+ * (it should be 1.0).
+ */
+ const GLenum srcFormat = _mesa_base_fbo_format(ctx, src->InternalFormat);
+ const GLenum dstFormat = _mesa_base_tex_format(ctx, dst->InternalFormat);
- if (srcFormat == dstLogicalFormat) {
+ /**
+ * XXX when we have red-only and red/green renderbuffers we'll need
+ * to add more cases here (or implement a general-purpose routine that
+ * queries the existance of the R,G,B,A channels in the src and dest).
+ */
+ if (srcFormat == dstFormat) {
/* This is the same as matching_base_formats, which should
* always pass, as it did previously.
*/
return TGSI_WRITEMASK_XYZW;
}
- else if (srcFormat == GL_RGBA &&
- dstLogicalFormat == GL_RGB) {
- /* Add a single special case to cope with RGBA->RGB transfers,
- * setting A to 1.0 to cope with situations where the RGB
- * destination is actually stored as RGBA.
+ else if (srcFormat == GL_RGB && dstFormat == GL_RGBA) {
+ /* Make sure that A in the dest is 1. The actual src format
+ * may be RGBA and have undefined A values.
+ */
+ return TGSI_WRITEMASK_XYZ;
+ }
+ else if (srcFormat == GL_RGBA && dstFormat == GL_RGB) {
+ /* Make sure that A in the dest is 1. The actual dst format
+ * may be RGBA and will need A=1 to provide proper alpha values
+ * when sampled later.
*/
- return TGSI_WRITEMASK_XYZ; /* A ==> 1.0 */
+ return TGSI_WRITEMASK_XYZ;
}
else {
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s failed for src %s, dst %s\n",
__FUNCTION__,
_mesa_lookup_enum_by_nr(srcFormat),
- _mesa_lookup_enum_by_nr(dstLogicalFormat));
+ _mesa_lookup_enum_by_nr(dstFormat));
/* Otherwise fail.
*/
@@ -1505,7 +1537,7 @@ st_copy_texsubimage(GLcontext *ctx,
matching_base_formats =
(_mesa_get_format_base_format(strb->Base.Format) ==
_mesa_get_format_base_format(texImage->TexFormat));
- format_writemask = compatible_src_dst_formats(&strb->Base, texImage);
+ format_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
if (ctx->_ImageTransferState == 0x0) {
diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c
index ab11c5b4fe0..b29191abef6 100644
--- a/src/mesa/state_tracker/st_cb_viewport.c
+++ b/src/mesa/state_tracker/st_cb_viewport.c
@@ -27,14 +27,11 @@
#include "main/glheader.h"
#include "st_context.h"
-#include "st_public.h"
#include "st_cb_viewport.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "pipe/internal/p_winsys_screen.h"
static void st_viewport(GLcontext * ctx, GLint x, GLint y,
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 45bb6b3cb7e..a62ff248ce5 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -27,11 +27,6 @@
#include "main/imports.h"
#include "main/context.h"
-#include "main/extensions.h"
-#include "main/matrix.h"
-#include "main/buffers.h"
-#include "main/scissor.h"
-#include "main/viewport.h"
#include "vbo/vbo.h"
#include "shader/shader_api.h"
#include "glapi/glapi.h"
@@ -48,7 +43,7 @@
#include "st_cb_drawpixels.h"
#include "st_cb_rasterpos.h"
#endif
-#ifdef FEATURE_OES_draw_texture
+#if FEATURE_OES_draw_texture
#include "st_cb_drawtex.h"
#endif
#include "st_cb_fbo.h"
@@ -69,7 +64,6 @@
#include "st_program.h"
#include "pipe/p_context.h"
#include "draw/draw_context.h"
-#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_context.h"
@@ -209,7 +203,7 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_bitmap(st);
st_destroy_drawpix(st);
#endif
-#ifdef FEATURE_OES_draw_texture
+#if FEATURE_OES_draw_texture
st_destroy_drawtex(st);
#endif
@@ -330,6 +324,11 @@ void st_init_driver_functions(struct dd_function_table *functions)
st_init_drawpixels_functions(functions);
st_init_rasterpos_functions(functions);
#endif
+
+#if FEATURE_OES_draw_texture
+ st_init_drawtex_functions(functions);
+#endif
+
st_init_fbo_functions(functions);
#if FEATURE_feedback
st_init_feedback_functions(functions);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 2c4943cfb0a..50e98d7146a 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -159,7 +159,7 @@ struct st_context
/** for glDraw/CopyPixels */
struct {
struct st_fragment_program *z_shader;
- struct st_vertex_program *vert_shaders[2];
+ void *vert_shaders[2]; /**< ureg shaders */
} drawpix;
/** for glClear */
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b0d5b993a77..381c68474d6 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -531,6 +531,9 @@ st_draw_vbo(GLcontext *ctx,
GLboolean userSpace = GL_FALSE;
GLboolean vertDataEdgeFlags;
+ /* Mesa core state should have been validated already */
+ assert(ctx->NewState == 0x0);
+
/* Gallium probably doesn't want this in some cases. */
if (!index_bounds_valid)
if (!vbo_all_varyings_in_vbos(arrays))
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index a05d6dd06bd..cdaee2a353e 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -28,7 +28,6 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "shader/prog_uniform.h"
#include "vbo/vbo.h"
@@ -242,7 +241,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
mapped_constants = pipe_buffer_map(pipe->screen,
st->state.constants[PIPE_SHADER_VERTEX],
PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, 0,
mapped_constants,
st->state.constants[PIPE_SHADER_VERTEX]->size);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 35e08749df7..f2a62f9b690 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -28,7 +28,6 @@
#include "main/imports.h"
#include "main/context.h"
-#include "main/extensions.h"
#include "main/macros.h"
#include "pipe/p_context.h"
@@ -148,6 +147,7 @@ void st_init_extensions(struct st_context *st)
* Extensions that are supported by all Gallium drivers:
*/
ctx->Extensions.ARB_copy_buffer = GL_TRUE;
+ ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.ARB_fragment_program = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_multisample = GL_TRUE;
@@ -168,6 +168,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
ctx->Extensions.EXT_fog_coord = GL_TRUE;
ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;
ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
@@ -187,6 +188,10 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.NV_texgen_reflection = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
+#if FEATURE_OES_draw_texture
+ ctx->Extensions.OES_draw_texture = GL_TRUE;
+#endif
+
ctx->Extensions.SGI_color_matrix = GL_TRUE;
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
@@ -310,4 +315,14 @@ void st_init_extensions(struct st_context *st)
if (st->pipe->render_condition) {
ctx->Extensions.NV_conditional_render = GL_TRUE;
}
+
+ if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_ENABLE)) {
+ ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
+ }
+
+#if 0 /* not yet */
+ if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_FUNC)) {
+ ctx->Extensions.ARB_draw_buffers_blend = GL_TRUE;
+ }
+#endif
}
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index d00b67a279e..3ffc2aee2a2 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -35,7 +35,6 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/texstore.h"
-#include "main/texformat.h"
#include "main/enums.h"
#include "main/macros.h"
@@ -288,6 +287,8 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat)
return MESA_FORMAT_XRGB8888;
case PIPE_FORMAT_B8G8R8A8_UNORM:
return MESA_FORMAT_ARGB8888_REV;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ return MESA_FORMAT_XRGB8888_REV;
case PIPE_FORMAT_A1R5G5B5_UNORM:
return MESA_FORMAT_ARGB1555;
case PIPE_FORMAT_A4R4G4B4_UNORM:
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index a5d1ae3b034..835142e3d41 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -30,15 +30,11 @@
#include "main/buffers.h"
#include "main/context.h"
#include "main/framebuffer.h"
-#include "main/matrix.h"
#include "main/renderbuffer.h"
-#include "main/scissor.h"
-#include "main/viewport.h"
#include "st_context.h"
#include "st_cb_fbo.h"
#include "st_public.h"
#include "pipe/p_defines.h"
-#include "pipe/p_context.h"
struct st_framebuffer *
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 2c283d464ae..3823a59d37a 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -46,9 +46,7 @@
#include "st_debug.h"
#include "st_context.h"
-#include "st_draw.h"
#include "st_gen_mipmap.h"
-#include "st_program.h"
#include "st_texture.h"
#include "st_cb_texture.h"
#include "st_inlines.h"
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index a41cfeb96f7..dccc46f12d7 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -126,6 +126,16 @@ st_no_flush_pipe_buffer_write(struct st_context *st,
}
static INLINE void
+st_no_flush_pipe_buffer_write_nooverlap(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int offset,
+ unsigned int size,
+ const void * data)
+{
+ pipe_buffer_write_nooverlap(st->pipe->screen, buf, offset, size, data);
+}
+
+static INLINE void
st_cond_flush_pipe_buffer_read(struct st_context *st,
struct pipe_buffer *buf,
unsigned int offset,
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index e788008dfe1..4aed2df8c31 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -34,8 +34,10 @@
#include "pipe/p_compiler.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/p_state.h"
+#include "pipe/p_context.h"
#include "tgsi/tgsi_ureg.h"
#include "st_mesa_to_tgsi.h"
+#include "st_context.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
@@ -48,6 +50,10 @@ struct label {
unsigned token;
};
+
+/**
+ * Intermediate state used during shader translation.
+ */
struct st_translate {
struct ureg_program *ureg;
@@ -661,6 +667,22 @@ compile_instruction(
}
}
+/**
+ * Emit the TGSI instructions to adjust the WPOS pixel center convention
+ */
+static void
+emit_adjusted_wpos( struct st_translate *t,
+ const struct gl_program *program, GLfloat value)
+{
+ struct ureg_program *ureg = t->ureg;
+ struct ureg_dst wpos_temp = ureg_DECL_temporary(ureg);
+ struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
+
+ ureg_ADD(ureg, ureg_writemask(wpos_temp, TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y),
+ wpos_input, ureg_imm1f(ureg, value));
+
+ t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp);
+}
/**
* Emit the TGSI instructions for inverting the WPOS y coordinate.
@@ -686,12 +708,17 @@ emit_inverted_wpos( struct st_translate *t,
winSizeState);
struct ureg_src winsize = ureg_DECL_constant( ureg, winHeightConst );
- struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg );
+ struct ureg_dst wpos_temp;
struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
/* MOV wpos_temp, input[wpos]
*/
- ureg_MOV( ureg, wpos_temp, wpos_input );
+ if (wpos_input.File == TGSI_FILE_TEMPORARY)
+ wpos_temp = ureg_dst(wpos_input);
+ else {
+ wpos_temp = ureg_DECL_temporary( ureg );
+ ureg_MOV( ureg, wpos_temp, wpos_input );
+ }
/* SUB wpos_temp.y, winsize_const, wpos_input
*/
@@ -730,6 +757,7 @@ emit_face_var( struct st_translate *t,
t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp);
}
+
static void
emit_edgeflags( struct st_translate *t,
const struct gl_program *program )
@@ -741,6 +769,7 @@ emit_edgeflags( struct st_translate *t,
ureg_MOV( ureg, edge_dst, edge_src );
}
+
/**
* Translate Mesa program to TGSI format.
* \param program the program to translate
@@ -758,7 +787,7 @@ emit_edgeflags( struct st_translate *t,
* \param outputSemanticIndex the semantic index (ex: which texcoord) for
* each output
*
- * \return array of translated tokens, caller's responsibility to free
+ * \return PIPE_OK or PIPE_ERROR_OUT_OF_MEMORY
*/
enum pipe_error
st_translate_mesa_program(
@@ -779,6 +808,7 @@ st_translate_mesa_program(
{
struct st_translate translate, *t;
unsigned i;
+ enum pipe_error ret = PIPE_OK;
t = &translate;
memset(t, 0, sizeof *t);
@@ -794,6 +824,7 @@ st_translate_mesa_program(
* Declare input attributes.
*/
if (procType == TGSI_PROCESSOR_FRAGMENT) {
+ struct gl_fragment_program* fp = (struct gl_fragment_program*)program;
for (i = 0; i < numInputs; i++) {
t->inputs[i] = ureg_DECL_fs_input(ureg,
inputSemanticName[i],
@@ -805,7 +836,51 @@ st_translate_mesa_program(
/* Must do this after setting up t->inputs, and before
* emitting constant references, below:
*/
- emit_inverted_wpos( t, program );
+ struct pipe_screen* pscreen = st_context(ctx)->pipe->screen;
+ boolean invert = FALSE;
+
+ if (fp->OriginUpperLeft) {
+ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) {
+ }
+ else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) {
+ ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT);
+ invert = TRUE;
+ }
+ else
+ assert(0);
+ }
+ else {
+ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT))
+ ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT);
+ else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT))
+ invert = TRUE;
+ else
+ assert(0);
+ }
+
+ if (fp->PixelCenterInteger) {
+ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER))
+ ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER);
+ else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER))
+ emit_adjusted_wpos(t, program, invert ? 0.5f : -0.5f);
+ else
+ assert(0);
+ }
+ else {
+ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) {
+ }
+ else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) {
+ ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER);
+ emit_adjusted_wpos(t, program, invert ? -0.5f : 0.5f);
+ }
+ else
+ assert(0);
+ }
+
+ /* we invert after adjustment so that we avoid the MOV to temporary,
+ * and reuse the adjustment ADD instead */
+ if (invert)
+ emit_inverted_wpos(t, program);
}
if (program->InputsRead & FRAG_BIT_FACE) {
@@ -865,8 +940,10 @@ st_translate_mesa_program(
t->constants = CALLOC( program->Parameters->NumParameters,
sizeof t->constants[0] );
- if (t->constants == NULL)
+ if (t->constants == NULL) {
+ ret = PIPE_ERROR_OUT_OF_MEMORY;
goto out;
+ }
for (i = 0; i < program->Parameters->NumParameters; i++) {
switch (program->Parameters->Parameters[i].Type) {
@@ -920,8 +997,6 @@ st_translate_mesa_program(
t->insn[t->labels[i].branch_target] );
}
- return PIPE_OK;
-
out:
FREE(t->insn);
FREE(t->labels);
@@ -931,7 +1006,7 @@ out:
debug_printf("%s: translate error flag set\n", __FUNCTION__);
}
- return PIPE_ERROR_OUT_OF_MEMORY;
+ return ret;
}