nir: move ends_in_break() helper to nir_loop_analyze.h
[mesa.git] / src / mesa / state_tracker / st_cb_drawtex.c
index d07cdcc8de960a5992625fa6e856f56794339a6c..b6bf71d4cd10e14684a1b206a6af65ad63313fd8 100644 (file)
@@ -16,6 +16,7 @@
 #include "main/image.h"
 #include "main/macros.h"
 #include "main/teximage.h"
+#include "main/framebuffer.h"
 #include "program/program.h"
 #include "program/prog_print.h"
 
@@ -107,7 +108,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
 {
    struct st_context *st = ctx->st;
    struct pipe_context *pipe = st->pipe;
-   struct cso_context *cso = ctx->st->cso_context;
+   struct cso_context *cso = st->cso_context;
    struct pipe_resource *vbuffer = NULL;
    GLuint i, numTexCoords, numAttribs;
    GLboolean emitColor;
@@ -117,11 +118,12 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
    unsigned offset;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
-   st_validate_state(st, ST_PIPELINE_RENDER);
+   st_validate_state(st, ST_PIPELINE_META);
 
    /* determine if we need vertex color */
-   if (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL0)
+   if (ctx->FragmentProgram._Current->info.inputs_read & VARYING_BIT_COL0)
       emitColor = GL_TRUE;
    else
       emitColor = GL_FALSE;
@@ -154,7 +156,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
       GLfloat *vbuf = NULL;
       GLuint tex_attr;
 
-      u_upload_alloc(st->uploader, 0,
+      u_upload_alloc(pipe->stream_uploader, 0,
                      numAttribs * 4 * 4 * sizeof(GLfloat), 4,
                      &offset, &vbuffer, (void **) &vbuf);
       if (!vbuffer) {
@@ -165,9 +167,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
 
       /* positions (in clip coords) */
       {
-         const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
-         const GLfloat fb_width = (GLfloat)fb->Width;
-         const GLfloat fb_height = (GLfloat)fb->Height;
+         const struct gl_framebuffer *fb = ctx->DrawBuffer;
+         const GLfloat fb_width = (GLfloat)_mesa_geometric_width(fb);
+         const GLfloat fb_height = (GLfloat)_mesa_geometric_height(fb);
 
          const GLfloat clip_x0 = (GLfloat)(x0 / fb_width * 2.0 - 1.0);
          const GLfloat clip_y0 = (GLfloat)(y0 / fb_height * 2.0 - 1.0);
@@ -226,7 +228,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
          }
       }
 
-      u_upload_unmap(st->uploader);
+      u_upload_unmap(pipe->stream_uploader);
 
 #undef SET_ATTRIB
    }
@@ -260,10 +262,10 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
 
    /* viewport state: viewport matching window dims */
    {
-      const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
+      const struct gl_framebuffer *fb = 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 GLfloat width = (GLfloat)_mesa_geometric_width(fb);
+      const GLfloat height = (GLfloat)_mesa_geometric_height(fb);
       struct pipe_viewport_state vp;
       vp.scale[0] =  0.5f * width;
       vp.scale[1] = height * (invert ? -0.5f : 0.5f);
@@ -274,8 +276,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
       cso_set_viewport(cso, &vp);
    }
 
-   util_draw_vertex_buffer(pipe, cso, vbuffer,
-                          cso_get_aux_vertex_buffer_slot(cso),
+   util_draw_vertex_buffer(pipe, cso, vbuffer, 0,
                            offset,  /* offset */
                            PIPE_PRIM_TRIANGLE_FAN,
                            4,  /* verts */