aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/scene.hpp4
-rw-r--r--include/vk-renderer.hpp2
-rw-r--r--src/compute-renderpass.cpp2
-rw-r--r--src/gltf.cpp8
-rw-r--r--src/main.cpp14
-rw-r--r--src/scene.cpp2
-rw-r--r--src/vk-context.cpp2
-rw-r--r--src/vk-renderer.cpp4
8 files changed, 20 insertions, 18 deletions
diff --git a/include/scene.hpp b/include/scene.hpp
index 257b8c9..a2db2e8 100644
--- a/include/scene.hpp
+++ b/include/scene.hpp
@@ -6,6 +6,8 @@
#include "camera.hpp"
class Buffer;
+class vkrenderer;
+
class scene {
struct metadata {
camera cam;
@@ -28,7 +30,7 @@ class scene {
// void random_scene();
public:
- scene(const camera& cam, uint32_t width, uint32_t height);
+ scene(const camera& cam, uint32_t width, uint32_t height, vkrenderer& renderer);
metadata meta;
diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp
index 57ebb31..deee33b 100644
--- a/include/vk-renderer.hpp
+++ b/include/vk-renderer.hpp
@@ -31,7 +31,7 @@ class vkrenderer {
void update_image(Texture* texture, void* data);
- void update_buffer(Buffer* buffer, void* data, off_t offset, size_t size) const;
+ void update_buffer(Buffer* buffer, void* data, off_t offset, size_t size);
Buffer* create_buffer(size_t size, bool isStatic);
diff --git a/src/compute-renderpass.cpp b/src/compute-renderpass.cpp
index 2728fec..9a1d43e 100644
--- a/src/compute-renderpass.cpp
+++ b/src/compute-renderpass.cpp
@@ -48,7 +48,7 @@ void ComputeRenderpass::set_constant(off_t offset, Buffer* buffer) {
memcpy(constants + offset, (void*)&device_buffer.device_address, sizeof(VkDeviceAddress));
}
-void ComputeRenderpass::execute(vkrenderer& renderer, VkCommandBuffer command_buffer) {
+void ComputeRenderpass::execute(vkrenderer&, VkCommandBuffer command_buffer) {
api.update_constants(command_buffer, VK_SHADER_STAGE_COMPUTE_BIT, 0, 64, (void*)&constants);
for (auto& texture: input_textures) {
diff --git a/src/gltf.cpp b/src/gltf.cpp
index adb58d2..7c1e26c 100644
--- a/src/gltf.cpp
+++ b/src/gltf.cpp
@@ -200,7 +200,7 @@ mesh_part gltf::load_primitive(json &gltf_json, json &primitive, std::vector<std
auto indices_length = indices_view["byteLength"].get<size_t>();
auto &indices_buffer = buffers_content[indices_buffer_index];
- auto *indices_start = (uint16_t *)(indices_buffer.data() + indices_offset);
+ auto *indices_start = reinterpret_cast<uint16_t *>(indices_buffer.data() + indices_offset);
part.indices.resize(indices_length / sizeof(uint16_t));
std::memcpy(part.indices.data(), indices_start, indices_length);
@@ -216,7 +216,7 @@ mesh_part gltf::load_primitive(json &gltf_json, json &primitive, std::vector<std
auto positions_length = positions_view["byteLength"].get<size_t>();
auto &positions_buffer = buffers_content[positions_buffer_index];
- auto *positions_start = (float *)(positions_buffer.data() + positions_offset);
+ auto *positions_start = reinterpret_cast<float *>(positions_buffer.data() + positions_offset);
part.positions.resize(positions_length / sizeof(float));
std::memcpy(part.positions.data(), positions_start, positions_length);
@@ -232,7 +232,7 @@ mesh_part gltf::load_primitive(json &gltf_json, json &primitive, std::vector<std
auto normals_length = normals_view["byteLength"].get<size_t>();
auto &normals_buffer = buffers_content[normals_buffer_index];
- auto *normals_start = (float *)(normals_buffer.data() + normals_offset);
+ auto *normals_start = reinterpret_cast<float *>(normals_buffer.data() + normals_offset);
part.normals.resize(normals_length / sizeof(float));
std::memcpy(part.normals.data(), normals_start, normals_length);
@@ -248,7 +248,7 @@ mesh_part gltf::load_primitive(json &gltf_json, json &primitive, std::vector<std
auto uvs_length = uvs_view["byteLength"].get<size_t>();
auto &uvs_buffer = buffers_content[uvs_buffer_index];
- auto *uvs_start = (float *)(uvs_buffer.data() + uvs_offset);
+ auto *uvs_start = reinterpret_cast<float *>(uvs_buffer.data() + uvs_offset);
part.uvs.resize(uvs_length / sizeof(float));
std::memcpy(part.uvs.data(), uvs_start, uvs_length);
diff --git a/src/main.cpp b/src/main.cpp
index 97aaa27..1d7a2ae 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -314,7 +314,7 @@ int main() {
// ImGui::End();
bool open = true;
- ImGui:ImGui::ShowDemoWindow(&open);
+ ImGui::ShowDemoWindow(&open);
ImGui::EndFrame();
@@ -338,9 +338,9 @@ int main() {
ui_pass->set_viewport(0.f, 0.f, (float)draw_data->DisplaySize.x, (float)draw_data->DisplaySize.y);
auto previous_size = ui_primitives.size();
- auto commands_count = 0;
+ auto commands_count = 0U;
- for (uint32_t draw_list_index = 0; draw_list_index < draw_data->CmdListsCount; draw_list_index++) {
+ for (int32_t draw_list_index = 0; draw_list_index < draw_data->CmdListsCount; draw_list_index++) {
commands_count += draw_data->CmdLists[draw_list_index]->CmdBuffer.size();
}
@@ -385,12 +385,12 @@ int main() {
off_t index_buffer_offset = 0;
std::vector<VkVertex> vertices;
uint32_t draw_call_index = 0;
- for (uint32_t draw_list_index = 0; draw_list_index < draw_data->CmdListsCount; draw_list_index++) {
+ for (int32_t draw_list_index = 0; draw_list_index < draw_data->CmdListsCount; draw_list_index++) {
auto& vertex_buffer = draw_data->CmdLists[draw_list_index]->VtxBuffer;
auto& index_buffer = draw_data->CmdLists[draw_list_index]->IdxBuffer;
vertices.resize(vertex_buffer.size());
- for (size_t vert_index = 0; vert_index < vertex_buffer.Size; vert_index++) {
+ for (int32_t vert_index = 0; vert_index < vertex_buffer.Size; vert_index++) {
vertices[vert_index] = *((VkVertex*)&vertex_buffer[vert_index]);
}
@@ -400,8 +400,8 @@ int main() {
ImDrawList* draw_list = draw_data->CmdLists[draw_list_index];
for (auto& draw_cmd: draw_list->CmdBuffer) {
auto& current_primitive = ui_primitives[draw_call_index];
- current_primitive->set_constant(8, (uint64_t*)&scale);
- current_primitive->set_constant(16, (uint64_t*)&translate);
+ current_primitive->set_constant(8, reinterpret_cast<uint64_t*>(&scale));
+ current_primitive->set_constant(16, reinterpret_cast<uint64_t*>(&translate));
ImVec2 pos = draw_data->DisplayPos;
current_primitive->set_scissor(
diff --git a/src/scene.cpp b/src/scene.cpp
index d62e309..dc6c8a1 100644
--- a/src/scene.cpp
+++ b/src/scene.cpp
@@ -61,7 +61,7 @@
scene::metadata::metadata(const camera &cam, uint32_t width, uint32_t height)
: cam(cam), width(width), height(height) {}
-scene::scene(const camera& cam, uint32_t width, uint32_t height)
+scene::scene(const camera& cam, uint32_t width, uint32_t height, vkrenderer& renderer)
:meta(cam, width, height){
// Geometry & BVH
diff --git a/src/vk-context.cpp b/src/vk-context.cpp
index e659b86..2783c6a 100644
--- a/src/vk-context.cpp
+++ b/src/vk-context.cpp
@@ -17,7 +17,7 @@
VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
VkDebugUtilsMessageTypeFlagsEXT type,
const VkDebugUtilsMessengerCallbackDataEXT *data,
- void *userData)
+ void*)
{
const char* severity_cstr = nullptr;
switch(severity) {
diff --git a/src/vk-renderer.cpp b/src/vk-renderer.cpp
index 55039da..ed7129c 100644
--- a/src/vk-renderer.cpp
+++ b/src/vk-renderer.cpp
@@ -158,8 +158,8 @@ void vkrenderer::update_image(Texture* texture, void* data) {
VKRESULT(vkWaitForFences(context.device, 1, &submission_fences[virtual_frame_index], VK_TRUE, UINT64_MAX))
}
-void vkrenderer::update_buffer(Buffer* buffer, void* data, off_t offset, size_t size) const {
- auto device_buffer = vkrenderer::api.get_buffer(buffer->device_buffer);
+void vkrenderer::update_buffer(Buffer* buffer, void* data, off_t offset, size_t size) {
+ auto device_buffer = api.get_buffer(buffer->device_buffer);
size_t dynamic_offset = buffer->isStatic ? 0 : buffer->size * virtual_frame_index;