aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-31 10:00:43 +0200
committermarha <marha@users.sourceforge.net>2012-07-31 10:00:43 +0200
commitbd27b3d008b0abf9ae2edcb127302728808533e4 (patch)
treea73a74f04a31a0f44465ed82bcf58b180ca53dbd /mesalib/src/mesa/state_tracker
parent2ff5448bcca8cba4b62026d5493cb08aaf2838d8 (diff)
downloadvcxsrv-bd27b3d008b0abf9ae2edcb127302728808533e4.tar.gz
vcxsrv-bd27b3d008b0abf9ae2edcb127302728808533e4.tar.bz2
vcxsrv-bd27b3d008b0abf9ae2edcb127302728808533e4.zip
fontconfig libXext mesa xserver pixman git update 31 Jul 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_array.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_clip.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_depth.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_framebuffer.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c84
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.h6
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c15
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_viewport.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h5
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp46
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c4
19 files changed, 126 insertions, 101 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_array.c b/mesalib/src/mesa/state_tracker/st_atom_array.c
index d60b0d7a9..ab46f1188 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_array.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_array.c
@@ -1,3 +1,4 @@
+
/**************************************************************************
*
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
@@ -45,7 +46,7 @@
#include "util/u_math.h"
#include "main/bufferobj.h"
-#include "main/image.h"
+#include "main/glformats.h"
static GLuint double_types[4] = {
diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c
index 2a5110098..a1a7e003a 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_clip.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c
@@ -47,7 +47,7 @@ static void update_clip( struct st_context *st )
const struct gl_context *ctx = st->ctx;
bool use_eye = FALSE;
- assert(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane));
+ STATIC_ASSERT(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane));
/* if we have a vertex shader that writes clip vertex we need to pass
the pre-projection transformed coordinates into the driver. */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_depth.c b/mesalib/src/mesa/state_tracker/st_atom_depth.c
index 6c51b1ac1..c76a6d8c6 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_depth.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_depth.c
@@ -49,14 +49,14 @@ GLuint
st_compare_func_to_pipe(GLenum func)
{
/* Same values, just biased */
- assert(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER);
- assert(PIPE_FUNC_LESS == GL_LESS - GL_NEVER);
- assert(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER);
- assert(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER);
- assert(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER);
- assert(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER);
- assert(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER);
- assert(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_LESS == GL_LESS - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER);
+ STATIC_ASSERT(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER);
assert(func >= GL_NEVER);
assert(func <= GL_ALWAYS);
return func - GL_NEVER;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c
index a8907c157..a10dbfbd0 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -33,6 +33,7 @@
#include "st_context.h"
#include "st_atom.h"
+#include "st_cb_bitmap.h"
#include "st_cb_fbo.h"
#include "st_texture.h"
#include "pipe/p_context.h"
@@ -52,7 +53,7 @@ update_renderbuffer_surface(struct st_context *st,
struct st_renderbuffer *strb)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_resource *resource = strb->rtt->pt;
+ struct pipe_resource *resource = strb->rtt ? strb->rtt->pt : strb->texture;
int rtt_width = strb->Base.Width;
int rtt_height = strb->Base.Height;
enum pipe_format format = st->ctx->Color.sRGBEnabled ? resource->format : util_format_linear(resource->format);
@@ -103,6 +104,9 @@ update_framebuffer_state( struct st_context *st )
struct st_renderbuffer *strb;
GLuint i;
+ st_flush_bitmap_cache(st);
+
+ st->state.fb_orientation = st_fb_orientation(fb);
framebuffer->width = fb->Width;
framebuffer->height = fb->Height;
@@ -117,7 +121,8 @@ update_framebuffer_state( struct st_context *st )
if (strb) {
/*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/
- if (strb->rtt) {
+ if (strb->rtt ||
+ (strb->texture && util_format_is_srgb(strb->texture->format))) {
/* rendering to a GL texture, may have to update surface */
update_renderbuffer_surface(st, strb);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index 09152c79a..c26058874 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -335,9 +335,8 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized,
struct pipe_resource **vbuf,
unsigned *vbuf_offset)
{
- const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
- const GLfloat fb_width = (GLfloat)fb->Width;
- const GLfloat fb_height = (GLfloat)fb->Height;
+ const GLfloat fb_width = (GLfloat)st->state.framebuffer.width;
+ const GLfloat fb_height = (GLfloat)st->state.framebuffer.height;
const GLfloat x0 = (GLfloat)x;
const GLfloat x1 = (GLfloat)(x + width);
const GLfloat y0 = (GLfloat)y;
@@ -502,10 +501,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* viewport state: viewport matching window dims */
{
- const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
- const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP);
- const GLfloat width = (GLfloat)fb->Width;
- const GLfloat height = (GLfloat)fb->Height;
+ const GLboolean invert = st->state.fb_orientation == Y_0_TOP;
+ const GLfloat width = (GLfloat)st->state.framebuffer.width;
+ const GLfloat height = (GLfloat)st->state.framebuffer.height;
struct pipe_viewport_state vp;
vp.scale[0] = 0.5f * width;
vp.scale[1] = height * (invert ? -0.5f : 0.5f);
@@ -636,43 +634,41 @@ st_flush_bitmap_cache(struct st_context *st)
if (!st->bitmap.cache->empty) {
struct bitmap_cache *cache = st->bitmap.cache;
- if (st->ctx->DrawBuffer) {
- struct pipe_context *pipe = st->pipe;
- struct pipe_sampler_view *sv;
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_sampler_view *sv;
- assert(cache->xmin <= cache->xmax);
-
-/* printf("flush size %d x %d at %d, %d\n",
- cache->xmax - cache->xmin,
- cache->ymax - cache->ymin,
- cache->xpos, cache->ypos);
+ assert(cache->xmin <= cache->xmax);
+
+/* printf("flush size %d x %d at %d, %d\n",
+ cache->xmax - cache->xmin,
+ cache->ymax - cache->ymin,
+ cache->xpos, cache->ypos);
*/
- /* The texture transfer has been mapped until now.
+ /* The texture transfer has been mapped until now.
* So unmap and release the texture transfer before drawing.
*/
- if (cache->trans) {
- if (0)
- print_cache(cache);
- pipe_transfer_unmap(pipe, cache->trans);
- cache->buffer = NULL;
-
- pipe->transfer_destroy(pipe, cache->trans);
- cache->trans = NULL;
- }
-
- sv = st_create_texture_sampler_view(st->pipe, cache->texture);
- if (sv) {
- draw_bitmap_quad(st->ctx,
- cache->xpos,
- cache->ypos,
- cache->zpos,
- BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
- sv,
- cache->color);
-
- pipe_sampler_view_reference(&sv, NULL);
- }
+ if (cache->trans) {
+ if (0)
+ print_cache(cache);
+ pipe_transfer_unmap(pipe, cache->trans);
+ cache->buffer = NULL;
+
+ pipe->transfer_destroy(pipe, cache->trans);
+ cache->trans = NULL;
+ }
+
+ sv = st_create_texture_sampler_view(st->pipe, cache->texture);
+ if (sv) {
+ draw_bitmap_quad(st->ctx,
+ cache->xpos,
+ cache->ypos,
+ cache->zpos,
+ BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
+ sv,
+ cache->color);
+
+ pipe_sampler_view_reference(&sv, NULL);
}
/* release/free the texture */
@@ -684,16 +680,6 @@ st_flush_bitmap_cache(struct st_context *st)
/**
- * Flush bitmap cache.
- */
-void
-st_flush_bitmap( struct st_context *st )
-{
- st_flush_bitmap_cache(st);
-}
-
-
-/**
* Try to accumulate this glBitmap call in the bitmap cache.
* \return GL_TRUE for success, GL_FALSE if bitmap is too large, etc.
*/
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h
index ed1415803..25410e503 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h
@@ -58,12 +58,6 @@ st_make_bitmap_fragment_program(struct st_context *st,
extern void
st_flush_bitmap_cache(struct st_context *st);
-/* Flush bitmap cache and release vertex buffer. Needed at end of
- * frame to avoid synchronous rendering.
- */
-extern void
-st_flush_bitmap(struct st_context *st);
-
#else
static INLINE void
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 1486779fd..b189cb406 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -80,9 +80,8 @@ st_BlitFramebuffer_resolve(struct gl_context *ctx,
info->src.res = srcRb->texture;
info->src.layer = srcRb->surface->u.tex.first_layer;
- info->dst.res = dstRb->texture;
- info->dst.level = dstRb->surface->u.tex.level;
- info->dst.layer = dstRb->surface->u.tex.first_layer;
+
+ info->dst.surface = dstRb->surface;
st->pipe->resource_resolve(st->pipe, info);
}
@@ -114,9 +113,8 @@ st_BlitFramebuffer_resolve(struct gl_context *ctx,
info->src.res = srcRb->texture;
info->src.layer = srcRb->surface->u.tex.first_layer;
- info->dst.res = dstRb->texture;
- info->dst.level = dstRb->surface->u.tex.level;
- info->dst.layer = dstRb->surface->u.tex.first_layer;
+
+ info->dst.surface = dstRb->surface;
st->pipe->resource_resolve(st->pipe, info);
}
@@ -130,9 +128,8 @@ st_BlitFramebuffer_resolve(struct gl_context *ctx,
info->src.res = srcRb->texture;
info->src.layer = srcRb->surface->u.tex.first_layer;
- info->dst.res = dstRb->texture;
- info->dst.level = dstRb->surface->u.tex.level;
- info->dst.layer = dstRb->surface->u.tex.first_layer;
+
+ info->dst.surface = dstRb->surface;
st->pipe->resource_resolve(st->pipe, info);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index c5f36316b..f288a9632 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -43,6 +43,7 @@
#include "main/texformat.h"
#include "main/teximage.h"
#include "main/texstore.h"
+#include "main/glformats.h"
#include "program/program.h"
#include "program/prog_print.h"
#include "program/prog_instruction.h"
@@ -368,7 +369,7 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
return GL_STENCIL_INDEX;
default:
- if (_mesa_is_integer_format(format)) {
+ if (_mesa_is_enum_format_integer(format)) {
switch (type) {
case GL_BYTE:
return GL_RGBA8I;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index e1818abb9..7eef5c659 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -291,13 +291,21 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_A8R8G8B8_UNORM:
+ strb->Base.InternalFormat = GL_RGBA8;
+ break;
case PIPE_FORMAT_R8G8B8X8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_X8R8G8B8_UNORM:
+ strb->Base.InternalFormat = GL_RGB8;
+ break;
case PIPE_FORMAT_B5G5R5A1_UNORM:
+ strb->Base.InternalFormat = GL_RGB5_A1;
+ break;
case PIPE_FORMAT_B4G4R4A4_UNORM:
+ strb->Base.InternalFormat = GL_RGBA4;
+ break;
case PIPE_FORMAT_B5G6R5_UNORM:
- strb->Base.InternalFormat = GL_RGBA;
+ strb->Base.InternalFormat = GL_RGB565;
break;
case PIPE_FORMAT_Z16_UNORM:
strb->Base.InternalFormat = GL_DEPTH_COMPONENT16;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 4e40a93f5..b4372ae7c 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -81,7 +81,7 @@ void st_flush( struct st_context *st,
{
FLUSH_CURRENT(st->ctx, 0);
- st_flush_bitmap(st);
+ st_flush_bitmap_cache(st);
st->pipe->flush( st->pipe, fence );
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_viewport.c b/mesalib/src/mesa/state_tracker/st_cb_viewport.c
index d4742eb89..d654ed6e7 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_viewport.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_viewport.c
@@ -43,7 +43,9 @@ static INLINE struct st_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
- return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
+ if (fb && _mesa_is_winsys_fbo(fb))
+ return (struct st_framebuffer *) fb;
+ return NULL;
}
static void st_viewport(struct gl_context * ctx, GLint x, GLint y,
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 117ea90f8..6b7c047ed 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -211,9 +211,9 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
struct dd_function_table funcs;
/* Sanity checks */
- assert(MESA_SHADER_VERTEX == PIPE_SHADER_VERTEX);
- assert(MESA_SHADER_FRAGMENT == PIPE_SHADER_FRAGMENT);
- assert(MESA_SHADER_GEOMETRY == PIPE_SHADER_GEOMETRY);
+ STATIC_ASSERT(MESA_SHADER_VERTEX == PIPE_SHADER_VERTEX);
+ STATIC_ASSERT(MESA_SHADER_FRAGMENT == PIPE_SHADER_FRAGMENT);
+ STATIC_ASSERT(MESA_SHADER_GEOMETRY == PIPE_SHADER_GEOMETRY);
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(&funcs);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index a3f44b3ab..cdac5a1c7 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -31,6 +31,7 @@
#include "main/mtypes.h"
#include "pipe/p_state.h"
#include "state_tracker/st_api.h"
+#include "main/fbobject.h"
struct bitmap_cache;
struct blit_state;
@@ -117,6 +118,8 @@ struct st_context
GLuint num_vertex_textures;
GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
+
+ GLuint fb_orientation;
} state;
char vendor[100];
@@ -236,7 +239,7 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state);
static INLINE GLuint
st_fb_orientation(const struct gl_framebuffer *fb)
{
- if (fb && fb->Name == 0) {
+ if (fb && _mesa_is_winsys_fbo(fb)) {
/* Drawing into a window (on-screen buffer).
*
* Negate Y scale to flip image vertically.
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 4dc09e7fb..9dc4822cc 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -153,9 +153,9 @@ static unsigned
translate_prim(const struct gl_context *ctx, unsigned prim)
{
/* GL prims should match Gallium prims, spot-check a few */
- assert(GL_POINTS == PIPE_PRIM_POINTS);
- assert(GL_QUADS == PIPE_PRIM_QUADS);
- assert(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
+ STATIC_ASSERT(GL_POINTS == PIPE_PRIM_POINTS);
+ STATIC_ASSERT(GL_QUADS == PIPE_PRIM_QUADS);
+ STATIC_ASSERT(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
/* Avoid quadstrips if it's easy to do so:
* Note: it's important to do the correct trimming if we change the
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 57d34411f..962b09250 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -34,6 +34,7 @@
#include "main/imports.h"
#include "main/context.h"
+#include "main/glformats.h"
#include "main/texstore.h"
#include "main/image.h"
#include "main/macros.h"
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 1d91e3661..fcd69b18d 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1448,9 +1448,29 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
emit(ir, TGSI_OPCODE_DDX, result_dst, op[0]);
break;
case ir_unop_dFdy:
- op[0].negate = ~op[0].negate;
- emit(ir, TGSI_OPCODE_DDY, result_dst, op[0]);
+ {
+ /* The X component contains 1 or -1 depending on whether the framebuffer
+ * is a FBO or the window system buffer, respectively.
+ * It is then multiplied with the source operand of DDY.
+ */
+ static const gl_state_index transform_y_state[STATE_LENGTH]
+ = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM };
+
+ unsigned transform_y_index =
+ _mesa_add_state_reference(this->prog->Parameters,
+ transform_y_state);
+
+ st_src_reg transform_y = st_src_reg(PROGRAM_STATE_VAR,
+ transform_y_index,
+ glsl_type::vec4_type);
+ transform_y.swizzle = SWIZZLE_XXXX;
+
+ st_src_reg temp = get_temp(glsl_type::vec4_type);
+
+ emit(ir, TGSI_OPCODE_MUL, st_dst_reg(temp), transform_y, op[0]);
+ emit(ir, TGSI_OPCODE_DDY, result_dst, temp);
break;
+ }
case ir_unop_noise: {
/* At some point, a motivated person could add a better
@@ -2758,8 +2778,6 @@ glsl_to_tgsi_visitor::visit(ir_return *ir)
void
glsl_to_tgsi_visitor::visit(ir_discard *ir)
{
- struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
-
if (ir->condition) {
ir->condition->accept(this);
this->result.negate = ~this->result.negate;
@@ -2767,8 +2785,6 @@ glsl_to_tgsi_visitor::visit(ir_discard *ir)
} else {
emit(ir, TGSI_OPCODE_KILP);
}
-
- fp->UsesKill = GL_TRUE;
}
void
@@ -2893,13 +2909,15 @@ set_uniform_initializer(struct gl_context *ctx, void *mem_ctx,
return;
}
- int loc = _mesa_get_uniform_location(ctx, shader_program, name);
-
- if (loc == -1) {
+ unsigned offset;
+ unsigned index = _mesa_get_uniform_location(ctx, shader_program, name,
+ &offset);
+ if (offset == GL_INVALID_INDEX) {
fail_link(shader_program,
"Couldn't find uniform for initializer %s\n", name);
return;
}
+ int loc = _mesa_uniform_merge_location_offset(index, offset);
for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) {
ir_constant *element;
@@ -4483,6 +4501,7 @@ st_translate_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
+ const GLboolean is_centroid[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
@@ -4524,10 +4543,11 @@ st_translate_program(
*/
if (procType == TGSI_PROCESSOR_FRAGMENT) {
for (i = 0; i < numInputs; i++) {
- t->inputs[i] = ureg_DECL_fs_input(ureg,
- inputSemanticName[i],
- inputSemanticIndex[i],
- interpMode[i]);
+ t->inputs[i] = ureg_DECL_fs_input_cyl_centroid(ureg,
+ inputSemanticName[i],
+ inputSemanticIndex[i],
+ interpMode[i], 0,
+ is_centroid[i]);
}
if (proginfo->InputsRead & FRAG_BIT_WPOS) {
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
index 55d59d571..a3fe91f7e 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -45,6 +45,7 @@ enum pipe_error st_translate_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
+ const GLboolean is_centroid[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 748624f3d..875e0c44a 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -64,7 +64,9 @@ static INLINE struct st_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
- return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
+ if (fb && _mesa_is_winsys_fbo(fb))
+ return (struct st_framebuffer *) fb;
+ return NULL;
}
/**
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 9f98298b4..36015f69a 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -347,6 +347,7 @@ st_translate_vertex_program(struct st_context *st,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
+ NULL, /* is centroid */
/* outputs */
stvp->num_outputs,
stvp->result_to_output,
@@ -484,6 +485,7 @@ st_translate_fragment_program(struct st_context *st,
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
+ GLboolean is_centroid[PIPE_MAX_SHADER_INPUTS];
uint fs_num_inputs = 0;
ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
@@ -537,6 +539,7 @@ st_translate_fragment_program(struct st_context *st,
const GLuint slot = fs_num_inputs++;
inputMapping[attr] = slot;
+ is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0;
switch (attr) {
case FRAG_ATTRIB_WPOS:
@@ -716,6 +719,7 @@ st_translate_fragment_program(struct st_context *st,
input_semantic_name,
input_semantic_index,
interpMode,
+ is_centroid,
/* outputs */
fs_num_outputs,
outputMapping,