Skip to content

Commit

Permalink
Fix MSVC build errors/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zeux committed Nov 30, 2024
1 parent e31e73c commit 6bf8dde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/niagara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void buildBLAS(VkDevice device, const std::vector<Mesh>& meshes, const Buffer& v
}
assert(i > start); // guaranteed as scratchBuffer.size >= maxScratchSize

vkCmdBuildAccelerationStructuresKHR(commandBuffer, i - start, &buildInfos[start], &buildRangePtrs[start]);
vkCmdBuildAccelerationStructuresKHR(commandBuffer, uint32_t(i - start), &buildInfos[start], &buildRangePtrs[start]);
start = i;

pipelineBarrier(commandBuffer, 0, 1, &scratchBarrier, 0, nullptr);
Expand Down Expand Up @@ -568,7 +568,7 @@ int main(int argc, const char** argv)
VkSampler depthSampler = createSampler(device, VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_NEAREST, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_REDUCTION_MODE_MIN);
assert(depthSampler);

const size_t gbufferCount = 2;
static const size_t gbufferCount = 2;
const VkFormat gbufferFormats[gbufferCount] = {
VK_FORMAT_R8G8B8A8_UNORM,
VK_FORMAT_A2B10G10R10_UNORM_PACK32,
Expand Down Expand Up @@ -762,7 +762,7 @@ int main(int argc, const char** argv)

printf("Loaded %d textures in %.2f sec\n", int(images.size()), glfwGetTime() - imageTimer);

uint32_t descriptorCount = texturePaths.size() + 1;
uint32_t descriptorCount = uint32_t(texturePaths.size() + 1);
std::pair<VkDescriptorPool, VkDescriptorSet> textureSet = createDescriptorArray(device, textureSetLayout, descriptorCount);

for (size_t i = 0; i < texturePaths.size(); ++i)
Expand All @@ -774,7 +774,7 @@ int main(int argc, const char** argv)
VkWriteDescriptorSet write = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET };
write.dstSet = textureSet.second;
write.dstBinding = 0;
write.dstArrayElement = i + 1;
write.dstArrayElement = uint32_t(i + 1);
write.descriptorCount = 1;
write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
write.pImageInfo = &imageInfo;
Expand Down
10 changes: 5 additions & 5 deletions src/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,21 +419,21 @@ bool loadScene(Geometry& geometry, std::vector<MeshDraw>& draws, std::vector<std

draw.albedoTexture =
material && material->pbr_metallic_roughness.base_color_texture.texture
? 1 + cgltf_texture_index(data, material->pbr_metallic_roughness.base_color_texture.texture)
? 1 + int(cgltf_texture_index(data, material->pbr_metallic_roughness.base_color_texture.texture))
: material && material->pbr_specular_glossiness.diffuse_texture.texture
? 1 + cgltf_texture_index(data, material->pbr_specular_glossiness.diffuse_texture.texture)
? 1 + int(cgltf_texture_index(data, material->pbr_specular_glossiness.diffuse_texture.texture))
: 0;
draw.normalTexture =
material && material->normal_texture.texture
? 1 + cgltf_texture_index(data, material->normal_texture.texture)
? 1 + int(cgltf_texture_index(data, material->normal_texture.texture))
: 0;
draw.specularTexture =
material && material->pbr_specular_glossiness.specular_glossiness_texture.texture
? 1 + cgltf_texture_index(data, material->pbr_specular_glossiness.specular_glossiness_texture.texture)
? 1 + int(cgltf_texture_index(data, material->pbr_specular_glossiness.specular_glossiness_texture.texture))
: 0;
draw.emissiveTexture =
material && material->emissive_texture.texture
? 1 + cgltf_texture_index(data, material->emissive_texture.texture)
? 1 + int(cgltf_texture_index(data, material->emissive_texture.texture))
: 0;

if (material && material->alpha_mode != cgltf_alpha_mode_opaque)
Expand Down

0 comments on commit 6bf8dde

Please sign in to comment.