Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/Dx/VertexInputDX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Ray::Dx::VertexInput &Ray::Dx::VertexInput::operator=(VertexInput &&rhs) noexcep
}
}

vkCmdBindVertexBuffers(cmd_buf, 0, uint32_t(buffers_to_bind.size()), buffers_to_bind.cdata(),
vkCmdBindVertexBuffers(cmd_buf, 0, buffers_to_bind.size(), buffers_to_bind.cdata(),
buffer_offsets.cdata());
if (elem_buf) {
vkCmdBindIndexBuffer(cmd_buf, elem_buf.buf, VkDeviceSize(index_offset), index_type);
Expand Down
4 changes: 2 additions & 2 deletions internal/RendererVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ Ray::color_data_rgba_t Ray::Vk::Renderer::get_pixels_ref(const bool tonemap) con

VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO};

submit_info.waitSemaphoreCount = uint32_t(wait_semaphores.size());
submit_info.waitSemaphoreCount = wait_semaphores.size();
submit_info.pWaitSemaphores = wait_semaphores.data();
submit_info.pWaitDstStageMask = wait_stages.data();

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

VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO};

submit_info.waitSemaphoreCount = uint32_t(wait_semaphores.size());
submit_info.waitSemaphoreCount = wait_semaphores.size();
submit_info.pWaitSemaphores = wait_semaphores.data();
submit_info.pWaitDstStageMask = wait_stages.data();

Expand Down
2 changes: 1 addition & 1 deletion internal/SceneVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void Ray::Vk::Scene::GenerateTextureMips_nolock() {
std::vector<mip_gen_info> mips_to_generate;
mips_to_generate.reserve(atlas_textures_.size());

for (uint32_t i = 0; i < uint32_t(atlas_textures_.size()); ++i) {
for (uint32_t i = 0; i < atlas_textures_.size(); ++i) {
const atlas_texture_t &t = atlas_textures_[i];
if ((t.height & ATLAS_TEX_MIPS_BIT) == 0 || IsCompressedFormat(tex_atlases_[t.atlas].format())) {
continue;
Expand Down
10 changes: 4 additions & 6 deletions internal/Vk/BufferVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void Ray::Vk::Buffer::UpdateSubRegion(const uint32_t offset, const uint32_t size
dst_stages &= ctx_->supported_stages_mask();

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

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

if (!barriers.empty()) {
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, uint32_t(barriers.size()), barriers.cdata(), 0,
nullptr);
dst_stages, 0, 0, nullptr, barriers.size(), barriers.cdata(), 0, nullptr);
}

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

resource_state = eResState::CopyDst;
}

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

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

if (!barriers.empty()) {
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, uint32_t(barriers.size()), barriers.cdata(), 0,
nullptr);
dst_stages, 0, 0, nullptr, barriers.size(), barriers.cdata(), 0, nullptr);
}

ctx_->api().vkCmdUpdateBuffer(cmd_buf, handle_.buf, VkDeviceSize{dst_offset}, VkDeviceSize{size}, data);
Expand Down
4 changes: 2 additions & 2 deletions internal/Vk/ContextVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ bool Ray::Vk::Context::InitVkInstance(const Api &api, VkInstance &instance, cons
}

const uint32_t number_required_extensions = 0;
const uint32_t number_optional_extensions = uint32_t(desired_extensions.size()) - number_required_extensions;
const uint32_t number_optional_extensions = desired_extensions.size() - number_required_extensions;

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

device_info.enabledExtensionCount = uint32_t(device_extensions.size());
device_info.enabledExtensionCount = device_extensions.size();
device_info.ppEnabledExtensionNames = device_extensions.cdata();

VkPhysicalDeviceFeatures features = {};
Expand Down
2 changes: 1 addition & 1 deletion internal/Vk/DescriptorPoolVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool Ray::Vk::DescrPool::Init(const DescrSizes &sizes, const uint32_t sets_count
}

VkDescriptorPoolCreateInfo pool_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO};
pool_info.poolSizeCount = uint32_t(pool_sizes.size());
pool_info.poolSizeCount = pool_sizes.size();
pool_info.pPoolSizes = pool_sizes.cdata();
pool_info.maxSets = sets_count;

Expand Down
2 changes: 1 addition & 1 deletion internal/Vk/DrawCallVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ VkDescriptorSet Ray::Vk::PrepareDescriptorSet(Context *ctx, VkDescriptorSetLayou
d.dstSet = descr_set;
}

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

