summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/d3d1x
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-10-20 20:12:51 +0200
committerChristoph Bumiller <[email protected]>2011-10-21 23:00:37 +0200
commit6ab6c43079083c811761241b901d07f9ad2c9aff (patch)
tree69646cad8703d76bd06f5e9933c2ec4e8a15b1d7 /src/gallium/state_trackers/d3d1x
parent4b7851623ed665ffc1ace5f46570b990346372ce (diff)
d3d1x: fix translation of subresource to layer
Diffstat (limited to 'src/gallium/state_trackers/d3d1x')
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index bbeeb8c3c95..f3db3843bef 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -1428,7 +1428,7 @@ changed:
}
}
- static unsigned d3d11_subresource_to_face(struct pipe_resource* resource, unsigned subresource)
+ static unsigned d3d11_subresource_to_layer(struct pipe_resource* resource, unsigned subresource)
{
if(subresource <= resource->last_level)
{
@@ -1458,9 +1458,9 @@ changed:
if(resource->transfers.count(subresource))
return E_FAIL;
unsigned level = d3d11_subresource_to_level(resource->resource, subresource);
- unsigned face = d3d11_subresource_to_face(resource->resource, subresource);
+ unsigned layer = d3d11_subresource_to_layer(resource->resource, subresource);
pipe_box box = d3d11_to_pipe_box(resource->resource, level, 0);
- /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+ box.z += layer;
unsigned usage = 0;
if(map_type == D3D11_MAP_READ)
usage = PIPE_TRANSFER_READ;
@@ -1519,11 +1519,12 @@ changed:
GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
unsigned dst_level = d3d11_subresource_to_level(dst->resource, dst_subresource);
- unsigned dst_face = d3d11_subresource_to_face(dst->resource, dst_subresource);
+ unsigned dst_layer = d3d11_subresource_to_layer(dst->resource, dst_subresource);
unsigned src_level = d3d11_subresource_to_level(src->resource, src_subresource);
- unsigned src_face = d3d11_subresource_to_face(src->resource, src_subresource);
- /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+ unsigned src_layer = d3d11_subresource_to_layer(src->resource, src_subresource);
pipe_box box = d3d11_to_pipe_box(src->resource, src_level, src_box);
+ dst_z += dst_layer;
+ box.z += src_layer;
{
pipe->resource_copy_region(pipe,
dst->resource, dst_level, dst_x, dst_y, dst_z,
@@ -1541,17 +1542,14 @@ changed:
unsigned level;
for(level = 0; level <= dst->resource->last_level; ++level)
{
- unsigned layers = 1;
pipe_box box;
- if (dst->resource->target == PIPE_TEXTURE_CUBE)
- layers = 6;
- else if (dst->resource->target == PIPE_TEXTURE_3D)
- layers = u_minify(dst->resource->depth0, level);
- /* else layers = dst->resource->array_size; */
box.x = box.y = box.z = 0;
box.width = u_minify(dst->resource->width0, level);
box.height = u_minify(dst->resource->height0, level);
- box.depth = layers;
+ if(dst->resource->target == PIPE_TEXTURE_3D)
+ box.depth = u_minify(dst->resource->depth0, level);
+ else
+ box.depth = dst->resource->array_size;
pipe->resource_copy_region(pipe,
dst->resource, level, 0, 0, 0,
src->resource, level, &box);
@@ -1569,8 +1567,9 @@ changed:
SYNCHRONIZED;
GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
unsigned dst_level = d3d11_subresource_to_level(dst->resource, dst_subresource);
- /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+ unsigned dst_layer = d3d11_subresource_to_layer(dst->resource, dst_subresource);
pipe_box box = d3d11_to_pipe_box(dst->resource, dst_level, pDstBox);
+ box.z += dst_layer;
pipe->transfer_inline_write(pipe, dst->resource, dst_level, PIPE_TRANSFER_WRITE, &box, pSrcData, src_row_pitch, src_depth_pitch);
}
@@ -1737,8 +1736,8 @@ changed:
info.dst.res = dst->resource;
info.src.res = src->resource;
info.dst.level = 0;
- info.dst.layer = d3d11_subresource_to_face(dst->resource, dst_subresource);
- info.src.layer = d3d11_subresource_to_face(src->resource, src_subresource);
+ info.dst.layer = d3d11_subresource_to_layer(dst->resource, dst_subresource);
+ info.src.layer = d3d11_subresource_to_layer(src->resource, src_subresource);
info.src.x0 = 0;
info.src.x1 = info.src.res->width0;