gallium/u_threaded: late alloc cpu_storage
Instead of allocating cpu_storage in threaded_resource_init, defer the allocation to first use (in tc_buffer_map). This avoids needless memory allocation if tc_buffer_disable_cpu_storage is called before tc_buffer_map. map_buffer_alignment is stored and serves as a "can cpu_storage be used" flag. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15074>
This commit is contained in:
@@ -365,7 +365,7 @@ crocus_alloc_resource(struct pipe_screen *pscreen,
|
||||
res->base.b.screen = pscreen;
|
||||
res->orig_screen = crocus_pscreen_ref(pscreen);
|
||||
pipe_reference_init(&res->base.b.reference, 1);
|
||||
threaded_resource_init(&res->base.b, false, 0);
|
||||
threaded_resource_init(&res->base.b, false);
|
||||
|
||||
if (templ->target == PIPE_BUFFER)
|
||||
util_range_init(&res->valid_buffer_range);
|
||||
|
Reference in New Issue
Block a user