chromium/third_party/vulkan-validation-layers/src/layers/state_tracker/pipeline_state.cpp

/* Copyright (c) 2015-2024 The Khronos Group Inc.
 * Copyright (c) 2015-2024 Valve Corporation
 * Copyright (c) 2015-2024 LunarG, Inc.
 * Copyright (C) 2015-2024 Google Inc.
 * Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "state_tracker/pipeline_state.h"
#include "state_tracker/descriptor_sets.h"
#include "state_tracker/cmd_buffer_state.h"
#include "state_tracker/render_pass_state.h"
#include "state_tracker/state_object.h"
#include "generated/enum_flag_bits.h"
#include "state_tracker/shader_object_state.h"
#include "chassis/chassis_modification_state.h"

namespace vvl {

static vku::safe_VkGraphicsPipelineCreateInfo MakeGraphicsCreateInfo(const VkGraphicsPipelineCreateInfo &ci,
                                                                    std::shared_ptr<const vvl::RenderPass> rpstate,
                                                                    const ValidationStateTracker &state_data) {}

// static
std::vector<ShaderStageState> Pipeline::GetStageStates(const ValidationStateTracker &state_data, const Pipeline &pipe_state,
                                                       spirv::StatelessData *stateless_data) {}

static uint32_t GetCreateInfoShaders(const Pipeline &pipe_state) {}

static uint32_t GetLinkingShaders(const VkPipelineLibraryCreateInfoKHR *link_info, const ValidationStateTracker &state_data) {}

static CBDynamicFlags GetGraphicsDynamicState(Pipeline &pipe_state) {}

static CBDynamicFlags GetRayTracingDynamicState(Pipeline &pipe_state) {}

static bool UsesPipelineRobustness(const void *pNext, const Pipeline &pipe_state) {}

static bool UsesPipelineVertexRobustness(const void *pNext, const Pipeline &pipe_state) {}

static bool IgnoreColorAttachments(const ValidationStateTracker &state_data, Pipeline &pipe_state) {}

static bool UsesShaderModuleId(const Pipeline &pipe_state) {}

static vvl::unordered_set<uint32_t> GetFSOutputLocations(const std::vector<ShaderStageState> &stage_states) {}

static VkPrimitiveTopology GetTopologyAtRasterizer(const Pipeline &pipeline) {}

static VkPipelineCreateFlags2KHR GetPipelineCreateFlags(const void *pNext, VkPipelineCreateFlags flags) {}

// static
std::shared_ptr<VertexInputState> Pipeline::CreateVertexInputState(const Pipeline &p, const ValidationStateTracker &state,
                                                                   const vku::safe_VkGraphicsPipelineCreateInfo &create_info) {}

// static
std::shared_ptr<PreRasterState> Pipeline::CreatePreRasterState(
    const Pipeline &p, const ValidationStateTracker &state, const vku::safe_VkGraphicsPipelineCreateInfo &create_info,
    const std::shared_ptr<const vvl::RenderPass> &rp, spirv::StatelessData stateless_data[kCommonMaxGraphicsShaderStages]) {}

// static
std::shared_ptr<FragmentShaderState> Pipeline::CreateFragmentShaderState(
    const Pipeline &p, const ValidationStateTracker &state, const VkGraphicsPipelineCreateInfo &create_info,
    const vku::safe_VkGraphicsPipelineCreateInfo &safe_create_info, const std::shared_ptr<const vvl::RenderPass> &rp,
    spirv::StatelessData stateless_data[kCommonMaxGraphicsShaderStages]) {}

// static
// Pointers that should be ignored have been set to null in safe_create_info, but if this is a graphics library we need the "raw"
// create_info.
std::shared_ptr<FragmentOutputState> Pipeline::CreateFragmentOutputState(
    const Pipeline &p, const ValidationStateTracker &state, const VkGraphicsPipelineCreateInfo &create_info,
    const vku::safe_VkGraphicsPipelineCreateInfo &safe_create_info, const std::shared_ptr<const vvl::RenderPass> &rp) {}

std::vector<std::shared_ptr<const vvl::PipelineLayout>> Pipeline::PipelineLayoutStateUnion() const {}

// TODO (ncesario) this needs to be automated. As a first step, need to leverage SubState::ValidShaderStages()
// Currently will return vvl::ShaderModule with no SPIR-V
std::shared_ptr<const vvl::ShaderModule> Pipeline::GetSubStateShader(VkShaderStageFlagBits state) const {}

Pipeline::Pipeline(const ValidationStateTracker &state_data, const VkGraphicsPipelineCreateInfo *pCreateInfo,
                   std::shared_ptr<const vvl::PipelineCache> &&pipe_cache, std::shared_ptr<const vvl::RenderPass> &&rpstate,
                   std::shared_ptr<const vvl::PipelineLayout> &&layout,
                   spirv::StatelessData stateless_data[kCommonMaxGraphicsShaderStages])
    :{}

Pipeline::Pipeline(const ValidationStateTracker &state_data, const VkComputePipelineCreateInfo *pCreateInfo,
                   std::shared_ptr<const vvl::PipelineCache> &&pipe_cache, std::shared_ptr<const vvl::PipelineLayout> &&layout,
                   spirv::StatelessData *stateless_data)
    :{}

Pipeline::Pipeline(const ValidationStateTracker &state_data, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
                   std::shared_ptr<const vvl::PipelineCache> &&pipe_cache, std::shared_ptr<const vvl::PipelineLayout> &&layout,
                   spirv::StatelessData *stateless_data)
    :{}

Pipeline::Pipeline(const ValidationStateTracker &state_data, const VkRayTracingPipelineCreateInfoNV *pCreateInfo,
                   std::shared_ptr<const vvl::PipelineCache> &&pipe_cache, std::shared_ptr<const vvl::PipelineLayout> &&layout,
                   spirv::StatelessData *stateless_data)
    :{}

}  // namespace vvl

void LastBound::UnbindAndResetPushDescriptorSet(std::shared_ptr<vvl::DescriptorSet> &&ds) {}

void LastBound::Reset() {}

bool LastBound::IsDepthTestEnable() const {}

bool LastBound::IsDepthBoundTestEnable() const {}

bool LastBound::IsDepthWriteEnable() const {}

bool LastBound::IsDepthBiasEnable() const {}

bool LastBound::IsStencilTestEnable() const {}

VkStencilOpState LastBound::GetStencilOpStateFront() const {}

VkStencilOpState LastBound::GetStencilOpStateBack() const {}

VkSampleCountFlagBits LastBound::GetRasterizationSamples() const {}

bool LastBound::IsRasterizationDisabled() const {}

bool LastBound::IsLogicOpEnabled() const {}

VkColorComponentFlags LastBound::GetColorWriteMask(uint32_t i) const {}

bool LastBound::IsColorWriteEnabled(uint32_t i) const {}

VkPrimitiveTopology LastBound::GetPrimitiveTopology() const {}

VkCullModeFlags LastBound::GetCullMode() const {}

VkConservativeRasterizationModeEXT LastBound::GetConservativeRasterizationMode() const {}

bool LastBound::IsSampleLocationsEnable() const {}

bool LastBound::IsExclusiveScissorEnabled() const {}

bool LastBound::IsCoverageToColorEnabled() const {}

bool LastBound::IsCoverageModulationTableEnable() const {}

VkCoverageModulationModeNV LastBound::GetCoverageModulationMode() const {}

bool LastBound::ValidShaderObjectCombination(const VkPipelineBindPoint bind_point, const DeviceFeatures &device_features) const {}

VkShaderEXT LastBound::GetShader(ShaderObjectStage stage) const {}

vvl::ShaderObject *LastBound::GetShaderState(ShaderObjectStage stage) const {}

bool LastBound::HasShaderObjects() const {}

bool LastBound::IsValidShaderBound(ShaderObjectStage stage) const {}

bool LastBound::IsValidShaderOrNullBound(ShaderObjectStage stage) const {}

std::vector<vvl::ShaderObject *> LastBound::GetAllBoundGraphicsShaders() {}

bool LastBound::IsAnyGraphicsShaderBound() const {}

bool LastBound::IsBoundSetCompatible(uint32_t set, const vvl::PipelineLayout &pipeline_layout) const {}

bool LastBound::IsBoundSetCompatible(uint32_t set, const vvl::ShaderObject &shader_object_state) const {
    if ((set >= per_set.size()) || (set >= shader_object_state.set_compat_ids.size())) {
        return false;
    }
    return (*(per_set[set].compat_id_for_set) == *(shader_object_state.set_compat_ids[set]));
};

std::string LastBound::DescribeNonCompatibleSet(uint32_t set, const vvl::PipelineLayout &pipeline_layout) const {}

std::string LastBound::DescribeNonCompatibleSet(uint32_t set, const vvl::ShaderObject &shader_object_state) const {}

const spirv::EntryPoint *LastBound::GetFragmentEntryPoint() const {}