[Mesa-dev] [PATCH 07/12] i965/blorp: Expand clear class hierarchy to prepare for RT resolves.
Paul Berry
stereotype441 at gmail.com
Tue May 21 16:52:11 PDT 2013
The fragment shaders that to do color clears will be re-used to
perform so-called "render target resolves" (the resolves associated
with fast color clears). To prepare for that, this patch expands the
class hierarchy for blorp params by adding
brw_blorp_const_color_params (which will be used for all blorp
operations where the fragment shader outputs a constant color).
Some other data structures and functions were also renamed to use
"const_color" nomenclature where appropriate.
---
src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 58 ++++++++++++++++-----------
src/mesa/drivers/dri/i965/brw_context.h | 2 +-
2 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 675289b..4ced318 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -37,13 +37,28 @@ extern "C" {
#include "brw_eu.h"
#include "brw_state.h"
-struct brw_blorp_clear_prog_key
+struct brw_blorp_const_color_prog_key
{
bool use_simd16_replicated_data;
bool pad[3];
};
-class brw_blorp_clear_params : public brw_blorp_params
+/**
+ * Parameters for a blorp operation where the fragment shader outputs a
+ * constant color. This is used for both fast color clears and color
+ * resolves.
+ */
+class brw_blorp_const_color_params : public brw_blorp_params
+{
+public:
+ virtual uint32_t get_wm_prog(struct brw_context *brw,
+ brw_blorp_prog_data **prog_data) const;
+
+protected:
+ brw_blorp_const_color_prog_key wm_prog_key;
+};
+
+class brw_blorp_clear_params : public brw_blorp_const_color_params
{
public:
brw_blorp_clear_params(struct brw_context *brw,
@@ -51,20 +66,14 @@ public:
struct gl_renderbuffer *rb,
GLubyte *color_mask,
bool partial_clear);
-
- virtual uint32_t get_wm_prog(struct brw_context *brw,
- brw_blorp_prog_data **prog_data) const;
-
-private:
- brw_blorp_clear_prog_key wm_prog_key;
};
-class brw_blorp_clear_program
+class brw_blorp_const_color_program
{
public:
- brw_blorp_clear_program(struct brw_context *brw,
- const brw_blorp_clear_prog_key *key);
- ~brw_blorp_clear_program();
+ brw_blorp_const_color_program(struct brw_context *brw,
+ const brw_blorp_const_color_prog_key *key);
+ ~brw_blorp_const_color_program();
const GLuint *compile(struct brw_context *brw, GLuint *program_size);
@@ -75,7 +84,7 @@ private:
void *mem_ctx;
struct brw_context *brw;
- const brw_blorp_clear_prog_key *key;
+ const brw_blorp_const_color_prog_key *key;
struct brw_compile func;
/* Thread dispatch header */
@@ -91,9 +100,9 @@ private:
GLuint base_mrf;
};
-brw_blorp_clear_program::brw_blorp_clear_program(
+brw_blorp_const_color_program::brw_blorp_const_color_program(
struct brw_context *brw,
- const brw_blorp_clear_prog_key *key)
+ const brw_blorp_const_color_prog_key *key)
: mem_ctx(ralloc_context(NULL)),
brw(brw),
key(key)
@@ -101,7 +110,7 @@ brw_blorp_clear_program::brw_blorp_clear_program(
brw_init_compile(brw, &func, mem_ctx);
}
-brw_blorp_clear_program::~brw_blorp_clear_program()
+brw_blorp_const_color_program::~brw_blorp_const_color_program()
{
ralloc_free(mem_ctx);
}
@@ -256,17 +265,18 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
}
uint32_t
-brw_blorp_clear_params::get_wm_prog(struct brw_context *brw,
- brw_blorp_prog_data **prog_data) const
+brw_blorp_const_color_params::get_wm_prog(struct brw_context *brw,
+ brw_blorp_prog_data **prog_data)
+ const
{
uint32_t prog_offset;
- if (!brw_search_cache(&brw->cache, BRW_BLORP_CLEAR_PROG,
+ if (!brw_search_cache(&brw->cache, BRW_BLORP_CONST_COLOR_PROG,
&this->wm_prog_key, sizeof(this->wm_prog_key),
&prog_offset, prog_data)) {
- brw_blorp_clear_program prog(brw, &this->wm_prog_key);
+ brw_blorp_const_color_program prog(brw, &this->wm_prog_key);
GLuint program_size;
const GLuint *program = prog.compile(brw, &program_size);
- brw_upload_cache(&brw->cache, BRW_BLORP_CLEAR_PROG,
+ brw_upload_cache(&brw->cache, BRW_BLORP_CONST_COLOR_PROG,
&this->wm_prog_key, sizeof(this->wm_prog_key),
program, program_size,
&prog.prog_data, sizeof(prog.prog_data),
@@ -276,7 +286,7 @@ brw_blorp_clear_params::get_wm_prog(struct brw_context *brw,
}
void
-brw_blorp_clear_program::alloc_regs()
+brw_blorp_const_color_program::alloc_regs()
{
int reg = 0;
this->R0 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);
@@ -293,8 +303,8 @@ brw_blorp_clear_program::alloc_regs()
}
const GLuint *
-brw_blorp_clear_program::compile(struct brw_context *brw,
- GLuint *program_size)
+brw_blorp_const_color_program::compile(struct brw_context *brw,
+ GLuint *program_size)
{
/* Set up prog_data */
memset(&prog_data, 0, sizeof(prog_data));
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index a25eca8..ee7bf33 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -615,7 +615,7 @@ enum brw_cache_id {
BRW_CC_UNIT,
BRW_WM_PROG,
BRW_BLORP_BLIT_PROG,
- BRW_BLORP_CLEAR_PROG,
+ BRW_BLORP_CONST_COLOR_PROG,
BRW_SAMPLER,
BRW_WM_UNIT,
BRW_SF_PROG,
--
1.8.2.3
More information about the mesa-dev
mailing list