summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2016-09-24 18:19:26 +0200
committerAxel Davy <[email protected]>2016-10-10 23:43:51 +0200
commit09edc0555f91d76001b1ffc0e656b0614abb809a (patch)
tree52e990e1f26f0bba30276502968a2777d51587e9 /src/gallium
parentfa2574497b25d06258404b83282719dbb477b190 (diff)
st/nine: Set CLAMP_TO_EDGE on cubetextures
Wine tests show that cubetextures always use PIPE_TEX_WRAP_CLAMP_TO_EDGE regardless of set sampler states. Fixes failing d3d9 wine test test_cube_wrap. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/nine/nine_pipe.c14
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c10
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h3
3 files changed, 22 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c
index ea7dc167ec3..7e33c0a9c39 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -220,9 +220,17 @@ nine_convert_sampler_state(struct cso_context *ctx, int idx, const DWORD *ss)
samp.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
}
samp.max_lod = 15.0f;
- samp.wrap_s = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSU]);
- samp.wrap_t = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSV]);
- samp.wrap_r = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSW]);
+
+ if (ss[NINED3DSAMP_CUBETEX]) {
+ /* Cube textures are always clamped to edge on D3D */
+ samp.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+ samp.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+ samp.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+ } else {
+ samp.wrap_s = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSU]);
+ samp.wrap_t = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSV]);
+ samp.wrap_r = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSW]);
+ }
samp.min_img_filter = (ss[D3DSAMP_MINFILTER] == D3DTEXF_POINT && !ss[NINED3DSAMP_SHADOW]) ? PIPE_TEX_FILTER_NEAREST : PIPE_TEX_FILTER_LINEAR;
samp.mag_img_filter = (ss[D3DSAMP_MAGFILTER] == D3DTEXF_POINT && !ss[NINED3DSAMP_SHADOW]) ? PIPE_TEX_FILTER_NEAREST : PIPE_TEX_FILTER_LINEAR;
if (ss[D3DSAMP_MINFILTER] == D3DTEXF_ANISOTROPIC ||
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index ed3c821f337..f6bf51e9763 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -714,6 +714,13 @@ update_sampler_derived(struct nine_state *state, unsigned s)
state->samp[s][NINED3DSAMP_SHADOW] = state->texture[s]->shadow;
}
+ if (state->samp[s][NINED3DSAMP_CUBETEX] !=
+ (NineResource9(state->texture[s])->type == D3DRTYPE_CUBETEXTURE)) {
+ changed = TRUE;
+ state->samp[s][NINED3DSAMP_CUBETEX] =
+ NineResource9(state->texture[s])->type == D3DRTYPE_CUBETEXTURE;
+ }
+
if (state->samp[s][D3DSAMP_MIPFILTER] != D3DTEXF_NONE) {
int lod = state->samp[s][D3DSAMP_MAXMIPLEVEL] - state->texture[s]->managed.lod;
if (lod < 0)
@@ -1264,7 +1271,8 @@ static const DWORD nine_samp_state_defaults[NINED3DSAMP_LAST + 1] =
[D3DSAMP_ELEMENTINDEX] = 0,
[D3DSAMP_DMAPOFFSET] = 0,
[NINED3DSAMP_MINLOD] = 0,
- [NINED3DSAMP_SHADOW] = 0
+ [NINED3DSAMP_SHADOW] = 0,
+ [NINED3DSAMP_CUBETEX] = 0
};
void nine_state_restore_non_cso(struct NineDevice9 *device)
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 05eb2c170d6..1c50775670d 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -30,6 +30,7 @@
#define NINED3DSAMP_MINLOD (D3DSAMP_DMAPOFFSET + 1)
#define NINED3DSAMP_SHADOW (D3DSAMP_DMAPOFFSET + 2)
+#define NINED3DSAMP_CUBETEX (D3DSAMP_DMAPOFFSET + 3)
#define NINED3DRS_VSPOINTSIZE (D3DRS_BLENDOPALPHA + 1)
#define NINED3DRS_RTMASK (D3DRS_BLENDOPALPHA + 2)
@@ -42,7 +43,7 @@
#define D3DRS_LAST D3DRS_BLENDOPALPHA
#define NINED3DRS_LAST NINED3DRS_MULTISAMPLE /* 214 */
-#define NINED3DSAMP_LAST NINED3DSAMP_SHADOW /* 15 */
+#define NINED3DSAMP_LAST NINED3DSAMP_CUBETEX /* 16 */
#define NINED3DTSS_LAST D3DTSS_CONSTANT
#define NINED3DTS_LAST D3DTS_WORLDMATRIX(255)