summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/nine/device9.c2
-rw-r--r--src/gallium/state_trackers/nine/nine_pipe.c2
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c30
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h8
4 files changed, 32 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index ed5d17a6e07..b29e161869c 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1833,7 +1833,7 @@ NineDevice9_SetRenderTarget( struct NineDevice9 *This,
This->state.scissor.maxx = rt->desc.Width;
This->state.scissor.maxy = rt->desc.Height;
- This->state.changed.group |= NINE_STATE_VIEWPORT | NINE_STATE_SCISSOR;
+ This->state.changed.group |= NINE_STATE_VIEWPORT | NINE_STATE_SCISSOR | NINE_STATE_MULTISAMPLE;
}
if (This->state.rt[i] != NineSurface9(pRenderTarget)) {
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c
index fc708c29d38..79b910c482f 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -94,7 +94,7 @@ nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const DW
rast.sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT;
rast.point_quad_rasterization = 1;
rast.point_size_per_vertex = rs[NINED3DRS_VSPOINTSIZE];
- rast.multisample = !!rs[D3DRS_MULTISAMPLEANTIALIAS];
+ rast.multisample = rs[NINED3DRS_MULTISAMPLE];
rast.line_smooth = !!rs[D3DRS_ANTIALIASEDLINEENABLE];
/* rast.line_stipple_enable = 0; */
rast.line_last_pixel = !!rs[D3DRS_LASTPIXEL];
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 5013b582df7..095c998876d 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -39,6 +39,22 @@
#define DBG_CHANNEL DBG_DEVICE
+/* Check if some states need to be set dirty */
+
+static inline DWORD
+check_multisample(struct NineDevice9 *device)
+{
+ DWORD *rs = device->state.rs;
+ DWORD new_value = (rs[D3DRS_ZENABLE] || rs[D3DRS_STENCILENABLE]) &&
+ device->state.rt[0]->desc.MultiSampleType >= 1 &&
+ rs[D3DRS_MULTISAMPLEANTIALIAS];
+ if (rs[NINED3DRS_MULTISAMPLE] != new_value) {
+ rs[NINED3DRS_MULTISAMPLE] = new_value;
+ return NINE_STATE_RASTERIZER;
+ }
+ return 0;
+}
+
/* State preparation only */
static inline void
@@ -908,7 +924,8 @@ commit_ps(struct NineDevice9 *device)
NINE_STATE_TEXTURE | \
NINE_STATE_SAMPLER | \
NINE_STATE_VS_CONST | \
- NINE_STATE_PS_CONST)
+ NINE_STATE_PS_CONST | \
+ NINE_STATE_MULTISAMPLE)
#define NINE_STATE_COMMON \
(NINE_STATE_FB | \
@@ -1004,6 +1021,8 @@ nine_update_state(struct NineDevice9 *device)
}
if (likely(group & (NINE_STATE_FREQUENT | NINE_STATE_VS | NINE_STATE_PS))) {
+ if (group & NINE_STATE_MULTISAMPLE)
+ group |= check_multisample(device);
if (group & NINE_STATE_RASTERIZER)
prepare_rasterizer(device);
if (group & (NINE_STATE_TEXTURE | NINE_STATE_SAMPLER))
@@ -1188,7 +1207,8 @@ static const DWORD nine_render_state_defaults[NINED3DRS_LAST + 1] =
[D3DRS_BLENDOPALPHA] = D3DBLENDOP_ADD,
[NINED3DRS_VSPOINTSIZE] = FALSE,
[NINED3DRS_RTMASK] = 0xf,
- [NINED3DRS_ALPHACOVERAGE] = FALSE
+ [NINED3DRS_ALPHACOVERAGE] = FALSE,
+ [NINED3DRS_MULTISAMPLE] = FALSE
};
static const DWORD nine_tex_stage_state_defaults[NINED3DTSS_LAST + 1] =
{
@@ -1472,7 +1492,7 @@ const uint32_t nine_render_states_vertex[(NINED3DRS_LAST + 31) / 32] =
/* TODO: put in the right values */
const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
{
- [D3DRS_ZENABLE] = NINE_STATE_DSA,
+ [D3DRS_ZENABLE] = NINE_STATE_DSA | NINE_STATE_MULTISAMPLE,
[D3DRS_FILLMODE] = NINE_STATE_RASTERIZER,
[D3DRS_SHADEMODE] = NINE_STATE_RASTERIZER,
[D3DRS_ZWRITEENABLE] = NINE_STATE_DSA,
@@ -1494,7 +1514,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
[D3DRS_FOGEND] = NINE_STATE_FF_OTHER | NINE_STATE_PS_CONST,
[D3DRS_FOGDENSITY] = NINE_STATE_FF_OTHER | NINE_STATE_PS_CONST,
[D3DRS_RANGEFOGENABLE] = NINE_STATE_FF_OTHER,
- [D3DRS_STENCILENABLE] = NINE_STATE_DSA,
+ [D3DRS_STENCILENABLE] = NINE_STATE_DSA | NINE_STATE_MULTISAMPLE,
[D3DRS_STENCILFAIL] = NINE_STATE_DSA,
[D3DRS_STENCILZFAIL] = NINE_STATE_DSA,
[D3DRS_STENCILPASS] = NINE_STATE_DSA,
@@ -1531,7 +1551,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
[D3DRS_POINTSCALE_A] = NINE_STATE_FF_OTHER,
[D3DRS_POINTSCALE_B] = NINE_STATE_FF_OTHER,
[D3DRS_POINTSCALE_C] = NINE_STATE_FF_OTHER,
- [D3DRS_MULTISAMPLEANTIALIAS] = NINE_STATE_RASTERIZER,
+ [D3DRS_MULTISAMPLEANTIALIAS] = NINE_STATE_MULTISAMPLE,
[D3DRS_MULTISAMPLEMASK] = NINE_STATE_SAMPLE_MASK,
[D3DRS_PATCHEDGESTYLE] = NINE_STATE_UNHANDLED,
[D3DRS_DEBUGMONITORTOKEN] = NINE_STATE_UNHANDLED,
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 7e7a8996c91..d3c36f84eab 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -38,9 +38,10 @@
* bit 1: ATOC is on
*/
#define NINED3DRS_ALPHACOVERAGE (D3DRS_BLENDOPALPHA + 3)
+#define NINED3DRS_MULTISAMPLE (D3DRS_BLENDOPALPHA + 4)
#define D3DRS_LAST D3DRS_BLENDOPALPHA
-#define NINED3DRS_LAST NINED3DRS_ALPHACOVERAGE /* 213 */
+#define NINED3DRS_LAST NINED3DRS_MULTISAMPLE /* 214 */
#define NINED3DSAMP_LAST NINED3DSAMP_SHADOW /* 15 */
#define NINED3DTSS_LAST D3DTSS_CONSTANT
#define NINED3DTS_LAST D3DTS_WORLDMATRIX(255)
@@ -82,8 +83,9 @@
#define NINE_STATE_FOG_SHADER (1 << 25)
#define NINE_STATE_PS1X_SHADER (1 << 26)
#define NINE_STATE_POINTSIZE_SHADER (1 << 27)
-#define NINE_STATE_ALL 0xfffffff
-#define NINE_STATE_UNHANDLED (1 << 28)
+#define NINE_STATE_MULTISAMPLE (1 << 28)
+#define NINE_STATE_ALL 0x1fffffff
+#define NINE_STATE_UNHANDLED (1 << 29)
#define NINE_STATE_COMMIT_DSA (1 << 0)
#define NINE_STATE_COMMIT_RASTERIZER (1 << 1)