summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2014-12-07 00:14:19 +0100
committerEmil Velikov <[email protected]>2015-01-22 22:16:23 +0000
commit4b7a9cfddb1b8b47aeb2b466f66973d962555542 (patch)
treef511bed9aafdd7f64a1756beec85a598bf39c030 /src
parent9690bf33d7af835eb36d9e4c5928ac8483ffeeaa (diff)
st/nine: Remove unused code for ps
Since constant indirect adressing is not allowed for ps, we can remove our code to handle that. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c43
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.c10
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.h2
3 files changed, 15 insertions, 40 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 2cd51400559..f788a3dae78 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -352,8 +352,8 @@ update_constants(struct NineDevice9 *device, unsigned shader_type)
const unsigned usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE;
unsigned x = 0; /* silence warning */
unsigned i, c;
- const struct nine_lconstf *lconstf;
- struct nine_range *r, *p;
+ struct nine_range *r, *p, *lconstf_ranges;
+ float *lconstf_data;
box.y = 0;
box.z = 0;
@@ -381,7 +381,9 @@ update_constants(struct NineDevice9 *device, unsigned shader_type)
device->state.changed.vs_const_b = 0;
const_b = device->state.vs_const_b;
- lconstf = &device->state.vs->lconstf;
+ lconstf_ranges = device->state.vs->lconstf.ranges;
+ lconstf_data = device->state.vs->lconstf.data;
+
device->state.ff.clobber.vs_const = TRUE;
device->state.changed.group &= ~NINE_STATE_VS_CONST;
} else {
@@ -405,7 +407,9 @@ update_constants(struct NineDevice9 *device, unsigned shader_type)
device->state.changed.ps_const_b = 0;
const_b = device->state.ps_const_b;
- lconstf = &device->state.ps->lconstf;
+ lconstf_ranges = NULL;
+ lconstf_data = NULL;
+
device->state.ff.clobber.ps_const = TRUE;
device->state.changed.group &= ~NINE_STATE_PS_CONST;
}
@@ -451,14 +455,14 @@ update_constants(struct NineDevice9 *device, unsigned shader_type)
}
/* TODO: only upload these when shader itself changes */
- if (lconstf->ranges) {
+ if (lconstf_ranges) {
unsigned n = 0;
- struct nine_range *r = lconstf->ranges;
+ struct nine_range *r = lconstf_ranges;
while (r) {
box.x = r->bgn * 4 * sizeof(float);
n += r->end - r->bgn;
box.width = (r->end - r->bgn) * 4 * sizeof(float);
- data = &lconstf->data[4 * n];
+ data = &lconstf_data[4 * n];
pipe->transfer_inline_write(pipe, buf, 0, usage, &box, data, 0, 0);
r = r->next;
}
@@ -555,33 +559,8 @@ update_ps_constants_userbuf(struct NineDevice9 *device)
state->changed.ps_const_b = 0;
}
-#ifdef DEBUG
- if (device->state.ps->lconstf.ranges) {
- /* TODO: Can we make it so that we don't have to copy everything ? */
- const struct nine_lconstf *lconstf = &device->state.ps->lconstf;
- const struct nine_range *r = lconstf->ranges;
- unsigned n = 0;
- float *dst = (float *)MALLOC(cb.buffer_size);
- float *src = (float *)cb.user_buffer;
- memcpy(dst, src, cb.buffer_size);
- while (r) {
- unsigned p = r->bgn;
- unsigned c = r->end - r->bgn;
- memcpy(&dst[p * 4], &lconstf->data[n * 4], c * 4 * sizeof(float));
- n += c;
- r = r->next;
- }
- cb.user_buffer = dst;
- }
-#endif
-
pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, &cb);
-#ifdef DEBUG
- if (device->state.ps->lconstf.ranges)
- FREE((void *)cb.user_buffer);
-#endif
-
if (device->state.changed.ps_const_f) {
struct nine_range *r = device->state.changed.ps_const_f;
struct nine_range *p = r;
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index ac204ff5785..dcd234670db 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -72,9 +72,10 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
This->sampler_mask = info.sampler_mask;
This->rt_mask = info.rt_mask;
This->const_used_size = info.const_used_size;
- if (info.const_used_size == ~0)
- This->const_used_size = NINE_CONSTBUF_SIZE(device->max_ps_const_f);
- This->lconstf = info.lconstf;
+ /* no constant relative addressing for ps */
+ assert(info.const_used_size != ~0);
+ assert(info.lconstf.data == NULL);
+ assert(info.lconstf.ranges == NULL);
return D3D_OK;
}
@@ -100,9 +101,6 @@ NinePixelShader9_dtor( struct NinePixelShader9 *This )
FREE((void *)This->byte_code.tokens); /* const_cast */
- FREE(This->lconstf.data);
- FREE(This->lconstf.ranges);
-
NineUnknown_dtor(&This->base);
}
diff --git a/src/gallium/state_trackers/nine/pixelshader9.h b/src/gallium/state_trackers/nine/pixelshader9.h
index 5e00b46e0c5..5e2219c946a 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.h
+++ b/src/gallium/state_trackers/nine/pixelshader9.h
@@ -41,8 +41,6 @@ struct NinePixelShader9
unsigned const_used_size; /* in bytes */
- struct nine_lconstf lconstf;
-
uint16_t sampler_mask;
uint16_t sampler_mask_shadow;
uint8_t rt_mask;