From eede38ff63ea795743dc206e12269ccfaf487096 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Tue, 18 Apr 2023 22:05:02 +0300 Subject: [PATCH] [SPIR-V] Remove more vec2-4 reserve calls --- src/xenia/gpu/spirv_shader_translator.cc | 9 --------- src/xenia/gpu/spirv_shader_translator_alu.cc | 1 - 2 files changed, 10 deletions(-) diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index 1a7ef2bac..1c5119906 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -1110,7 +1110,6 @@ spv::Id SpirvShaderTranslator::SpirvSmearScalarResultOrConstant( } int num_components = builder_->getNumTypeComponents(vector_type); id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(size_t(num_components)); for (int i = 0; i < num_components; ++i) { id_vector_temp_util_.push_back(scalar); } @@ -2386,7 +2385,6 @@ spv::Id SpirvShaderTranslator::LoadOperandStorage( case InstructionStorageSource::kConstantFloat: assert_true(uniform_float_constants_ != spv::NoResult); id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(2); // The first and the only structure member. id_vector_temp_util_.push_back(const_int_0_); // Array element. @@ -2448,7 +2446,6 @@ spv::Id SpirvShaderTranslator::GetUnmodifiedOperandComponents( static_cast(SwizzleSource::kX)); } uint_vector_temp_util_.clear(); - uint_vector_temp_util_.reserve(component_count); uint32_t components_remaining = components; uint32_t component_index; while (xe::bit_scan_forward(components_remaining, &component_index)) { @@ -2575,7 +2572,6 @@ void SpirvShaderTranslator::StoreResult(const InstructionResult& result, if (result.is_clamped && non_constant_components) { // Apply the saturation modifier to the result. id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(3); id_vector_temp_util_.push_back(value); id_vector_temp_util_.push_back( const_float_vectors_0_[value_num_components - 1]); @@ -2660,7 +2656,6 @@ void SpirvShaderTranslator::StoreResult(const InstructionResult& result, value_to_store = value; } else { uint_vector_temp_util_.clear(); - uint_vector_temp_util_.reserve(target_num_components); uint_vector_temp_util_.insert( uint_vector_temp_util_.cend(), result_swizzled_value_components, result_swizzled_value_components + target_num_components); @@ -2686,7 +2681,6 @@ void SpirvShaderTranslator::StoreResult(const InstructionResult& result, if (target_num_components > 1) { // Constants only - vector target. id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(target_num_components); for (uint32_t i = 0; i < target_num_components; ++i) { id_vector_temp_util_.push_back( (constant_values & (1 << i)) ? const_float_1_ : const_float_0_); @@ -2718,7 +2712,6 @@ void SpirvShaderTranslator::StoreResult(const InstructionResult& result, } else { // Mixed non-constants and constants - scalar source. id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(target_num_components); for (uint32_t i = 0; i < target_num_components; ++i) { if (constant_components & (1 << i)) { id_vector_temp_util_.push_back( @@ -2805,7 +2798,6 @@ void SpirvShaderTranslator::StoreResult(const InstructionResult& result, id_vector_temp_util_), spv::NoPrecision)); id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(2); id_vector_temp_util_.push_back(point_vertex_diameter_min); id_vector_temp_util_.push_back(point_size); point_size = @@ -2822,7 +2814,6 @@ void SpirvShaderTranslator::StoreResult(const InstructionResult& result, id_vector_temp_util_), spv::NoPrecision)); id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(2); id_vector_temp_util_.push_back(point_vertex_diameter_max); id_vector_temp_util_.push_back(point_size); point_size = diff --git a/src/xenia/gpu/spirv_shader_translator_alu.cc b/src/xenia/gpu/spirv_shader_translator_alu.cc index c017e351c..b82f0c427 100644 --- a/src/xenia/gpu/spirv_shader_translator_alu.cc +++ b/src/xenia/gpu/spirv_shader_translator_alu.cc @@ -29,7 +29,6 @@ spv::Id SpirvShaderTranslator::ZeroIfAnyOperandIsZero(spv::Id value, assert_true(builder_->getNumComponents(operand_0_abs) == num_components); assert_true(builder_->getNumComponents(operand_1_abs) == num_components); id_vector_temp_util_.clear(); - id_vector_temp_util_.reserve(2); id_vector_temp_util_.push_back(operand_0_abs); id_vector_temp_util_.push_back(operand_1_abs); return builder_->createTriOp(