Make Vulkan shader/UBO/layout path real enough for end-to-end blits
- Add shared UBO layout across vertex + fragment stages so vertex uniforms like ove_mvpmat compile and bind correctly. - Rewrite uniform extraction/injection to avoid corrupting the UBO block and to keep explicit sampler bindings stable. - Make the UBO and sampler descriptor bindings visible to both vertex and fragment stages. - Add layout locations for vertex varyings (ove_texcoord) and fragment inputs so SPIR-V generation succeeds. - Extend TransitionImageLayout() to cover all layout pairs used by upload/download/clear/blit. - Add subpass dependencies to the cached render pass and leave destinations in SHADER_READ_ONLY_OPTIMAL after Blit(). - Move descriptor allocation before command recording and abort cleanly if allocation fails; switch Blit() to the persistent linear sampler. - Add a gtest that creates a Vulkan backend, uploads a red U8 RGBA texture, blits through the default pass-through shader, and verifies the downloaded pixel is red. This test passes on the current system. ctest passes 4/4; DynamicRenderBackend.* passes 3/1 (Vulkan fallback skipped because Vulkan is available).
This commit is contained in:
@@ -115,9 +115,14 @@ private:
|
||||
bool CompileGlslToSpv(const QString &glsl, VkShaderStageFlagBits stage,
|
||||
QByteArray *out_spv);
|
||||
QString ConvertGlslToVulkan(const QString &glsl, VkShaderStageFlagBits stage);
|
||||
QString ConvertGlslUniformsToUbo(const QString &glsl,
|
||||
QVector<UniformInfo> *out_uniforms,
|
||||
int *out_sampler_count = nullptr);
|
||||
QString EnsureGlslVersion450(const QString &glsl) const;
|
||||
void ExtractUniforms(const QString &glsl, QVector<UniformInfo> *out_uniforms,
|
||||
QVector<QString> *out_samplers) const;
|
||||
void ComputeUniformLayout(QVector<UniformInfo> *uniforms) const;
|
||||
QString BuildUboBlock(const QVector<UniformInfo> &uniforms) const;
|
||||
QString RewriteShaderWithUbo(const QString &glsl,
|
||||
const QVector<UniformInfo> &all_uniforms,
|
||||
const QHash<QString, int> &sampler_bindings) const;
|
||||
VkDeviceSize GetStd140Size(const QString &type) const;
|
||||
VkDeviceSize GetStd140Alignment(const QString &type) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user