d3d10core/tests: Introduce get_resource_data() helper function.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-03-24 17:14:46 +01:00 committed by Alexandre Julliard
parent 16e22c8a6b
commit 556f1dc854
1 changed files with 9 additions and 4 deletions

View File

@ -568,24 +568,29 @@ static void get_texture_readback(ID3D10Texture2D *texture, unsigned int sub_reso
ID3D10Device_Release(device);
}
static void *get_readback_data(struct resource_readback *rb, unsigned int x, unsigned int y, unsigned byte_width)
{
return (BYTE *)rb->map_desc.pData + y * rb->map_desc.RowPitch + x * byte_width;
}
static DWORD get_readback_color(struct resource_readback *rb, unsigned int x, unsigned int y)
{
return ((DWORD *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(DWORD) + x];
return *(DWORD *)get_readback_data(rb, x, y, sizeof(DWORD));
}
static float get_readback_float(struct resource_readback *rb, unsigned int x, unsigned int y)
{
return ((float *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(float) + x];
return *(float *)get_readback_data(rb, x, y, sizeof(float));
}
static const struct vec4 *get_readback_vec4(struct resource_readback *rb, unsigned int x, unsigned int y)
{
return &((const struct vec4 *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(struct vec4) + x];
return get_readback_data(rb, x, y, sizeof(struct vec4));
}
static const struct uvec4 *get_readback_uvec4(struct resource_readback *rb, unsigned int x, unsigned int y)
{
return &((const struct uvec4 *)rb->map_desc.pData)[rb->map_desc.RowPitch * y / sizeof(struct uvec4) + x];
return get_readback_data(rb, x, y, sizeof(struct uvec4));
}
static void release_resource_readback(struct resource_readback *rb)