[SPIR-V] Remove temp reserve for 4 or less elements

This commit is contained in:
Triang3l 2023-04-13 22:43:44 +03:00
parent 75d805245d
commit 887fda55c2
6 changed files with 0 additions and 212 deletions

View File

@ -197,14 +197,12 @@ void SpirvShaderTranslator::StartTranslation() {
const_int_0_ = builder_->makeIntConstant(0);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp_.push_back(const_int_0_);
}
const_int4_0_ = builder_->makeCompositeConstant(type_int4_, id_vector_temp_);
const_uint_0_ = builder_->makeUintConstant(0);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp_.push_back(const_uint_0_);
}
@ -212,7 +210,6 @@ void SpirvShaderTranslator::StartTranslation() {
builder_->makeCompositeConstant(type_uint4_, id_vector_temp_);
const_float_0_ = builder_->makeFloatConstant(0.0f);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(const_float_0_);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp_.push_back(const_float_0_);
@ -221,7 +218,6 @@ void SpirvShaderTranslator::StartTranslation() {
}
const_float_1_ = builder_->makeFloatConstant(1.0f);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(const_float_1_);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp_.push_back(const_float_1_);
@ -229,7 +225,6 @@ void SpirvShaderTranslator::StartTranslation() {
type_float_vectors_[i], id_vector_temp_);
}
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(const_float_0_);
id_vector_temp_.push_back(const_float_1_);
const_float2_0_1_ =
@ -378,7 +373,6 @@ void SpirvShaderTranslator::StartTranslation() {
// vectors instead of scalar arrays because the latter would have padding to
// 16 bytes in each element.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// 256 bool constants.
id_vector_temp_.push_back(builder_->makeArrayType(
type_uint4_, builder_->makeUintConstant(2), sizeof(uint32_t) * 4));
@ -576,7 +570,6 @@ void SpirvShaderTranslator::StartTranslation() {
if (has_main_switch) {
// OpPhi must be the first in the block.
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(main_loop_pre_header.getId());
main_loop_pc_next_ = builder_->getUniqueId();
@ -855,7 +848,6 @@ void SpirvShaderTranslator::ProcessLoopStartInstruction(
EnsureBuildPointAvailable();
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// Loop constants (member 1).
id_vector_temp_.push_back(builder_->makeIntConstant(1));
// 4-component vector.
@ -882,7 +874,6 @@ void SpirvShaderTranslator::ProcessLoopStartInstruction(
builder_->createTriOp(spv::OpBitFieldUExtract, type_uint_, loop_constant,
const_int_0_, const_int_8);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(loop_count_new);
for (unsigned int i = 0; i < 3; ++i) {
id_vector_temp_.push_back(
@ -897,7 +888,6 @@ void SpirvShaderTranslator::ProcessLoopStartInstruction(
spv::Id address_relative_stack_old =
builder_->createLoad(var_main_loop_address_, spv::NoPrecision);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
if (instr.is_repeat) {
id_vector_temp_.emplace_back();
} else {
@ -1017,7 +1007,6 @@ void SpirvShaderTranslator::ProcessLoopEndInstruction(
// Extract the value to add to aL (signed, in bits 16:23 of the loop
// constant).
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// Loop constants (member 1).
id_vector_temp_.push_back(builder_->makeIntConstant(1));
// 4-component vector.
@ -1056,7 +1045,6 @@ void SpirvShaderTranslator::ProcessLoopEndInstruction(
// Pop the current loop off the loop counter and the relative address stacks -
// move YZW to XYZ and set W to 0.
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
for (unsigned int i = 1; i < 4; ++i) {
id_vector_temp_.push_back(
builder_->createCompositeExtract(loop_count_stack_old, type_uint_, i));
@ -1066,7 +1054,6 @@ void SpirvShaderTranslator::ProcessLoopEndInstruction(
builder_->createCompositeConstruct(type_uint4_, id_vector_temp_),
var_main_loop_count_);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
for (unsigned int i = 1; i < 4; ++i) {
id_vector_temp_.push_back(builder_->createCompositeExtract(
address_relative_stack_old, type_int_, i));
@ -1240,7 +1227,6 @@ void SpirvShaderTranslator::StartVertexOrTessEvalShaderInMain() {
// The edge flag isn't used for any purpose by the translator.
if (current_shader().writes_point_size_edge_flag_kill_vertex() & 0b101) {
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// Set the point size to a negative value to tell the point sprite expansion
// that it should use the default point size if the vertex shader does not
// override it.
@ -1475,7 +1461,6 @@ void SpirvShaderTranslator::StartVertexOrTessEvalShaderInMain() {
spv::NoPrecision));
// Write the index to r0.x as float.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(const_int_0_);
builder_->createStore(
@ -1521,7 +1506,6 @@ void SpirvShaderTranslator::CompleteVertexOrTessEvalShaderInMain() {
// Check if the shader returns XY/W rather than XY, and if it does, revert
// that.
uint_vector_temp_.clear();
uint_vector_temp_.reserve(2);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
spv::Id position_xy = builder_->createRvalueSwizzle(
@ -1629,7 +1613,6 @@ void SpirvShaderTranslator::CompleteVertexOrTessEvalShaderInMain() {
// frontFace = VkFrontFace(0), but faceness is ignored for non-polygon
// primitive types).
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(builder_->makeUintConstant(0b10));
id_vector_temp_.push_back(builder_->makeUintConstant(0b01));
spv::Id point_vertex_positive = builder_->createBinOp(
@ -1704,7 +1687,6 @@ void SpirvShaderTranslator::CompleteVertexOrTessEvalShaderInMain() {
spv::DecorationNoContraction);
// Expand the point sprite.
uint_vector_temp_.clear();
uint_vector_temp_.reserve(2);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
spv::Id point_position_xy = builder_->createBinOp(
@ -2139,7 +2121,6 @@ void SpirvShaderTranslator::StartFragmentShaderInMain() {
// Saturate to avoid negative point coordinates if the center of the pixel
// is not covered, and extrapolation is done.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(
builder_->createLoad(input_point_coordinates_, spv::NoPrecision));
id_vector_temp_.push_back(const_float2_0_);
@ -2168,7 +2149,6 @@ void SpirvShaderTranslator::StartFragmentShaderInMain() {
}
// Store the pixel parameters.
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(param_gen_x);
id_vector_temp_.push_back(param_gen_y);
id_vector_temp_.push_back(param_gen_z);
@ -2234,7 +2214,6 @@ void SpirvShaderTranslator::UpdateExecConditionals(
spv::Id condition_id;
if (type == ParsedExecInstruction::Type::kConditional) {
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// Bool constants (member 0).
id_vector_temp_.push_back(const_int_0_);
// 128-bit vector.
@ -2865,7 +2844,6 @@ spv::Id SpirvShaderTranslator::EndianSwap32Uint(spv::Id value, spv::Id endian) {
spv::Id const_uint_8_typed, const_uint_00ff00ff_typed, const_uint_16_typed;
int num_components = builder_->getNumTypeComponents(type);
if (num_components > 1) {
id_vector_temp_.reserve(num_components);
id_vector_temp_.clear();
id_vector_temp_.insert(id_vector_temp_.cend(), num_components,
const_uint_8_scalar);
@ -2946,7 +2924,6 @@ spv::Id SpirvShaderTranslator::EndianSwap32Uint(spv::Id value, spv::Id endian) {
&block_16in32_merge);
builder_->setBuildPoint(&block_16in32);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(builder_->createBinOp(
spv::OpShiftRightLogical, type, value, const_uint_16_typed));
id_vector_temp_.push_back(value);
@ -2983,7 +2960,6 @@ spv::Id SpirvShaderTranslator::LoadUint32FromSharedMemory(
if (!buffer_count_log2) {
// Single binding - load directly.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// The only SSBO struct member.
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(address_dwords_int);
@ -3034,7 +3010,6 @@ spv::Id SpirvShaderTranslator::LoadUint32FromSharedMemory(
for (uint32_t i = 0; i < buffer_count; ++i) {
builder_->setBuildPoint(switch_case_blocks[i]);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(builder_->makeIntConstant(int(i)));
// The only SSBO struct member.
id_vector_temp_.push_back(const_int_0_);
@ -3068,7 +3043,6 @@ spv::Id SpirvShaderTranslator::PWLGammaToLinear(spv::Id gamma,
if (!gamma_pre_saturated) {
// Saturate, flushing NaN to 0.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(gamma);
id_vector_temp_.push_back(const_vector_0);
id_vector_temp_.push_back(const_vector_1);
@ -3166,7 +3140,6 @@ spv::Id SpirvShaderTranslator::LinearToPWLGamma(spv::Id linear,
if (!linear_pre_saturated) {
// Saturate, flushing NaN to 0.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(linear);
id_vector_temp_.push_back(const_vector_0);
id_vector_temp_.push_back(const_vector_1);

View File

@ -195,7 +195,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
// Extract the different components, if not all are different.
if (multiplicands_different != used_result_components) {
uint_vector_temp_.clear();
uint_vector_temp_.reserve(different_count);
uint32_t components_remaining = used_result_components;
for (uint32_t i = 0; i < used_result_component_count; ++i) {
uint32_t component;
@ -231,7 +230,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
instr.vector_operands[i]);
}
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(different_operands[0]);
id_vector_temp_.push_back(different_operands[1]);
spv::Id different_abs_min =
@ -315,7 +313,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
builder_->createBuiltinCall(type_float_, ext_inst_glsl_std_450_,
GLSLstd450Floor, id_vector_temp_);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(maxa_address);
id_vector_temp_.push_back(builder_->makeFloatConstant(-256.0f));
id_vector_temp_.push_back(builder_->makeFloatConstant(255.0f));
@ -346,7 +343,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
if (used_result_component_count > 1) {
// Need all but the last (W) element of operand_0 as a vector.
uint_vector_temp_.clear();
uint_vector_temp_.reserve(used_result_component_count);
for (unsigned int i = 0; i < used_result_component_count; ++i) {
uint_vector_temp_.push_back(i);
}
@ -390,7 +386,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
// Mixed identical and different components.
assert_true(used_result_component_count > 1);
id_vector_temp_.clear();
id_vector_temp_.reserve(used_result_component_count);
uint32_t components_remaining = used_result_components;
for (uint32_t i = 0; i < used_result_component_count; ++i) {
// Composite extraction of operand_0[i] works fine even it's maxa with
@ -695,7 +690,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
builder_->setBuildPoint(ma_merge_block);
// Choose the result options from Z and YX cases.
id_vector_temp_.clear();
id_vector_temp_.reserve(used_result_component_count);
for (uint32_t i = 0; i < 4; ++i) {
if (!(used_result_components & (1 << i))) {
continue;
@ -753,7 +747,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
while (xe::bit_scan_forward(components_remaining, &component)) {
components_remaining &= ~(uint32_t(1) << component);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(result);
id_vector_temp_.push_back(builder_->createCompositeExtract(
operand, type_float_, static_cast<unsigned int>(component)));
@ -895,7 +888,6 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
}
}
id_vector_temp_.clear();
id_vector_temp_.reserve(used_result_component_count);
if (used_result_components & 0b0001) {
// x = 1.0
id_vector_temp_.push_back(const_float_1_);
@ -1171,7 +1163,6 @@ spv::Id SpirvShaderTranslator::ProcessScalarAluOperation(
builder_->createBuiltinCall(type_float_, ext_inst_glsl_std_450_,
GLSLstd450Floor, id_vector_temp_);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(maxa_address);
id_vector_temp_.push_back(builder_->makeFloatConstant(-256.0f));
id_vector_temp_.push_back(builder_->makeFloatConstant(255.0f));

View File

@ -52,7 +52,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
// Get the base address in dwords from the bits 2:31 of the first fetch
// constant word.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// The only element of the fetch constant buffer.
id_vector_temp_.push_back(const_int_0_);
// Vector index.
@ -140,7 +139,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
// because of the LoadUint32FromSharedMemory call (potentially using
// id_vector_temp_ internally).
id_vector_temp_.clear();
id_vector_temp_.reserve(word_count);
id_vector_temp_.insert(id_vector_temp_.cend(), word_composite_constituents,
word_composite_constituents + word_count);
words = builder_->createCompositeConstruct(
@ -153,7 +151,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
// fetch constant word.
uint32_t fetch_constant_word_1_index = fetch_constant_word_0_index + 1;
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// The only element of the fetch constant buffer.
id_vector_temp_.push_back(const_int_0_);
// Vector index.
@ -316,7 +313,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
builder_->makeFloatConstant(0.5f / 2147483647.5f);
if (used_format_component_count > 1) {
id_vector_temp_.clear();
id_vector_temp_.reserve(used_format_component_count);
id_vector_temp_.insert(id_vector_temp_.cend(),
used_format_component_count,
const_no_zero);
@ -396,7 +392,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
assert_true(extracted_component_count == used_format_component_count);
if (used_format_component_count > 1) {
id_vector_temp_.clear();
id_vector_temp_.reserve(used_format_component_count);
id_vector_temp_.insert(
id_vector_temp_.cend(), extracted_components,
extracted_components + used_format_component_count);
@ -443,7 +438,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
} else {
packed_scale_mul_op = spv::OpFMul;
id_vector_temp_.clear();
id_vector_temp_.reserve(used_format_component_count);
id_vector_temp_.push_back(const_packed_scale);
for (uint32_t i = 1; i < used_format_component_count; ++i) {
id_vector_temp_.push_back(
@ -466,7 +460,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
spv::Id const_minus_1 = builder_->makeFloatConstant(-1.0f);
if (used_format_component_count > 1) {
id_vector_temp_.clear();
id_vector_temp_.reserve(used_format_component_count);
id_vector_temp_.insert(id_vector_temp_.cend(),
used_format_component_count,
const_minus_1);
@ -482,7 +475,6 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
} break;
case xenos::SignedRepeatingFractionMode::kNoZero:
id_vector_temp_.clear();
id_vector_temp_.reserve(used_format_component_count);
for (uint32_t i = 0; i < used_format_component_count; ++i) {
id_vector_temp_.push_back(
builder_->makeFloatConstant(0.5f * packed_scales[i]));
@ -925,7 +917,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// Get the data dimensionality from the bits 9:10 of the fetch constant
// word 5.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(builder_->makeIntConstant(
int((fetch_constant_word_0_index + 5) >> 2)));
@ -948,7 +939,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
if (size_needed_components) {
// Get the size from the fetch constant word 2.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(builder_->makeIntConstant(
int((fetch_constant_word_0_index + 2) >> 2)));
@ -1296,7 +1286,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
builder_->addDecoration(face, spv::DecorationNoContraction);
}
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(face);
id_vector_temp_.push_back(const_float_0_);
id_vector_temp_.push_back(builder_->makeFloatConstant(5.0f));
@ -1410,7 +1399,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
}
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantTextureSwizzledSigns));
id_vector_temp_.push_back(
@ -1463,7 +1451,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// 3D.
builder_->setBuildPoint(&block_dimension_3d_start);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
for (uint32_t i = 0; i < 3; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1479,7 +1466,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// 2D stacked.
builder_->setBuildPoint(&block_dimension_stacked_start);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1512,7 +1498,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
uint32_t lod_query_coordinate_component_count =
instr.dimension == xenos::FetchOpDimension::kCube ? 3 : 2;
id_vector_temp_.clear();
id_vector_temp_.reserve(lod_query_coordinate_component_count);
for (uint32_t i = 0; i < lod_query_coordinate_component_count; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1575,7 +1560,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// biasing, for result exponent biasing, and conditionally for stacked
// texture filtering.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(builder_->makeIntConstant(
int((fetch_constant_word_0_index + 4) >> 2)));
@ -1681,7 +1665,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// 1D textures are sampled as 2D arrays - need 2-component
// gradients.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(gradient_h_1d);
id_vector_temp_.push_back(const_float_0_);
gradients_h = builder_->createCompositeConstruct(type_float2_,
@ -1717,7 +1700,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
spv::DecorationNoContraction);
}
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(register_gradient_x);
id_vector_temp_.push_back(register_gradient_y);
(i ? gradients_v : gradients_h) =
@ -1726,7 +1708,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
}
} else {
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1763,7 +1744,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
for (uint32_t i = 0; i < 2; ++i) {
spv::Id& gradient_ref = i ? gradients_v : gradients_h;
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
for (uint32_t j = 0; j < 3; ++j) {
assert_true(size[j] != spv::NoResult);
id_vector_temp_.push_back(builder_->createBinOp(
@ -1780,7 +1760,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
}
} else {
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
for (uint32_t i = 0; i < 3; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1818,7 +1797,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
spv::NoPrecision);
} else {
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
for (uint32_t i = 0; i < 3; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1879,7 +1857,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
texture_parameters.gradY = gradients_v;
}
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
for (uint32_t i = 0; i < 3; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -1899,7 +1876,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
if (use_computed_lod) {
// Extract 2D gradients for stacked textures which are 2D arrays.
uint_vector_temp_.clear();
uint_vector_temp_.reserve(2);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
texture_parameters.gradX = builder_->createRvalueSwizzle(
@ -1924,7 +1900,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
vol_mag_filter_is_linear != vol_min_filter_is_linear)) {
// Check if minifying along layers (derivative > 1 along any axis).
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp_.push_back(builder_->createCompositeExtract(
i ? gradients_v : gradients_h, type_float_, 2));
@ -2022,7 +1997,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
builder_->createBuiltinCall(type_float_, ext_inst_glsl_std_450_,
GLSLstd450Floor, id_vector_temp_);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(coordinates[0]);
id_vector_temp_.push_back(coordinates[1]);
id_vector_temp_.push_back(layer_0_coordinate);
@ -2057,7 +2031,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
spv::OpFAdd, type_float_, layer_0_coordinate,
builder_->makeFloatConstant(1.0f));
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(coordinates[0]);
id_vector_temp_.push_back(coordinates[1]);
id_vector_temp_.push_back(layer_1_coordinate);
@ -2153,7 +2126,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
texture_parameters.gradY = gradients_v;
}
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
for (uint32_t i = 0; i < 3; ++i) {
id_vector_temp_.push_back(coordinates[i]);
}
@ -2175,7 +2147,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// and gamma) swizzling.
if (!features_.image_view_format_swizzle) {
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantTextureSwizzles));
id_vector_temp_.push_back(
@ -2398,7 +2369,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
// Apply the exponent bias from the bits 13:18 of the fetch constant
// word 4.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(builder_->makeFloatConstant(1.0f));
id_vector_temp_.push_back(builder_->createTriOp(
spv::OpBitFieldSExtract, type_int_, fetch_constant_word_4_signed,
@ -2429,7 +2399,6 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
spv::Id result_vector;
if (used_result_component_count > 1) {
id_vector_temp_.clear();
id_vector_temp_.reserve(used_result_component_count);
uint32_t result_components_remaining = used_result_components;
uint32_t result_component_index;
while (xe::bit_scan_forward(result_components_remaining,

View File

@ -613,7 +613,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
}
builder_->setBuildPoint(&block_alpha_test_not_equal_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(alpha_test_result_not_equal);
id_vector_temp_.push_back(block_alpha_test_not_equal.getId());
id_vector_temp_.push_back(alpha_test_result_non_not_equal);
@ -671,7 +670,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
// The tests might have modified the sample mask via
// fsi_sample_mask_in_rt_0_alpha_tests.
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(fsi_sample_mask_in_rt_0_alpha_tests);
id_vector_temp_.push_back(
block_fsi_rt_0_alpha_tests_rt_written_end.getId());
@ -742,7 +740,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
spv::Id depth_stencil_sample_address =
FSI_AddSampleOffset(main_fsi_address_depth_, i);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// First SSBO structure element.
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(depth_stencil_sample_address);
@ -834,7 +831,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
// Apply the exponent bias after the alpha test and alpha to coverage
// because they need the unbiased alpha from the shader.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantColorExpBias));
id_vector_temp_.push_back(
@ -894,7 +890,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
// overwritten, or UINT32_MAX, UINT32_MAX if writing to the target is
// disabled completely.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantEdramRTKeepMask));
id_vector_temp_.push_back(rt_uint2_index_array);
@ -935,7 +930,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
// Load the information about the render target.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantEdramRTFormatFlags));
id_vector_temp_.push_back(const_int_rt_index);
@ -954,7 +948,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
const_uint_0_);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantEdramRTBaseDwordsScaled));
id_vector_temp_.push_back(const_int_rt_index);
@ -977,7 +970,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
// Load the blending parameters for the render target.
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantEdramRTBlendFactorsOps));
id_vector_temp_.push_back(const_int_rt_index);
@ -1019,7 +1011,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
RenderTargetCache::kPSIColorFormatFlag_FixedPointAlpha)),
const_uint_0_);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(
builder_->makeIntConstant(kSystemConstantEdramRTClamp));
id_vector_temp_.push_back(const_int_rt_index);
@ -1071,7 +1062,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
id_vector_temp_),
spv::NoPrecision);
uint_vector_temp_.clear();
uint_vector_temp_.reserve(3);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
uint_vector_temp_.push_back(2);
@ -1088,7 +1078,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
rt_alpha_is_fixed_point, rt_clamp_alpha_min, rt_clamp_alpha_max);
uint_vector_temp_.clear();
uint_vector_temp_.reserve(3);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
uint_vector_temp_.push_back(2);
@ -1121,7 +1110,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
spv::Id rt_sample_address =
FSI_AddSampleOffset(rt_sample_0_address, i, rt_is_64bpp);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// First SSBO structure element.
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(rt_sample_address);
@ -1156,7 +1144,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
builder_->createBranch(&block_load_64bpp_merge);
builder_->setBuildPoint(&block_load_64bpp_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(dest_packed_64bpp_high);
id_vector_temp_.push_back(block_load_64bpp.getId());
id_vector_temp_.push_back(const_uint_0_);
@ -1167,7 +1154,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
std::array<spv::Id, 4> dest_unpacked =
FSI_UnpackColor(dest_packed, rt_format_with_flags);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(dest_unpacked[0]);
id_vector_temp_.push_back(dest_unpacked[1]);
id_vector_temp_.push_back(dest_unpacked[2]);
@ -1289,7 +1275,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
spv::Id rt_sample_address =
FSI_AddSampleOffset(rt_sample_0_address, i, rt_is_64bpp);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// First SSBO structure element.
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(rt_sample_address);
@ -1355,7 +1340,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
spv::Id rt_sample_address =
FSI_AddSampleOffset(rt_sample_0_address, i, rt_is_64bpp);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// First SSBO structure element.
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(rt_sample_address);
@ -1404,7 +1388,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
// issues in the host render target path.
// TODO(Triang3l): Gamma as sRGB check.
uint_vector_temp_.clear();
uint_vector_temp_.reserve(3);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
uint_vector_temp_.push_back(2);
@ -1428,7 +1411,6 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
builder_->createBranch(&block_gamma_merge);
builder_->setBuildPoint(&block_gamma_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(color_rgb_gamma);
id_vector_temp_.push_back(block_gamma.getId());
id_vector_temp_.push_back(color_rgb);
@ -1543,7 +1525,6 @@ void SpirvShaderTranslator::FSI_LoadSampleMask(spv::Id msaa_samples) {
} else {
// 0 and 3 to 0 and 1.
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(input_sample_mask_value);
id_vector_temp_.push_back(builder_->createTriOp(
spv::OpBitFieldUExtract, type_uint_, input_sample_mask_value,
@ -1560,7 +1541,6 @@ void SpirvShaderTranslator::FSI_LoadSampleMask(spv::Id msaa_samples) {
// Flip samples in bits 0:1 by reversing the whole coverage mask and inserting
// the reversing bits.
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(input_sample_mask_value);
id_vector_temp_.push_back(builder_->createBinOp(
spv::OpShiftRightLogical, type_uint_,
@ -1974,7 +1954,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
type_float_, ext_inst_glsl_std_450_, GLSLstd450FAbs, id_vector_temp_);
}
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(depth_dxy_abs[0]);
id_vector_temp_.push_back(depth_dxy_abs[1]);
spv::Id depth_max_slope = builder_->createBuiltinCall(
@ -2016,7 +1995,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
// Load the original depth and stencil for the sample.
spv::Id sample_address = FSI_AddSampleOffset(main_fsi_address_depth_, i);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
// First SSBO structure element.
id_vector_temp_.push_back(const_int_0_);
id_vector_temp_.push_back(sample_address);
@ -2102,7 +2080,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
spv::OpFAdd, type_float_, center_depth32_biased, sample_depth32);
builder_->addDecoration(sample_depth32, spv::DecorationNoContraction);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(sample_depth32);
id_vector_temp_.push_back(const_float_0_);
id_vector_temp_.push_back(const_float_1_);
@ -2143,7 +2120,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
// Merge between the two formats.
builder_->setBuildPoint(&block_depth_format_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(sample_depth_float24);
id_vector_temp_.push_back(block_depth_format_float_end.getId());
id_vector_temp_.push_back(sample_depth_unorm24);
@ -2280,7 +2256,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
// Increment and clamp.
builder_->setBuildPoint(&block_stencil_op_increment_clamp);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(builder_->makeUintConstant(UINT8_MAX - 1));
id_vector_temp_.push_back(
builder_->createBinOp(spv::OpBitwiseAnd, type_uint_, old_depth_stencil,
@ -2294,7 +2269,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
// Decrement and clamp.
builder_->setBuildPoint(&block_stencil_op_decrement_clamp);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(const_uint_1);
id_vector_temp_.push_back(
builder_->createBinOp(spv::OpBitwiseAnd, type_uint_, old_depth_stencil,
@ -2362,7 +2336,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
builder_->createBranch(&block_stencil_enabled_merge);
spv::Block& block_stencil_enabled_end = *builder_->getBuildPoint();
builder_->setBuildPoint(&block_stencil_enabled_merge);
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.clear();
id_vector_temp_.push_back(stencil_passed_if_enabled);
id_vector_temp_.push_back(block_stencil_enabled_end.getId());
@ -2390,7 +2363,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
// Combine the new depth and the new stencil taking into account whether the
// new depth should be written.
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(new_stencil_and_old_depth);
id_vector_temp_.push_back(sample_depth24);
id_vector_temp_.push_back(const_uint_8);
@ -2451,7 +2423,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
builder_->createBranch(&block_sample_covered_merge);
spv::Block& block_sample_covered_end = *builder_->getBuildPoint();
builder_->setBuildPoint(&block_sample_covered_merge);
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.clear();
id_vector_temp_.push_back(new_sample_mask_after_sample);
id_vector_temp_.push_back(block_sample_covered_end.getId());
@ -2475,7 +2446,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
builder_->createBranch(block_any_sample_covered_merge);
spv::Block& block_any_sample_covered_end = *builder_->getBuildPoint();
builder_->setBuildPoint(block_any_sample_covered_merge);
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.clear();
id_vector_temp_.push_back(new_sample_mask);
id_vector_temp_.push_back(block_any_sample_covered_end.getId());
@ -2498,7 +2468,6 @@ void SpirvShaderTranslator::FSI_DepthStencilTest(
builder_->createBranch(&block_depth_stencil_enabled_merge);
spv::Block& block_depth_stencil_enabled_end = *builder_->getBuildPoint();
builder_->setBuildPoint(&block_depth_stencil_enabled_merge);
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.clear();
id_vector_temp_.push_back(new_sample_mask);
id_vector_temp_.push_back(block_depth_stencil_enabled_end.getId());
@ -2601,7 +2570,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
{
builder_->setBuildPoint(&block_format_8_8_8_8);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(color_float4);
id_vector_temp_.push_back(const_float4_0_);
id_vector_temp_.push_back(const_float4_1_);
@ -2621,7 +2589,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id component_width = builder_->makeUintConstant(8);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(packed_8_8_8_8);
id_vector_temp_.push_back(
builder_->createCompositeExtract(color_uint4, type_uint_, i));
@ -2641,7 +2608,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
{
builder_->setBuildPoint(&block_format_8_8_8_8_gamma);
uint_vector_temp_.clear();
uint_vector_temp_.reserve(3);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(1);
uint_vector_temp_.push_back(2);
@ -2652,7 +2618,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
color_float4, uint_vector_temp_),
false);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(
builder_->createCompositeExtract(color_float4, type_float_, 3));
id_vector_temp_.push_back(const_float_0_);
@ -2687,7 +2652,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id component_width = builder_->makeUintConstant(8);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(packed_8_8_8_8_gamma);
id_vector_temp_.push_back(
builder_->createCompositeExtract(color_uint4, type_uint_, i));
@ -2708,7 +2672,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
{
builder_->setBuildPoint(&block_format_2_10_10_10);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(color_float4);
id_vector_temp_.push_back(const_float4_0_);
id_vector_temp_.push_back(const_float4_1_);
@ -2716,7 +2679,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
builder_->createBuiltinCall(type_float4_, ext_inst_glsl_std_450_,
GLSLstd450NClamp, id_vector_temp_);
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.resize(3, builder_->makeFloatConstant(1023.0f));
id_vector_temp_.push_back(builder_->makeFloatConstant(3.0f));
spv::Id color_scaled = builder_->createBinOp(
@ -2734,7 +2696,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id alpha_width = builder_->makeUintConstant(2);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(packed_2_10_10_10);
id_vector_temp_.push_back(
builder_->createCompositeExtract(color_uint4, type_uint_, i));
@ -2764,7 +2725,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
}
// Alpha.
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
id_vector_temp_.push_back(
builder_->createCompositeExtract(color_float4, type_float_, 3));
id_vector_temp_.push_back(const_float_0_);
@ -2785,7 +2745,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id rgb_width = builder_->makeUintConstant(10);
for (uint32_t i = 1; i < 3; ++i) {
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(packed_2_10_10_10_float);
id_vector_temp_.push_back(color_components[i]);
id_vector_temp_.push_back(builder_->makeUintConstant(10 * i));
@ -2794,7 +2753,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
type_uint_, id_vector_temp_);
}
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(packed_2_10_10_10_float);
id_vector_temp_.push_back(color_components[3]);
id_vector_temp_.push_back(builder_->makeUintConstant(30));
@ -2821,7 +2779,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id const_float4_32 =
builder_->makeCompositeConstant(type_float4_, id_vector_temp_);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// NaN to 0, not to -32.
id_vector_temp_.push_back(builder_->createTriOp(
spv::OpSelect, type_float4_,
@ -2853,7 +2810,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id component_offset_width = builder_->makeUintConstant(16);
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp_.clear();
id_vector_temp_.reserve(4);
id_vector_temp_.push_back(
builder_->createCompositeExtract(color_uint4, type_uint_, 2 * i));
id_vector_temp_.push_back(
@ -2884,7 +2840,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
spv::Id const_float4_float16_max =
builder_->makeCompositeConstant(type_float4_, id_vector_temp_);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// NaN to 0, not to -max.
id_vector_temp_.push_back(builder_->createTriOp(
spv::OpSelect, type_float4_,
@ -2897,7 +2852,6 @@ std::array<spv::Id, 2> SpirvShaderTranslator::FSI_ClampAndPackColor(
GLSLstd450FClamp, id_vector_temp_);
for (uint32_t i = 0; i < 2; ++i) {
uint_vector_temp_.clear();
uint_vector_temp_.reserve(2);
uint_vector_temp_.push_back(2 * i);
uint_vector_temp_.push_back(2 * i + 1);
id_vector_temp_.clear();
@ -3176,7 +3130,6 @@ std::array<spv::Id, 4> SpirvShaderTranslator::FSI_UnpackColor(
component_scale);
builder_->addDecoration(component, spv::DecorationNoContraction);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(component_min);
id_vector_temp_.push_back(component);
component =
@ -3300,7 +3253,6 @@ spv::Id SpirvShaderTranslator::FSI_FlushNaNClampAndInBlending(
&block_is_fixed_point_merge);
builder_->setBuildPoint(&block_is_fixed_point_if);
id_vector_temp_.clear();
id_vector_temp_.reserve(3);
// Flush NaN to 0 even for signed (NMax would flush it to the minimum value).
id_vector_temp_.push_back(builder_->createTriOp(
spv::OpSelect, color_or_alpha_type,
@ -3316,7 +3268,6 @@ spv::Id SpirvShaderTranslator::FSI_FlushNaNClampAndInBlending(
builder_->createBranch(&block_is_fixed_point_merge);
builder_->setBuildPoint(&block_is_fixed_point_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(color_or_alpha_clamped);
id_vector_temp_.push_back(block_is_fixed_point_if.getId());
id_vector_temp_.push_back(color_or_alpha);
@ -3509,7 +3460,6 @@ spv::Id SpirvShaderTranslator::FSI_ApplyColorBlendFactor(
spv::OpFSub, type_float_, const_float_1_, dest_alpha);
builder_->addDecoration(one_minus_dest_alpha, spv::DecorationNoContraction);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(source_alpha);
id_vector_temp_.push_back(one_minus_dest_alpha);
spv::Id factor_source_alpha_saturate = builder_->createBuiltinCall(
@ -3551,7 +3501,6 @@ spv::Id SpirvShaderTranslator::FSI_ApplyColorBlendFactor(
// Make the result zero if the factor is zero.
builder_->setBuildPoint(&block_not_zero_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(result);
id_vector_temp_.push_back(block_not_zero_if_end.getId());
id_vector_temp_.push_back(const_float3_0_);
@ -3699,7 +3648,6 @@ spv::Id SpirvShaderTranslator::FSI_ApplyAlphaBlendFactor(
spv::OpFSub, type_float_, const_float_1_, dest_alpha);
builder_->addDecoration(one_minus_dest_alpha, spv::DecorationNoContraction);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(source_alpha);
id_vector_temp_.push_back(one_minus_dest_alpha);
spv::Id factor_source_alpha_saturate = builder_->createBuiltinCall(
@ -3736,7 +3684,6 @@ spv::Id SpirvShaderTranslator::FSI_ApplyAlphaBlendFactor(
// Make the result zero if the factor is zero.
builder_->setBuildPoint(&block_not_zero_merge);
id_vector_temp_.clear();
id_vector_temp_.reserve(2 * 2);
id_vector_temp_.push_back(result);
id_vector_temp_.push_back(block_not_zero_if_end.getId());
id_vector_temp_.push_back(const_float_0_);
@ -3783,7 +3730,6 @@ spv::Id SpirvShaderTranslator::FSI_BlendColorOrAlphaWithUnclampedResult(
// Min case.
builder_->setBuildPoint(&block_min_max_min);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(is_alpha ? source_alpha_clamped
: source_color_clamped);
id_vector_temp_.push_back(is_alpha ? dest_alpha : dest_color);
@ -3794,7 +3740,6 @@ spv::Id SpirvShaderTranslator::FSI_BlendColorOrAlphaWithUnclampedResult(
// Max case.
builder_->setBuildPoint(&block_min_max_max);
id_vector_temp_.clear();
id_vector_temp_.reserve(2);
id_vector_temp_.push_back(is_alpha ? source_alpha_clamped
: source_color_clamped);
id_vector_temp_.push_back(is_alpha ? dest_alpha : dest_color);

View File

@ -1220,7 +1220,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
// set to NaN for emulation of vertex killing with the OR operator).
for (uint32_t i = 0; i < input_primitive_vertex_count; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(builder.makeIntConstant(int32_t(i)));
id_vector_temp.push_back(const_member_in_gl_per_vertex_position);
spv::Id position_is_nan = builder.createUnaryOp(
@ -1273,7 +1272,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
for (uint32_t i = 0; i < cull_distance_count; ++i) {
for (uint32_t j = 0; j < input_primitive_vertex_count; ++j) {
id_vector_temp.clear();
id_vector_temp.reserve(3);
id_vector_temp.push_back(builder.makeIntConstant(int32_t(j)));
id_vector_temp.push_back(const_member_in_gl_per_vertex_cull_distance);
id_vector_temp.push_back(builder.makeIntConstant(int32_t(i)));
@ -1332,7 +1330,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
// Load the point diameter in guest pixels.
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(
builder.makeIntConstant(int32_t(kPointConstantConstantDiameter)));
id_vector_temp.push_back(const_int_0);
@ -1412,7 +1409,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
// normalized device coordinates, and then to the clip space by
// multiplying by W.
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(builder.makeIntConstant(
int32_t(kPointConstantScreenDiameterToNdcRadius)));
id_vector_temp.push_back(const_int_0);
@ -1432,7 +1428,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
spv::NoPrecision));
builder.addDecoration(point_radius_y, spv::DecorationNoContraction);
id_vector_temp.clear();
id_vector_temp.reserve(2);
// 0 is the input primitive vertex index.
id_vector_temp.push_back(const_int_0);
id_vector_temp.push_back(const_member_in_gl_per_vertex_position);
@ -1482,7 +1477,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
spv::Id point_clip_distances = spv::NoResult;
if (clip_distance_count) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
// 0 is the input primitive vertex index.
id_vector_temp.push_back(const_int_0);
id_vector_temp.push_back(const_member_in_gl_per_vertex_clip_distance);
@ -1506,7 +1500,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
// Point coordinates.
if (key.has_point_coordinates) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(
builder.makeFloatConstant(float(point_vertex_x)));
id_vector_temp.push_back(
@ -1517,7 +1510,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
}
// Position.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(point_edge_x[point_vertex_x]);
id_vector_temp.push_back(point_edge_y[point_vertex_y]);
id_vector_temp.push_back(point_z);
@ -1655,7 +1647,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
if (key.has_point_coordinates) {
spv::Id const_float_0 = builder.makeFloatConstant(0.0f);
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(const_float_0);
id_vector_temp.push_back(const_float_0);
const_point_coordinates_zero =
@ -1683,7 +1674,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
}
// Position.
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(vertex_index);
id_vector_temp.push_back(const_member_in_gl_per_vertex_position);
spv::Id vertex_position = builder.createLoad(
@ -1699,7 +1689,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
// Clip distances.
if (clip_distance_count) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(vertex_index);
id_vector_temp.push_back(const_member_in_gl_per_vertex_clip_distance);
spv::Id vertex_clip_distances = builder.createLoad(
@ -1756,7 +1745,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
}
// Position.
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(vertex_indices[0]);
id_vector_temp.push_back(const_member_in_gl_per_vertex_position);
spv::Id vertex_position_v0 = builder.createLoad(
@ -1790,7 +1778,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
for (uint32_t i = 0; i < clip_distance_count; ++i) {
spv::Id const_int_i = builder.makeIntConstant(int32_t(i));
id_vector_temp.clear();
id_vector_temp.reserve(3);
id_vector_temp.push_back(vertex_indices[0]);
id_vector_temp.push_back(const_member_in_gl_per_vertex_clip_distance);
id_vector_temp.push_back(const_int_i);
@ -1818,7 +1805,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
builder.addDecoration(vertex_clip_distance_v3,
spv::DecorationNoContraction);
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(const_member_in_gl_per_vertex_clip_distance);
id_vector_temp.push_back(const_int_i);
builder.createStore(
@ -1838,7 +1824,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
if (key.has_point_coordinates) {
spv::Id const_float_0 = builder.makeFloatConstant(0.0f);
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(const_float_0);
id_vector_temp.push_back(const_float_0);
const_point_coordinates_zero =
@ -1870,7 +1855,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
}
// Position.
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(const_vertex_index);
id_vector_temp.push_back(const_member_in_gl_per_vertex_position);
spv::Id vertex_position = builder.createLoad(
@ -1886,7 +1870,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
// Clip distances.
if (clip_distance_count) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(const_vertex_index);
id_vector_temp.push_back(const_member_in_gl_per_vertex_clip_distance);
spv::Id vertex_clip_distances = builder.createLoad(

View File

@ -2527,7 +2527,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// is not eliminated when compiling the shader for AMD via RenderDoc on
// Windows, as of June 2022.
uint_vector_temp.clear();
uint_vector_temp.reserve(2);
uint_vector_temp.push_back(0);
uint_vector_temp.push_back(1);
spv::Id dest_pixel_coord = builder.createUnaryOp(
@ -2623,7 +2622,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.createBinOp(spv::OpBitwiseAnd, type_uint, dest_sample_id,
builder.makeUintConstant(1 << 1));
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -2658,7 +2656,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// Horizontal pixel index can be reused. Vertical pixel 1 should
// become sample 2.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.makeUintConstant(0));
id_vector_temp.push_back(dest_tile_pixel_y);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -2677,7 +2674,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// The X part.
// 1 destination horizontal sample = 2 source horizontal pixels.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpShiftLeftLogical, type_uint, dest_tile_pixel_x,
builder.makeUintConstant(2)));
@ -2711,7 +2707,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// Vertical pixel and sample (second bit) addressing is the same.
// However, 1 horizontal destination pixel = 1 horizontal source sample.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(0));
@ -2751,7 +2746,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// (second bit).
if (msaa_2x_attachments_supported_) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseXor, type_uint, dest_sample_id,
@ -2762,7 +2756,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
type_uint, id_vector_temp);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(builder.makeUintConstant(0));
@ -2774,7 +2767,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// 64bpp -> 32bpp, 4x -> 1x.
// 1 destination vertical pixel = 1 source vertical sample.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(source_tile_pixel_y);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -2817,7 +2809,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// sample bit.
if (msaa_2x_attachments_supported_) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseXor, type_uint, dest_sample_id,
@ -2828,7 +2819,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
type_uint, id_vector_temp);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(0));
@ -2843,7 +2833,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// Same BPP, 4x -> 1x.
// Pixels to samples.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseAnd, type_uint, dest_tile_pixel_x,
builder.makeUintConstant(1)));
@ -2865,7 +2854,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
if (key.dest_msaa_samples >= xenos::MsaaSamples::k4X) {
// Horizontal samples to pixels.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -2895,7 +2883,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.makeUintConstant(1));
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -2907,7 +2894,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// 1x -> 4x.
// Vertical samples (second bit) to Y pixels.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(
builder.createBinOp(spv::OpShiftRightLogical, type_uint,
dest_sample_id, builder.makeUintConstant(1)));
@ -2932,7 +2918,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.makeUintConstant(1));
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(source_sample_id);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -2950,7 +2935,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// source.
if (msaa_2x_attachments_supported_) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(
builder.createBinOp(spv::OpBitwiseXor, type_uint, dest_sample_id,
builder.makeUintConstant(1)));
@ -2961,7 +2945,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
type_uint, id_vector_temp);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(
builder.createBinOp(spv::OpShiftRightLogical, type_uint,
dest_sample_id, builder.makeUintConstant(1)));
@ -3056,7 +3039,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Builder::TextureParameters source_texture_parameters = {};
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(source_pixel_x_int);
id_vector_temp.push_back(source_pixel_y_int);
spv::Id source_coordinates[2] = {
@ -3079,7 +3061,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.makeIntConstant(1));
} else {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(builder.createBinOp(spv::OpBitwiseOr, type_int,
source_pixel_x_int,
builder.makeIntConstant(1)));
@ -3203,7 +3184,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
unorm_round_offset));
for (uint32_t j = 1; j < 4; ++j) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[i]);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -3236,7 +3216,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
unorm_round_offset));
for (uint32_t j = 1; j < 4; ++j) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[i]);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -3270,7 +3249,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder, source_color[i][0], ext_inst_glsl_std_450);
for (uint32_t j = 1; j < 3; ++j) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[i]);
id_vector_temp.push_back(
SpirvShaderTranslator::UnclampedFloat32To7e3(
@ -3282,7 +3260,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
}
// Saturate and convert the alpha.
id_vector_temp.clear();
id_vector_temp.reserve(3);
id_vector_temp.push_back(source_color[i][3]);
id_vector_temp.push_back(float_0);
id_vector_temp.push_back(float_1);
@ -3290,7 +3267,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.createBuiltinCall(type_float, ext_inst_glsl_std_450,
GLSLstd450NClamp, id_vector_temp);
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[i]);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -3320,7 +3296,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id color_16_in_32[2];
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_color[i][0]);
id_vector_temp.push_back(source_color[i][1]);
id_vector_temp.push_back(component_offset_width);
@ -3329,7 +3304,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
type_uint, id_vector_temp);
}
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(color_16_in_32[0]);
id_vector_temp.push_back(color_16_in_32[1]);
builder.createStore(builder.createCompositeConstruct(
@ -3337,7 +3311,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
output_fragment_data);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(source_color[i >> 1][i & 1]);
}
@ -3354,7 +3327,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id color_16_in_32[2];
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_color[0][i << 1]);
id_vector_temp.push_back(source_color[0][(i << 1) + 1]);
id_vector_temp.push_back(component_offset_width);
@ -3363,7 +3335,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
type_uint, id_vector_temp);
}
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(color_16_in_32[0]);
id_vector_temp.push_back(color_16_in_32[1]);
builder.createStore(builder.createCompositeConstruct(
@ -3371,7 +3342,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
output_fragment_data);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(source_color[0][i]);
}
@ -3430,7 +3400,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
}
// Merge depth and stencil.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_stencil[i]);
id_vector_temp.push_back(depth24);
id_vector_temp.push_back(depth_offset);
@ -3445,7 +3414,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
assert_true(packed[1] != spv::NoResult);
if (dest_color_format == xenos::ColorRenderTargetFormat::k_32_32_FLOAT) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(packed[1]);
// Multisampled sampled images are optional in Vulkan, and image views
@ -3466,7 +3434,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id const_uint_0 = builder.makeUintConstant(0);
spv::Id const_uint_16 = builder.makeUintConstant(16);
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(builder.createTriOp(
spv::OpBitFieldUExtract, type_uint, packed[i >> 1],
@ -3501,7 +3468,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
xenos::ColorRenderTargetFormat::k_8_8_8_8_GAMMA)) {
// Same format - passthrough.
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(source_color[0][i]);
}
@ -3544,7 +3510,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id component_width = builder.makeUintConstant(8);
for (uint32_t i = 1; i < 4 - packed_component_offset; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -3571,7 +3536,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
dest_color_format == xenos::ColorRenderTargetFormat::
k_2_10_10_10_AS_10_10_10_10)) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(source_color[0][i]);
}
@ -3594,7 +3558,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id width_a = builder.makeUintConstant(2);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -3621,7 +3584,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
dest_color_format == xenos::ColorRenderTargetFormat::
k_2_10_10_10_FLOAT_AS_16_16_16_16)) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(source_color[0][i]);
}
@ -3637,7 +3599,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id width_rgb = builder.makeUintConstant(10);
for (uint32_t i = 1; i < 3; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed);
id_vector_temp.push_back(
SpirvShaderTranslator::UnclampedFloat32To7e3(
@ -3649,7 +3610,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
}
// Saturate and convert the alpha.
id_vector_temp.clear();
id_vector_temp.reserve(3);
id_vector_temp.push_back(source_color[0][3]);
id_vector_temp.push_back(builder.makeFloatConstant(0.0f));
id_vector_temp.push_back(builder.makeFloatConstant(1.0f));
@ -3657,7 +3617,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.createBuiltinCall(type_float, ext_inst_glsl_std_450,
GLSLstd450NClamp, id_vector_temp);
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -3690,7 +3649,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
dest_color_format ==
xenos::ColorRenderTargetFormat::k_16_16_FLOAT)) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp.push_back(source_color[0][i]);
}
@ -3702,7 +3660,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
if (mode.output != TransferOutput::kStencilBit) {
spv::Id component_offset_width = builder.makeUintConstant(16);
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed);
id_vector_temp.push_back(source_color[0][1]);
id_vector_temp.push_back(component_offset_width);
@ -3752,7 +3709,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
} else {
// Merge depth and stencil.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_stencil[0]);
id_vector_temp.push_back(packed);
id_vector_temp.push_back(builder.makeUintConstant(8));
@ -3773,7 +3729,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id component_width = builder.makeUintConstant(8);
spv::Id unorm_scale = builder.makeFloatConstant(1.0f / 255.0f);
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(builder.createBinOp(
spv::OpFMul, type_float,
@ -3796,7 +3751,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::Id width_a = builder.makeUintConstant(2);
spv::Id unorm_scale_a = builder.makeFloatConstant(1.0f / 3.0f);
id_vector_temp.clear();
id_vector_temp.reserve(4);
for (uint32_t i = 0; i < 4; ++i) {
id_vector_temp.push_back(builder.createBinOp(
spv::OpFMul, type_float,
@ -3816,7 +3770,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
case xenos::ColorRenderTargetFormat::
k_2_10_10_10_FLOAT_AS_16_16_16_16: {
id_vector_temp.clear();
id_vector_temp.reserve(4);
// Color.
spv::Id width_rgb = builder.makeUintConstant(10);
for (uint32_t i = 0; i < 3; ++i) {
@ -3847,7 +3800,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// where that wouldn't help anyway).
spv::Id component_offset_width = builder.makeUintConstant(16);
id_vector_temp.clear();
id_vector_temp.reserve(2);
for (uint32_t i = 0; i < 2; ++i) {
id_vector_temp.push_back(builder.createTriOp(
spv::OpBitFieldUExtract, type_uint, packed,
@ -3910,7 +3862,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// 4x) to second sample bit.
if (msaa_2x_attachments_supported_) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseXor, type_uint, dest_sample_id,
@ -3921,7 +3872,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::OpBitFieldInsert, type_uint, id_vector_temp);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(0));
@ -3936,7 +3886,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// 4x -> 1x.
// Pixels to samples.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseAnd, type_uint, dest_tile_pixel_x,
builder.makeUintConstant(1)));
@ -3958,7 +3907,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
if (key.dest_msaa_samples >= xenos::MsaaSamples::k4X) {
// Horizontal samples to pixels.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -3988,7 +3936,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.makeUintConstant(1));
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(host_depth_source_sample_id);
id_vector_temp.push_back(host_depth_source_sample_id);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -4000,7 +3947,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// 1x -> 4x.
// Vertical samples (second bit) to Y pixels.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpShiftRightLogical, type_uint, dest_sample_id,
builder.makeUintConstant(1)));
@ -4027,7 +3973,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.makeUintConstant(1));
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(host_depth_source_sample_id);
id_vector_temp.push_back(host_depth_source_sample_id);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -4045,7 +3990,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// vertical pixels of 1x source.
if (msaa_2x_attachments_supported_) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseXor, type_uint, dest_sample_id,
builder.makeUintConstant(1)));
@ -4056,7 +4000,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
spv::OpBitFieldInsert, type_uint, id_vector_temp);
} else {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpShiftRightLogical, type_uint, dest_sample_id,
builder.makeUintConstant(1)));
@ -4142,7 +4085,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
host_depth_source_texture_parameters.sampler =
builder.createLoad(host_depth_source_texture, spv::NoPrecision);
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(host_depth_source_pixel_x_int);
id_vector_temp.push_back(host_depth_source_pixel_y_int);
host_depth_source_texture_parameters.coords =
@ -4176,7 +4118,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
if (key.dest_msaa_samples >= xenos::MsaaSamples::k4X) {
// Horizontal sample index in bit 0.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(dest_sample_id);
id_vector_temp.push_back(dest_tile_pixel_x);
id_vector_temp.push_back(builder.makeUintConstant(1));
@ -4187,7 +4128,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
// Vertical sample index as 1 or 0 in bit 0 for true 2x or as 0
// or 1 in bit 1 for 4x or for 2x emulated as 4x.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
(key.dest_msaa_samples == xenos::MsaaSamples::k2X &&
msaa_2x_attachments_supported_)
@ -4218,7 +4158,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
dest_tile_sample_y),
dest_tile_sample_x));
id_vector_temp.clear();
id_vector_temp.reserve(2);
// The only SSBO structure member.
id_vector_temp.push_back(builder.makeIntConstant(0));
id_vector_temp.push_back(builder.createUnaryOp(
@ -4326,7 +4265,6 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.createBranch(depth24_to_depth32_merge);
builder.setBuildPoint(depth24_to_depth32_merge);
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(guest_depth32);
id_vector_temp.push_back(depth24_to_depth32_result_block_id);
id_vector_temp.push_back(host_depth32);
@ -5895,7 +5833,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
// 4x MSAA source texture sample index - bit 0 for horizontal, bit 1 for
// vertical.
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(builder.createBinOp(
spv::OpBitwiseAnd, type_uint, source_sample_x, const_uint_1));
id_vector_temp.push_back(source_sample_y);
@ -5926,7 +5863,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
source_texture_parameters.sampler =
builder.createLoad(source_texture, spv::NoPrecision);
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(
builder.createUnaryOp(spv::OpBitcast, type_int, source_pixel_x));
id_vector_temp.push_back(
@ -5975,7 +5911,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
} break;
}
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(source_stencil);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(builder.makeUintConstant(8));
@ -6000,7 +5935,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
spv::Id component_width = builder.makeUintConstant(8);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -6035,7 +5969,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
spv::Id width_a = builder.makeUintConstant(2);
for (uint32_t i = 1; i < 4; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -6062,7 +5995,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
spv::Id width_rgb = builder.makeUintConstant(10);
for (uint32_t i = 1; i < 3; ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(SpirvShaderTranslator::UnclampedFloat32To7e3(
builder,
@ -6074,7 +6006,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
id_vector_temp);
// Saturate and convert the alpha.
id_vector_temp.clear();
id_vector_temp.reserve(3);
id_vector_temp.push_back(
builder.createCompositeExtract(source_vec4, type_float, 3));
id_vector_temp.push_back(builder.makeFloatConstant(0.0f));
@ -6083,7 +6014,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
builder.createBuiltinCall(type_float, ext_inst_glsl_std_450,
GLSLstd450NClamp, id_vector_temp);
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(builder.createUnaryOp(
spv::OpConvertFToU, type_uint,
@ -6112,7 +6042,6 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
spv::Id component_offset_width = builder.makeUintConstant(16);
for (uint32_t i = 0; i <= uint32_t(format_is_64bpp); ++i) {
id_vector_temp.clear();
id_vector_temp.reserve(4);
id_vector_temp.push_back(
builder.createCompositeExtract(source_vec4, type_uint, 2 * i));
id_vector_temp.push_back(builder.createCompositeExtract(
@ -6144,13 +6073,11 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
spv::Id store_value = packed[0];
if (format_is_64bpp) {
id_vector_temp.clear();
id_vector_temp.reserve(2);
id_vector_temp.push_back(packed[0]);
id_vector_temp.push_back(packed[1]);
store_value = builder.createCompositeConstruct(type_uint2, id_vector_temp);
}
id_vector_temp.clear();
id_vector_temp.reserve(2);
// The only SSBO structure member.
id_vector_temp.push_back(builder.makeIntConstant(0));
id_vector_temp.push_back(