Skip to content

Commit 04de65a

Browse files
committed
Minor refactoring
1 parent 8e88ac0 commit 04de65a

14 files changed

+52
-55
lines changed

internal/Dx/VertexInputDX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Ray::Dx::VertexInput &Ray::Dx::VertexInput::operator=(VertexInput &&rhs) noexcep
6666
}
6767
}
6868
69-
vkCmdBindVertexBuffers(cmd_buf, 0, uint32_t(buffers_to_bind.size()), buffers_to_bind.cdata(),
69+
vkCmdBindVertexBuffers(cmd_buf, 0, buffers_to_bind.size(), buffers_to_bind.cdata(),
7070
buffer_offsets.cdata());
7171
if (elem_buf) {
7272
vkCmdBindIndexBuffer(cmd_buf, elem_buf.buf, VkDeviceSize(index_offset), index_type);

internal/RendererVK.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ Ray::color_data_rgba_t Ray::Vk::Renderer::get_pixels_ref(const bool tonemap) con
17051705

17061706
VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO};
17071707

1708-
submit_info.waitSemaphoreCount = uint32_t(wait_semaphores.size());
1708+
submit_info.waitSemaphoreCount = wait_semaphores.size();
17091709
submit_info.pWaitSemaphores = wait_semaphores.data();
17101710
submit_info.pWaitDstStageMask = wait_stages.data();
17111711

@@ -1769,7 +1769,7 @@ Ray::color_data_rgba_t Ray::Vk::Renderer::get_aux_pixels_ref(const eAUXBuffer bu
17691769

17701770
VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO};
17711771

1772-
submit_info.waitSemaphoreCount = uint32_t(wait_semaphores.size());
1772+
submit_info.waitSemaphoreCount = wait_semaphores.size();
17731773
submit_info.pWaitSemaphores = wait_semaphores.data();
17741774
submit_info.pWaitDstStageMask = wait_stages.data();
17751775

internal/SceneVK.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void Ray::Vk::Scene::GenerateTextureMips_nolock() {
7575
std::vector<mip_gen_info> mips_to_generate;
7676
mips_to_generate.reserve(atlas_textures_.size());
7777

78-
for (uint32_t i = 0; i < uint32_t(atlas_textures_.size()); ++i) {
78+
for (uint32_t i = 0; i < atlas_textures_.size(); ++i) {
7979
const atlas_texture_t &t = atlas_textures_[i];
8080
if ((t.height & ATLAS_TEX_MIPS_BIT) == 0 || IsCompressedFormat(tex_atlases_[t.atlas].format())) {
8181
continue;

internal/Vk/BufferVK.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void Ray::Vk::Buffer::UpdateSubRegion(const uint32_t offset, const uint32_t size
133133
dst_stages &= ctx_->supported_stages_mask();
134134

135135
if (!barriers.empty()) {
136-
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages, dst_stages, 0, 0, nullptr, uint32_t(barriers.size()),
136+
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages, dst_stages, 0, 0, nullptr, barriers.size(),
137137
barriers.cdata(), 0, nullptr);
138138
}
139139

@@ -337,16 +337,15 @@ void Ray::Vk::Buffer::Fill(const uint32_t dst_offset, const uint32_t size, const
337337

338338
if (!barriers.empty()) {
339339
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
340-
dst_stages, 0, 0, nullptr, uint32_t(barriers.size()), barriers.cdata(), 0,
341-
nullptr);
340+
dst_stages, 0, 0, nullptr, barriers.size(), barriers.cdata(), 0, nullptr);
342341
}
343342

344343
ctx_->api().vkCmdFillBuffer(cmd_buf, handle_.buf, VkDeviceSize{dst_offset}, VkDeviceSize{size}, data);
345344

346345
resource_state = eResState::CopyDst;
347346
}
348347

349-
void Ray::Vk::Buffer::UpdateImmediate(uint32_t dst_offset, uint32_t size, const void *data, VkCommandBuffer cmd_buf) {
348+
void Ray::Vk::Buffer::UpdateImmediate(const uint32_t dst_offset, const uint32_t size, const void *data, VkCommandBuffer cmd_buf) {
350349
VkPipelineStageFlags src_stages = 0, dst_stages = 0;
351350
SmallVector<VkBufferMemoryBarrier, 1> barriers;
352351

@@ -370,8 +369,7 @@ void Ray::Vk::Buffer::UpdateImmediate(uint32_t dst_offset, uint32_t size, const
370369

371370
if (!barriers.empty()) {
372371
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
373-
dst_stages, 0, 0, nullptr, uint32_t(barriers.size()), barriers.cdata(), 0,
374-
nullptr);
372+
dst_stages, 0, 0, nullptr, barriers.size(), barriers.cdata(), 0, nullptr);
375373
}
376374

377375
ctx_->api().vkCmdUpdateBuffer(cmd_buf, handle_.buf, VkDeviceSize{dst_offset}, VkDeviceSize{size}, data);

internal/Vk/ContextVK.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ bool Ray::Vk::Context::InitVkInstance(const Api &api, VkInstance &instance, cons
364364
}
365365

366366
const uint32_t number_required_extensions = 0;
367-
const uint32_t number_optional_extensions = uint32_t(desired_extensions.size()) - number_required_extensions;
367+
const uint32_t number_optional_extensions = desired_extensions.size() - number_required_extensions;
368368

369369
{ // Find required extensions
370370
uint32_t ext_count = 0;
@@ -711,7 +711,7 @@ bool Ray::Vk::Context::InitVkDevice(const Api &api, VkDevice &device, VkPhysical
711711
device_extensions.push_back(VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME);
712712
}
713713

714-
device_info.enabledExtensionCount = uint32_t(device_extensions.size());
714+
device_info.enabledExtensionCount = device_extensions.size();
715715
device_info.ppEnabledExtensionNames = device_extensions.cdata();
716716

717717
VkPhysicalDeviceFeatures features = {};

internal/Vk/DescriptorPoolVK.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool Ray::Vk::DescrPool::Init(const DescrSizes &sizes, const uint32_t sets_count
5959
}
6060

6161
VkDescriptorPoolCreateInfo pool_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO};
62-
pool_info.poolSizeCount = uint32_t(pool_sizes.size());
62+
pool_info.poolSizeCount = pool_sizes.size();
6363
pool_info.pPoolSizes = pool_sizes.cdata();
6464
pool_info.maxSets = sets_count;
6565

internal/Vk/DrawCallVK.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ VkDescriptorSet Ray::Vk::PrepareDescriptorSet(Context *ctx, VkDescriptorSetLayou
173173
d.dstSet = descr_set;
174174
}
175175

176-
ctx->api().vkUpdateDescriptorSets(ctx->device(), uint32_t(descr_writes.size()), descr_writes.data(), 0, nullptr);
176+
ctx->api().vkUpdateDescriptorSets(ctx->device(), descr_writes.size(), descr_writes.data(), 0, nullptr);
177177

178178
return descr_set;
179179
}

internal/Vk/PipelineVK.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, const RastState &rast_state, Program
160160

161161
VkPipelineVertexInputStateCreateInfo vtx_input_state_create_info = {
162162
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
163-
vtx_input_state_create_info.vertexBindingDescriptionCount = uint32_t(bindings.size());
163+
vtx_input_state_create_info.vertexBindingDescriptionCount = bindings.size();
164164
vtx_input_state_create_info.pVertexBindingDescriptions = bindings.cdata();
165-
vtx_input_state_create_info.vertexAttributeDescriptionCount = uint32_t(attribs.size());
165+
vtx_input_state_create_info.vertexAttributeDescriptionCount = attribs.size();
166166
vtx_input_state_create_info.pVertexAttributeDescriptions = attribs.cdata();
167167

168168
VkPipelineInputAssemblyStateCreateInfo input_assembly_state_create_info = {
@@ -264,11 +264,11 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, const RastState &rast_state, Program
264264
}
265265

266266
VkPipelineDynamicStateCreateInfo dynamic_state_ci = {VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO};
267-
dynamic_state_ci.dynamicStateCount = uint32_t(dynamic_states.size());
267+
dynamic_state_ci.dynamicStateCount = dynamic_states.size();
268268
dynamic_state_ci.pDynamicStates = dynamic_states.cdata();
269269

270270
VkGraphicsPipelineCreateInfo pipeline_create_info = {VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO};
271-
pipeline_create_info.stageCount = uint32_t(shader_stage_create_info.size());
271+
pipeline_create_info.stageCount = shader_stage_create_info.size();
272272
pipeline_create_info.pStages = shader_stage_create_info.cdata();
273273
pipeline_create_info.pVertexInputState = &vtx_input_state_create_info;
274274
pipeline_create_info.pInputAssemblyState = &input_assembly_state_create_info;
@@ -365,15 +365,15 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
365365
auto &new_group = rt_shader_groups_.emplace_back();
366366
new_group = {VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR};
367367
new_group.type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR;
368-
new_group.generalShader = uint32_t(shader_stage_create_info.size());
368+
new_group.generalShader = shader_stage_create_info.size();
369369
new_group.anyHitShader = VK_SHADER_UNUSED_KHR;
370370
new_group.closestHitShader = VK_SHADER_UNUSED_KHR;
371371
new_group.intersectionShader = VK_SHADER_UNUSED_KHR;
372372
} else if (eShaderType(i) == eShaderType::Miss) {
373373
auto &new_group = rt_shader_groups_.emplace_back();
374374
new_group = {VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR};
375375
new_group.type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR;
376-
new_group.generalShader = uint32_t(shader_stage_create_info.size());
376+
new_group.generalShader = shader_stage_create_info.size();
377377
new_group.anyHitShader = VK_SHADER_UNUSED_KHR;
378378
new_group.closestHitShader = VK_SHADER_UNUSED_KHR;
379379
new_group.intersectionShader = VK_SHADER_UNUSED_KHR;
@@ -391,7 +391,7 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
391391
} else {
392392
hit_group = &rt_shader_groups_[hit_group_index];
393393
}
394-
hit_group->closestHitShader = uint32_t(shader_stage_create_info.size());
394+
hit_group->closestHitShader = shader_stage_create_info.size();
395395
} else if (eShaderType(i) == eShaderType::AnyHit) {
396396
VkRayTracingShaderGroupCreateInfoKHR *hit_group = nullptr;
397397
if (hit_group_index == -1) {
@@ -406,7 +406,7 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
406406
} else {
407407
hit_group = &rt_shader_groups_[hit_group_index];
408408
}
409-
hit_group->anyHitShader = uint32_t(shader_stage_create_info.size());
409+
hit_group->anyHitShader = shader_stage_create_info.size();
410410
}
411411

412412
auto &stage_info = shader_stage_create_info.emplace_back();
@@ -453,10 +453,10 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
453453
} else /* if (type == ePipelineType::Raytracing) */ {
454454
VkRayTracingPipelineCreateInfoKHR info = {VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR};
455455
info.pStages = shader_stage_create_info.cdata();
456-
info.stageCount = uint32_t(shader_stage_create_info.size());
456+
info.stageCount = shader_stage_create_info.size();
457457
info.layout = layout_;
458458
info.maxPipelineRayRecursionDepth = 1;
459-
info.groupCount = uint32_t(rt_shader_groups_.size());
459+
info.groupCount = rt_shader_groups_.size();
460460
info.pGroups = rt_shader_groups_.cdata();
461461

462462
const VkResult res = ctx->api().vkCreateRayTracingPipelinesKHR(ctx->device(), VK_NULL_HANDLE, VK_NULL_HANDLE, 1,

internal/Vk/ProgramVK.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ bool Ray::Vk::Program::InitDescrSetLayouts(ILog *log) {
165165
}
166166

167167
VkDescriptorSetLayoutCreateInfo layout_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO};
168-
layout_info.bindingCount = uint32_t(layout_bindings[i].size());
168+
layout_info.bindingCount = layout_bindings[i].size();
169169
layout_info.pBindings = layout_bindings[i].cdata();
170170

171171
VkDescriptorBindingFlagsEXT bind_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT;

internal/Vk/RenderPassVK.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ bool Ray::Vk::RenderPass::Init(Context *ctx, Span<const RenderTargetInfo> _color
7474
depth_rt = {};
7575

7676
if (_depth_rt) {
77-
const auto att_index = uint32_t(pass_attachments.size());
77+
const uint32_t att_index = pass_attachments.size();
7878

7979
auto &att_desc = pass_attachments.emplace_back();
8080
att_desc.format = Ray::Vk::VKFormatFromTexFormat(_depth_rt.format);
@@ -97,7 +97,7 @@ bool Ray::Vk::RenderPass::Init(Context *ctx, Span<const RenderTargetInfo> _color
9797
continue;
9898
}
9999

100-
const auto att_index = uint32_t(pass_attachments.size());
100+
const uint32_t att_index = pass_attachments.size();
101101

102102
auto &att_desc = pass_attachments.emplace_back();
103103
att_desc.format = VKFormatFromTexFormat(_color_rts[i].format);
@@ -132,7 +132,7 @@ bool Ray::Vk::RenderPass::Init(Context *ctx, Span<const RenderTargetInfo> _color
132132
}
133133

134134
VkRenderPassCreateInfo render_pass_create_info = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO};
135-
render_pass_create_info.attachmentCount = uint32_t(pass_attachments.size());
135+
render_pass_create_info.attachmentCount = pass_attachments.size();
136136
render_pass_create_info.pAttachments = pass_attachments.data();
137137
render_pass_create_info.subpassCount = 1;
138138
render_pass_create_info.pSubpasses = &subpass;

0 commit comments

Comments
 (0)