diff options
author | Ilia Mirkin <[email protected]> | 2016-02-18 01:04:13 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-02-19 11:30:33 -0500 |
commit | 2b938a390c15a06be8cf706083890c822979508f (patch) | |
tree | 08ca8d3537c81135fc0f0e5e458de98b1a487b5d /src/mesa/state_tracker/st_cb_texture.c | |
parent | 68c4af1c1942d30665f3f99654e8f35b175d1256 (diff) |
st/mesa: fix pbo uploads
- LOD must be provided in .w for TXF (even for buffer textures)
- User buffer must be valid at draw time
- Must have a sampler associated with the sampler view
This makes PBO uploads work again on nouveau.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 8ee95d2f0f5..cfec627f10c 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1272,10 +1272,11 @@ create_pbo_upload_fs(struct st_context *st) ureg_scalar(ureg_src(temp0), TGSI_SWIZZLE_X)); } + /* temp0.w = 0 */ + ureg_MOV(ureg, ureg_writemask(temp0, TGSI_WRITEMASK_W), ureg_imm1u(ureg, 0)); + /* out = txf(sampler, temp0.x) */ - ureg_TXF(ureg, out, TGSI_TEXTURE_BUFFER, - ureg_scalar(ureg_src(temp0), TGSI_SWIZZLE_X), - sampler); + ureg_TXF(ureg, out, TGSI_TEXTURE_BUFFER, ureg_src(temp0), sampler); ureg_release_temporary(ureg, temp0); @@ -1335,6 +1336,7 @@ try_pbo_upload_common(struct gl_context *ctx, } cso_save_state(cso, (CSO_BIT_FRAGMENT_SAMPLER_VIEWS | + CSO_BIT_FRAGMENT_SAMPLERS | CSO_BIT_VERTEX_ELEMENTS | CSO_BIT_AUX_VERTEX_BUFFER_SLOT | CSO_BIT_FRAMEBUFFER | @@ -1354,6 +1356,8 @@ try_pbo_upload_common(struct gl_context *ctx, + (upload_height - 1 + (depth - 1) * image_height) * stride; struct pipe_sampler_view templ; struct pipe_sampler_view *sampler_view; + struct pipe_sampler_state sampler = {0}; + const struct pipe_sampler_state *samplers[1] = {&sampler}; /* This should be ensured by Mesa before calling our callbacks */ assert((last_element + 1) * bytes_per_pixel <= buffer->width0); @@ -1362,6 +1366,7 @@ try_pbo_upload_common(struct gl_context *ctx, goto fail; memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_BUFFER; templ.format = src_format; templ.u.buf.first_element = first_element; templ.u.buf.last_element = last_element; @@ -1377,6 +1382,8 @@ try_pbo_upload_common(struct gl_context *ctx, cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, 1, &sampler_view); pipe_sampler_view_reference(&sampler_view, NULL); + + cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 1, samplers); } /* Upload vertices */ @@ -1424,16 +1431,17 @@ try_pbo_upload_common(struct gl_context *ctx, } /* Upload constants */ + /* Note: the user buffer must be valid until draw time */ + struct { + int32_t xoffset; + int32_t yoffset; + int32_t stride; + int32_t image_size; + } constants; + { struct pipe_constant_buffer cb; - struct { - int32_t xoffset; - int32_t yoffset; - int32_t stride; - int32_t image_size; - } constants; - constants.xoffset = -xoffset + skip_pixels; constants.yoffset = -yoffset; constants.stride = stride; |