diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 25 | ||||
| -rw-r--r-- | src/scene.cpp | 4 | ||||
| -rw-r--r-- | src/vk-command-buffer.cpp | 6 |
3 files changed, 27 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index a046c0a..34cc894 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,14 +120,28 @@ void ui(scene* scene, float frame_time) { } if (ImGui::CollapsingHeader("Scene")) { - ImGui::SliderInt("Max bounce", reinterpret_cast<int*>(&scene->meta.max_bounce), 5, 100); - ImGui::SliderInt("Min bounce", reinterpret_cast<int*>(&scene->meta.min_bounce), 1, 5); + int max_bounce = 0; + ImGui::SliderInt("Max bounce", &max_bounce, 5, 100); + scene->meta.max_bounce = (u8)max_bounce; - ImGui::Checkbox("DOF", reinterpret_cast<bool*>(&scene->meta.enable_dof)); - ImGui::Checkbox("Debug BVH", reinterpret_cast<bool*>(&scene->meta.debug_bvh)); - if (ImGui::SliderInt("Scale facotr", reinterpret_cast<int*>(&scene->meta.downscale_factor), 1, 20)) { + int min_bounce = 0; + ImGui::SliderInt("Min bounce", &min_bounce, 1, 5); + scene->meta.min_bounce = (u8)min_bounce; + + scene->meta.features = 0U; + bool enable_dof = false; + ImGui::Checkbox("DOF", &enable_dof); + scene->meta.features |= enable_dof << FEATURES_BIT_INDEX::DOF; + + bool enable_bvh_debug_view = false; + ImGui::Checkbox("Debug BVH", &enable_bvh_debug_view); + scene->meta.features |= enable_bvh_debug_view << FEATURES_BIT_INDEX::BVH_DEBUG_VIEW; + + int downscale_factor = 0; + if (ImGui::SliderInt("Scale factor", &downscale_factor, 1, 20)) { scene->meta.sample_index = 1U; } + scene->meta.downscale_factor = (u8)downscale_factor; } ImGui::End(); @@ -676,7 +690,6 @@ int main() { } { - // TODO: Pack this fields struct params { struct metadata meta; uintptr_t bvh_buffer; diff --git a/src/scene.cpp b/src/scene.cpp index ae009e7..12499b0 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -51,10 +51,10 @@ // }
-metadata::metadata(const camera &cam, uint32_t width, uint32_t height)
+metadata::metadata(const camera &cam, u16 width, u16 height)
: cam(cam), width(width), height(height) {}
-scene::scene(const camera& cam, uint32_t width, uint32_t height)
+scene::scene(const camera& cam, u16 width, u16 height)
// :model("../models/sponza/Sponza.gltf"), meta(cam, width, height) {
// :model("../models/BistroInterior/BistroInterior.gltf"), meta(cam, width, height) {
// :model("../models/BistroExterior/BistroExterior.gltf"), meta(cam, width, height) {
diff --git a/src/vk-command-buffer.cpp b/src/vk-command-buffer.cpp index 00d60a1..aa87265 100644 --- a/src/vk-command-buffer.cpp +++ b/src/vk-command-buffer.cpp @@ -124,6 +124,8 @@ void command_buffer::copy(handle<device_buffer> buffer_handle, ::handle<device_t } void graphics_command_buffer::dispatch(const dispatch_params& params, const void* data, size_t size) const { + assert(size <= descriptor_heap_props.maxPushDataSize); + const device_pipeline* pipeline = vkdevice::get().get_pipeline(params.pipeline); vkCmdBindPipeline(vk_command_buffer, pipeline->bind_point, pipeline->vk_pipeline); @@ -204,6 +206,8 @@ void graphics_command_buffer::begin_renderpass(const renderpass_params& params) } void graphics_command_buffer::draw(const draw_params& params, const void* data, size_t size) const { + assert(size <= descriptor_heap_props.maxPushDataSize); + const device_pipeline* pipeline = vkdevice::get().get_pipeline(params.pipeline); vkCmdBindPipeline(vk_command_buffer, pipeline->bind_point, pipeline->vk_pipeline); @@ -222,6 +226,8 @@ void graphics_command_buffer::draw(const draw_params& params, const void* data, } void graphics_command_buffer::draw_indexed(const draw_indexed_params& params, const void* data, size_t size) const { + assert(size <= descriptor_heap_props.maxPushDataSize); + const device_pipeline* pipeline = vkdevice::get().get_pipeline(params.pipeline); vkCmdBindPipeline(vk_command_buffer, pipeline->bind_point, pipeline->vk_pipeline); |
