[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mesa: Changes to 'debian-experimental'



 VERSION                                                       |    2 
 bin/.cherry-ignore                                            |    3 
 configure.ac                                                  |   28 
 debian/changelog                                              |    5 
 docs/relnotes/10.2.html                                       |   19 
 src/egl/wayland/wayland-drm/wayland-drm.xml                   |   35 
 src/gallium/auxiliary/draw/draw_context.c                     |    2 
 src/gallium/auxiliary/draw/draw_gs.c                          |   10 
 src/gallium/auxiliary/draw/draw_private.h                     |    4 
 src/gallium/auxiliary/draw/draw_vs.c                          |    4 
 src/gallium/auxiliary/draw/draw_vs_exec.c                     |    4 
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c            |    3 
 src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp    |    3 
 src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp |    4 
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp      |    3 
 src/gallium/drivers/nouveau/nv50/nv50_context.h               |   10 
 src/gallium/drivers/nouveau/nv50/nv50_query.c                 |    6 
 src/gallium/drivers/nouveau/nv50/nv50_screen.c                |    2 
 src/gallium/drivers/nouveau/nv50/nv50_surface.c               |   21 
 src/gallium/drivers/nouveau/nv50/nv50_tex.c                   |    2 
 src/gallium/drivers/nouveau/nvc0/nvc0_query.c                 |    5 
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c                |    2 
 src/gallium/drivers/nouveau/nvc0/nvc0_surface.c               |   11 
 src/gallium/drivers/r600/r600_pipe.h                          |    9 
 src/gallium/drivers/radeon/r600_pipe_common.h                 |    9 
 src/gallium/drivers/radeonsi/si_descriptors.c                 |    4 
 src/gallium/drivers/radeonsi/si_pipe.c                        |    4 
 src/gallium/drivers/radeonsi/si_pipe.h                        |    4 
 src/gallium/drivers/radeonsi/si_state.c                       |   17 
 src/gallium/include/pipe/p_state.h                            |    3 
 src/gallium/state_trackers/clover/core/device.cpp             |    5 
 src/gallium/state_trackers/xa/xa_context.c                    |    2 
 src/glsl/builtin_functions.cpp                                |    8 
 src/glsl/glsl_parser.yy                                       |   11 
 src/glsl/link_varyings.cpp                                    |    8 
 src/glsl/tests/varyings_test.cpp                              |   11 
 src/glx/tests/query_renderer_implementation_unittest.cpp      |    6 
 src/mesa/drivers/common/meta.c                                |  293 +++--
 src/mesa/drivers/common/meta.h                                |   38 
 src/mesa/drivers/common/meta_blit.c                           |  179 +--
 src/mesa/drivers/common/meta_generate_mipmap.c                |    2 
 src/mesa/drivers/dri/i965/Makefile.sources                    |    2 
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp                  |  124 --
 src/mesa/drivers/dri/i965/brw_context.h                       |   14 
 src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c             |  524 ++++++++++
 src/mesa/drivers/dri/i965/brw_meta_updownsample.c             |   35 
 src/mesa/drivers/dri/i965/brw_meta_util.c                     |  160 +++
 src/mesa/drivers/dri/i965/brw_meta_util.h                     |   46 
 src/mesa/drivers/dri/i965/brw_state.h                         |    6 
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c              |   24 
 src/mesa/drivers/dri/i965/gen7_misc_state.c                   |   15 
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c             |   17 
 src/mesa/drivers/dri/i965/gen8_depth_state.c                  |   17 
 src/mesa/drivers/dri/i965/gen8_generator.cpp                  |   14 
 src/mesa/drivers/dri/i965/gen8_surface_state.c                |   87 +
 src/mesa/drivers/dri/i965/intel_buffers.c                     |    2 
 src/mesa/drivers/dri/i965/intel_extensions.c                  |    5 
 src/mesa/drivers/dri/i965/intel_fbo.c                         |    9 
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c                 |    9 
 src/mesa/drivers/dri/i965/intel_tex_image.c                   |    1 
 src/mesa/main/context.c                                       |    4 
 src/mesa/main/fbobject.c                                      |    2 
 src/mesa/state_tracker/st_cb_blit.c                           |    1 
 src/mesa/state_tracker/st_cb_readpixels.c                     |    1 
 src/mesa/state_tracker/st_cb_texture.c                        |    2 
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp                    |   11 
 66 files changed, 1434 insertions(+), 499 deletions(-)

New commits:
commit d980884d00a9bdf576f431a0c560a52a60efb3a6
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue May 20 15:35:34 2014 +0200

    bump changelog

diff --git a/debian/changelog b/debian/changelog
index c6386af..4006dc7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mesa (10.2.0~rc1-2) UNRELEASED; urgency=medium
+mesa (10.2.0~rc3-1) UNRELEASED; urgency=medium
 
   [ Fabio Pedretti ]
   * debian/rules: remove unused --with-llvm-shared-libs configure option
@@ -10,6 +10,9 @@ mesa (10.2.0~rc1-2) UNRELEASED; urgency=medium
   * Remove Cyril Brulebois from Uploaders.
   * debian/rules: explicitly disable omx.
 
+  [ Maarten Lankhorst ]
+  * New upstream release.
+
  -- Julien Cristau <jcristau@debian.org>  Thu, 15 May 2014 17:19:49 +0200
 
 mesa (10.2.0~rc1-1) experimental; urgency=medium

commit d0aa3947411fa48cf03de2ded53d8538998df653
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Fri May 16 23:48:44 2014 -0700

    Bump version to 10.2-rc3
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/VERSION b/VERSION
index 827ea06..24ee34e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.2.0-rc2
+10.2.0-rc3

commit 4baf6f12a528a2baa37b065f8e980d362d14d0cc
Author: Brian Paul <brianp@vmware.com>
Date:   Thu May 15 15:49:14 2014 -0600

    mesa: fix double-freeing of dispatch tables inside glBegin/End.
    
    We allocate dispatch tables for BeginEnd and OutsideBeginEnd.  But
    when we destroy the context we were freeing the BeginEnd and Exec
    tables.  If Exec==BeginEnd we did a double-free.  This would happen
    if the context was destroyed while inside a glBegin/End pair.  Now
    free the BeginEnd and OutsideBeginEnd pointers.
    
    Cc: "10.1", "10.2" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
    (cherry picked from commit ef6b6658f91bd5871739bdb71a08042f26abe389)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 860ae86..8eb426d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1141,7 +1141,7 @@ _mesa_initialize_context(struct gl_context *ctx,
 fail:
    _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
    free(ctx->BeginEnd);
-   free(ctx->Exec);
+   free(ctx->OutsideBeginEnd);
    free(ctx->Save);
    return GL_FALSE;
 }
@@ -1242,7 +1242,7 @@ _mesa_free_context_data( struct gl_context *ctx )
 
    /* free dispatch tables */
    free(ctx->BeginEnd);
-   free(ctx->Exec);
+   free(ctx->OutsideBeginEnd);
    free(ctx->Save);
 
    /* Shared context state (display lists, textures, etc) */

commit 21792665c7923ca9e3c879727bbc7cfef4ca2582
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu May 15 12:23:16 2014 +0900

    glsl_to_tgsi: Make sure the 'shader' member is always initialized
    
    Fixes the valgrind report below and random crashes with piglit on radeonsi.
    
    ==30005== Conditional jump or move depends on uninitialised value(s)
    ==30005==    at 0xB13584E: st_translate_program (st_glsl_to_tgsi.cpp:5100)
    ==30005==    by 0xB14698B: st_translate_fragment_program (st_program.c:747)
    ==30005==    by 0xB14777D: st_get_fp_variant (st_program.c:824)
    ==30005==    by 0xB11219C: get_color_fp_variant (st_cb_drawpixels.c:1042)
    ==30005==    by 0xB1131AE: st_DrawPixels (st_cb_drawpixels.c:1154)
    ==30005==    by 0xAFF8806: _mesa_DrawPixels (drawpix.c:162)
    ==30005==    by 0x4EB86DB: stub_glDrawPixels (generated_dispatch.c:6640)
    ==30005==    by 0x4F1DF08: piglit_visualize_image (piglit-util-gl.c:1574)
    ==30005==    by 0x40691D: draw_image_to_window_system_fb(int, bool) (draw-buffers-common.cpp:733)
    ==30005==    by 0x406C8B: draw_reference_image(bool, bool) (draw-buffers-common.cpp:854)
    ==30005==    by 0x40722A: piglit_display (alpha-to-coverage-dual-src-blend.cpp:117)
    ==30005==    by 0x4EA7168: run_test (piglit_fbo_framework.c:52)
    
    Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
    
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Roland Scheidegger <sroland@vmware.com>
    (cherry picked from commit 2bab95973d8ad3a84f62670143d6f26c230d9582)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 036b51b..adc9312 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3095,6 +3095,7 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
    ctx = NULL;
    prog = NULL;
    shader_program = NULL;
+   shader = NULL;
    options = NULL;
 }
 
