summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/surface9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-02-09 22:35:27 +0100
committerAxel Davy <[email protected]>2016-05-18 23:37:14 +0200
commit217d969746e3c1473df4cc1e6e6ec1eb0d84a3d4 (patch)
tree84b06627bc876283b8f7d25a2f23a438b2fabec3 /src/gallium/state_trackers/nine/surface9.c
parent4c77673de75049a3f1d707efce8ee30df03634c8 (diff)
st/nine: Rework UpdateTexture Checks
Our code did match the user documentation of the function quite well (except for format check). However the DDI documentation and wine tests show that documentation was not correct. Thus adapt our code to fit the best possible to the -real- spec. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/surface9.c')
-rw-r--r--src/gallium/state_trackers/nine/surface9.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index 4c4234bfe27..da2b46ec3b9 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -480,9 +480,10 @@ NineSurface9_CopyMemToDefault( struct NineSurface9 *This,
const RECT *pSourceRect )
{
struct pipe_context *pipe = This->pipe;
+ struct pipe_transfer *transfer = NULL;
struct pipe_resource *r_dst = This->base.resource;
struct pipe_box dst_box;
- const uint8_t *p_src;
+ uint8_t *map = NULL;
int src_x, src_y, dst_x, dst_y, copy_width, copy_height;
assert(This->base.pool == D3DPOOL_DEFAULT &&
@@ -511,11 +512,25 @@ NineSurface9_CopyMemToDefault( struct NineSurface9 *This,
u_box_2d_zslice(dst_x, dst_y, This->layer,
copy_width, copy_height, &dst_box);
- p_src = NineSurface9_GetSystemMemPointer(From, src_x, src_y);
+ map = pipe->transfer_map(pipe,
+ r_dst,
+ This->level,
+ PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ &dst_box, &transfer);
+ if (!map)
+ return;
- pipe->transfer_inline_write(pipe, r_dst, This->level,
- 0, /* WRITE|DISCARD are implicit */
- &dst_box, p_src, From->stride, 0);
+ /* Note: if formats are the sames, it will revert
+ * to normal memcpy */
+ (void) util_format_translate(r_dst->format,
+ map, transfer->stride,
+ 0, 0,
+ From->base.info.format,
+ From->data, From->stride,
+ src_x, src_y,
+ copy_width, copy_height);
+
+ pipe_transfer_unmap(pipe, transfer);
NineSurface9_MarkContainerDirty(This);
}