Skip to content

Commit

Permalink
A bunch of cleanup to make it so the build is warning free.
Browse files Browse the repository at this point in the history
  • Loading branch information
AWoloszyn committed Sep 12, 2022
1 parent ddb8d47 commit 976647f
Show file tree
Hide file tree
Showing 22 changed files with 318 additions and 267 deletions.
4 changes: 2 additions & 2 deletions application_sandbox/calibrated_timestamps/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ class CalibratedTimestampsSample
data_->allocator());

VkResult result = app()->device()->vkGetCalibratedTimestampsEXT(
app()->device(), time_domains_.size(), timestamp_infos.data(),
timestamps.data(), max_deviation.data());
app()->device(), static_cast<uint32_t>(time_domains_.size()),
timestamp_infos.data(), timestamps.data(), max_deviation.data());

for (uint32_t i = 0; i < timestamp_infos.size(); i++) {
app()->GetLogger()->LogInfo(
Expand Down
4 changes: 2 additions & 2 deletions application_sandbox/compute_particles/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class ComputeParticlesSample

virtual void Render(vulkan::VkQueue* queue, size_t frame_index,
ComputeParticlesFrameData* data) override {
compute_task_.SubmitComputeTask(frame_index,
compute_task_.SubmitComputeTask(static_cast<uint32_t>(frame_index),
data->render_semaphore_->get_raw_object());
// Get the next buffer that we use for the particle positions.
auto* buffer = compute_task_.GetBufferForRender();
Expand Down Expand Up @@ -844,7 +844,7 @@ class ComputeParticlesSample
VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType
nullptr, // pNext
1, // waitSemaphoreCount
&compute_task_.GetSemaphoreForIndex(frame_index)
&compute_task_.GetSemaphoreForIndex(static_cast<uint32_t>(frame_index))
->get_raw_object(), // pWaitSemaphores
&waitStageMask, // pWaitDstStageMask,
1, // commandBufferCount
Expand Down
2 changes: 1 addition & 1 deletion application_sandbox/extended_dynamic_state/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class ExtendedDynamicStateSample
VK_STENCIL_OP_KEEP /* passOp */, VK_STENCIL_OP_ZERO /* depthFailOp */,
VK_COMPARE_OP_EQUAL /* compareOp */);
cmdBuffer->vkCmdSetStencilReference(cmdBuffer,
VK_STENCIL_FACE_FRONT_AND_BACK, 1.0f);
VK_STENCIL_FACE_FRONT_AND_BACK, 1);
cmdBuffer->vkCmdDrawIndexed(
cmdBuffer, static_cast<uint32_t>(extended_dynamic_state_.NumIndices()),
4 /* instanceCount */, 0, 0, 0);
Expand Down
3 changes: 2 additions & 1 deletion application_sandbox/external_buffer/buffer_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ int main_entry(const entry::EntryData* data) {

DWORD bytes_writen;
WriteFile(pipe_handle, client_data_handles.data(),
sizeof(HANDLE) * client_data_handles.size(), &bytes_writen, NULL);
static_cast<DWORD>(sizeof(HANDLE) * client_data_handles.size()),
&bytes_writen, NULL);
FlushFileBuffers(pipe_handle);

CloseHandle(current_process);
Expand Down
14 changes: 7 additions & 7 deletions application_sandbox/external_buffer/buffer_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <chrono>

#include "application_sandbox/sample_application_framework/sample_application.h"
#include "external_buffer.h"
#include "mathfu/matrix.h"
#include "mathfu/vector.h"
#include "support/entry/entry.h"
#include "vulkan_helpers/buffer_frame_data.h"
#include "vulkan_helpers/helper_functions.h"
#include "vulkan_helpers/vulkan_application.h"
#include "vulkan_helpers/vulkan_model.h"

#include <chrono>
#include "mathfu/matrix.h"
#include "mathfu/vector.h"

#include "external_buffer.h"

#ifdef __linux__
#include <sys/socket.h>
#include <sys/types.h>
Expand Down Expand Up @@ -334,7 +333,8 @@ class CubeSample : public sample_application::Sample<CubeFrameData> {
} while (pipe_handle == INVALID_HANDLE_VALUE);
DWORD bytes_read;
ReadFile(pipe_handle, native_handles.data(),
sizeof(HANDLE) * native_handles.size(), &bytes_read, NULL);
static_cast<DWORD>(sizeof(HANDLE) * native_handles.size()),
&bytes_read, NULL);

CloseHandle(pipe_handle);
}
Expand Down
3 changes: 2 additions & 1 deletion application_sandbox/external_image/image_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ int main_entry(const entry::EntryData* data) {

DWORD bytes_writen;
WriteFile(pipe_handle, client_data_handles.data(),
sizeof(HANDLE) * client_data_handles.size(), &bytes_writen, NULL);
static_cast<DWORD>(sizeof(HANDLE) * client_data_handles.size()),
&bytes_writen, NULL);
FlushFileBuffers(pipe_handle);

