clang format

This commit is contained in:
IndecisiveTurtle 2024-12-23 15:51:35 +02:00
parent 3485a30337
commit 0925d58924
4 changed files with 23 additions and 20 deletions

View file

@ -65,7 +65,8 @@ struct QuadRectListEmitter : public Sirit::Module {
std::array<Id, 3> point_coord_equal; std::array<Id, 3> point_coord_equal;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
// point_coord_equal[i] = equal(gl_in[i].gl_Position.xy, gl_in[(i + 1) % 3].gl_Position.xy); // point_coord_equal[i] = equal(gl_in[i].gl_Position.xy, gl_in[(i + 1) %
// 3].gl_Position.xy);
const Id pos_l_xy{OpVectorShuffle(vec2_id, pos[i], pos[i], 0, 1)}; const Id pos_l_xy{OpVectorShuffle(vec2_id, pos[i], pos[i], 0, 1)};
const Id pos_r_xy{OpVectorShuffle(vec2_id, pos[(i + 1) % 3], pos[(i + 1) % 3], 0, 1)}; const Id pos_r_xy{OpVectorShuffle(vec2_id, pos[(i + 1) % 3], pos[(i + 1) % 3], 0, 1)};
point_coord_equal[i] = OpFOrdEqual(bvec2_id, pos_l_xy, pos_r_xy); point_coord_equal[i] = OpFOrdEqual(bvec2_id, pos_l_xy, pos_r_xy);
@ -104,7 +105,8 @@ struct QuadRectListEmitter : public Sirit::Module {
const Id invocation_3{OpIEqual(bool_id, invocation_id, Int(3))}; const Id invocation_3{OpIEqual(bool_id, invocation_id, Int(3))};
const Id index{OpSMod(int_id, OpIAdd(int_id, vertex_index, invocation_id), Int(3))}; const Id index{OpSMod(int_id, OpIAdd(int_id, vertex_index, invocation_id), Int(3))};
// gl_out[gl_InvocationID].gl_Position = gl_InvocationID == 3 ? pos3 : gl_in[index].gl_Position; // gl_out[gl_InvocationID].gl_Position = gl_InvocationID == 3 ? pos3 :
// gl_in[index].gl_Position;
const Id pos3{interpolate(pos[0], pos[1], pos[2])}; const Id pos3{interpolate(pos[0], pos[1], pos[2])};
const Id in_ptr{OpAccessChain(input_vec4, gl_in, index, Int(0))}; const Id in_ptr{OpAccessChain(input_vec4, gl_in, index, Int(0))};
const Id position{OpSelect(vec4_id, invocation_3, pos3, OpLoad(vec4_id, in_ptr))}; const Id position{OpSelect(vec4_id, invocation_3, pos3, OpLoad(vec4_id, in_ptr))};
@ -136,7 +138,8 @@ struct QuadRectListEmitter : public Sirit::Module {
const Id invocation_id{OpLoad(int_id, gl_invocation_id)}; const Id invocation_id{OpLoad(int_id, gl_invocation_id)};
// gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; // gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
const Id in_position{OpLoad(vec4_id, OpAccessChain(input_vec4, gl_in, invocation_id, Int(0)))}; const Id in_position{
OpLoad(vec4_id, OpAccessChain(input_vec4, gl_in, invocation_id, Int(0)))};
OpStore(OpAccessChain(output_vec4, gl_out, invocation_id, Int(0)), in_position); OpStore(OpAccessChain(output_vec4, gl_out, invocation_id, Int(0)), in_position);
for (int i = 0; i < num_attribs; i++) { for (int i = 0; i < num_attribs; i++) {
@ -303,5 +306,4 @@ std::vector<u32> EmitAuxilaryTessShader(AuxShaderType type, size_t num_attribs)
return ctx.Assemble(); return ctx.Assemble();
} }
} // namespace Shader::Backend::SPIRV } // namespace Shader::Backend::SPIRV

View file

@ -7,26 +7,26 @@
#include <boost/container/static_vector.hpp> #include <boost/container/static_vector.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/scope_exit.h"
#include "common/io_file.h" #include "common/io_file.h"
#include "common/scope_exit.h"
#include "shader_recompiler/backend/spirv/emit_spirv_quad_rect.h" #include "shader_recompiler/backend/spirv/emit_spirv_quad_rect.h"
#include "shader_recompiler/frontend/fetch_shader.h" #include "shader_recompiler/frontend/fetch_shader.h"
#include "shader_recompiler/runtime_info.h" #include "shader_recompiler/runtime_info.h"
#include "video_core/amdgpu/resource.h" #include "video_core/amdgpu/resource.h"
#include "video_core/buffer_cache/buffer_cache.h" #include "video_core/buffer_cache/buffer_cache.h"
#include "video_core/renderer_vulkan/vk_graphics_pipeline.h" #include "video_core/renderer_vulkan/vk_graphics_pipeline.h"
#include "video_core/renderer_vulkan/vk_shader_util.h"
#include "video_core/renderer_vulkan/vk_instance.h" #include "video_core/renderer_vulkan/vk_instance.h"
#include "video_core/renderer_vulkan/vk_scheduler.h" #include "video_core/renderer_vulkan/vk_scheduler.h"
#include "video_core/renderer_vulkan/vk_shader_util.h"
#include "video_core/texture_cache/texture_cache.h" #include "video_core/texture_cache/texture_cache.h"
namespace Vulkan { namespace Vulkan {
using Shader::Backend::SPIRV::AuxShaderType; using Shader::Backend::SPIRV::AuxShaderType;
GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& scheduler_, GraphicsPipeline::GraphicsPipeline(
DescriptorHeap& desc_heap_, const GraphicsPipelineKey& key_, const Instance& instance_, Scheduler& scheduler_, DescriptorHeap& desc_heap_,
vk::PipelineCache pipeline_cache, const GraphicsPipelineKey& key_, vk::PipelineCache pipeline_cache,
std::span<const Shader::Info*, MaxShaderStages> infos, std::span<const Shader::Info*, MaxShaderStages> infos,
std::span<const Shader::RuntimeInfo, MaxShaderStages> runtime_infos, std::span<const Shader::RuntimeInfo, MaxShaderStages> runtime_infos,
std::optional<const Shader::Gcn::FetchShaderData> fetch_shader_, std::optional<const Shader::Gcn::FetchShaderData> fetch_shader_,
@ -251,7 +251,8 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& schedul
.pName = "main", .pName = "main",
}); });
} else if (is_rect_list) { } else if (is_rect_list) {
auto tes = Shader::Backend::SPIRV::EmitAuxilaryTessShader(AuxShaderType::PassthroughTES, num_fs_inputs); auto tes = Shader::Backend::SPIRV::EmitAuxilaryTessShader(AuxShaderType::PassthroughTES,
num_fs_inputs);
shader_stages.emplace_back(vk::PipelineShaderStageCreateInfo{ shader_stages.emplace_back(vk::PipelineShaderStageCreateInfo{
.stage = vk::ShaderStageFlagBits::eTessellationEvaluation, .stage = vk::ShaderStageFlagBits::eTessellationEvaluation,
.module = CompileSPV(tes, instance.GetDevice()), .module = CompileSPV(tes, instance.GetDevice()),

View file

@ -221,9 +221,9 @@ const GraphicsPipeline* PipelineCache::GetGraphicsPipeline() {
} }
const auto [it, is_new] = graphics_pipelines.try_emplace(graphics_key); const auto [it, is_new] = graphics_pipelines.try_emplace(graphics_key);
if (is_new) { if (is_new) {
it.value() = it.value() = std::make_unique<GraphicsPipeline>(instance, scheduler, desc_heap,
std::make_unique<GraphicsPipeline>(instance, scheduler, desc_heap, graphics_key, graphics_key, *pipeline_cache, infos,
*pipeline_cache, infos, runtime_infos, fetch_shader, modules); runtime_infos, fetch_shader, modules);
if (Config::collectShadersForDebug()) { if (Config::collectShadersForDebug()) {
for (auto stage = 0; stage < MaxShaderStages; ++stage) { for (auto stage = 0; stage < MaxShaderStages; ++stage) {
if (infos[stage]) { if (infos[stage]) {