return descr_set;
}
Expand Down
20 changes: 10 additions & 10 deletions internal/Vk/PipelineVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, const RastState &rast_state, Program

VkPipelineVertexInputStateCreateInfo vtx_input_state_create_info = {
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
vtx_input_state_create_info.vertexBindingDescriptionCount = uint32_t(bindings.size());
vtx_input_state_create_info.vertexBindingDescriptionCount = bindings.size();
vtx_input_state_create_info.pVertexBindingDescriptions = bindings.cdata();
vtx_input_state_create_info.vertexAttributeDescriptionCount = uint32_t(attribs.size());
vtx_input_state_create_info.vertexAttributeDescriptionCount = attribs.size();
vtx_input_state_create_info.pVertexAttributeDescriptions = attribs.cdata();

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

VkPipelineDynamicStateCreateInfo dynamic_state_ci = {VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO};
dynamic_state_ci.dynamicStateCount = uint32_t(dynamic_states.size());
dynamic_state_ci.dynamicStateCount = dynamic_states.size();
dynamic_state_ci.pDynamicStates = dynamic_states.cdata();

VkGraphicsPipelineCreateInfo pipeline_create_info = {VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO};
pipeline_create_info.stageCount = uint32_t(shader_stage_create_info.size());
pipeline_create_info.stageCount = shader_stage_create_info.size();
pipeline_create_info.pStages = shader_stage_create_info.cdata();
pipeline_create_info.pVertexInputState = &vtx_input_state_create_info;
pipeline_create_info.pInputAssemblyState = &input_assembly_state_create_info;
Expand Down Expand Up @@ -365,15 +365,15 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
auto &new_group = rt_shader_groups_.emplace_back();
new_group = {VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR};
new_group.type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR;
new_group.generalShader = uint32_t(shader_stage_create_info.size());
new_group.generalShader = shader_stage_create_info.size();
new_group.anyHitShader = VK_SHADER_UNUSED_KHR;
new_group.closestHitShader = VK_SHADER_UNUSED_KHR;
new_group.intersectionShader = VK_SHADER_UNUSED_KHR;
} else if (eShaderType(i) == eShaderType::Miss) {
auto &new_group = rt_shader_groups_.emplace_back();
new_group = {VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR};
new_group.type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR;
new_group.generalShader = uint32_t(shader_stage_create_info.size());
new_group.generalShader = shader_stage_create_info.size();
new_group.anyHitShader = VK_SHADER_UNUSED_KHR;
new_group.closestHitShader = VK_SHADER_UNUSED_KHR;
new_group.intersectionShader = VK_SHADER_UNUSED_KHR;
Expand All @@ -391,7 +391,7 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
} else {
hit_group = &rt_shader_groups_[hit_group_index];
}
hit_group->closestHitShader = uint32_t(shader_stage_create_info.size());
hit_group->closestHitShader = shader_stage_create_info.size();
} else if (eShaderType(i) == eShaderType::AnyHit) {
VkRayTracingShaderGroupCreateInfoKHR *hit_group = nullptr;
if (hit_group_index == -1) {
Expand All @@ -406,7 +406,7 @@ bool Ray::Vk::Pipeline::Init(Context *ctx, Program *prog, ILog *log) {
} else {
hit_group = &rt_shader_groups_[hit_group_index];
}
hit_group->anyHitShader = uint32_t(shader_stage_create_info.size());
hit_group->anyHitShader = shader_stage_create_info.size();
}

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

const VkResult res = ctx->api().vkCreateRayTracingPipelinesKHR(ctx->device(), VK_NULL_HANDLE, VK_NULL_HANDLE, 1,
Expand Down
2 changes: 1 addition & 1 deletion internal/Vk/ProgramVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ bool Ray::Vk::Program::InitDescrSetLayouts(ILog *log) {
}

VkDescriptorSetLayoutCreateInfo layout_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO};
layout_info.bindingCount = uint32_t(layout_bindings[i].size());
layout_info.bindingCount = layout_bindings[i].size();
layout_info.pBindings = layout_bindings[i].cdata();

VkDescriptorBindingFlagsEXT bind_flag = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT;
Expand Down
6 changes: 3 additions & 3 deletions internal/Vk/RenderPassVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool Ray::Vk::RenderPass::Init(Context *ctx, Span<const RenderTargetInfo> _color
depth_rt = {};

if (_depth_rt) {
const auto att_index = uint32_t(pass_attachments.size());
const uint32_t att_index = pass_attachments.size();

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

const auto att_index = uint32_t(pass_attachments.size());
const uint32_t att_index = pass_attachments.size();

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

VkRenderPassCreateInfo render_pass_create_info = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO};
render_pass_create_info.attachmentCount = uint32_t(pass_attachments.size());
render_pass_create_info.attachmentCount = pass_attachments.size();
render_pass_create_info.pAttachments = pass_attachments.data();
render_pass_create_info.subpassCount = 1;
render_pass_create_info.pSubpasses = &subpass;
Expand Down
4 changes: 2 additions & 2 deletions internal/Vk/ResourceVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void Ray::Vk::TransitionResourceStates(VkCommandBuffer cmd_buf, const eStageBits
dst_stages &= ctx->supported_stages_mask();

ctx->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, uint32_t(buf_barriers.size()), buf_barriers.cdata(),
uint32_t(img_barriers.size()), img_barriers.cdata());
dst_stages, 0, 0, nullptr, buf_barriers.size(), buf_barriers.cdata(),
img_barriers.size(), img_barriers.cdata());
}
}
20 changes: 10 additions & 10 deletions internal/Vk/TextureAtlasVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ bool Ray::Vk::TextureAtlas::Resize(const int pages_count) {
VkCommandBuffer cmd_buf = BegSingleTimeCommands(ctx_->api(), ctx_->device(), ctx_->temp_command_pool());

ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, 0, nullptr, uint32_t(img_barriers.size()),
dst_stages, 0, 0, nullptr, 0, nullptr, img_barriers.size(),
img_barriers.cdata());

