Commit 556f1dc8 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d10core/tests: Introduce get_resource_data() helper function.

parent 16e22c8a
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment