@@ -58,12 +58,12 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
58
58
uint32_t magic_number = in_spv[SPV_HEADER_MAGIC_NUM_OFFSET];
59
59
60
60
Vector<uint32_t > spv_header;
61
- for (int i = 0 ; i < SPV_HEADER_LENGTH; i++) {
61
+ for (uint32_t i = 0 ; i < SPV_HEADER_LENGTH; i++) {
62
62
spv_header.push_back (in_spv[i]);
63
63
}
64
64
65
65
Vector<uint32_t > spv;
66
- for (int i = SPV_HEADER_LENGTH; i < in_spv.size (); i++) {
66
+ for (uint32_t i = SPV_HEADER_LENGTH; i < in_spv.size (); i++) {
67
67
spv.push_back (in_spv[i]);
68
68
}
69
69
@@ -195,10 +195,10 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
195
195
// 3. OpTypePointer
196
196
Vector<Pair<uint32_t , uint32_t >> type_pointer_res_ids;
197
197
198
- for (int i = 0 ; i < op_type_pointer_idxs.size (); i++) {
198
+ for (uint32_t i = 0 ; i < op_type_pointer_idxs.size (); i++) {
199
199
uint32_t tp_idx = op_type_pointer_idxs[i];
200
200
201
- for (int j = 0 ; j < op_type_sampled_image_idxs.size (); ++j) {
201
+ for (uint32_t j = 0 ; j < op_type_sampled_image_idxs.size (); ++j) {
202
202
uint32_t ts_idx = op_type_sampled_image_idxs[j];
203
203
204
204
// - Find OpTypePointers that ref OpTypeSampledImage
@@ -220,10 +220,10 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
220
220
Vector<Pair<Pair<uint32_t , uint32_t >, uint32_t >>
221
221
variable_res_ids;
222
222
223
- for (int i = 0 ; i < op_variable_idxs.size (); i++) {
223
+ for (uint32_t i = 0 ; i < op_variable_idxs.size (); i++) {
224
224
uint32_t v_idx = op_variable_idxs[i];
225
225
226
- for (int j = 0 ; j < type_pointer_res_ids.size (); ++j) {
226
+ for (uint32_t j = 0 ; j < type_pointer_res_ids.size (); ++j) {
227
227
uint32_t tp_res_id = type_pointer_res_ids[j].first ;
228
228
uint32_t underlying_image_id = type_pointer_res_ids[j].second ;
229
229
@@ -258,7 +258,7 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
258
258
HashSet<uint32_t > descriptor_sets_to_correct;
259
259
260
260
// - Find the current binding and descriptor set pair for each combimgsamp
261
- for (int i = 0 ; i < op_decorate_idxs.size (); i++) {
261
+ for (uint32_t i = 0 ; i < op_decorate_idxs.size (); i++) {
262
262
uint32_t d_idx = op_decorate_idxs[i];
263
263
264
264
for (const auto &[v_res_id_and_sampler_v_res_id, _] : variable_res_ids) {
@@ -344,15 +344,15 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
344
344
}
345
345
346
346
// 6. OpTypeFunction
347
- for (int i = 0 ; i < op_type_function_idxs.size (); i++) {
347
+ for (uint32_t i = 0 ; i < op_type_function_idxs.size (); i++) {
348
348
uint32_t tf_idx = op_type_function_idxs[i];
349
349
350
350
// - Append a sampler OpTypePointer to OpTypeFunctions when an underlying image OpTypePointer
351
351
// is found.
352
352
for (const auto &[image_type_pointer, _] : type_pointer_res_ids) {
353
353
uint16_t word_count = hiword (spv[tf_idx]);
354
354
355
- for (int j = 0 ; j < word_count - 3 ; ++j) {
355
+ for (uint32_t j = 0 ; j < word_count - 3 ; ++j) {
356
356
uint32_t ty_idx = tf_idx + 3 + j;
357
357
358
358
if (spv[ty_idx] == image_type_pointer) {
@@ -367,7 +367,7 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
367
367
// 7. OpFunctionParameter
368
368
HashMap<uint32_t , Pair<uint32_t , uint32_t >> parameter_res_ids;
369
369
370
- for (int i = 0 ; i < op_function_parameter_idxs.size (); i++) {
370
+ for (uint32_t i = 0 ; i < op_function_parameter_idxs.size (); i++) {
371
371
uint32_t fp_idx = op_function_parameter_idxs[i];
372
372
373
373
for (const auto &[image_type_pointer, underlying_image_id] : type_pointer_res_ids) {
@@ -393,10 +393,10 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
393
393
}
394
394
395
395
// 8. OpLoad
396
- for (int i = 0 ; i < op_loads_idxs.size (); i++) {
396
+ for (uint32_t i = 0 ; i < op_loads_idxs.size (); i++) {
397
397
uint32_t l_idx = op_loads_idxs[i];
398
398
399
- for (int j = 0 ; j < variable_res_ids.size (); ++j) {
399
+ for (uint32_t j = 0 ; j < variable_res_ids.size (); ++j) {
400
400
uint32_t v_res_id = variable_res_ids[j].first .first ;
401
401
uint32_t sampler_v_res_id = variable_res_ids[j].first .second ;
402
402
uint32_t underlying_image_id = variable_res_ids[j].second ;
@@ -431,7 +431,7 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
431
431
}
432
432
433
433
// TODO: This code is not very DRY!
434
- for (int i = 0 ; i < op_loads_idxs.size (); i++) {
434
+ for (uint32_t i = 0 ; i < op_loads_idxs.size (); i++) {
435
435
uint32_t l_idx = op_loads_idxs[i];
436
436
437
437
for (const auto &[image_res_id, sampler_data] : parameter_res_ids) {
@@ -556,7 +556,7 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
556
556
const InstructionInsert &new_instruction = *it.instruction ;
557
557
uint16_t offset = hiword (spv[new_instruction.previous_spv_idx ]);
558
558
559
- for (int i = 0 ; i < new_instruction.instruction .size (); i++) {
559
+ for (uint32_t i = 0 ; i < new_instruction.instruction .size (); i++) {
560
560
new_spv.insert (new_instruction.previous_spv_idx +
561
561
offset + i,
562
562
new_instruction.instruction [i]);
@@ -631,7 +631,7 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
631
631
if (binding == static_cast <uint32_t >(prev_binding)) {
632
632
increment += 1 ;
633
633
634
- if (prev_id <= this_id) {
634
+ if (prev_id <= ( int32_t ) this_id) {
635
635
new_spv[static_cast <uint32_t >(prev_d_idx) + 3 ];
636
636
new_spv.write [d_idx + 3 ] -= 1 ;
637
637
}
@@ -652,7 +652,7 @@ Vector<uint32_t> combimgsampsplitter(const Vector<uint32_t> &in_spv) {
652
652
uint16_t instruction = loword (op);
653
653
654
654
if (instruction == SPV_INSTRUCTION_OP_NOP) {
655
- for (int i = 0 ; i < word_count; i++) {
655
+ for (uint32_t i = 0 ; i < word_count; i++) {
656
656
new_spv.remove_at (i_idx);
657
657
}
658
658
} else {
0 commit comments