diff --git a/engine/asset/src/asset.cpp b/engine/asset/src/asset.cpp index 3924e9d..f201d19 100644 --- a/engine/asset/src/asset.cpp +++ b/engine/asset/src/asset.cpp @@ -220,6 +220,7 @@ std::unique_ptr load_texture(const file::Path path) { texture->height = height; GFXTextureCreateInfo createInfo = {}; + createInfo.label = path.string(); createInfo.width = width; createInfo.height = height; createInfo.format = GFXPixelFormat::R8G8B8A8_UNORM; diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index fb8cc5f..ab80353 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -432,8 +432,8 @@ void Engine::resize(const int identifier, const prism::Extent extent) { Expects(identifier >= 0); auto window = get_window(identifier); - - Expects(window != nullptr); + if (window == nullptr) + return; window->extent = extent; diff --git a/engine/gfx/public/gfx.hpp b/engine/gfx/public/gfx.hpp index 2203788..3601da5 100755 --- a/engine/gfx/public/gfx.hpp +++ b/engine/gfx/public/gfx.hpp @@ -252,6 +252,8 @@ enum class GFXFilter { }; struct GFXTextureCreateInfo { + std::string label; // only used for debug + GFXTextureType type = GFXTextureType::Single2D; uint32_t width = 0; uint32_t height = 0; diff --git a/engine/gfx/vulkan/src/gfx_vulkan.cpp b/engine/gfx/vulkan/src/gfx_vulkan.cpp index 4fd20cd..3ddbe75 100755 --- a/engine/gfx/vulkan/src/gfx_vulkan.cpp +++ b/engine/gfx/vulkan/src/gfx_vulkan.cpp @@ -299,6 +299,8 @@ GFXTexture* GFXVulkan::create_texture(const GFXTextureCreateInfo& info) { vkCreateImage(device, &imageInfo, nullptr, &texture->handle); + name_object(device, VK_OBJECT_TYPE_IMAGE, (uint64_t)texture->handle, info.label); + texture->width = info.width; texture->height = info.height; texture->format = imageFormat; @@ -1650,11 +1652,11 @@ void GFXVulkan::inlineTransitionImageLayout(VkCommandBuffer commandBuffer, VkIma destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; } else { - barrier.srcAccessMask = 0; - barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; + barrier.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT; + barrier.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT; sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; - destinationStage = VK_PIPELINE_STAGE_TRANSFER_BIT; + destinationStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; } vkCmdPipelineBarrier( diff --git a/engine/renderer/src/dofpass.cpp b/engine/renderer/src/dofpass.cpp index 70c2d88..0343061 100755 --- a/engine/renderer/src/dofpass.cpp +++ b/engine/renderer/src/dofpass.cpp @@ -53,6 +53,7 @@ DoFPass::DoFPass(GFX* gfx, Renderer* renderer) : renderer(renderer) { pipeline = gfx->create_graphics_pipeline(create_info); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Normal Field"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::RGBA_32F; @@ -60,6 +61,8 @@ DoFPass::DoFPass(GFX* gfx, Renderer* renderer) : renderer(renderer) { textureInfo.samplingMode = SamplingMode::ClampToEdge; normal_field = gfx->create_texture(textureInfo); + + textureInfo.label = "Far Field"; far_field = gfx->create_texture(textureInfo); GFXFramebufferCreateInfo framebufferInfo = {}; diff --git a/engine/renderer/src/gaussianhelper.cpp b/engine/renderer/src/gaussianhelper.cpp index db3a2ad..9953ad0 100755 --- a/engine/renderer/src/gaussianhelper.cpp +++ b/engine/renderer/src/gaussianhelper.cpp @@ -34,6 +34,7 @@ GaussianHelper::GaussianHelper(GFX* gfx, const prism::Extent extent) : extent(ex // resources GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Gaussian"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::RGBA_32F; diff --git a/engine/renderer/src/imguipass.cpp b/engine/renderer/src/imguipass.cpp index 37c556f..2f35a26 100755 --- a/engine/renderer/src/imguipass.cpp +++ b/engine/renderer/src/imguipass.cpp @@ -16,7 +16,7 @@ void ImGuiPass::initialize() { io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; -#if !defined(PLATFORM_TVOS) && !defined(PLATFORM_IOS) && !defined(PLATFORM_WINDOWS) +#if !defined(PLATFORM_TVOS) && !defined(PLATFORM_IOS) load_font("OpenSans-Regular.ttf"); #endif create_font_texture(); @@ -175,6 +175,7 @@ void ImGuiPass::create_font_texture() { io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); GFXTextureCreateInfo createInfo = {}; + createInfo.label = "ImGui Font"; createInfo.width = width; createInfo.height = height; createInfo.format = GFXPixelFormat::RGBA8_UNORM; diff --git a/engine/renderer/src/renderer.cpp b/engine/renderer/src/renderer.cpp index 28fcefc..d8dd3b6 100755 --- a/engine/renderer/src/renderer.cpp +++ b/engine/renderer/src/renderer.cpp @@ -772,6 +772,7 @@ void Renderer::create_mesh_pipeline(Material& material) { void Renderer::createDummyTexture() { GFXTextureCreateInfo createInfo = {}; + createInfo.label = "Dummy"; createInfo.width = 1; createInfo.height = 1; createInfo.format = GFXPixelFormat::R8G8B8A8_UNORM; @@ -801,6 +802,7 @@ void Renderer::createOffscreenResources() { const auto extent = get_render_extent(); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Offscreen Color"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::RGBA_32F; @@ -808,8 +810,11 @@ void Renderer::createOffscreenResources() { textureInfo.samplingMode = SamplingMode::ClampToEdge; offscreenColorTexture = gfx->create_texture(textureInfo); + + textureInfo.label = "Offscreen Back"; offscreenBackTexture = gfx->create_texture(textureInfo); + textureInfo.label = "Offscreen Depth"; textureInfo.format = GFXPixelFormat::DEPTH_32F; offscreenDepthTexture = gfx->create_texture(textureInfo); @@ -829,6 +834,7 @@ void Renderer::createOffscreenResources() { viewportRenderPass = gfx->create_render_pass(renderPassInfo); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Viewport Color"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::RGBA8_UNORM; @@ -934,6 +940,7 @@ void Renderer::createFontPipeline() { worldTextPipeline = gfx->create_graphics_pipeline(pipelineInfo); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "UI Font"; textureInfo.width = font.width; textureInfo.height = font.height; textureInfo.format = GFXPixelFormat::R8_UNORM; @@ -1003,6 +1010,7 @@ void Renderer::createGaussianResources() { gHelper = std::make_unique(gfx, extent); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Blur Store"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::RGBA_32F; @@ -1031,6 +1039,7 @@ void Renderer::createBRDF() { brdfPipeline = gfx->create_graphics_pipeline(pipelineInfo); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "BRDF LUT"; textureInfo.format = GFXPixelFormat::R8G8_SFLOAT; textureInfo.width = brdf_resolution; textureInfo.height = brdf_resolution; @@ -1088,6 +1097,7 @@ void Renderer::create_histogram_resources() { histogram_buffer = gfx->create_buffer(nullptr, sizeof(uint32_t) * 256, false, GFXBufferUsage::Storage); GFXTextureCreateInfo texture_info = {}; + texture_info.label = "Average Luminance Store"; texture_info.width = 1; texture_info.height = 1; texture_info.format = GFXPixelFormat::R_16F; diff --git a/engine/renderer/src/scenecapture.cpp b/engine/renderer/src/scenecapture.cpp index 4b0bb60..c685cf7 100755 --- a/engine/renderer/src/scenecapture.cpp +++ b/engine/renderer/src/scenecapture.cpp @@ -67,6 +67,7 @@ SceneCapture::SceneCapture(GFX* gfx) { renderPass = gfx->create_render_pass(renderPassInfo); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Scene Capture Color"; textureInfo.width = scene_cubemap_resolution; textureInfo.height = scene_cubemap_resolution; textureInfo.format = GFXPixelFormat::R8G8B8A8_UNORM; @@ -76,6 +77,7 @@ SceneCapture::SceneCapture(GFX* gfx) { offscreenTexture = gfx->create_texture(textureInfo); GFXTextureCreateInfo depthTextureInfo = {}; + depthTextureInfo.label = "Scene Capture Depth"; depthTextureInfo.width = scene_cubemap_resolution; depthTextureInfo.height = scene_cubemap_resolution; depthTextureInfo.format = GFXPixelFormat::DEPTH_32F; @@ -91,6 +93,7 @@ SceneCapture::SceneCapture(GFX* gfx) { offscreenFramebuffer = gfx->create_framebuffer(info); GFXTextureCreateInfo cubeTextureInfo = {}; + cubeTextureInfo.label = "Scene Capture Cubemap"; cubeTextureInfo.type = GFXTextureType::Cubemap; cubeTextureInfo.width = scene_cubemap_resolution; cubeTextureInfo.height = scene_cubemap_resolution; @@ -113,6 +116,7 @@ void SceneCapture::create_scene_resources(Scene& scene) { if(gfx->supports_feature(GFXFeature::CubemapArray)) { GFXTextureCreateInfo cubeTextureInfo = {}; + cubeTextureInfo.label = "Irriadiance Cubemap"; cubeTextureInfo.type = GFXTextureType::CubemapArray; cubeTextureInfo.width = irradiance_cubemap_resolution; cubeTextureInfo.height = irradiance_cubemap_resolution; @@ -124,6 +128,7 @@ void SceneCapture::create_scene_resources(Scene& scene) { scene.irradianceCubeArray = gfx->create_texture(cubeTextureInfo); cubeTextureInfo = {}; + cubeTextureInfo.label = "Prefiltered Cubemap"; cubeTextureInfo.type = GFXTextureType::CubemapArray; cubeTextureInfo.width = scene_cubemap_resolution; cubeTextureInfo.height = scene_cubemap_resolution; @@ -408,6 +413,7 @@ void SceneCapture::createIrradianceResources() { GFX* gfx = engine->get_gfx(); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Irradiance Offscreen"; textureInfo.width = irradiance_cubemap_resolution; textureInfo.height = irradiance_cubemap_resolution; textureInfo.format = GFXPixelFormat::R8G8B8A8_UNORM; @@ -461,6 +467,7 @@ void SceneCapture::createPrefilterResources() { GFX* gfx = engine->get_gfx(); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Prefiltered Offscreen"; textureInfo.width = scene_cubemap_resolution; textureInfo.height = scene_cubemap_resolution; textureInfo.format = GFXPixelFormat::R8G8B8A8_UNORM; diff --git a/engine/renderer/src/shadowpass.cpp b/engine/renderer/src/shadowpass.cpp index 1e96a65..0bd83cb 100755 --- a/engine/renderer/src/shadowpass.cpp +++ b/engine/renderer/src/shadowpass.cpp @@ -45,6 +45,7 @@ void ShadowPass::create_scene_resources(Scene& scene) { // sun light { GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Shadow Depth"; textureInfo.width = render_options.shadow_resolution; textureInfo.height = render_options.shadow_resolution; textureInfo.format = GFXPixelFormat::DEPTH_32F; @@ -62,6 +63,7 @@ void ShadowPass::create_scene_resources(Scene& scene) { // point lights if(gfx->supports_feature(GFXFeature::CubemapArray)) { GFXTextureCreateInfo cubeTextureInfo = {}; + cubeTextureInfo.label = "Point Light Array"; cubeTextureInfo.type = GFXTextureType::CubemapArray; cubeTextureInfo.width = render_options.shadow_resolution; cubeTextureInfo.height = render_options.shadow_resolution; @@ -76,6 +78,7 @@ void ShadowPass::create_scene_resources(Scene& scene) { // spot lights { GFXTextureCreateInfo spotTextureInfo = {}; + spotTextureInfo.label = "Spot Light Array"; spotTextureInfo.type = GFXTextureType::Array2D; spotTextureInfo.width = render_options.shadow_resolution; spotTextureInfo.height = render_options.shadow_resolution; @@ -374,6 +377,7 @@ void ShadowPass::create_offscreen_resources() { auto gfx = engine->get_gfx(); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Shadow Color"; textureInfo.width = render_options.shadow_resolution; textureInfo.height = render_options.shadow_resolution; textureInfo.format = GFXPixelFormat::R_32F; @@ -383,6 +387,7 @@ void ShadowPass::create_offscreen_resources() { offscreen_color_texture = gfx->create_texture(textureInfo); GFXTextureCreateInfo depthTextureInfo = {}; + depthTextureInfo.label = "Shadow Depth"; depthTextureInfo.width = render_options.shadow_resolution; depthTextureInfo.height = render_options.shadow_resolution; depthTextureInfo.format = GFXPixelFormat::DEPTH_32F; diff --git a/engine/renderer/src/smaapass.cpp b/engine/renderer/src/smaapass.cpp index e670791..00f4231 100755 --- a/engine/renderer/src/smaapass.cpp +++ b/engine/renderer/src/smaapass.cpp @@ -73,6 +73,7 @@ void SMAAPass::create_textures() { //load area image GFXTextureCreateInfo areaInfo = {}; + areaInfo.label = "SMAA Area"; areaInfo.width = AREATEX_WIDTH; areaInfo.height = AREATEX_HEIGHT; areaInfo.format = GFXPixelFormat::R8G8_UNORM; @@ -85,6 +86,7 @@ void SMAAPass::create_textures() { // load search image GFXTextureCreateInfo searchInfo = {}; + searchInfo.label = "SMAA Search"; searchInfo.width = SEARCHTEX_WIDTH; searchInfo.height = SEARCHTEX_HEIGHT; searchInfo.format = GFXPixelFormat::R8_UNORM; @@ -138,12 +140,15 @@ void SMAAPass::create_offscreen_resources() { auto gfx = engine->get_gfx(); GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "SMAA Edge"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::R16G16B16A16_SFLOAT; textureInfo.usage = GFXTextureUsage::Attachment | GFXTextureUsage::Sampled; edge_texture = gfx->create_texture(textureInfo); + + textureInfo.label = "SMAA Blend"; blend_texture = gfx->create_texture(textureInfo); GFXFramebufferCreateInfo framebufferInfo = {}; diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index 3e0510e..db6cd70 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -763,6 +763,7 @@ bool material_readable(const file::Path path) { } void cacheAssetFilesystem() { +#ifndef PLATFORM_WINDOWS asset_files.clear(); auto data_directory = "../../../data"; @@ -777,6 +778,7 @@ void cacheAssetFilesystem() { } filesystem_cached = true; +#endif } void CommonEditor::drawAssets() { @@ -863,6 +865,7 @@ GFXTexture* CommonEditor::get_texture_preview(Texture& texture) { auto gfx = engine->get_gfx(); GFXTextureCreateInfo texture_create_info = {}; + texture_create_info.label = "Preview of " + texture.path; texture_create_info.width = thumbnail_resolution; texture_create_info.height = thumbnail_resolution; texture_create_info.format = GFXPixelFormat::RGBA8_UNORM; @@ -1103,6 +1106,7 @@ void CommonEditor::load_thumbnail_cache() { thumbnail_cache->read(image.data(), thumbnail_resolution * thumbnail_resolution * 4); GFXTextureCreateInfo info; + info.label = "Preview of " + filename; info.width = thumbnail_resolution; info.height = thumbnail_resolution; info.format = GFXPixelFormat::RGBA8_UNORM; diff --git a/tools/common/src/debugpass.cpp b/tools/common/src/debugpass.cpp index 94cfea1..91f789d 100755 --- a/tools/common/src/debugpass.cpp +++ b/tools/common/src/debugpass.cpp @@ -177,6 +177,7 @@ void DebugPass::createOffscreenResources() { // selection resources { GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Select Color"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::R8G8B8A8_UNORM; @@ -185,6 +186,7 @@ void DebugPass::createOffscreenResources() { selectTexture = engine->get_gfx()->create_texture(textureInfo); + textureInfo.label = "Select Depth"; textureInfo.format = GFXPixelFormat::DEPTH_32F; selectDepthTexture = engine->get_gfx()->create_texture(textureInfo); @@ -201,6 +203,7 @@ void DebugPass::createOffscreenResources() { // sobel { GFXTextureCreateInfo textureInfo = {}; + textureInfo.label = "Sobel"; textureInfo.width = extent.width; textureInfo.height = extent.height; textureInfo.format = GFXPixelFormat::R8_UNORM;