mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
vulkan: split vulkan-utils into generic and compute part
This commit should just shuffle code around with no functional changes. The goal is to ease development of simple vulkan nodes by providing generic helpers.
This commit is contained in:
parent
e7b4129944
commit
ea2a2c47c7
8 changed files with 770 additions and 615 deletions
72
spa/plugins/vulkan/vulkan-compute-utils.h
Normal file
72
spa/plugins/vulkan/vulkan-compute-utils.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* Spa */
|
||||
/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include <spa/buffer/buffer.h>
|
||||
#include <spa/node/node.h>
|
||||
|
||||
#include "vulkan-utils.h"
|
||||
|
||||
#define MAX_STREAMS 2
|
||||
#define WORKGROUP_SIZE 32
|
||||
|
||||
struct pixel {
|
||||
float r, g, b, a;
|
||||
};
|
||||
|
||||
struct push_constants {
|
||||
float time;
|
||||
int frame;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
|
||||
struct vulkan_compute_state {
|
||||
struct spa_log *log;
|
||||
|
||||
struct push_constants constants;
|
||||
|
||||
struct vulkan_base base;
|
||||
|
||||
VkPipeline pipeline;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
const char *shaderName;
|
||||
VkShaderModule computeShaderModule;
|
||||
|
||||
VkCommandPool commandPool;
|
||||
VkCommandBuffer commandBuffer;
|
||||
|
||||
VkFence fence;
|
||||
unsigned int initialized:1;
|
||||
unsigned int prepared:1;
|
||||
unsigned int started:1;
|
||||
|
||||
VkDescriptorPool descriptorPool;
|
||||
VkDescriptorSetLayout descriptorSetLayout;
|
||||
|
||||
VkSampler sampler;
|
||||
|
||||
uint32_t n_streams;
|
||||
VkDescriptorSet descriptorSet;
|
||||
struct vulkan_stream streams[MAX_STREAMS];
|
||||
};
|
||||
|
||||
int spa_vulkan_init_stream(struct vulkan_compute_state *s, struct vulkan_stream *stream, enum spa_direction,
|
||||
struct spa_dict *props);
|
||||
|
||||
int spa_vulkan_prepare(struct vulkan_compute_state *s);
|
||||
int spa_vulkan_use_buffers(struct vulkan_compute_state *s, struct vulkan_stream *stream, uint32_t flags,
|
||||
uint32_t n_buffers, struct spa_buffer **buffers);
|
||||
int spa_vulkan_unprepare(struct vulkan_compute_state *s);
|
||||
|
||||
int spa_vulkan_start(struct vulkan_compute_state *s);
|
||||
int spa_vulkan_stop(struct vulkan_compute_state *s);
|
||||
int spa_vulkan_ready(struct vulkan_compute_state *s);
|
||||
int spa_vulkan_process(struct vulkan_compute_state *s);
|
||||
int spa_vulkan_cleanup(struct vulkan_compute_state *s);
|
||||
|
||||
int spa_vulkan_init(struct vulkan_compute_state *s);
|
||||
void spa_vulkan_deinit(struct vulkan_compute_state *s);
|
||||
Loading…
Add table
Add a link
Reference in a new issue