diff --git a/src/gallium/drivers/r600/r600_buffer_common.c b/src/gallium/drivers/r600/r600_buffer_common.c index 8b4c6a94dab..1ca2bc4c4c9 100644 --- a/src/gallium/drivers/r600/r600_buffer_common.c +++ b/src/gallium/drivers/r600/r600_buffer_common.c @@ -27,6 +27,7 @@ #include "r600_cs.h" #include "evergreen_compute.h" #include "compute_memory_pool.h" +#include "util/macros.h" #include "util/u_memory.h" #include "util/u_upload_mgr.h" #include @@ -107,7 +108,7 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen, struct r600_resource *res, uint64_t size, unsigned alignment) { - struct r600_texture *rtex = (struct r600_texture*)res; + struct r600_texture *rtex = container_of(res, struct r600_texture, resource); res->bo_size = size; res->bo_alignment = alignment;