CloseHandle(current_process);
Expand Down
11 changes: 6 additions & 5 deletions application_sandbox/external_image/image_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <chrono>

#include "application_sandbox/sample_application_framework/sample_application.h"
#include "mathfu/matrix.h"
#include "mathfu/vector.h"
#include "support/entry/entry.h"
#include "vulkan_helpers/buffer_frame_data.h"
#include "vulkan_helpers/helper_functions.h"
#include "vulkan_helpers/vulkan_application.h"
#include "vulkan_helpers/vulkan_model.h"
#include "vulkan_helpers/vulkan_texture.h"

#include <chrono>
#include "mathfu/matrix.h"
#include "mathfu/vector.h"

#ifdef __linux__
#include <sys/socket.h>
#include <sys/types.h>
Expand Down Expand Up @@ -561,7 +561,8 @@ class TexturedCubeSample
} while (pipe_handle == INVALID_HANDLE_VALUE);
DWORD bytes_read;
ReadFile(pipe_handle, native_handles.data(),
sizeof(HANDLE) * native_handles.size(), &bytes_read, NULL);
static_cast<DWORD>(sizeof(HANDLE) * native_handles.size()),
&bytes_read, NULL);

CloseHandle(pipe_handle);
}
Expand Down
3 changes: 2 additions & 1 deletion application_sandbox/external_memory_host/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class VkBufferExternalMemoryHost {

const auto& memory_properties = device_.physical_device_memory_properties();
int idx = -1;
for (idx = 0; idx < memory_properties.memoryTypeCount; idx++) {
for (idx = 0; idx < static_cast<int>(memory_properties.memoryTypeCount);
idx++) {
if (memoryTypeBits & (1U << idx)) {
break;
}
Expand Down
14 changes: 7 additions & 7 deletions application_sandbox/many_commandbuffers_cube/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <chrono>

#include "application_sandbox/sample_application_framework/sample_application.h"
#include "mathfu/matrix.h"
#include "mathfu/vector.h"
#include "support/entry/entry.h"
#include "vulkan_helpers/buffer_frame_data.h"
#include "vulkan_helpers/helper_functions.h"
#include "vulkan_helpers/vulkan_application.h"
#include "vulkan_helpers/vulkan_model.h"

#include <chrono>
#include "mathfu/matrix.h"
#include "mathfu/vector.h"

using Mat44 = mathfu::Matrix<float, 4, 4>;
using Vector4 = mathfu::Vector<float, 4>;

Expand Down Expand Up @@ -273,7 +273,7 @@ class ManyCommandbuffersCube
auto& cb = frame_data->dummy_command_buffers_[i];
cb->vkResetCommandBuffer(cb, 0);
cb->vkBeginCommandBuffer(cb, &sample_application::kBeginCommandBuffer);
cb->vkCmdSetLineWidth(cb, 1.0);
cb->vkCmdSetLineWidth(cb, 1.0f);
cb->vkEndCommandBuffer(cb);
VkSubmitInfo dummy_submit_info{
VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType
Expand Down Expand Up @@ -303,8 +303,8 @@ class ManyCommandbuffersCube
submit_info_list.push_back(cube_submit_info);

app()->render_queue()->vkQueueSubmit(
app()->render_queue(), submit_info_list.size(), submit_info_list.data(),
static_cast<VkFence>(VK_NULL_HANDLE));
app()->render_queue(), static_cast<uint32_t>(submit_info_list.size()),
submit_info_list.data(), static_cast<VkFence>(VK_NULL_HANDLE));
}

private:
Expand Down
13 changes: 7 additions & 6 deletions application_sandbox/memory_budget/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <chrono>

#include "application_sandbox/sample_application_framework/sample_application.h"
#include "mathfu/matrix.h"
#include "mathfu/vector.h"
#include "support/entry/entry.h"
#include "vulkan_helpers/buffer_frame_data.h"
#include "vulkan_helpers/helper_functions.h"
#include "vulkan_helpers/vulkan_application.h"
#include "vulkan_helpers/vulkan_model.h"

#include <chrono>
#include "mathfu/matrix.h"
#include "mathfu/vector.h"

using Mat44 = mathfu::Matrix<float, 4, 4>;
using Vector4 = mathfu::Vector<float, 4>;

Expand Down Expand Up @@ -158,11 +158,12 @@ class CubeSample : public sample_application::Sample<CubeFrameData> {
app()->instance()->vkGetPhysicalDeviceMemoryProperties2(
app()->device().physical_device(), &memory_properties);

for (int i = 0; i < memory_properties.memoryProperties.memoryHeapCount;
for (uint32_t i = 0; i < memory_properties.memoryProperties.memoryHeapCount;
++i) {
app()->GetLogger()->LogInfo("Heap ", i, ":");
app()->GetLogger()->LogInfo(
"HeapSize: ", memory_properties.memoryProperties.memoryHeaps[i].size);
"HeapSize: ",
memory_properties.memoryProperties.memoryHeaps[i].size);
app()->GetLogger()->LogInfo("HeapBudget: ",
memory_budget_properties.heapBudget[i]);
app()->GetLogger()->LogInfo("HeapUsage: ",
Expand Down
14 changes: 8 additions & 6 deletions application_sandbox/overlapping_frames/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ int main_entry(const entry::EntryData* data) {
g_pipeline);
ref_buf->vkCmdPushConstants(
ref_buf, g_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0,
sizeof(GeometryPushConstantData), &g_push_constant_data);
static_cast<uint32_t>(sizeof(GeometryPushConstantData)),
&g_push_constant_data);
ref_buf->vkCmdDraw(ref_buf, 3, 1, 0, 0);
ref_buf->vkCmdEndRenderPass(ref_buf);
LOG_ASSERT(==, data->logger(), VK_SUCCESS,
Expand Down Expand Up @@ -558,10 +559,10 @@ int main_entry(const entry::EntryData* data) {
// Update push constants
std::chrono::steady_clock::time_point current_time_point =
std::chrono::steady_clock::now();
float time_lapse = std::chrono::duration_cast<std::chrono::milliseconds>(
current_time_point - start_time_point)
.count();
g_push_constant_data.time = triangle_speed * time_lapse;
auto time_lapse = std::chrono::duration_cast<std::chrono::milliseconds>(
current_time_point - start_time_point)
.count();
g_push_constant_data.time = triangle_speed * static_cast<float>(time_lapse);

// Write command buffer
auto& geometry_buf = frame_data[next_frame].gCommandBuffer;
Expand All @@ -584,7 +585,8 @@ int main_entry(const entry::EntryData* data) {
g_pipeline);
geo_ref->vkCmdPushConstants(
geo_ref, g_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0,
sizeof(GeometryPushConstantData), &g_push_constant_data);
static_cast<uint32_t>(sizeof(GeometryPushConstantData)),
&g_push_constant_data);
geo_ref->vkCmdDraw(geo_ref, 3, 1, 0, 0);
geo_ref->vkCmdEndRenderPass(geo_ref);
LOG_ASSERT(==, data->logger(), VK_SUCCESS,
Expand Down
49 changes: 26 additions & 23 deletions application_sandbox/render_depth_attachment/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <array>
#include <chrono>

#include "application_sandbox/sample_application_framework/sample_application.h"
#include "mathfu/matrix.h"
#include "mathfu/vector.h"
#include "support/entry/entry.h"
#include "vulkan_helpers/buffer_frame_data.h"
#include "vulkan_helpers/helper_functions.h"
#include "vulkan_helpers/vulkan_application.h"
#include "vulkan_helpers/vulkan_model.h"

#include <array>
#include <chrono>
#include "mathfu/matrix.h"
#include "mathfu/vector.h"

uint32_t populating_attachments_frag[] =
#include "intermediate.frag.spv"
;
Expand Down Expand Up @@ -168,13 +168,13 @@ class RenderQuadSample
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout
};
auto i_att_desc = VkAttachmentDescription{
0, // flags
VK_FORMAT_D16_UNORM, // format
VK_SAMPLE_COUNT_1_BIT, // samples
VK_ATTACHMENT_LOAD_OP_LOAD, // loadOp
VK_ATTACHMENT_STORE_OP_STORE, // storeOp
VK_ATTACHMENT_LOAD_OP_LOAD, // stencilLoadOp
VK_ATTACHMENT_STORE_OP_STORE, // stencilStoreOp
0, // flags
VK_FORMAT_D16_UNORM, // format
VK_SAMPLE_COUNT_1_BIT, // samples
VK_ATTACHMENT_LOAD_OP_LOAD, // loadOp
VK_ATTACHMENT_STORE_OP_STORE, // storeOp
VK_ATTACHMENT_LOAD_OP_LOAD, // stencilLoadOp
VK_ATTACHMENT_STORE_OP_STORE, // stencilStoreOp
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, // initialLayout
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL // finalLayout
};
Expand All @@ -198,7 +198,7 @@ class RenderQuadSample
{
o_att_desc, // Color Attachment
i_att_desc, // Depth Input Attachment
}, // AttachmentDescriptions
}, // AttachmentDescriptions
{
subpass_desc,
}, // SubpassDescriptions
Expand All @@ -208,8 +208,8 @@ class RenderQuadSample
rendering_output_pipeline_ =
containers::make_unique<vulkan::VulkanGraphicsPipeline>(
data_->allocator(), app()->CreateGraphicsPipeline(
pipeline_layout_.get(),
rendering_output_render_pass_.get(), 0));
pipeline_layout_.get(),
rendering_output_render_pass_.get(), 0));
rendering_output_pipeline_->AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main",
pass_through_vert);
rendering_output_pipeline_->AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main",
Expand Down Expand Up @@ -245,7 +245,7 @@ class RenderQuadSample
{
o_att_desc, // Depth Attachment
i_att_desc, // Color Input Attachment
}, // AttachmentDescriptions
}, // AttachmentDescriptions
{
subpass_desc,
}, // SubpassDescriptions
Expand All @@ -267,7 +267,8 @@ class RenderQuadSample
populating_attachments_pipeline_->SetScissor(scissor());
populating_attachments_pipeline_->SetViewport(viewport());
populating_attachments_pipeline_->SetSamples(VK_SAMPLE_COUNT_1_BIT);
populating_attachments_pipeline_->DepthStencilState().depthCompareOp = VK_COMPARE_OP_ALWAYS;
populating_attachments_pipeline_->DepthStencilState().depthCompareOp =
VK_COMPARE_OP_ALWAYS;
populating_attachments_pipeline_->Commit();

