summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r--src/gallium/state_trackers/nine/nine_pipe.c7
-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, 22 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c
index 0538957e9af..364cab90eb2 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -69,13 +69,12 @@ nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *dsa_state,
*dsa_state = dsa;
}
-/* TODO: Keep a static copy in device so we don't have to memset every time ? */
void
-nine_convert_rasterizer_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const DWORD *rs)
{
struct pipe_rasterizer_state rast;
- memset(&rast, 0, sizeof(rast)); /* memcmp safety */
+ memset(&rast, 0, sizeof(rast));
rast.flatshade = rs[D3DRS_SHADEMODE] == D3DSHADE_FLAT;
/* rast.light_twoside = 0; */
@@ -122,7 +121,7 @@ nine_convert_rasterizer_state(struct cso_context *ctx, const DWORD *rs)
rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
/* rast.offset_clamp = 0.0f; */
- cso_set_rasterizer(ctx, &rast);
+ *rast_state = rast;
}
static inline void
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h
index 2f2e9cb815b..e2680f6f5e6 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -38,7 +38,7 @@ extern const enum pipe_format nine_d3d9_to_pipe_format_map[120];
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 cso_context *, 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_sampler_state(struct cso_context *, int idx, const DWORD *);
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 7875d31d9b4..b29556b56ee 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -46,6 +46,13 @@ prepare_dsa(struct NineDevice9 *device)
device->state.commit |= NINE_STATE_COMMIT_DSA;
}
+static inline void
+prepare_rasterizer(struct NineDevice9 *device)
+{
+ nine_convert_rasterizer_state(&device->state.pipe.rast, device->state.rs);
+ device->state.commit |= NINE_STATE_COMMIT_RASTERIZER;
+}
+
/* State preparation incremental */
/* State preparation + State commit */
@@ -195,12 +202,6 @@ update_blend(struct NineDevice9 *device)
nine_convert_blend_state(device->cso, device->state.rs);
}
-static inline void
-update_rasterizer(struct NineDevice9 *device)
-{
- nine_convert_rasterizer_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.
@@ -859,6 +860,12 @@ commit_scissor(struct NineDevice9 *device)
}
static inline void
+commit_rasterizer(struct NineDevice9 *device)
+{
+ cso_set_rasterizer(device->cso, &device->state.pipe.rast);
+}
+
+static inline void
commit_index_buffer(struct NineDevice9 *device)
{
struct pipe_context *pipe = device->pipe;
@@ -958,7 +965,7 @@ nine_update_state(struct NineDevice9 *device)
group |= update_vs(device);
if (group & NINE_STATE_RASTERIZER)
- update_rasterizer(device);
+ prepare_rasterizer(device);
if (group & NINE_STATE_PS)
group |= update_ps(device);
@@ -1012,6 +1019,8 @@ nine_update_state(struct NineDevice9 *device)
if (state->commit & NINE_STATE_COMMIT_DSA)
commit_dsa(device);
+ if (state->commit & NINE_STATE_COMMIT_RASTERIZER)
+ commit_rasterizer(device);
state->commit = 0;
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index e833225d35e..bd2ad380d7a 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -79,6 +79,7 @@
#define NINE_STATE_UNHANDLED (1 << 24)
#define NINE_STATE_COMMIT_DSA (1 << 0)
+#define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
#define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
@@ -214,6 +215,7 @@ struct nine_state
uint32_t commit;
struct {
struct pipe_depth_stencil_alpha_state dsa;
+ struct pipe_rasterizer_state rast;
} pipe;
};