resource_state = eResState::CopySrc;
Expand Down Expand Up @@ -454,10 +454,10 @@ bool Ray::Vk::TextureAtlas::Resize(const int pages_count) {

VkCommandBuffer cmd_buf = BegSingleTimeCommands(ctx_->api(), ctx_->device(), ctx_->temp_command_pool());

ctx_->api().vkCmdPipelineBarrier(
cmd_buf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VKPipelineStagesForState(eResState::ShaderResource) & ctx_->supported_stages_mask(), 0, 0, nullptr, 0,
nullptr, uint32_t(img_barriers.size()), img_barriers.cdata());
ctx_->api().vkCmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VKPipelineStagesForState(eResState::ShaderResource) &
ctx_->supported_stages_mask(),
0, 0, nullptr, 0, nullptr, img_barriers.size(), img_barriers.cdata());

EndSingleTimeCommands(ctx_->api(), ctx_->device(), ctx_->graphics_queue(), cmd_buf, ctx_->temp_command_pool());
}
Expand Down Expand Up @@ -514,7 +514,7 @@ int Ray::Vk::TextureAtlas::DownsampleRegion(const int src_page, const int src_po
dst_stages &= ctx_->supported_stages_mask();

ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, 0, nullptr, uint32_t(img_barriers.size()),
dst_stages, 0, 0, nullptr, 0, nullptr, img_barriers.size(),
img_barriers.cdata());
}

Expand Down Expand Up @@ -568,7 +568,7 @@ int Ray::Vk::TextureAtlas::DownsampleRegion(const int src_page, const int src_po
dst_stages &= ctx_->supported_stages_mask();

ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, 0, nullptr, uint32_t(img_barriers.size()),
dst_stages, 0, 0, nullptr, 0, nullptr, img_barriers.size(),
img_barriers.cdata());
}

Expand Down Expand Up @@ -742,7 +742,7 @@ int Ray::Vk::TextureAtlas::DownsampleRegion(const int src_page, const int src_po
dst_stages &= ctx_->supported_stages_mask();

ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, 0, nullptr, uint32_t(img_barriers.size()),
dst_stages, 0, 0, nullptr, 0, nullptr, img_barriers.size(),
img_barriers.cdata());
}

Expand Down Expand Up @@ -906,8 +906,8 @@ void Ray::Vk::TextureAtlas::CopyRegionTo(const int page, const int x, const int

if (!buf_barriers.empty() || !img_barriers.empty()) {
ctx_->api().vkCmdPipelineBarrier(cmd_buf, src_stages ? src_stages : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
dst_stages, 0, 0, nullptr, uint32_t(buf_barriers.size()), buf_barriers.cdata(),
uint32_t(img_barriers.size()), img_barriers.cdata());
dst_stages, 0, 0, nullptr, buf_barriers.size(), buf_barriers.cdata(),
img_barriers.size(), img_barriers.cdata());
}

resource_state = eResState::CopySrc;
Expand Down
Loading