/* Copyright (c) 2024 LunarG, Inc. * * 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 "pass.h" #include "module.h" #include "gpu/shaders/gpu_error_codes.h" namespace gpu { namespace spirv { const Variable& Pass::GetBuiltinVariable(uint32_t built_in) { … } // To reduce having to load this information everytime we do a OpFunctionCall, instead just create it once per Function block and // reference it each time uint32_t Pass::GetStageInfo(Function& function, BasicBlockIt target_block_it, InstructionIt& target_inst_it) { … } const Instruction* Pass::GetDecoration(uint32_t id, spv::Decoration decoration) { … } const Instruction* Pass::GetMemeberDecoration(uint32_t id, uint32_t member_index, spv::Decoration decoration) { … } // Find outermost buffer type and its access chain index. // Because access chains indexes can be runtime values, we need to build arithmetic logic in the SPIR-V to get the runtime value of // the indexing uint32_t Pass::GetLastByte(const Instruction& var_inst, const Instruction& access_chain_inst, BasicBlock& block, InstructionIt* inst_it) { … } // Generate code to convert integer id to 32bit, if needed. uint32_t Pass::ConvertTo32(uint32_t id, BasicBlock& block, InstructionIt* inst_it) { … } // Generate code to cast integer it to 32bit unsigned, if needed. uint32_t Pass::CastToUint32(uint32_t id, BasicBlock& block, InstructionIt* inst_it) { … } InstructionIt Pass::FindTargetInstruction(BasicBlock& block) const { … } } // namespace spirv } // namespace gpu