[Mesa-dev] [PATCH 08/14] i965/blorp: Add support for setting samplers for glsl-based blits

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Apr 23 11:18:22 PDT 2015


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp.h    |  2 ++
 src/mesa/drivers/dri/i965/gen6_blorp.cpp | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index c0f416a..12b4133 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -457,6 +457,8 @@ public:
    virtual void gen6_emit_surface_states(struct brw_context *brw);
    virtual void gen7_emit_surface_states(struct brw_context *brw);
 
+   virtual void gen6_emit_sampler_state(struct brw_context *brw) const;
+
 private:
    const float src_x0, src_y0, src_x1, src_y1;
    const struct gl_framebuffer * const read_fb;
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index c0e3a06..f45dcd4 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -1301,6 +1301,36 @@ brw_meta_blit_params::gen6_emit_surface_states(struct brw_context *brw)
                             &wm_stage_state);
 }
 
+void
+brw_meta_blit_params::gen6_emit_sampler_state(struct brw_context *brw) const
+{
+   const float min_lod = -1000.0f;
+   const float max_lod = 1000.0f;
+   const float lod_bias = 0.0f;
+   const float max_anisotropy = 1.0f;
+   const struct gl_sampler_object sampler = 
+      { 0, 0, 0, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE,
+        filter, filter, { 0.0, 0.0, 0.0, 0.0 }, min_lod, max_lod, lod_bias,
+        max_anisotropy, GL_NONE, GL_LEQUAL, GL_DECODE_EXT, GL_FALSE };
+
+   uint32_t sampler_offset;
+   uint32_t *sampler_state = (uint32_t *)
+      brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE, 16, 32, &sampler_offset);
+
+   const struct gl_renderbuffer *irb = read_fb->_ColorReadBuffer;
+   const bool tex_cube_map_seamless = false;
+   const float tex_unit_lod_bias = 0.0f;
+   const bool is_integer_format = false;
+   brw_update_sampler_state(brw,
+                            target, tex_cube_map_seamless,
+                            tex_unit_lod_bias,
+                            irb->Format, irb->_BaseFormat,
+                            is_integer_format,
+                            &sampler,
+                            sampler_state, sampler_offset);
+   gen6_blorp_emit_sampler_state_pointers(brw, sampler_offset);
+}
+
 /**
  * \brief Execute a blit or render pass operation.
  *
-- 
1.9.3



More information about the mesa-dev mailing list