style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -17,21 +17,21 @@ namespace
|
||||
class BackendVulkanRenderer : public olive::VulkanRenderer {
|
||||
public:
|
||||
using olive::VulkanRenderer::VulkanRenderer;
|
||||
using olive::VulkanRenderer::Blit;
|
||||
using olive::VulkanRenderer::CreateNativeTexture;
|
||||
using olive::VulkanRenderer::DestroyInternal;
|
||||
using olive::VulkanRenderer::DestroyNativeTexture;
|
||||
using olive::VulkanRenderer::blit;
|
||||
using olive::VulkanRenderer::create_native_texture;
|
||||
using olive::VulkanRenderer::destroy_internal;
|
||||
using olive::VulkanRenderer::destroy_native_texture;
|
||||
};
|
||||
|
||||
// Converts the opaque C ABI handle back to the C++ Vulkan renderer.
|
||||
BackendVulkanRenderer *Renderer(OakRenderBackendHandle handle)
|
||||
BackendVulkanRenderer *renderer(OakRenderBackendHandle handle)
|
||||
{
|
||||
return static_cast<BackendVulkanRenderer *>(handle);
|
||||
}
|
||||
|
||||
// Interprets ABI QVariant payloads without copying; this ABI version assumes
|
||||
// the host and backend are built with the same Qt/C++ ABI.
|
||||
const QVariant &VariantRef(const void *variant)
|
||||
const QVariant &variant_ref(const void *variant)
|
||||
{
|
||||
return *static_cast<const QVariant *>(variant);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ oak_renderer_create(void *parent)
|
||||
OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_destroy(OakRenderBackendHandle handle)
|
||||
{
|
||||
delete Renderer(handle);
|
||||
delete renderer(handle);
|
||||
}
|
||||
|
||||
// Reports Vulkan backend capabilities and runtime availability status.
|
||||
@@ -61,12 +61,12 @@ oak_renderer_get_info(OakRenderBackendHandle handle,
|
||||
return false;
|
||||
}
|
||||
out_info->abi_version = 1;
|
||||
out_info->kind = OAK_RENDER_BACKEND_VULKAN;
|
||||
out_info->kind = oak_render_backend_vulkan;
|
||||
out_info->capabilities =
|
||||
OAK_RENDER_BACKEND_CAP_TEXTURES | OAK_RENDER_BACKEND_CAP_SHADERS |
|
||||
OAK_RENDER_BACKEND_CAP_BLIT | OAK_RENDER_BACKEND_CAP_READBACK;
|
||||
oak_render_backend_cap_textures | oak_render_backend_cap_shaders |
|
||||
oak_render_backend_cap_blit | oak_render_backend_cap_readback;
|
||||
out_info->name = "vulkan";
|
||||
out_info->status = Renderer(handle)->IsAvailable() ? "available" :
|
||||
out_info->status = renderer(handle)->is_available() ? "available" :
|
||||
"unavailable";
|
||||
return true;
|
||||
}
|
||||
@@ -76,21 +76,21 @@ oak_renderer_get_info(OakRenderBackendHandle handle,
|
||||
OAK_RENDER_BACKEND_EXPORT bool
|
||||
oak_renderer_is_available(OakRenderBackendHandle handle)
|
||||
{
|
||||
auto *r = Renderer(handle);
|
||||
if (!r || r->IsAvailable()) {
|
||||
return r && r->IsAvailable();
|
||||
auto *r = renderer(handle);
|
||||
if (!r || r->is_available()) {
|
||||
return r && r->is_available();
|
||||
}
|
||||
// Try to initialize if not already available
|
||||
if (r->Init()) {
|
||||
r->PostInit();
|
||||
if (r->init()) {
|
||||
r->post_init();
|
||||
}
|
||||
return r->IsAvailable();
|
||||
return r->is_available();
|
||||
}
|
||||
|
||||
// Initializes the Vulkan device path.
|
||||
OAK_RENDER_BACKEND_EXPORT bool oak_renderer_init(OakRenderBackendHandle handle)
|
||||
{
|
||||
return Renderer(handle)->Init();
|
||||
return renderer(handle)->init();
|
||||
}
|
||||
|
||||
// Vulkan does not use a QOpenGLContext; the argument is accepted for ABI parity.
|
||||
@@ -98,28 +98,28 @@ OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_init_with_context(OakRenderBackendHandle handle, void *context)
|
||||
{
|
||||
Q_UNUSED(context)
|
||||
Renderer(handle)->Init();
|
||||
renderer(handle)->init();
|
||||
}
|
||||
|
||||
// Creates reusable Vulkan resources after device initialization.
|
||||
OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_post_init(OakRenderBackendHandle handle)
|
||||
{
|
||||
Renderer(handle)->PostInit();
|
||||
renderer(handle)->post_init();
|
||||
}
|
||||
|
||||
// Reserved for API symmetry; Vulkan cleanup is handled by destroy_internal.
|
||||
OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_post_destroy(OakRenderBackendHandle handle)
|
||||
{
|
||||
Renderer(handle)->PostDestroy();
|
||||
renderer(handle)->post_destroy();
|
||||
}
|
||||
|
||||
// Releases all Vulkan resources owned by the renderer.
|
||||
OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_destroy_internal(OakRenderBackendHandle handle)
|
||||
{
|
||||
Renderer(handle)->DestroyInternal();
|
||||
renderer(handle)->destroy_internal();
|
||||
}
|
||||
|
||||
// Clears a Vulkan texture destination.
|
||||
@@ -127,7 +127,7 @@ OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_clear_destination(OakRenderBackendHandle handle, void *texture,
|
||||
double r, double g, double b, double a)
|
||||
{
|
||||
Renderer(handle)->ClearDestination(static_cast<olive::Texture *>(texture),
|
||||
renderer(handle)->clear_destination(static_cast<olive::Texture *>(texture),
|
||||
r, g, b, a);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ OAK_RENDER_BACKEND_EXPORT void oak_renderer_create_native_texture(
|
||||
int channel_count, const void *data, int linesize, void *out_variant)
|
||||
{
|
||||
*static_cast<QVariant *>(out_variant) =
|
||||
Renderer(handle)->CreateNativeTexture(
|
||||
renderer(handle)->create_native_texture(
|
||||
width, height, depth,
|
||||
static_cast<olive::PixelFormat::Format>(format), channel_count,
|
||||
data, linesize);
|
||||
@@ -148,7 +148,7 @@ OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_destroy_native_texture(OakRenderBackendHandle handle,
|
||||
const void *variant)
|
||||
{
|
||||
Renderer(handle)->DestroyNativeTexture(VariantRef(variant));
|
||||
renderer(handle)->destroy_native_texture(variant_ref(variant));
|
||||
}
|
||||
|
||||
// Compiles a Vulkan shader and returns its QVariant handle.
|
||||
@@ -157,7 +157,7 @@ oak_renderer_create_native_shader(OakRenderBackendHandle handle,
|
||||
const void *shader_code, void *out_variant)
|
||||
{
|
||||
*static_cast<QVariant *>(out_variant) =
|
||||
Renderer(handle)->CreateNativeShader(
|
||||
renderer(handle)->create_native_shader(
|
||||
*static_cast<const olive::ShaderCode *>(shader_code));
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ OAK_RENDER_BACKEND_EXPORT void
|
||||
oak_renderer_destroy_native_shader(OakRenderBackendHandle handle,
|
||||
const void *variant)
|
||||
{
|
||||
Renderer(handle)->DestroyNativeShader(VariantRef(variant));
|
||||
renderer(handle)->destroy_native_shader(variant_ref(variant));
|
||||
}
|
||||
|
||||
// Uploads CPU pixel data into a Vulkan texture.
|
||||
@@ -175,8 +175,8 @@ oak_renderer_upload_to_texture(OakRenderBackendHandle handle,
|
||||
const void *variant, const void *video_params,
|
||||
const void *data, int linesize)
|
||||
{
|
||||
Renderer(handle)->UploadToTexture(
|
||||
VariantRef(variant),
|
||||
renderer(handle)->upload_to_texture(
|
||||
variant_ref(variant),
|
||||
*static_cast<const olive::VideoParams *>(video_params), data, linesize);
|
||||
}
|
||||
|
||||
@@ -185,15 +185,15 @@ OAK_RENDER_BACKEND_EXPORT void oak_renderer_download_from_texture(
|
||||
OakRenderBackendHandle handle, const void *variant,
|
||||
const void *video_params, void *data, int linesize)
|
||||
{
|
||||
Renderer(handle)->DownloadFromTexture(
|
||||
VariantRef(variant),
|
||||
renderer(handle)->download_from_texture(
|
||||
variant_ref(variant),
|
||||
*static_cast<const olive::VideoParams *>(video_params), data, linesize);
|
||||
}
|
||||
|
||||
// Waits for all queued Vulkan work to finish.
|
||||
OAK_RENDER_BACKEND_EXPORT void oak_renderer_flush(OakRenderBackendHandle handle)
|
||||
{
|
||||
Renderer(handle)->Flush();
|
||||
renderer(handle)->flush();
|
||||
}
|
||||
|
||||
// Reads one pixel from a Vulkan texture.
|
||||
@@ -203,7 +203,7 @@ oak_renderer_get_pixel_from_texture(OakRenderBackendHandle handle,
|
||||
void *out_color)
|
||||
{
|
||||
*static_cast<olive::Color *>(out_color) =
|
||||
Renderer(handle)->GetPixelFromTexture(
|
||||
renderer(handle)->get_pixel_from_texture(
|
||||
static_cast<olive::Texture *>(texture),
|
||||
*static_cast<const QPointF *>(point));
|
||||
}
|
||||
@@ -215,8 +215,8 @@ OAK_RENDER_BACKEND_EXPORT void oak_renderer_blit(OakRenderBackendHandle handle,
|
||||
const void *destination_params,
|
||||
bool clear_destination)
|
||||
{
|
||||
Renderer(handle)->Blit(
|
||||
VariantRef(shader), *static_cast<olive::AcceleratedJob *>(job),
|
||||
renderer(handle)->blit(
|
||||
variant_ref(shader), *static_cast<olive::AcceleratedJob *>(job),
|
||||
static_cast<olive::Texture *>(destination),
|
||||
*static_cast<const olive::VideoParams *>(destination_params),
|
||||
clear_destination);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,8 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef VULKANRENDERER_H
|
||||
#define VULKANRENDERER_H
|
||||
#ifndef OAK_VULKANRENDERER_H
|
||||
#define OAK_VULKANRENDERER_H
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
@@ -42,67 +42,67 @@ public:
|
||||
|
||||
// Creates the Vulkan instance, logical device, command pool, and descriptor
|
||||
// pool required for offscreen rendering.
|
||||
virtual bool Init() override;
|
||||
virtual bool init() override;
|
||||
// Creates reusable GPU resources that require a fully initialized device.
|
||||
virtual void PostInit() override;
|
||||
virtual void post_init() override;
|
||||
// Reserved for symmetry with OpenGLRenderer; Vulkan cleanup is handled by
|
||||
// DestroyInternal().
|
||||
virtual void PostDestroy() override;
|
||||
virtual void post_destroy() override;
|
||||
|
||||
// Clears either a texture render target or the currently bound output target.
|
||||
virtual void ClearDestination(olive::Texture *texture = nullptr,
|
||||
virtual void clear_destination(olive::Texture *texture = nullptr,
|
||||
double r = 0.0, double g = 0.0,
|
||||
double b = 0.0, double a = 0.0) override;
|
||||
|
||||
// Compiles GLSL to SPIR-V, creates shader modules, and prepares descriptor
|
||||
// metadata for later blits.
|
||||
virtual QVariant CreateNativeShader(olive::ShaderCode code) override;
|
||||
virtual QVariant create_native_shader(olive::ShaderCode code) override;
|
||||
// Destroys shader modules, descriptor layout, pipeline layout, and cached
|
||||
// pipelines associated with a shader handle.
|
||||
virtual void DestroyNativeShader(QVariant shader) override;
|
||||
virtual void destroy_native_shader(QVariant shader) override;
|
||||
|
||||
// Uploads CPU pixel data to a Vulkan image via a staging buffer.
|
||||
virtual void UploadToTexture(const QVariant &handle,
|
||||
virtual void upload_to_texture(const QVariant &handle,
|
||||
const VideoParams ¶ms, const void *data,
|
||||
int linesize) override;
|
||||
// Downloads a Vulkan image to CPU memory via a staging buffer.
|
||||
virtual void DownloadFromTexture(const QVariant &handle,
|
||||
virtual void download_from_texture(const QVariant &handle,
|
||||
const VideoParams ¶ms, void *data,
|
||||
int linesize) override;
|
||||
|
||||
// Waits for outstanding device work to complete.
|
||||
virtual void Flush() override;
|
||||
virtual void flush() override;
|
||||
|
||||
virtual bool IsVulkan() const override
|
||||
virtual bool is_vulkan() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reads a single texture pixel using a one-pixel transfer readback.
|
||||
virtual Color GetPixelFromTexture(olive::Texture *texture,
|
||||
virtual Color get_pixel_from_texture(olive::Texture *texture,
|
||||
const QPointF &pt) override;
|
||||
|
||||
bool IsAvailable() const
|
||||
bool is_available() const
|
||||
{
|
||||
return device_ != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Runs one or more fullscreen shader passes into the destination texture.
|
||||
virtual void Blit(QVariant shader, olive::AcceleratedJob &job,
|
||||
virtual void blit(QVariant shader, olive::AcceleratedJob &job,
|
||||
olive::Texture *destination,
|
||||
VideoParams destination_params,
|
||||
bool clear_destination) override;
|
||||
// Creates a Vulkan image/view/memory bundle and optionally uploads initial
|
||||
// pixel data.
|
||||
virtual QVariant CreateNativeTexture(int width, int height, int depth,
|
||||
virtual QVariant create_native_texture(int width, int height, int depth,
|
||||
PixelFormat format, int channel_count,
|
||||
const void *data = nullptr,
|
||||
int linesize = 0) override;
|
||||
// Releases a Vulkan texture bundle.
|
||||
virtual void DestroyNativeTexture(QVariant texture) override;
|
||||
virtual void destroy_native_texture(QVariant texture) override;
|
||||
// Releases all Vulkan device resources owned by this renderer.
|
||||
virtual void DestroyInternal() override;
|
||||
virtual void destroy_internal() override;
|
||||
|
||||
private:
|
||||
struct VulkanTexture;
|
||||
@@ -111,113 +111,113 @@ private:
|
||||
struct StagingBuffer;
|
||||
|
||||
// Creates the Vulkan instance used for all offscreen work.
|
||||
bool CreateInstance();
|
||||
bool create_instance();
|
||||
// Creates the debug messenger when validation layers are available.
|
||||
bool CreateDebugMessenger();
|
||||
bool create_debug_messenger();
|
||||
// Destroys the debug messenger before the instance is destroyed.
|
||||
void DestroyDebugMessenger();
|
||||
void destroy_debug_messenger();
|
||||
// Validation layer callback; logs errors/warnings so synchronization issues
|
||||
// are visible before they become GPU hangs.
|
||||
static VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
|
||||
void *pUserData);
|
||||
debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT message_type,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT *p_callback_data,
|
||||
void *p_user_data);
|
||||
// Chooses a graphics-capable physical device and creates the logical device.
|
||||
bool CreateDevice();
|
||||
bool create_device();
|
||||
// Creates a command pool for short-lived command buffers.
|
||||
bool CreateCommandPool();
|
||||
bool create_command_pool();
|
||||
// Creates the descriptor pool used for per-blit UBO/sampler sets.
|
||||
bool CreateDescriptorPool();
|
||||
bool create_descriptor_pool();
|
||||
// Uploads the fullscreen quad vertex buffer used by BlitPass().
|
||||
bool CreateVertexBuffer();
|
||||
bool create_vertex_buffer();
|
||||
// Creates the persistent linear sampler.
|
||||
bool CreateLinearSampler();
|
||||
bool create_linear_sampler();
|
||||
// Creates the persistent nearest-neighbor sampler.
|
||||
bool CreateNearestSampler();
|
||||
bool create_nearest_sampler();
|
||||
// Returns the persistent sampler matching the requested interpolation mode.
|
||||
VkSampler GetSampler(Texture::Interpolation interpolation) const;
|
||||
VkSampler get_sampler(Texture::Interpolation interpolation) const;
|
||||
// Allocates a host-visible staging buffer for upload/download transfers.
|
||||
bool CreateStagingBuffer(VkDeviceSize size, VkBuffer *out_buffer,
|
||||
bool create_staging_buffer(VkDeviceSize size, VkBuffer *out_buffer,
|
||||
VkDeviceMemory *out_memory);
|
||||
// Destroys a staging buffer pair allocated by CreateStagingBuffer().
|
||||
void DestroyStagingBuffer(VkBuffer buffer, VkDeviceMemory memory);
|
||||
void destroy_staging_buffer(VkBuffer buffer, VkDeviceMemory memory);
|
||||
|
||||
// Begins a one-shot command buffer and records it immediately.
|
||||
VkCommandBuffer BeginOneTimeCommands();
|
||||
VkCommandBuffer begin_one_time_commands();
|
||||
// Submits and waits for a one-shot command buffer.
|
||||
void EndOneTimeCommands(VkCommandBuffer cmd);
|
||||
void end_one_time_commands(VkCommandBuffer cmd);
|
||||
|
||||
// Emits an image memory barrier for the subset of layouts this renderer uses.
|
||||
void TransitionImageLayout(VkCommandBuffer cmd, VkImage image,
|
||||
void transition_image_layout(VkCommandBuffer cmd, VkImage image,
|
||||
VkImageLayout old_layout,
|
||||
VkImageLayout new_layout);
|
||||
// Records a tightly packed buffer-to-image copy.
|
||||
void CopyBufferToImage(VkCommandBuffer cmd, VkBuffer buffer, VkImage image,
|
||||
void copy_buffer_to_image(VkCommandBuffer cmd, VkBuffer buffer, VkImage image,
|
||||
uint32_t width, uint32_t height, uint32_t depth);
|
||||
// Records an image-to-buffer copy, optionally reading one pixel offset.
|
||||
void CopyImageToBuffer(VkCommandBuffer cmd, VkImage image, VkBuffer buffer,
|
||||
void copy_image_to_buffer(VkCommandBuffer cmd, VkImage image, VkBuffer buffer,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t offset_x = 0, uint32_t offset_y = 0);
|
||||
|
||||
// Converts Oak pixel format/channel metadata to a preferred Vulkan format.
|
||||
VkFormat PixelFormatToVkFormat(PixelFormat format, int channel_count) const;
|
||||
VkFormat pixel_format_to_vk_format(PixelFormat format, int channel_count) const;
|
||||
// Picks a color-attachment-capable format, falling back from RGB to RGBA
|
||||
// where drivers do not support 3-channel render targets.
|
||||
VkFormat PickRenderableFormat(PixelFormat format, int channel_count) const;
|
||||
VkFormat pick_renderable_format(PixelFormat format, int channel_count) const;
|
||||
// Checks whether a format can be used as a render target.
|
||||
bool IsColorAttachmentSupported(VkFormat format) const;
|
||||
bool is_color_attachment_supported(VkFormat format) const;
|
||||
// Returns the packed byte size for supported VkFormat values.
|
||||
int GetVkFormatBytesPerPixel(VkFormat format) const;
|
||||
int get_vk_format_bytes_per_pixel(VkFormat format) const;
|
||||
// Returns the alpha fill value used when expanding RGB data to RGBA.
|
||||
float GetFormatMaxAlpha(PixelFormat format) const;
|
||||
float get_format_max_alpha(PixelFormat format) const;
|
||||
// Repackages tightly packed pixels when the requested CPU channel count
|
||||
// differs from the selected GPU format channel count.
|
||||
void CopyPixelsWithChannelConversion(const void *src, void *dst, int width,
|
||||
void copy_pixels_with_channel_conversion(const void *src, void *dst, int width,
|
||||
int height, int depth,
|
||||
int src_channels, int dst_channels,
|
||||
PixelFormat format) const;
|
||||
// Rounds a size up to the requested alignment.
|
||||
VkDeviceSize AlignSize(VkDeviceSize size, VkDeviceSize alignment) const;
|
||||
VkDeviceSize align_size(VkDeviceSize size, VkDeviceSize alignment) const;
|
||||
|
||||
// Finds a Vulkan memory type matching the requested properties.
|
||||
uint32_t FindMemoryType(uint32_t type_filter,
|
||||
uint32_t find_memory_type(uint32_t type_filter,
|
||||
VkMemoryPropertyFlags properties) const;
|
||||
|
||||
// Compiles GLSL source into SPIR-V using shaderc when available.
|
||||
bool CompileGlslToSpv(const QString &glsl, VkShaderStageFlagBits stage,
|
||||
bool compile_glsl_to_spv(const QString &glsl, VkShaderStageFlagBits stage,
|
||||
QByteArray *out_spv);
|
||||
// Rewrites an Oak GLSL shader into Vulkan-compatible GLSL.
|
||||
QString ConvertGlslToVulkan(const QString &glsl,
|
||||
QString convert_glsl_to_vulkan(const QString &glsl,
|
||||
VkShaderStageFlagBits stage);
|
||||
// Ensures a shader declares a Vulkan-compatible GLSL version.
|
||||
QString EnsureGlslVersion450(const QString &glsl) const;
|
||||
QString ensure_glsl_version450(const QString &glsl) const;
|
||||
// Extracts uniforms and sampler names from GLSL declarations.
|
||||
void ExtractUniforms(const QString &glsl,
|
||||
void extract_uniforms(const QString &glsl,
|
||||
QVector<UniformInfo> *out_uniforms,
|
||||
QVector<QString> *out_samplers) const;
|
||||
// Computes std140 offsets and total UBO size for extracted uniforms.
|
||||
void ComputeUniformLayout(QVector<UniformInfo> *uniforms) const;
|
||||
void compute_uniform_layout(QVector<UniformInfo> *uniforms) const;
|
||||
// Builds the generated uniform block used by rewritten shaders.
|
||||
QString BuildUboBlock(const QVector<UniformInfo> &uniforms) const;
|
||||
QString build_ubo_block(const QVector<UniformInfo> &uniforms) const;
|
||||
// Rewrites standalone uniforms and samplers into explicit UBO/sampler
|
||||
// bindings accepted by Vulkan GLSL.
|
||||
QString
|
||||
RewriteShaderWithUbo(const QString &glsl,
|
||||
rewrite_shader_with_ubo(const QString &glsl,
|
||||
const QVector<UniformInfo> &all_uniforms,
|
||||
const QHash<QString, int> &sampler_bindings) const;
|
||||
// Returns std140 storage size for a supported GLSL type.
|
||||
VkDeviceSize GetStd140Size(const QString &type) const;
|
||||
VkDeviceSize get_std140_size(const QString &type) const;
|
||||
// Returns std140 alignment for a supported GLSL type.
|
||||
VkDeviceSize GetStd140Alignment(const QString &type) const;
|
||||
VkDeviceSize get_std140_alignment(const QString &type) const;
|
||||
|
||||
// Creates or retrieves the graphics pipeline for a shader/render format pair.
|
||||
bool CreatePipelineForShader(VulkanShader *shader,
|
||||
bool create_pipeline_for_shader(VulkanShader *shader,
|
||||
const VideoParams &dest_params,
|
||||
VkFormat render_pass_format);
|
||||
|
||||
// Caches simple single-color-attachment render passes by format/clear mode.
|
||||
VkRenderPass GetOrCreateRenderPass(VkFormat format, bool clear);
|
||||
VkRenderPass get_or_create_render_pass(VkFormat format, bool clear);
|
||||
|
||||
struct TextureBinding {
|
||||
QString name;
|
||||
@@ -226,7 +226,7 @@ private:
|
||||
};
|
||||
|
||||
// Executes one fullscreen pass with the provided texture bindings and UBO.
|
||||
void BlitPass(VulkanShader *shader, VulkanTexture *dest_tex,
|
||||
void blit_pass(VulkanShader *shader, VulkanTexture *dest_tex,
|
||||
const QVector<TextureBinding> &bindings,
|
||||
const QByteArray &ubo_data,
|
||||
const VideoParams &destination_params, bool clear_destination,
|
||||
@@ -269,9 +269,9 @@ private:
|
||||
quint64 next_shader_id_ = 1;
|
||||
QHash<quint64, VulkanShader *> shaders_;
|
||||
|
||||
static const int kMaxDescriptorSets = 1024;
|
||||
static const int k_max_descriptor_sets = 1024;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // VULKANRENDERER_H
|
||||
#endif // OAK_VULKANRENDERER_H
|
||||
|
||||
Reference in New Issue
Block a user