From 6e99fcf695c5faff8a02070a2e8f55b023b012d5 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Thu, 1 Nov 2018 11:23:33 +0100 Subject: [PATCH] Run format_all.sh. --- spirv_glsl.cpp | 22 ++++++++++------------ spirv_glsl.hpp | 6 ++---- spirv_hlsl.cpp | 5 ++--- spirv_msl.cpp | 8 +++++--- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index 870075c5..3b640afb 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -459,10 +459,8 @@ std::string CompilerGLSL::get_partial_source() return buffer ? buffer->str() : "No compiled source available yet."; } -void CompilerGLSL::build_workgroup_size(vector &arguments, - const SpecializationConstant &wg_x, - const SpecializationConstant &wg_y, - const SpecializationConstant &wg_z) +void CompilerGLSL::build_workgroup_size(vector &arguments, const SpecializationConstant &wg_x, + const SpecializationConstant &wg_y, const SpecializationConstant &wg_z) { auto &execution = get_entry_point(); @@ -1750,16 +1748,15 @@ void CompilerGLSL::emit_constant(const SPIRConstant &constant) // These specialization constants are implicitly declared by emitting layout() in; // In legacy GLSL, we will still need to emit macros for these, so a layout() in; declaration // later can use macro overrides for work group size. - bool is_workgroup_size_constant = constant.self == wg_x.id || - constant.self == wg_y.id || - constant.self == wg_z.id; + bool is_workgroup_size_constant = constant.self == wg_x.id || constant.self == wg_y.id || constant.self == wg_z.id; if (options.vulkan_semantics && is_workgroup_size_constant) { // Vulkan GLSL does not need to declare workgroup spec constants explicitly, it is handled in layout(). return; } - else if (!options.vulkan_semantics && is_workgroup_size_constant && !has_decoration(constant.self, DecorationSpecId)) + else if (!options.vulkan_semantics && is_workgroup_size_constant && + !has_decoration(constant.self, DecorationSpecId)) { // Only bother declaring a workgroup size if it is actually a specialization constant, because we need macros. return; @@ -2198,7 +2195,7 @@ void CompilerGLSL::emit_resources() if (!options.vulkan_semantics && c.specialization) { c.specialization_constant_macro_name = - constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); + constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); } emit_constant(c); emitted = true; @@ -2217,7 +2214,8 @@ void CompilerGLSL::emit_resources() // If we needed to declare work group size late, check here. // If the work group size depends on a specialization constant, we need to declare the layout() block // after constants (and their macros) have been declared. - if (execution.model == ExecutionModelGLCompute && !options.vulkan_semantics && execution.workgroup_size.constant != 0) + if (execution.model == ExecutionModelGLCompute && !options.vulkan_semantics && + execution.workgroup_size.constant != 0) { SpecializationConstant wg_x, wg_y, wg_z; get_work_group_size_specialization_constants(wg_x, wg_y, wg_z); @@ -2577,7 +2575,7 @@ string CompilerGLSL::to_expression(uint32_t id) } case TypeConstantOp: - return to_name(id); + return to_name(id); case TypeVariable: { @@ -6980,7 +6978,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) case OpBitwiseXor: { auto type = get(ops[0]).basetype; - GLSL_BOP_CAST (^, type); + GLSL_BOP_CAST(^, type); break; } diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp index 742894da..54e8bdb4 100644 --- a/spirv_glsl.hpp +++ b/spirv_glsl.hpp @@ -232,10 +232,8 @@ protected: virtual void emit_spv_amd_gcn_shader_op(uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count); virtual void emit_header(); - void build_workgroup_size(std::vector &arguments, - const SpecializationConstant &x, - const SpecializationConstant &y, - const SpecializationConstant &z); + void build_workgroup_size(std::vector &arguments, const SpecializationConstant &x, + const SpecializationConstant &y, const SpecializationConstant &z); virtual void emit_sampled_image_op(uint32_t result_type, uint32_t result_id, uint32_t image_id, uint32_t samp_id); virtual void emit_texture_op(const Instruction &i); diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp index f461ee13..8b3664ee 100644 --- a/spirv_hlsl.cpp +++ b/spirv_hlsl.cpp @@ -1029,8 +1029,7 @@ void CompilerHLSL::emit_specialization_constants() if (c.self == workgroup_size_id) { statement("static const uint3 gl_WorkGroupSize = ", - constant_expression(get(workgroup_size_id)), - ";"); + constant_expression(get(workgroup_size_id)), ";"); emitted = true; } else if (c.specialization) @@ -1040,7 +1039,7 @@ void CompilerHLSL::emit_specialization_constants() // HLSL does not support specialization constants, so fallback to macros. c.specialization_constant_macro_name = - constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); + constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); statement("#ifndef ", c.specialization_constant_macro_name); statement("#define ", c.specialization_constant_macro_name, " ", constant_expression(c)); diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 0be1673a..aabb493b 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1944,7 +1944,8 @@ void CompilerMSL::emit_specialization_constants() // This "default" value can be overridden to the true specialization constant by the API user. // Specialization constants which are used as array length expressions cannot be function constants in MSL, // so just fall back to macros. - if (msl_options.supports_msl_version(1, 2) && has_decoration(c.self, DecorationSpecId) && !c.is_used_as_array_length) + if (msl_options.supports_msl_version(1, 2) && has_decoration(c.self, DecorationSpecId) && + !c.is_used_as_array_length) { uint32_t constant_id = get_decoration(c.self, DecorationSpecId); // Only scalar, non-composite values can be function constants. @@ -1957,12 +1958,13 @@ void CompilerMSL::emit_specialization_constants() { // Fallback to macro overrides. c.specialization_constant_macro_name = - constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); + constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); statement("#ifndef ", c.specialization_constant_macro_name); statement("#define ", c.specialization_constant_macro_name, " ", constant_expression(c)); statement("#endif"); - statement("constant ", sc_type_name, " ", sc_name, " = ", c.specialization_constant_macro_name, ";"); + statement("constant ", sc_type_name, " ", sc_name, " = ", c.specialization_constant_macro_name, + ";"); } else {