@@ -3966,6 +3967,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
    v->ctx = original->ctx;
    v->prog = prog;
    v->shader_program = NULL;
+   v->shader = NULL;
    v->glsl_version = original->glsl_version;
    v->native_integers = original->native_integers;
    v->options = original->options;
@@ -4096,6 +4098,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
    v->ctx = original->ctx;
    v->prog = prog;
    v->shader_program = NULL;
+   v->shader = NULL;
    v->glsl_version = original->glsl_version;
    v->native_integers = original->native_integers;
    v->options = original->options;

commit 872ea423ac4b62479375395ff0ebf6c7f24b713a
Author: Topi Pohjolainen <topi.pohjolainen@intel.com>
Date:   Mon May 12 12:42:28 2014 +0300

    i965/fb: Use meta path for stencil up/downsampling
    
    Cc: "10.2" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    (cherry picked from commit d45fadf11a8dbd9cdf0a1548a38127462b4ceee0)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index b23fddf..88bd8f0 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1655,7 +1655,7 @@ intel_miptree_updownsample(struct brw_context *brw,
                            struct intel_mipmap_tree *src,
                            struct intel_mipmap_tree *dst)
 {
-   if (brw->gen < 8 || src->format == MESA_FORMAT_S_UINT8) {
+   if (brw->gen < 8) {
       brw_blorp_blit_miptrees(brw,
                               src, 0 /* level */, 0 /* layer */,
                               dst, 0 /* level */, 0 /* layer */,
@@ -1664,11 +1664,18 @@ intel_miptree_updownsample(struct brw_context *brw,
                               0, 0,
                               dst->logical_width0, dst->logical_height0,
                               GL_NEAREST, false, false /*mirror x, y*/);
+   } else if (src->format == MESA_FORMAT_S_UINT8) {
+      brw_meta_stencil_updownsample(brw, src, dst);
    } else {
       brw_meta_updownsample(brw, src, dst);
    }
 
    if (src->stencil_mt) {
+      if (brw->gen >= 8) {
+         brw_meta_stencil_updownsample(brw, src->stencil_mt, dst);
+         return;
+      }
+
       brw_blorp_blit_miptrees(brw,
                               src->stencil_mt, 0 /* level */, 0 /* layer */,
                               dst->stencil_mt, 0 /* level */, 0 /* layer */,

commit ad8ad99eff71014af60cc434f7d7ac102e3cf4d5
Author: Topi Pohjolainen <topi.pohjolainen@intel.com>
Date:   Mon May 12 12:35:40 2014 +0300

    i965/meta: Stencil blit for miptree updownsampling
    
    Cc: "10.2" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit 475216a4f082b7db9651238e1bd31f6d52c7c475)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index d6b7f16..a9adbf2 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1488,6 +1488,10 @@ void brw_meta_fbo_stencil_blit(struct brw_context *brw,
                                GLfloat srcX1, GLfloat srcY1,
                                GLfloat dstX0, GLfloat dstY0,
                                GLfloat dstX1, GLfloat dstY1);
+
+void brw_meta_stencil_updownsample(struct brw_context *brw,
+                                   struct intel_mipmap_tree *src,
+                                   struct intel_mipmap_tree *dst);
 /*======================================================================
  * brw_misc_state.c
  */
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
index b47f49d..e369001 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -488,3 +488,37 @@ brw_meta_fbo_stencil_blit(struct brw_context *brw,
                          dst_mt, dst_irb->mt_level, dst_irb->mt_layer, &dims);
    intel_batchbuffer_emit_mi_flush(brw);
 }
+
+void
+brw_meta_stencil_updownsample(struct brw_context *brw,
+                              struct intel_mipmap_tree *src,
+                              struct intel_mipmap_tree *dst)
+{
+   struct gl_context *ctx = &brw->ctx;
+   struct blit_dims dims = {
+      .src_x0 = 0, .src_y0 = 0,
+      .src_x1 = src->logical_width0, .src_y1 = src->logical_height0,
+      .dst_x0 = 0, .dst_y0 = 0,
+      .dst_x1 = dst->logical_width0, .dst_y1 = dst->logical_height0,
+      .mirror_x = 0, .mirror_y = 0 };
+   GLuint fbo, rbo;
+
+   if (dst->stencil_mt)
+      dst = dst->stencil_mt;
+
+   intel_batchbuffer_emit_mi_flush(brw);
+   _mesa_meta_begin(ctx, MESA_META_ALL);
+
+   _mesa_GenFramebuffers(1, &fbo);
+   rbo = brw_get_rb_for_slice(brw, src, 0, 0, false);
+
+   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
+   _mesa_FramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+                                 GL_RENDERBUFFER, rbo);
+
+   brw_meta_stencil_blit(brw, dst, 0, 0, &dims);
+   intel_batchbuffer_emit_mi_flush(brw);
+
+   _mesa_DeleteRenderbuffers(1, &rbo);
+   _mesa_DeleteFramebuffers(1, &fbo);
+}

commit 62f15090702b4946a026149f31b6f7237f3d2519
Author: Topi Pohjolainen <topi.pohjolainen@intel.com>
Date:   Sat Apr 19 17:11:10 2014 +0300

    i965/fb: Use meta path for stencil blits
    
    This is effective only on gen8 for now as previous generations still
    go through blorp.
    
    Cc: "10.2" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit b18f6b9b86531581da567eaa400923e35e22006d)

diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index e820a14..8cff998 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -879,6 +879,15 @@ intel_blit_framebuffer(struct gl_context *ctx,
    if (mask == 0x0)
       return;
 
+   if (mask & GL_STENCIL_BUFFER_BIT) {
+      brw_meta_fbo_stencil_blit(brw_context(ctx),
+                                srcX0, srcY0, srcX1, srcY1,
+                                dstX0, dstY0, dstX1, dstY1);
+      mask &= ~GL_STENCIL_BUFFER_BIT;
+      if (mask == 0x0)
+         return;
+   }
+
    /* Try using the BLT engine. */
    mask = intel_blit_framebuffer_with_blitter(ctx,
                                               srcX0, srcY0, srcX1, srcY1,

commit eb2ef1641c80b8a499b64bbdebb34b3e3a8e54b9
Author: Topi Pohjolainen <topi.pohjolainen@intel.com>
Date:   Mon May 5 22:18:46 2014 +0300

    i965/meta: Stencil blits
    
    v2: Create the intel renderbuffer with level hardcoded to zero instead
        of overriding it in the surface state configuration. Also moved the
        dimension adjustments for tiling, mip level, msaa into the render
        buffer creation. Finally prepares for another blit path needed for
        miptree updownsampling.
    v3 (Ken): Dropped unnecessary memory context for "ralloc_asprintf()"
    
    Cc: "10.2" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    (cherry picked from commit d1829badf5caae794393de77cfe34eda44c1fcc9)

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index 9379fd2..5fc90b5 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -76,6 +76,7 @@ i965_FILES = \
 	brw_lower_texture_gradients.cpp \
 	brw_lower_unnormalized_offset.cpp \
 	brw_meta_updownsample.c \
+	brw_meta_stencil_blit.c \
 	brw_meta_util.c \
 	brw_misc_state.c \
 	brw_object_purgeable.c \
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 6d4a5b5..d6b7f16 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1482,6 +1482,12 @@ GLuint brw_get_rb_for_slice(struct brw_context *brw,
 void brw_meta_updownsample(struct brw_context *brw,
                            struct intel_mipmap_tree *src,
                            struct intel_mipmap_tree *dst);
+
+void brw_meta_fbo_stencil_blit(struct brw_context *brw,
+                               GLfloat srcX0, GLfloat srcY0,
+                               GLfloat srcX1, GLfloat srcY1,
+                               GLfloat dstX0, GLfloat dstY0,
+                               GLfloat dstX1, GLfloat dstY1);
 /*======================================================================
  * brw_misc_state.c
  */
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
new file mode 100644
index 0000000..b47f49d
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -0,0 +1,490 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * @file brw_meta_stencil_blit.c
+ *
+ * Implements upsampling, downsampling and scaling of stencil miptrees. The
+ * logic can be originally found in brw_blorp_blit.c.
+ * Implementation creates a temporary draw framebuffer object and attaches the
+ * destination stencil buffer attachment as color attachment. Source attachment
+ * is in turn treated as a stencil texture and the glsl program used for the
+ * blitting samples it using stencil-indexing.
+ *
+ * Unfortunately as the data port does not support interleaved msaa-surfaces
+ * (stencil is always IMS), the glsl program needs to handle the writing of
+ * individual samples manually. Surface is configured as if it were single
+ * sampled (with adjusted dimensions) and the glsl program extracts the
+ * sample indices from the input coordinates for correct texturing.
+ *
+ * Target surface is also configured as Y-tiled instead of W-tiled in order
+ * to support generations 6-7. Later hardware supports W-tiled as render target
+ * and the logic here could be simplified for those.
+ */
+
+#include "brw_context.h"
+#include "intel_batchbuffer.h"
+#include "intel_fbo.h"
+
+#include "main/blit.h"
+#include "main/buffers.h"
+#include "main/fbobject.h"
+#include "main/uniforms.h"
+#include "main/texparam.h"
+#include "main/texobj.h"
+#include "main/viewport.h"
+#include "main/enable.h"
+#include "main/blend.h"
+#include "main/varray.h"
+#include "main/shaderapi.h"
+#include "glsl/ralloc.h"
+
+#include "drivers/common/meta.h"
+#include "brw_meta_util.h"
+
+#define FILE_DEBUG_FLAG DEBUG_FBO
+
+struct blit_dims {
+   int src_x0, src_y0, src_x1, src_y1;
+   int dst_x0, dst_y0, dst_x1, dst_y1;
+   bool mirror_x, mirror_y;
+};
+
+static const char *vs_source =
+   "#version 130\n"
+   "in vec2 position;\n"
+   "out vec2 tex_coords;\n"
+   "void main()\n"
+   "{\n"
+   "   tex_coords = (position + 1.0) / 2.0;\n"
+   "   gl_Position = vec4(position, 0.0, 1.0);\n"
+   "}\n";
+
+static const struct sampler_and_fetch {
+  const char *sampler;
+  const char *fetch;
+} samplers[] = {
+   { "uniform usampler2D texSampler;\n",
+     "   out_color = texelFetch(texSampler, txl_coords, 0)" },
+   { "#extension GL_ARB_texture_multisample : enable\n"
+     "uniform usampler2DMS texSampler;\n",
+     "   out_color = texelFetch(texSampler, txl_coords, sample_index)" }
+};
+
+/**
+ * Translating Y-tiled to W-tiled:
+ *
+ *  X' = (X & ~0b1011) >> 1 | (Y & 0b1) << 2 | X & 0b1
+ *  Y' = (Y & ~0b1) << 1 | (X & 0b1000) >> 2 | (X & 0b10) >> 1
+ */
+static const char *fs_tmpl =
+   "#version 130\n"
+   "%s"
+   "uniform float src_x_scale;\n"
+   "uniform float src_y_scale;\n"
+   "uniform float src_x_off;\n" /* Top right coordinates of the source */
+   "uniform float src_y_off;\n" /* rectangle in W-tiled space. */
+   "uniform float dst_x_off;\n" /* Top right coordinates of the target */
+   "uniform float dst_y_off;\n" /* rectangle in Y-tiled space. */
+   "uniform float draw_rect_w;\n" /* This is the unnormalized size of the */
+   "uniform float draw_rect_h;\n" /* drawing rectangle in Y-tiled space. */
+   "uniform int dst_x0;\n" /* This is the bounding rectangle in the W-tiled */
+   "uniform int dst_x1;\n" /* space that will be used to skip pixels lying */
+   "uniform int dst_y0;\n" /* outside. In some cases the Y-tiled rectangle */
+   "uniform int dst_y1;\n" /* is larger. */
+   "uniform int dst_num_samples;\n"
+   "in vec2 tex_coords;\n"
+   "ivec2 txl_coords;\n"
+   "int sample_index;\n"
+   "out uvec4 out_color;\n"
+   "\n"
+   "void get_unorm_target_coords()\n"
+   "{\n"
+   "   txl_coords.x = int(tex_coords.x * draw_rect_w + dst_x_off);\n"
+   "   txl_coords.y = int(tex_coords.y * draw_rect_h + dst_y_off);\n"
+   "}\n"
+   "\n"
+   "void translate_dst_to_src()\n"
+   "{\n"
+   "   txl_coords.x = int(float(txl_coords.x) * src_x_scale + src_x_off);\n"
+   "   txl_coords.y = int(float(txl_coords.y) * src_y_scale + src_y_off);\n"
+   "}\n"
+   "\n"
+   "void translate_y_to_w_tiling()\n"
+   "{\n"
+   "   int X = txl_coords.x;\n"
+   "   int Y = txl_coords.y;\n"
+   "   txl_coords.x = (X & int(0xfff4)) >> 1;\n"
+   "   txl_coords.x |= ((Y & int(0x1)) << 2);\n"
+   "   txl_coords.x |= (X & int(0x1));\n"
+   "   txl_coords.y = (Y & int(0xfffe)) << 1;\n"
+   "   txl_coords.y |= ((X & int(0x8)) >> 2);\n"
+   "   txl_coords.y |= ((X & int(0x2)) >> 1);\n"
+   "}\n"
+   "\n"
+   "void decode_msaa()\n"
+   "{\n"
+   "   int X = txl_coords.x;\n"
+   "   int Y = txl_coords.y;\n"
+   "   switch (dst_num_samples) {\n"
+   "   case 0:\n"
+   "      sample_index = 0;\n"
+   "      break;\n"
+   "   case 2:\n"
+   "      txl_coords.x = ((X & int(0xfffc)) >> 1) | (X & int(0x1));\n"
+   "      sample_index = (X & 0x2) >> 1;\n"
+   "      break;\n"
+   "   case 4:\n"
+   "      txl_coords.x = ((X & int(0xfffc)) >> 1) | (X & int(0x1));\n"
+   "      txl_coords.y = ((Y & int(0xfffc)) >> 1) | (Y & int(0x1));\n"
+   "      sample_index = (Y & 0x2) | ((X & 0x2) >> 1);\n"
+   "      break;\n"
+   "   case 8:\n"
+   "      txl_coords.x = ((X & int(0xfff8)) >> 2) | (X & int(0x1));\n"
+   "      txl_coords.y = ((Y & int(0xfffc)) >> 1) | (Y & int(0x1));\n"
+   "      sample_index = (X & 0x4) | (Y & 0x2) | ((X & 0x2) >> 1);\n"
+   "   }\n"
+   "}\n"
+   "\n"
+   "void discard_outside_bounding_rect()\n"
+   "{\n"
+   "   int X = txl_coords.x;\n"
+   "   int Y = txl_coords.y;\n"
+   "   if (X >= dst_x1 || X < dst_x0 || Y >= dst_y1 || Y < dst_y0)\n"
+   "      discard;\n"
+   "}\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "   get_unorm_target_coords();\n"
+   "   translate_y_to_w_tiling();\n"
+   "   decode_msaa();"
+   "   discard_outside_bounding_rect();\n"
+   "   translate_dst_to_src();\n"
+   "   %s;\n"
+   "}\n";
+
+/**
+ * Setup uniforms telling the coordinates of the destination rectangle in the
+ * native w-tiled space. These are needed to ignore pixels that lie outside.
+ * The destination is drawn as Y-tiled and in some cases the Y-tiled drawing
+ * rectangle is larger than the original (for example 1x4 w-tiled requires
+ * 16x2 y-tiled).
+ */
+static void
+setup_bounding_rect(GLuint prog, const struct blit_dims *dims)
+{
+   _mesa_Uniform1i(_mesa_GetUniformLocation(prog, "dst_x0"), dims->dst_x0);
+   _mesa_Uniform1i(_mesa_GetUniformLocation(prog, "dst_x1"), dims->dst_x1);
+   _mesa_Uniform1i(_mesa_GetUniformLocation(prog, "dst_y0"), dims->dst_y0);
+   _mesa_Uniform1i(_mesa_GetUniformLocation(prog, "dst_y1"), dims->dst_y1);
+}
+
+/**
+ * Setup uniforms telling the destination width, height and the offset. These
+ * are needed to unnoormalize the input coordinates and to correctly translate
+ * between destination and source that may have differing offsets.
+ */
+static void
+setup_drawing_rect(GLuint prog, const struct blit_dims *dims)
+{
+   _mesa_Uniform1f(_mesa_GetUniformLocation(prog, "draw_rect_w"),
+                   dims->dst_x1 - dims->dst_x0);
+   _mesa_Uniform1f(_mesa_GetUniformLocation(prog, "draw_rect_h"),
+                   dims->dst_y1 - dims->dst_y0);
+   _mesa_Uniform1f(_mesa_GetUniformLocation(prog, "dst_x_off"), dims->dst_x0);
+   _mesa_Uniform1f(_mesa_GetUniformLocation(prog, "dst_y_off"), dims->dst_y0);
+}
+
+/**
+ * When not mirroring a coordinate (say, X), we need:
+ *   src_x - src_x0 = (dst_x - dst_x0 + 0.5) * scale
+ * Therefore:
+ *   src_x = src_x0 + (dst_x - dst_x0 + 0.5) * scale
+ *
+ * The program uses "round toward zero" to convert the transformed floating
+ * point coordinates to integer coordinates, whereas the behaviour we actually
+ * want is "round to nearest", so 0.5 provides the necessary correction.
+ *
+ * When mirroring X we need:
+ *   src_x - src_x0 = dst_x1 - dst_x - 0.5
+ * Therefore:
+ *   src_x = src_x0 + (dst_x1 -dst_x - 0.5) * scale
+ */
+static void
+setup_coord_coeff(GLuint prog, GLuint multiplier, GLuint offset,
+                  int src_0, int src_1, int dst_0, int dst_1, bool mirror)
+{
+   const float scale = ((float)(src_1 - src_0)) / (dst_1 - dst_0);
+
+   if (mirror) {
+      _mesa_Uniform1f(multiplier, -scale);
+      _mesa_Uniform1f(offset, src_0 + (dst_1 - 0.5) * scale);
+   } else {
+      _mesa_Uniform1f(multiplier, scale);
+      _mesa_Uniform1f(offset, src_0 + (-dst_0 + 0.5) * scale);
+   }
+}
+
+/**
+ * Setup uniforms providing relation between source and destination surfaces.
+ * Destination coordinates are in Y-tiling layout while texelFetch() expects
+ * W-tiled coordinates. Once the destination coordinates are re-interpreted by
+ * the program into the original W-tiled layout, the program needs to know the
+ * offset and scaling factors between the destination and source.
+ * Note that these are calculated in the original W-tiled space before the
+ * destination rectangle is adjusted for possible msaa and Y-tiling.
+ */
+static void
+setup_coord_transform(GLuint prog, const struct blit_dims *dims)
+{
+   setup_coord_coeff(prog,
+                     _mesa_GetUniformLocation(prog, "src_x_scale"),
+                     _mesa_GetUniformLocation(prog, "src_x_off"),
+                     dims->src_x0, dims->src_x1, dims->dst_x0, dims->dst_x1,
+                     dims->mirror_x);
+
+   setup_coord_coeff(prog,
+                     _mesa_GetUniformLocation(prog, "src_y_scale"),
+                     _mesa_GetUniformLocation(prog, "src_y_off"),
+                     dims->src_y0, dims->src_y1, dims->dst_y0, dims->dst_y1,
+                     dims->mirror_y);
+}
+
+static GLuint
+setup_program(struct gl_context *ctx, bool msaa_tex)
+{
+   struct blit_state *blit = &ctx->Meta->Blit;
+   static GLuint prog_cache[] = { 0, 0 };
+   const char *fs_source;
+   const struct sampler_and_fetch *sampler = &samplers[msaa_tex];
+
+   _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
+
+   if (prog_cache[msaa_tex]) {
+      _mesa_UseProgram(prog_cache[msaa_tex]);
+      return prog_cache[msaa_tex];
+   }
+  
+   fs_source = ralloc_asprintf(NULL, fs_tmpl, sampler->sampler,
+                               sampler->fetch);
+   _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source,
+                                       "i965 stencil blit",
+                                       &prog_cache[msaa_tex]);
+   ralloc_free(fs_source);
+
+   return prog_cache[msaa_tex];
+}
+
+/**
+ * Samples in stencil buffer are interleaved, and unfortunately the data port 
+ * does not support it as render target. Therefore the surface is set up as
+ * single sampled and the program handles the interleaving.
+ * In case of single sampled stencil, the render buffer is adjusted with
+ * twice the base level height in order for the program to be able to write
+ * any mip-level. (Used to set the drawing rectangle for the hw).
+ */
+static void
+adjust_msaa(struct blit_dims *dims, int num_samples)
+{
+   if (num_samples == 2) {
+      dims->dst_x0 *= 2;
+      dims->dst_x1 *= 2;
+   } else if (num_samples) {
+      const int x_num_samples = num_samples / 2;
+      dims->dst_x0 = ROUND_DOWN_TO(dims->dst_x0 * x_num_samples, num_samples);
+      dims->dst_y0 = ROUND_DOWN_TO(dims->dst_y0 * 2, 4);
+      dims->dst_x1 = ALIGN(dims->dst_x1 * x_num_samples, num_samples);
+      dims->dst_y1 = ALIGN(dims->dst_y1 * 2, 4);
+   }
+}
+
+/**
+ * Stencil is mapped as Y-tiled render target and the dimensions need to be
+ * adjusted in order for the Y-tiled rectangle to cover the entire linear
+ * memory space of the original W-tiled rectangle.
+ */
+static void
+adjust_tiling(struct blit_dims *dims, int num_samples)
+{
+   const unsigned x_align = 8, y_align = num_samples > 2 ? 8 : 4;
+
+   dims->dst_x0 = ROUND_DOWN_TO(dims->dst_x0, x_align) * 2;
+   dims->dst_y0 = ROUND_DOWN_TO(dims->dst_y0, y_align) / 2;
+   dims->dst_x1 = ALIGN(dims->dst_x1, x_align) * 2;
+   dims->dst_y1 = ALIGN(dims->dst_y1, y_align) / 2;
+}
+
+/**
+ * When stencil is mapped as Y-tiled render target the mip-level offsets
+ * calculated for the Y-tiling do not always match the offsets in W-tiling.
+ * Therefore the sampling engine cannot be used for individual mip-level
+ * access but the program needs to do it internally. This can be achieved
+ * by shifting the coordinates of the blit rectangle here.
+ */
+static void
+adjust_mip_level(const struct intel_mipmap_tree *mt,
+                 unsigned level, unsigned layer, struct blit_dims *dims)
+{
+   unsigned x_offset;
+   unsigned y_offset;
+
+   intel_miptree_get_image_offset(mt, level, layer, &x_offset, &y_offset);
+
+   dims->dst_x0 += x_offset;
+   dims->dst_y0 += y_offset;
+   dims->dst_x1 += x_offset;
+   dims->dst_y1 += y_offset;
+}
+
+static void
+prepare_vertex_data(void)
+{
+   static const struct vertex verts[] = {
+      { .x = -1.0f, .y = -1.0f },
+      { .x =  1.0f, .y = -1.0f },
+      { .x =  1.0f, .y =  1.0f },
+      { .x = -1.0f, .y =  1.0f } };
+
+   _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+}
+
+static void
+set_read_rb_tex_image(struct gl_context *ctx, struct fb_tex_blit_state *blit,
+                      GLenum *target)
+{
+   const struct gl_renderbuffer_attachment *att =
+      &ctx->ReadBuffer->Attachment[BUFFER_STENCIL];
+   struct gl_renderbuffer *rb = att->Renderbuffer;
+   struct gl_texture_object *tex_obj;
+   unsigned level = 0;
+
+   /* If the renderbuffer is already backed by an tex image, use it. */
+   if (att->Texture) {
+      tex_obj = att->Texture;
+      *target = tex_obj->Target;
+      level = att->TextureLevel;
+   } else {
+      _mesa_meta_bind_rb_as_tex_image(ctx, rb, &blit->tempTex, &tex_obj,
+                                      target);
+   }
+
+   blit->baseLevelSave = tex_obj->BaseLevel;
+   blit->maxLevelSave = tex_obj->MaxLevel;
+   blit->sampler = _mesa_meta_setup_sampler(ctx, tex_obj, *target,
+                                            GL_NEAREST, level);
+}
+
+static void
+brw_meta_stencil_blit(struct brw_context *brw,
+                      struct intel_mipmap_tree *dst_mt,
+                      unsigned dst_level, unsigned dst_layer,
+                      const struct blit_dims *orig_dims)
+{
+   struct gl_context *ctx = &brw->ctx;
+   struct blit_dims dims = *orig_dims;
+   struct fb_tex_blit_state blit;
+   GLuint prog, fbo, rbo;
+   GLenum target;
+
+   _mesa_meta_fb_tex_blit_begin(ctx, &blit);
+
+   _mesa_GenFramebuffers(1, &fbo);
+   /* Force the surface to be configured for level zero. */
+   rbo = brw_get_rb_for_slice(brw, dst_mt, 0, dst_layer, true);
+   adjust_msaa(&dims, dst_mt->num_samples);
+   adjust_tiling(&dims, dst_mt->num_samples);
+
+   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
+   _mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+                                 GL_RENDERBUFFER, rbo);
+   _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
+   ctx->DrawBuffer->_Status = GL_FRAMEBUFFER_COMPLETE;
+
+   set_read_rb_tex_image(ctx, &blit, &target);
+
+   _mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
+                       GL_STENCIL_INDEX);
+
+   prog = setup_program(ctx, target != GL_TEXTURE_2D);
+   setup_bounding_rect(prog, orig_dims);
+   setup_drawing_rect(prog, &dims);
+   setup_coord_transform(prog, orig_dims);
+
+   _mesa_Uniform1i(_mesa_GetUniformLocation(prog, "dst_num_samples"),
+                   dst_mt->num_samples);
+
+   prepare_vertex_data();
+   _mesa_set_viewport(ctx, 0, dims.dst_x0, dims.dst_y0,
+                      dims.dst_x1 - dims.dst_x0, dims.dst_y1 - dims.dst_y0);
+   _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+   _mesa_set_enable(ctx, GL_DEPTH_TEST, false);
+
+   _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+   _mesa_meta_fb_tex_blit_end(ctx, target, &blit);
+   _mesa_meta_end(ctx);
+
+   _mesa_DeleteRenderbuffers(1, &rbo);
+   _mesa_DeleteFramebuffers(1, &fbo);
+}
+
+void
+brw_meta_fbo_stencil_blit(struct brw_context *brw,
+                          GLfloat src_x0, GLfloat src_y0,
+                          GLfloat src_x1, GLfloat src_y1,
+                          GLfloat dst_x0, GLfloat dst_y0,
+                          GLfloat dst_x1, GLfloat dst_y1)
+{
+   struct gl_context *ctx = &brw->ctx;
+   struct gl_renderbuffer *draw_fb =
+      ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
+   const struct intel_renderbuffer *dst_irb = intel_renderbuffer(draw_fb);
+   struct intel_mipmap_tree *dst_mt = dst_irb->mt;
+
+   if (!dst_mt)
+      return;
+
+   if (dst_mt->stencil_mt)
+      dst_mt = dst_mt->stencil_mt;
+
+   bool mirror_x, mirror_y;
+   if (brw_meta_mirror_clip_and_scissor(ctx,
+                                        &src_x0, &src_y0, &src_x1, &src_y1,
+                                        &dst_x0, &dst_y0, &dst_x1, &dst_y1,
+                                        &mirror_x, &mirror_y))
+      return;
+
+   struct blit_dims dims = { .src_x0 = src_x0, .src_y0 = src_y0,
+                             .src_x1 = src_x1, .src_y1 = src_y1,
+                             .dst_x0 = dst_x0, .dst_y0 = dst_y0,
+                             .dst_x1 = dst_x1, .dst_y1 = dst_y1,
+                             .mirror_x = mirror_x, .mirror_y = mirror_y };
+   adjust_mip_level(dst_mt, dst_irb->mt_level, dst_irb->mt_layer, &dims);
+
+   intel_batchbuffer_emit_mi_flush(brw);
+   _mesa_meta_begin(ctx, MESA_META_ALL);
+   brw_meta_stencil_blit(brw,
+                         dst_mt, dst_irb->mt_level, dst_irb->mt_layer, &dims);
+   intel_batchbuffer_emit_mi_flush(brw);
+}

commit 947b60d19e9fd408ae644dd969d2e11db54d39b8
Author: Topi Pohjolainen <topi.pohjolainen@intel.com>
Date:   Wed May 7 08:42:29 2014 +0300

    meta: Refactor state save/restore for framebuffer texture blits
    
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 2a549c43a8c585b312fda920fcd7048e52fdcb05)
    
    Note: This patch was cherry picked so that the next patch would build.

diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index cc76214..2186a39 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -267,6 +267,13 @@ struct blit_state
    bool no_ctsi_fallback;
 };
 
+struct fb_tex_blit_state
+{
+   GLint baseLevelSave, maxLevelSave;
+   GLuint sampler, samplerSave;
+   GLuint tempTex;
+};
+
 
 /**
  * State for glClear()
@@ -395,6 +402,14 @@ _mesa_meta_end(struct gl_context *ctx);
 extern GLboolean
 _mesa_meta_in_progress(struct gl_context *ctx);
 
+extern void
+_mesa_meta_fb_tex_blit_begin(const struct gl_context *ctx,
+                             struct fb_tex_blit_state *blit);
+
+extern void
+_mesa_meta_fb_tex_blit_end(const struct gl_context *ctx, GLenum target,
+                           struct fb_tex_blit_state *blit);
+
 extern GLboolean
 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
                                 struct gl_renderbuffer *rb,
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 1cb3d67..e5a0a9a 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -356,19 +356,14 @@ blitframebuffer_texture(struct gl_context *ctx,
    const struct gl_renderbuffer_attachment *readAtt =
       &readFb->Attachment[att_index];
    struct blit_state *blit = &ctx->Meta->Blit;
+   struct fb_tex_blit_state fb_tex_blit;
    const GLint dstX = MIN2(dstX0, dstX1);
    const GLint dstY = MIN2(dstY0, dstY1);
    const GLint dstW = abs(dstX1 - dstX0);
    const GLint dstH = abs(dstY1 - dstY0);
    struct gl_texture_object *texObj;
    GLuint srcLevel;
-   GLint baseLevelSave;
-   GLint maxLevelSave;
    GLenum target;
-   GLuint sampler, samplerSave =
-      ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
-      ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
-   GLuint tempTex = 0;
    struct gl_renderbuffer *rb = readAtt->Renderbuffer;
    struct temp_texture *meta_temp_texture;
 
@@ -380,6 +375,8 @@ blitframebuffer_texture(struct gl_context *ctx,
       filter = GL_LINEAR;
    }
 
+   _mesa_meta_fb_tex_blit_begin(ctx, &fb_tex_blit);
+
    if (readAtt->Texture &&
        (readAtt->Texture->Target == GL_TEXTURE_2D ||
         readAtt->Texture->Target == GL_TEXTURE_RECTANGLE ||
@@ -392,8 +389,8 @@ blitframebuffer_texture(struct gl_context *ctx,
       texObj = readAtt->Texture;
       target = texObj->Target;
    } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) {
-      if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb,
-                                           &tempTex, &texObj, &target))
+      if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, &fb_tex_blit.tempTex,
+                                           &texObj, &target))
          return false;
 
       srcLevel = 0;
@@ -442,8 +439,8 @@ blitframebuffer_texture(struct gl_context *ctx,
       srcY1 = srcH;
    }
 
-   baseLevelSave = texObj->BaseLevel;
-   maxLevelSave = texObj->MaxLevel;
+   fb_tex_blit.baseLevelSave = texObj->BaseLevel;
+   fb_tex_blit.maxLevelSave = texObj->MaxLevel;
 
    if (glsl_version) {


Reply to: