summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Davy <axel.davy@ens.fr>2015-03-24 10:10:25 +0100
committerAxel Davy <axel.davy@ens.fr>2015-08-21 22:21:47 +0200
commita3f0d21da9a33e58a4be41f65f77eebe1dd85841 (patch)
tree2f8905fd0888817dce55be63cfc2090fdbc69632
parentb06f3ee6f4ebf6ad403e7ee917c54bef85899c19 (diff)
st/nine: Rework blend states
Separate state preparation and state commit Signed-off-by: Axel Davy <axel.davy@ens.fr>
-rw-r--r--src/gallium/state_trackers/nine/nine_pipe.c4
-rw-r--r--src/gallium/state_trackers/nine/nine_pipe.h2
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c23
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h2
4 files changed, 21 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c
index 364cab90eb2..869f5dff354 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -143,7 +143,7 @@ nine_convert_blend_state_fixup(struct pipe_blend_state *blend, const DWORD *rs)
}
void
-nine_convert_blend_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_blend_state(struct pipe_blend_state *blend_state, const DWORD *rs)
{
struct pipe_blend_state blend;
@@ -187,7 +187,7 @@ nine_convert_blend_state(struct cso_context *ctx, const DWORD *rs)
/* blend.force_srgb = !!rs[D3DRS_SRGBWRITEENABLE]; */
- cso_set_blend(ctx, &blend);
+ *blend_state = blend;
}
void
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h
index e2680f6f5e6..86117866ed5 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -39,7 +39,7 @@ extern const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT];
void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const DWORD *);
void nine_convert_rasterizer_state(struct pipe_rasterizer_state *, const DWORD *);
-void nine_convert_blend_state(struct cso_context *, const DWORD *);
+void nine_convert_blend_state(struct pipe_blend_state *, const DWORD *);
void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
void nine_pipe_context_clear(struct NineDevice9 *);
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 2fb2f7a845a..8c2b6eb4bc0 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -41,6 +41,13 @@
/* State preparation only */
static inline void
+prepare_blend(struct NineDevice9 *device)
+{
+ nine_convert_blend_state(&device->state.pipe.blend, device->state.rs);
+ device->state.commit |= NINE_STATE_COMMIT_BLEND;
+}
+
+static inline void
prepare_dsa(struct NineDevice9 *device)
{
nine_convert_dsa_state(&device->state.pipe.dsa, device->state.rs);
@@ -197,12 +204,6 @@ update_viewport(struct NineDevice9 *device)
pipe->set_viewport_states(pipe, 0, 1, &pvport);
}
-static inline void
-update_blend(struct NineDevice9 *device)
-{
- nine_convert_blend_state(device->cso, device->state.rs);
-}
-
/* Loop through VS inputs and pick the vertex elements with the declared
* usage from the vertex declaration, then insert the instance divisor from
* the stream source frequency setting.
@@ -869,6 +870,12 @@ update_textures_and_samplers(struct NineDevice9 *device)
/* State commit only */
static inline void
+commit_blend(struct NineDevice9 *device)
+{
+ cso_set_blend(device->cso, &device->state.pipe.blend);
+}
+
+static inline void
commit_dsa(struct NineDevice9 *device)
{
cso_set_depth_stencil_alpha(device->cso, &device->state.pipe.dsa);
@@ -982,7 +989,7 @@ nine_update_state(struct NineDevice9 *device)
if (group & NINE_STATE_DSA)
prepare_dsa(device);
if (group & NINE_STATE_BLEND)
- update_blend(device);
+ prepare_blend(device);
if (group & NINE_STATE_VS)
group |= update_vs(device);
@@ -1040,6 +1047,8 @@ nine_update_state(struct NineDevice9 *device)
if (state->changed.vtxbuf)
update_vertex_buffers(device);
+ if (state->commit & NINE_STATE_COMMIT_BLEND)
+ commit_blend(device);
if (state->commit & NINE_STATE_COMMIT_DSA)
commit_dsa(device);
if (state->commit & NINE_STATE_COMMIT_RASTERIZER)
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index bd2ad380d7a..60e5d8fe291 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -80,6 +80,7 @@
#define NINE_STATE_COMMIT_DSA (1 << 0)
#define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
+#define NINE_STATE_COMMIT_BLEND (1 << 2)
#define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
@@ -216,6 +217,7 @@ struct nine_state
struct {
struct pipe_depth_stencil_alpha_state dsa;
struct pipe_rasterizer_state rast;
+ struct pipe_blend_state blend;
} pipe;
};