depth_data_ = containers::make_unique<vulkan::BufferFrameData<DepthData>>(
Expand Down Expand Up @@ -330,8 +331,8 @@ class RenderQuadSample
*frame_data->trans_dst_img_, // image
VK_IMAGE_VIEW_TYPE_2D, // viewType
frame_data->trans_dst_img_->format(), // format
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY},
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY},
{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
::VkImageView raw_trans_dst_view;
LOG_ASSERT(==, data_->logger(), VK_SUCCESS,
Expand Down Expand Up @@ -425,7 +426,8 @@ class RenderQuadSample
data_->allocator(),
app()->AllocateDescriptorSet({descriptor_set_layout_binding_}));
input_attachment_info.imageView = *frame_data->attachment_img_view_;
input_attachment_info.imageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
input_attachment_info.imageLayout =
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
write.dstSet = *frame_data->rendering_output_descriptor_set_;
app()->device()->vkUpdateDescriptorSets(app()->device(), 1, &write, 0,
nullptr);
Expand Down Expand Up @@ -480,9 +482,10 @@ class RenderQuadSample
// copy from buf to img. The swapchain image must be larger in both
// dimensions.
LOG_ASSERT(>=, data_->logger(), app()->swapchain().width(), src_data.width);
LOG_ASSERT(>=, data_->logger(), app()->swapchain().height(), src_data.height);
uint32_t copy_width = src_data.width;
uint32_t copy_height = src_data.height;
LOG_ASSERT(>=, data_->logger(), app()->swapchain().height(),
src_data.height);
uint32_t copy_width = static_cast<uint32_t>(src_data.width);
uint32_t copy_height = static_cast<uint32_t>(src_data.height);
VkBufferImageCopy copy_region{
depth_data_->get_offset_for_frame(frame_index),
0,
Expand Down
Loading

0 comments on commit 976647f

Please sign in to comment.