Edit

kc3-lang/angle/src/libANGLE/renderer/vulkan/ProgramPipelineVk.h

Branch :

  • Show log

    Commit

  • Author : Tim Van Patten
    Date : 2021-02-04 20:44:15
    Hash : a9de5d99
    Message : Vulkan: setAllDefaultUniformsDirty after createPipelineLayout The default uniform descriptor set is reset while recreating the pipeline layout during handling of immutable samplers and then is never re-allocated and bound before the next draw. The call stack to allocate the program uniforms descriptor set: ProgramExecutableVk::allocUniformAndXfbDescriptorSet ProgramVk::updateUniforms ContextVk::setupDraw ContextVk::drawArrays Context::drawArrays Unfortunately, this occurs before the pipeline layout is reset (and the descriptor sets are reset) due to the presence of an immutable sampler: ProgramExecutableVk::reset <<---- mDescriptorSets.fill(VK_NULL_HANDLE); ProgramExecutableVk::createPipelineLayout ContextVk::updateActiveTextures ContextVk::invalidateCurrentTextures ContextVk::syncState Context::syncDirtyBits Context::prepareForDraw Context::drawArrays This CL calls setAllDefaultUniformsDirty() for the Program/PPO to ensure the default uniforms descriptor sets are re-allocated and re-bound before the next draw command. Bug: b/178424566 Bug: angleproject:5624 Test: CtsCameraTestCases Change-Id: If54a9f2cc09809a5103bc3eac641c77f56362229 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2677385 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>

  • src/libANGLE/renderer/vulkan/ProgramPipelineVk.h
  • //
    // Copyright 2017 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // ProgramPipelineVk.h:
    //    Defines the class interface for ProgramPipelineVk, implementing ProgramPipelineImpl.
    //
    
    #ifndef LIBANGLE_RENDERER_VULKAN_PROGRAMPIPELINEVK_H_
    #define LIBANGLE_RENDERER_VULKAN_PROGRAMPIPELINEVK_H_
    
    #include "libANGLE/renderer/ProgramPipelineImpl.h"
    
    #include "libANGLE/renderer/vulkan/ContextVk.h"
    #include "libANGLE/renderer/vulkan/ProgramExecutableVk.h"
    #include "libANGLE/renderer/vulkan/ProgramVk.h"
    
    namespace rx
    {
    
    class ProgramPipelineVk : public ProgramPipelineImpl
    {
      public:
        ProgramPipelineVk(const gl::ProgramPipelineState &state);
        ~ProgramPipelineVk() override;
    
        void destroy(const gl::Context *context) override;
        void reset(ContextVk *contextVk);
    
        const ProgramExecutableVk &getExecutable() const { return mExecutable; }
        ProgramExecutableVk &getExecutable() { return mExecutable; }
    
        ProgramVk *getShaderProgram(const gl::State &glState, gl::ShaderType shaderType) const
        {
            gl::ProgramPipeline *pipeline = glState.getProgramPipeline();
            const gl::Program *program    = pipeline->getShaderProgram(shaderType);
            if (program)
            {
                return vk::GetImpl(program);
            }
            return nullptr;
        }
    
        void fillProgramStateMap(const ContextVk *contextVk,
                                 gl::ShaderMap<const gl::ProgramState *> *programStatesOut);
    
        angle::Result link(const gl::Context *glContext,
                           const gl::ProgramMergedVaryings &mergedVaryings,
                           const gl::ProgramVaryingPacking &varyingPacking) override;
    
        angle::Result updateUniforms(ContextVk *contextVk);
    
        void setAllDefaultUniformsDirty(const gl::State &glState);
        bool dirtyUniforms(const gl::State &glState);
        void onProgramBind(ContextVk *contextVk);
    
      private:
        size_t calcUniformUpdateRequiredSpace(ContextVk *contextVk,
                                              const gl::ProgramExecutable &glExecutable,
                                              const gl::State &glState,
                                              gl::ShaderMap<VkDeviceSize> *uniformOffsets) const;
    
        ProgramExecutableVk mExecutable;
    };
    
    }  // namespace rx
    
    #endif  // LIBANGLE_RENDERER_VULKAN_PROGRAMPIPELINEVK_H_