mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
vulkan: vulkan_compute initialize base on plugin creation
This commit is contained in:
parent
402ed65a79
commit
06a1d5151b
3 changed files with 11 additions and 2 deletions
|
|
@ -650,6 +650,13 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
||||||
|
|
||||||
static int impl_clear(struct spa_handle *handle)
|
static int impl_clear(struct spa_handle *handle)
|
||||||
{
|
{
|
||||||
|
struct impl *this;
|
||||||
|
|
||||||
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
||||||
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
|
spa_vulkan_deinit(&this->state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -742,6 +749,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_DIRECTION_OUTPUT, NULL);
|
SPA_DIRECTION_OUTPUT, NULL);
|
||||||
|
|
||||||
this->state.n_streams = 2;
|
this->state.n_streams = 2;
|
||||||
|
spa_vulkan_init(&this->state);
|
||||||
spa_vulkan_prepare(&this->state);
|
spa_vulkan_prepare(&this->state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -860,6 +860,8 @@ static int impl_clear(struct spa_handle *handle)
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
|
spa_vulkan_deinit(&this->state);
|
||||||
|
|
||||||
if (this->data_loop)
|
if (this->data_loop)
|
||||||
spa_loop_invoke(this->data_loop, do_remove_timer, 0, NULL, 0, true, this);
|
spa_loop_invoke(this->data_loop, do_remove_timer, 0, NULL, 0, true, this);
|
||||||
spa_system_close(this->data_system, this->timer_source.fd);
|
spa_system_close(this->data_system, this->timer_source.fd);
|
||||||
|
|
@ -952,6 +954,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_DIRECTION_OUTPUT, NULL);
|
SPA_DIRECTION_OUTPUT, NULL);
|
||||||
this->state.shaderName = "spa/plugins/vulkan/shaders/main.spv";
|
this->state.shaderName = "spa/plugins/vulkan/shaders/main.spv";
|
||||||
this->state.n_streams = 1;
|
this->state.n_streams = 1;
|
||||||
|
spa_vulkan_init(&this->state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,6 @@ int spa_vulkan_init_stream(struct vulkan_compute_state *s, struct vulkan_stream
|
||||||
int spa_vulkan_prepare(struct vulkan_compute_state *s)
|
int spa_vulkan_prepare(struct vulkan_compute_state *s)
|
||||||
{
|
{
|
||||||
if (!s->prepared) {
|
if (!s->prepared) {
|
||||||
CHECK(spa_vulkan_init(s));
|
|
||||||
CHECK(createFence(s));
|
CHECK(createFence(s));
|
||||||
CHECK(createDescriptors(s));
|
CHECK(createDescriptors(s));
|
||||||
CHECK(createComputePipeline(s, s->shaderName));
|
CHECK(createComputePipeline(s, s->shaderName));
|
||||||
|
|
@ -435,7 +434,6 @@ int spa_vulkan_unprepare(struct vulkan_compute_state *s)
|
||||||
vkDestroyPipeline(s->base.device, s->pipeline, NULL);
|
vkDestroyPipeline(s->base.device, s->pipeline, NULL);
|
||||||
vkDestroyCommandPool(s->base.device, s->commandPool, NULL);
|
vkDestroyCommandPool(s->base.device, s->commandPool, NULL);
|
||||||
vkDestroyFence(s->base.device, s->fence, NULL);
|
vkDestroyFence(s->base.device, s->fence, NULL);
|
||||||
spa_vulkan_deinit(s);
|
|
||||||
s->prepared = false;
|
s->prepared = false;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue