Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit 976647f

Browse files
committed
A bunch of cleanup to make it so the build is warning free.
1 parent ddb8d47 commit 976647f

File tree

22 files changed

+318
-267
lines changed

22 files changed

+318
-267
lines changed

application_sandbox/calibrated_timestamps/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ class CalibratedTimestampsSample
327327
data_->allocator());
328328

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

333333
for (uint32_t i = 0; i < timestamp_infos.size(); i++) {
334334
app()->GetLogger()->LogInfo(

application_sandbox/compute_particles/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class ComputeParticlesSample
678678

679679
virtual void Render(vulkan::VkQueue* queue, size_t frame_index,
680680
ComputeParticlesFrameData* data) override {
681-
compute_task_.SubmitComputeTask(frame_index,
681+
compute_task_.SubmitComputeTask(static_cast<uint32_t>(frame_index),
682682
data->render_semaphore_->get_raw_object());
683683
// Get the next buffer that we use for the particle positions.
684684
auto* buffer = compute_task_.GetBufferForRender();
@@ -844,7 +844,7 @@ class ComputeParticlesSample
844844
VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType
845845
nullptr, // pNext
846846
1, // waitSemaphoreCount
847-
&compute_task_.GetSemaphoreForIndex(frame_index)
847+
&compute_task_.GetSemaphoreForIndex(static_cast<uint32_t>(frame_index))
848848
->get_raw_object(), // pWaitSemaphores
849849
&waitStageMask, // pWaitDstStageMask,
850850
1, // commandBufferCount

application_sandbox/extended_dynamic_state/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class ExtendedDynamicStateSample
426426
VK_STENCIL_OP_KEEP /* passOp */, VK_STENCIL_OP_ZERO /* depthFailOp */,
427427
VK_COMPARE_OP_EQUAL /* compareOp */);
428428
cmdBuffer->vkCmdSetStencilReference(cmdBuffer,
429-
VK_STENCIL_FACE_FRONT_AND_BACK, 1.0f);
429+
VK_STENCIL_FACE_FRONT_AND_BACK, 1);
430430
cmdBuffer->vkCmdDrawIndexed(
431431
cmdBuffer, static_cast<uint32_t>(extended_dynamic_state_.NumIndices()),
432432
4 /* instanceCount */, 0, 0, 0);

application_sandbox/external_buffer/buffer_export.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ int main_entry(const entry::EntryData* data) {
181181

182182
DWORD bytes_writen;
183183
WriteFile(pipe_handle, client_data_handles.data(),
184-
sizeof(HANDLE) * client_data_handles.size(), &bytes_writen, NULL);
184+
static_cast<DWORD>(sizeof(HANDLE) * client_data_handles.size()),
185+
&bytes_writen, NULL);
185186
FlushFileBuffers(pipe_handle);
186187

187188
CloseHandle(current_process);

application_sandbox/external_buffer/buffer_import.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <chrono>
16+
1517
#include "application_sandbox/sample_application_framework/sample_application.h"
18+
#include "external_buffer.h"
19+
#include "mathfu/matrix.h"
20+
#include "mathfu/vector.h"
1621
#include "support/entry/entry.h"
1722
#include "vulkan_helpers/buffer_frame_data.h"
1823
#include "vulkan_helpers/helper_functions.h"
1924
#include "vulkan_helpers/vulkan_application.h"
2025
#include "vulkan_helpers/vulkan_model.h"
2126

22-
#include <chrono>
23-
#include "mathfu/matrix.h"
24-
#include "mathfu/vector.h"
25-
26-
#include "external_buffer.h"
27-
2827
#ifdef __linux__
2928
#include <sys/socket.h>
3029
#include <sys/types.h>
@@ -334,7 +333,8 @@ class CubeSample : public sample_application::Sample<CubeFrameData> {
334333
} while (pipe_handle == INVALID_HANDLE_VALUE);
335334
DWORD bytes_read;
336335
ReadFile(pipe_handle, native_handles.data(),
337-
sizeof(HANDLE) * native_handles.size(), &bytes_read, NULL);
336+
static_cast<DWORD>(sizeof(HANDLE) * native_handles.size()),
337+
&bytes_read, NULL);
338338

339339
CloseHandle(pipe_handle);
340340
}

application_sandbox/external_image/image_export.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ int main_entry(const entry::EntryData* data) {
577577

578578
DWORD bytes_writen;
579579
WriteFile(pipe_handle, client_data_handles.data(),
580-
sizeof(HANDLE) * client_data_handles.size(), &bytes_writen, NULL);
580+
static_cast<DWORD>(sizeof(HANDLE) * client_data_handles.size()),
581+
&bytes_writen, NULL);
581582
FlushFileBuffers(pipe_handle);
582583

583584
CloseHandle(current_process);

application_sandbox/external_image/image_import.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <chrono>
16+
1517
#include "application_sandbox/sample_application_framework/sample_application.h"
18+
#include "mathfu/matrix.h"
19+
#include "mathfu/vector.h"
1620
#include "support/entry/entry.h"
1721
#include "vulkan_helpers/buffer_frame_data.h"
1822
#include "vulkan_helpers/helper_functions.h"
1923
#include "vulkan_helpers/vulkan_application.h"
2024
#include "vulkan_helpers/vulkan_model.h"
2125
#include "vulkan_helpers/vulkan_texture.h"
2226

23-
#include <chrono>
24-
#include "mathfu/matrix.h"
25-
#include "mathfu/vector.h"
26-
2727
#ifdef __linux__
2828
#include <sys/socket.h>
2929
#include <sys/types.h>
@@ -561,7 +561,8 @@ class TexturedCubeSample
561561
} while (pipe_handle == INVALID_HANDLE_VALUE);
562562
DWORD bytes_read;
563563
ReadFile(pipe_handle, native_handles.data(),
564-
sizeof(HANDLE) * native_handles.size(), &bytes_read, NULL);
564+
static_cast<DWORD>(sizeof(HANDLE) * native_handles.size()),
565+
&bytes_read, NULL);
565566

566567
CloseHandle(pipe_handle);
567568
}

application_sandbox/external_memory_host/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ class VkBufferExternalMemoryHost {
146146

147147
const auto& memory_properties = device_.physical_device_memory_properties();
148148
int idx = -1;
149-
for (idx = 0; idx < memory_properties.memoryTypeCount; idx++) {
149+
for (idx = 0; idx < static_cast<int>(memory_properties.memoryTypeCount);
150+
idx++) {
150151
if (memoryTypeBits & (1U << idx)) {
151152
break;
152153
}

application_sandbox/many_commandbuffers_cube/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <chrono>
16+
1517
#include "application_sandbox/sample_application_framework/sample_application.h"
18+
#include "mathfu/matrix.h"
19+
#include "mathfu/vector.h"
1620
#include "support/entry/entry.h"
1721
#include "vulkan_helpers/buffer_frame_data.h"
1822
#include "vulkan_helpers/helper_functions.h"
1923
#include "vulkan_helpers/vulkan_application.h"
2024
#include "vulkan_helpers/vulkan_model.h"
2125

22-
#include <chrono>
23-
#include "mathfu/matrix.h"
24-
#include "mathfu/vector.h"
25-
2626
using Mat44 = mathfu::Matrix<float, 4, 4>;
2727
using Vector4 = mathfu::Vector<float, 4>;
2828

@@ -273,7 +273,7 @@ class ManyCommandbuffersCube
273273
auto& cb = frame_data->dummy_command_buffers_[i];
274274
cb->vkResetCommandBuffer(cb, 0);
275275
cb->vkBeginCommandBuffer(cb, &sample_application::kBeginCommandBuffer);
276-
cb->vkCmdSetLineWidth(cb, 1.0);
276+
cb->vkCmdSetLineWidth(cb, 1.0f);
277277
cb->vkEndCommandBuffer(cb);
278278
VkSubmitInfo dummy_submit_info{
279279
VK_STRUCTURE_TYPE_SUBMIT_INFO, // sType
@@ -303,8 +303,8 @@ class ManyCommandbuffersCube
303303
submit_info_list.push_back(cube_submit_info);
304304

305305
app()->render_queue()->vkQueueSubmit(
306-
app()->render_queue(), submit_info_list.size(), submit_info_list.data(),
307-
static_cast<VkFence>(VK_NULL_HANDLE));
306+
app()->render_queue(), static_cast<uint32_t>(submit_info_list.size()),
307+
submit_info_list.data(), static_cast<VkFence>(VK_NULL_HANDLE));
308308
}
309309

310310
private:

application_sandbox/memory_budget/main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <chrono>
16+
1517
#include "application_sandbox/sample_application_framework/sample_application.h"
18+
#include "mathfu/matrix.h"
19+
#include "mathfu/vector.h"
1620
#include "support/entry/entry.h"
1721
#include "vulkan_helpers/buffer_frame_data.h"
1822
#include "vulkan_helpers/helper_functions.h"
1923
#include "vulkan_helpers/vulkan_application.h"
2024
#include "vulkan_helpers/vulkan_model.h"
2125

22-
#include <chrono>
23-
#include "mathfu/matrix.h"
24-
#include "mathfu/vector.h"
25-
2626
using Mat44 = mathfu::Matrix<float, 4, 4>;
2727
using Vector4 = mathfu::Vector<float, 4>;
2828

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

161-
for (int i = 0; i < memory_properties.memoryProperties.memoryHeapCount;
161+
for (uint32_t i = 0; i < memory_properties.memoryProperties.memoryHeapCount;
162162
++i) {
163163
app()->GetLogger()->LogInfo("Heap ", i, ":");
164164
app()->GetLogger()->LogInfo(
165-
"HeapSize: ", memory_properties.memoryProperties.memoryHeaps[i].size);
165+
"HeapSize: ",
166+
memory_properties.memoryProperties.memoryHeaps[i].size);
166167
app()->GetLogger()->LogInfo("HeapBudget: ",
167168
memory_budget_properties.heapBudget[i]);
168169
app()->GetLogger()->LogInfo("HeapUsage: ",

application_sandbox/overlapping_frames/main.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ int main_entry(const entry::EntryData* data) {
526526
g_pipeline);
527527
ref_buf->vkCmdPushConstants(
528528
ref_buf, g_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0,
529-
sizeof(GeometryPushConstantData), &g_push_constant_data);
529+
static_cast<uint32_t>(sizeof(GeometryPushConstantData)),
530+
&g_push_constant_data);
530531
ref_buf->vkCmdDraw(ref_buf, 3, 1, 0, 0);
531532
ref_buf->vkCmdEndRenderPass(ref_buf);
532533
LOG_ASSERT(==, data->logger(), VK_SUCCESS,
@@ -558,10 +559,10 @@ int main_entry(const entry::EntryData* data) {
558559
// Update push constants
559560
std::chrono::steady_clock::time_point current_time_point =
560561
std::chrono::steady_clock::now();
561-
float time_lapse = std::chrono::duration_cast<std::chrono::milliseconds>(
562-
current_time_point - start_time_point)
563-
.count();
564-
g_push_constant_data.time = triangle_speed * time_lapse;
562+
auto time_lapse = std::chrono::duration_cast<std::chrono::milliseconds>(
563+
current_time_point - start_time_point)
564+
.count();
565+
g_push_constant_data.time = triangle_speed * static_cast<float>(time_lapse);
565566

566567
// Write command buffer
567568
auto& geometry_buf = frame_data[next_frame].gCommandBuffer;
@@ -584,7 +585,8 @@ int main_entry(const entry::EntryData* data) {
584585
g_pipeline);
585586
geo_ref->vkCmdPushConstants(
586587
geo_ref, g_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0,
587-
sizeof(GeometryPushConstantData), &g_push_constant_data);
588+
static_cast<uint32_t>(sizeof(GeometryPushConstantData)),
589+
&g_push_constant_data);
588590
geo_ref->vkCmdDraw(geo_ref, 3, 1, 0, 0);
589591
geo_ref->vkCmdEndRenderPass(geo_ref);
590592
LOG_ASSERT(==, data->logger(), VK_SUCCESS,

application_sandbox/render_depth_attachment/main.cpp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <array>
16+
#include <chrono>
17+
1518
#include "application_sandbox/sample_application_framework/sample_application.h"
19+
#include "mathfu/matrix.h"
20+
#include "mathfu/vector.h"
1621
#include "support/entry/entry.h"
1722
#include "vulkan_helpers/buffer_frame_data.h"
1823
#include "vulkan_helpers/helper_functions.h"
1924
#include "vulkan_helpers/vulkan_application.h"
2025
#include "vulkan_helpers/vulkan_model.h"
2126

22-
#include <array>
23-
#include <chrono>
24-
#include "mathfu/matrix.h"
25-
#include "mathfu/vector.h"
26-
2727
uint32_t populating_attachments_frag[] =
2828
#include "intermediate.frag.spv"
2929
;
@@ -168,13 +168,13 @@ class RenderQuadSample
168168
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // finalLayout
169169
};
170170
auto i_att_desc = VkAttachmentDescription{
171-
0, // flags
172-
VK_FORMAT_D16_UNORM, // format
173-
VK_SAMPLE_COUNT_1_BIT, // samples
174-
VK_ATTACHMENT_LOAD_OP_LOAD, // loadOp
175-
VK_ATTACHMENT_STORE_OP_STORE, // storeOp
176-
VK_ATTACHMENT_LOAD_OP_LOAD, // stencilLoadOp
177-
VK_ATTACHMENT_STORE_OP_STORE, // stencilStoreOp
171+
0, // flags
172+
VK_FORMAT_D16_UNORM, // format
173+
VK_SAMPLE_COUNT_1_BIT, // samples
174+
VK_ATTACHMENT_LOAD_OP_LOAD, // loadOp
175+
VK_ATTACHMENT_STORE_OP_STORE, // storeOp
176+
VK_ATTACHMENT_LOAD_OP_LOAD, // stencilLoadOp
177+
VK_ATTACHMENT_STORE_OP_STORE, // stencilStoreOp
178178
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, // initialLayout
179179
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL // finalLayout
180180
};
@@ -198,7 +198,7 @@ class RenderQuadSample
198198
{
199199
o_att_desc, // Color Attachment
200200
i_att_desc, // Depth Input Attachment
201-
}, // AttachmentDescriptions
201+
}, // AttachmentDescriptions
202202
{
203203
subpass_desc,
204204
}, // SubpassDescriptions
@@ -208,8 +208,8 @@ class RenderQuadSample
208208
rendering_output_pipeline_ =
209209
containers::make_unique<vulkan::VulkanGraphicsPipeline>(
210210
data_->allocator(), app()->CreateGraphicsPipeline(
211-
pipeline_layout_.get(),
212-
rendering_output_render_pass_.get(), 0));
211+
pipeline_layout_.get(),
212+
rendering_output_render_pass_.get(), 0));
213213
rendering_output_pipeline_->AddShader(VK_SHADER_STAGE_VERTEX_BIT, "main",
214214
pass_through_vert);
215215
rendering_output_pipeline_->AddShader(VK_SHADER_STAGE_FRAGMENT_BIT, "main",
@@ -245,7 +245,7 @@ class RenderQuadSample
245245
{
246246
o_att_desc, // Depth Attachment
247247
i_att_desc, // Color Input Attachment
248-
}, // AttachmentDescriptions
248+
}, // AttachmentDescriptions
249249
{
250250
subpass_desc,
251251
}, // SubpassDescriptions
@@ -267,7 +267,8 @@ class RenderQuadSample
267267
populating_attachments_pipeline_->SetScissor(scissor());
268268
populating_attachments_pipeline_->SetViewport(viewport());
269269
populating_attachments_pipeline_->SetSamples(VK_SAMPLE_COUNT_1_BIT);
270-
populating_attachments_pipeline_->DepthStencilState().depthCompareOp = VK_COMPARE_OP_ALWAYS;
270+
populating_attachments_pipeline_->DepthStencilState().depthCompareOp =
271+
VK_COMPARE_OP_ALWAYS;
271272
populating_attachments_pipeline_->Commit();
272273

273274
depth_data_ = containers::make_unique<vulkan::BufferFrameData<DepthData>>(
@@ -330,8 +331,8 @@ class RenderQuadSample
330331
*frame_data->trans_dst_img_, // image
331332
VK_IMAGE_VIEW_TYPE_2D, // viewType
332333
frame_data->trans_dst_img_->format(), // format
333-
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
334-
VK_COMPONENT_SWIZZLE_IDENTITY},
334+
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
335+
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY},
335336
{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
336337
::VkImageView raw_trans_dst_view;
337338
LOG_ASSERT(==, data_->logger(), VK_SUCCESS,
@@ -425,7 +426,8 @@ class RenderQuadSample
425426
data_->allocator(),
426427
app()->AllocateDescriptorSet({descriptor_set_layout_binding_}));
427428
input_attachment_info.imageView = *frame_data->attachment_img_view_;
428-
input_attachment_info.imageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
429+
input_attachment_info.imageLayout =
430+
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
429431
write.dstSet = *frame_data->rendering_output_descriptor_set_;
430432
app()->device()->vkUpdateDescriptorSets(app()->device(), 1, &write, 0,
431433
nullptr);
@@ -480,9 +482,10 @@ class RenderQuadSample
480482
// copy from buf to img. The swapchain image must be larger in both
481483
// dimensions.
482484
LOG_ASSERT(>=, data_->logger(), app()->swapchain().width(), src_data.width);
483-
LOG_ASSERT(>=, data_->logger(), app()->swapchain().height(), src_data.height);
484-
uint32_t copy_width = src_data.width;
485-
uint32_t copy_height = src_data.height;
485+
LOG_ASSERT(>=, data_->logger(), app()->swapchain().height(),
486+
src_data.height);
487+
uint32_t copy_width = static_cast<uint32_t>(src_data.width);
488+
uint32_t copy_height = static_cast<uint32_t>(src_data.height);
486489
VkBufferImageCopy copy_region{
487490
depth_data_->get_offset_for_frame(frame_index),
488491
0,

0 commit comments

Comments
 (0)