OGRECave / ogre-next

aka ogre v2 - scene-oriented, flexible 3D C++ engine
https://ogrecave.github.io/ogre-next/api/latest
Other
1.02k stars 224 forks source link

Vulkan Backend: render area does not change when render window is embedded into qt widget #221

Open maz-1 opened 3 years ago

maz-1 commented 3 years ago

System Information

Detailled description

I'm try to embed ogre render window into qt5 widget as described here: https://forums.ogre3d.org/viewtopic.php?f=2&t=96408&p=551295#p551295

All three backends ( OpenGL, DirectX11, Vulkan) can be embedded successfully. OpenGL & DirectX11 can adjust render area when widget is resized, However Vulkan does not

Screenshot-20210830-193301 image

Tried OpenGL & Vulkan under Archlinux and all three backends under windows 10.

Ogre.log


10:54:46: Creating resource group General
10:54:46: Creating resource group Internal
10:54:46: Creating resource group Autodetect
10:54:46: SceneManagerFactory for type 'DefaultSceneManager' registered.
10:54:46: Registering ResourceManager for type Material
10:54:46: Registering ResourceManager for type Mesh
10:54:46: Registering ResourceManager for type Mesh2
10:54:46: Registering ResourceManager for type OldSkeleton
10:54:46: MovableObjectFactory for type 'ParticleSystem' registered.
10:54:46: ArchiveFactory for archive type FileSystem registered.
10:54:46: ArchiveFactory for archive type Zip registered.
10:54:46: ArchiveFactory for archive type EmbeddedZip registered.
10:54:46: DDS codec registering
10:54:46: FreeImage version: 3.18.0
10:54:46: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
10:54:46: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,psb,cut,xbm,xpm,gif,hdr,sgi,rgb,rgba,bw,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti,x3f,webp,jxr,wdp,hdp
10:54:46: ETC codec registering
10:54:46: OITD codec registering
10:54:46: Registering ResourceManager for type HighLevelGpuProgram
10:54:46: MovableObjectFactory for type 'Decal' registered.
10:54:46: MovableObjectFactory for type 'InternalCubemapProbe' registered.
10:54:46: MovableObjectFactory for type 'Entity' registered.
10:54:46: MovableObjectFactory for type 'Item' registered.
10:54:46: MovableObjectFactory for type 'Light' registered.
10:54:46: MovableObjectFactory for type 'Rectangle2Dv2' registered.
10:54:46: MovableObjectFactory for type 'BillboardSet' registered.
10:54:46: MovableObjectFactory for type 'ManualObject2' registered.
10:54:46: MovableObjectFactory for type 'BillboardChain' registered.
10:54:46: MovableObjectFactory for type 'RibbonTrail' registered.
10:54:46: MovableObjectFactory for type 'WireAabb' registered.
10:54:46: *-*-* OGRE Initialising
10:54:46: *-*-* Version 2.3.0unstable (D)
10:54:46: Loading library ./RenderSystem_Vulkan
10:54:46: Installing plugin: Vulkan RenderSystem
10:54:46: [Vulkan] Initializing VkInstance
10:54:47: Found instance extension: VK_KHR_surface
10:54:47: Found instance extension: VK_KHR_win32_surface
10:54:47: Found instance extension: VK_KHR_external_memory_capabilities
10:54:47: Found instance extension: VK_KHR_external_semaphore_capabilities
10:54:47: Found instance extension: VK_KHR_external_fence_capabilities
10:54:47: Found instance extension: VK_KHR_get_physical_device_properties2
10:54:47: Found instance extension: VK_KHR_get_surface_capabilities2
10:54:47: Found instance extension: VK_KHR_device_group_creation
10:54:47: Found instance extension: VK_EXT_swapchain_colorspace
10:54:47: Found instance extension: VK_EXT_debug_report
10:54:47: Found instance extension: VK_EXT_debug_utils
10:54:47: Found instance layer: VK_LAYER_AMD_switchable_graphics
10:54:47: Found instance layer: VK_LAYER_OBS_HOOK
10:54:47: Found instance layer: VK_LAYER_VALVE_steam_overlay
10:54:47: Found instance layer: VK_LAYER_VALVE_steam_fossilize
10:54:47: Found instance layer: VK_LAYER_LUNARG_api_dump
10:54:47: Found instance layer: VK_LAYER_LUNARG_device_simulation
10:54:47: Found instance layer: VK_LAYER_LUNARG_gfxreconstruct
10:54:47: Found instance layer: VK_LAYER_KHRONOS_synchronization2
10:54:47: Found instance layer: VK_LAYER_KHRONOS_validation
10:54:47: Found instance layer: VK_LAYER_LUNARG_monitor
10:54:47: Found instance layer: VK_LAYER_LUNARG_screenshot
10:54:47: [Vulkan] Found 2 devices
10:54:47: [Vulkan] Found devices:
10:54:47: Radeon RX 580 Series #0
10:54:47: Intel(R) UHD Graphics P630 #1
10:54:47: Plugin successfully installed
10:54:47: CPU Identifier & Features
10:54:47: -------------------------
10:54:47:  *   CPU ID: GenuineIntel: Genuine Intel(R) CPU 0000 @ 3.40GHz
10:54:47:  *   Logical cores: 12
10:54:47:  *      SSE: yes
10:54:47:  *     SSE2: yes
10:54:47:  *     SSE3: yes
10:54:47:  *      MMX: yes
10:54:47:  *   MMXEXT: yes
10:54:47:  *    3DNOW: no
10:54:47:  * 3DNOWEXT: no
10:54:47:  *     CMOV: yes
10:54:47:  *      TSC: yes
10:54:47:  *      FPU: yes
10:54:47:  *      PRO: yes
10:54:47:  *       HT: no
10:54:47: -------------------------
10:54:47: Added resource location 'Media/models' of type 'FileSystem' to resource group 'General'
10:54:47: Added resource location 'Media/materials' of type 'FileSystem' to resource group 'General'
10:54:47: [Vulkan] Found 2 devices
10:54:47: [Vulkan] Selecting device 0
10:54:47: [Vulkan] API Version: 1.2.182 (0x4020b6)
10:54:47: [Vulkan] Driver Version (raw): 0x8000c1
10:54:47: [Vulkan] Vendor ID: 0x1002
10:54:47: [Vulkan] Device ID: 0x67df
10:54:47: Registering ResourceManager for type GpuProgram
10:54:47: RenderSystem capabilities
10:54:47: -------------------------
10:54:47: RenderSystem Name: Vulkan Rendering Subsystem
10:54:47: GPU Vendor: amd
10:54:47: Device Name: Radeon RX 580 Series
10:54:47: Driver Version: 2.0.193.0
10:54:47:  * Fixed function pipeline: no
10:54:47:  * Hardware generation of mipmaps: yes
10:54:47:  * Texture blending: yes
10:54:47:  * Anisotropic texture filtering: yes
10:54:47:  * Dot product texture operation: yes
10:54:47:  * Cube mapping: yes
10:54:47:  * Hardware stencil buffer: yes
10:54:47:    - Stencil depth: 8
10:54:47:    - Two sided stencil support: yes
10:54:47:    - Wrap stencil values: yes
10:54:47:  * Hardware vertex / index buffers: yes
10:54:47:  * 32-bit index buffers: no
10:54:47:  * Vertex programs: no
10:54:47:  * Number of floating-point constants for vertex programs: 256
10:54:47:  * Number of integer constants for vertex programs: 256
10:54:47:  * Number of boolean constants for vertex programs: 256
10:54:47:  * Fragment programs: no
10:54:47:  * Number of floating-point constants for fragment programs: 256
10:54:47:  * Number of integer constants for fragment programs: 256
10:54:47:  * Number of boolean constants for fragment programs: 256
10:54:47:  * Geometry programs: no
10:54:47:  * Number of floating-point constants for geometry programs: 256
10:54:47:  * Number of integer constants for geometry programs: 256
10:54:47:  * Number of boolean constants for geometry programs: 256
10:54:47:  * Tessellation Hull programs: no
10:54:47:  * Number of floating-point constants for tessellation hull programs: 256
10:54:47:  * Number of integer constants for tessellation hull programs: 256
10:54:47:  * Number of boolean constants for tessellation hull programs: 256
10:54:47:  * Tessellation Domain programs: no
10:54:47:  * Number of floating-point constants for tessellation domain programs: 256
10:54:47:  * Number of integer constants for tessellation domain programs: 256
10:54:47:  * Number of boolean constants for tessellation domain programs: 256
10:54:47:  * Compute programs: yes
10:54:47:  * Number of floating-point constants for compute programs: 256
10:54:47:  * Number of integer constants for compute programs: 256
10:54:47:  * Number of boolean constants for compute programs: 256
10:54:47:  * Supported Shader Profiles: glsl glslvk hlsl hlslvk
10:54:47:  * Texture Compression: yes
10:54:47:    - DXT: yes
10:54:47:    - VTC: no
10:54:47:    - PVRTC: no
10:54:47:    - ATC: no
10:54:47:    - ETC1: no
10:54:47:    - ETC2: no
10:54:47:    - BC4/BC5: yes
10:54:47:    - BC6H/BC7: yes
10:54:47:    - ASTC: no
10:54:47:  * Hardware Occlusion Query: no
10:54:47:  * User clip planes: yes
10:54:47:  * VET_UBYTE4 vertex element type: yes
10:54:47:  * Infinite far plane projection: yes
10:54:47:  * Hardware render-to-texture: yes
10:54:47:  * Floating point textures: yes
10:54:47:  * Non-power-of-two textures: yes
10:54:47:  * 1d textures: yes
10:54:47:  * Volume textures: yes
10:54:47:  * Max Texture resolution (2D) 16384
10:54:47:  * Max Texture resolution (3D) 4096
10:54:47:  * Max Texture resolution (Cubemaps) 16384
10:54:47:  * Multiple Render Targets: 1
10:54:47:    - With different bit depths: no
10:54:47:  * Point Sprites: yes
10:54:47:  * Extended point parameters: yes
10:54:47:  * Max Point Size: 256
10:54:47:  * Vertex texture fetch: no
10:54:47:  * Number of world matrices: 0
10:54:47:  * Number of texture units: 32
10:54:47:  * Stencil buffer depth: 8
10:54:47:  * Number of vertex blend matrices: 0
10:54:47:  * Render to Vertex Buffer : no
10:54:47:  * Hardware Atomic Counters: no
10:54:47:  * Compute max threads per threadgroup per axis: 1024, 1024, 1024
10:54:47:  * Compute max threads per threadgroup total: 1024
10:54:47:  * Using Reverse Z: yes
10:54:47: Found device extension: VK_KHR_16bit_storage
10:54:47: Found device extension: VK_KHR_8bit_storage
10:54:47: Found device extension: VK_KHR_bind_memory2
10:54:47: Found device extension: VK_KHR_buffer_device_address
10:54:47: Found device extension: VK_KHR_copy_commands2
10:54:47: Found device extension: VK_KHR_create_renderpass2
10:54:47: Found device extension: VK_KHR_dedicated_allocation
10:54:47: Found device extension: VK_KHR_depth_stencil_resolve
10:54:47: Found device extension: VK_KHR_descriptor_update_template
10:54:47: Found device extension: VK_KHR_device_group
10:54:47: Found device extension: VK_KHR_draw_indirect_count
10:54:47: Found device extension: VK_KHR_driver_properties
10:54:47: Found device extension: VK_KHR_external_fence
10:54:47: Found device extension: VK_KHR_external_fence_win32
10:54:47: Found device extension: VK_KHR_external_memory
10:54:47: Found device extension: VK_KHR_external_memory_win32
10:54:47: Found device extension: VK_KHR_external_semaphore
10:54:47: Found device extension: VK_KHR_external_semaphore_win32
10:54:47: Found device extension: VK_KHR_get_memory_requirements2
10:54:47: Found device extension: VK_KHR_imageless_framebuffer
10:54:47: Found device extension: VK_KHR_image_format_list
10:54:47: Found device extension: VK_KHR_maintenance1
10:54:47: Found device extension: VK_KHR_maintenance2
10:54:47: Found device extension: VK_KHR_maintenance3
10:54:47: Found device extension: VK_KHR_multiview
10:54:47: Found device extension: VK_KHR_pipeline_executable_properties
10:54:47: Found device extension: VK_KHR_relaxed_block_layout
10:54:47: Found device extension: VK_KHR_sampler_mirror_clamp_to_edge
10:54:47: Found device extension: VK_KHR_sampler_ycbcr_conversion
10:54:47: Found device extension: VK_KHR_separate_depth_stencil_layouts
10:54:47: Found device extension: VK_KHR_shader_atomic_int64
10:54:47: Found device extension: VK_KHR_shader_clock
10:54:47: Found device extension: VK_KHR_shader_draw_parameters
10:54:47: Found device extension: VK_KHR_shader_float16_int8
10:54:47: Found device extension: VK_KHR_shader_float_controls
10:54:47: Found device extension: VK_KHR_shader_non_semantic_info
10:54:47: Found device extension: VK_KHR_shader_subgroup_extended_types
10:54:47: Found device extension: VK_KHR_shader_subgroup_uniform_control_flow
10:54:47: Found device extension: VK_KHR_shader_terminate_invocation
10:54:47: Found device extension: VK_KHR_spirv_1_4
10:54:47: Found device extension: VK_KHR_storage_buffer_storage_class
10:54:47: Found device extension: VK_KHR_swapchain
10:54:47: Found device extension: VK_KHR_swapchain_mutable_format
10:54:47: Found device extension: VK_KHR_synchronization2
10:54:47: Found device extension: VK_KHR_timeline_semaphore
10:54:47: Found device extension: VK_KHR_uniform_buffer_standard_layout
10:54:47: Found device extension: VK_KHR_variable_pointers
10:54:47: Found device extension: VK_KHR_vulkan_memory_model
10:54:47: Found device extension: VK_KHR_win32_keyed_mutex
10:54:47: Found device extension: VK_EXT_4444_formats
10:54:47: Found device extension: VK_EXT_calibrated_timestamps
10:54:47: Found device extension: VK_EXT_color_write_enable
10:54:47: Found device extension: VK_EXT_custom_border_color
10:54:47: Found device extension: VK_EXT_depth_clip_enable
10:54:47: Found device extension: VK_EXT_depth_range_unrestricted
10:54:47: Found device extension: VK_EXT_descriptor_indexing
10:54:47: Found device extension: VK_EXT_extended_dynamic_state
10:54:47: Found device extension: VK_EXT_extended_dynamic_state2
10:54:47: Found device extension: VK_EXT_external_memory_host
10:54:47: Found device extension: VK_EXT_full_screen_exclusive
10:54:47: Found device extension: VK_EXT_global_priority
10:54:47: Found device extension: VK_EXT_hdr_metadata
10:54:47: Found device extension: VK_EXT_host_query_reset
10:54:47: Found device extension: VK_EXT_image_robustness
10:54:47: Found device extension: VK_EXT_inline_uniform_block
10:54:47: Found device extension: VK_EXT_line_rasterization
10:54:47: Found device extension: VK_EXT_memory_budget
10:54:47: Found device extension: VK_EXT_memory_priority
10:54:47: Found device extension: VK_EXT_pipeline_creation_cache_control
10:54:47: Found device extension: VK_EXT_pipeline_creation_feedback
10:54:47: Found device extension: VK_EXT_private_data
10:54:47: Found device extension: VK_EXT_queue_family_foreign
10:54:47: Found device extension: VK_EXT_robustness2
10:54:47: Found device extension: VK_EXT_sampler_filter_minmax
10:54:47: Found device extension: VK_EXT_sample_locations
10:54:47: Found device extension: VK_EXT_scalar_block_layout
10:54:47: Found device extension: VK_EXT_separate_stencil_usage
10:54:47: Found device extension: VK_EXT_shader_demote_to_helper_invocation
10:54:47: Found device extension: VK_EXT_shader_image_atomic_int64
10:54:47: Found device extension: VK_EXT_shader_stencil_export
10:54:47: Found device extension: VK_EXT_shader_subgroup_ballot
10:54:47: Found device extension: VK_EXT_shader_subgroup_vote
10:54:47: Found device extension: VK_EXT_shader_viewport_index_layer
10:54:47: Found device extension: VK_EXT_subgroup_size_control
10:54:47: Found device extension: VK_EXT_texel_buffer_alignment
10:54:47: Found device extension: VK_EXT_tooling_info
10:54:47: Found device extension: VK_EXT_transform_feedback
10:54:47: Found device extension: VK_EXT_vertex_attribute_divisor
10:54:47: Found device extension: VK_AMD_buffer_marker
10:54:47: Found device extension: VK_AMD_calibrated_timestamps
10:54:47: Found device extension: VK_AMD_display_native_hdr
10:54:47: Found device extension: VK_AMD_draw_indirect_count
10:54:47: Found device extension: VK_AMD_gcn_shader
10:54:47: Found device extension: VK_AMD_gpa_interface
10:54:47: Found device extension: VK_AMD_memory_overallocation_behavior
10:54:47: Found device extension: VK_AMD_mixed_attachment_samples
10:54:47: Found device extension: VK_AMD_pipeline_compiler_control
10:54:47: Found device extension: VK_AMD_rasterization_order
10:54:47: Found device extension: VK_AMD_shader_ballot
10:54:47: Found device extension: VK_AMD_shader_core_properties
10:54:47: Found device extension: VK_AMD_shader_core_properties2
10:54:47: Found device extension: VK_AMD_shader_explicit_vertex_parameter
10:54:47: Found device extension: VK_AMD_shader_fragment_mask
10:54:47: Found device extension: VK_AMD_shader_image_load_store_lod
10:54:47: Found device extension: VK_AMD_shader_info
10:54:47: Found device extension: VK_AMD_shader_trinary_minmax
10:54:47: Found device extension: VK_AMD_wave_limits
10:54:47: Found device extension: VK_GOOGLE_decorate_string
10:54:47: Found device extension: VK_GOOGLE_hlsl_functionality1
10:54:47: Found device extension: VK_GOOGLE_user_type
10:54:47: Supported memory types for general buffer usage: 15
10:54:47: Supported memory types for reading: 15
10:54:47: VkDevice will use coherent memory buffers: true
10:54:47: VkDevice will use non-coherent memory buffers: false
10:54:47: VkDevice will use coherent memory for reading: true
10:54:47: VkDevice read memory is coherent: true
10:54:48: Trying presentMode = IMMEDIATE_KHR
10:54:48: Chosen presentMode = IMMEDIATE_KHR
10:54:48: surfaceCaps.currentTransform = 1
10:54:48: DefaultWorkQueue('Root') initialising on thread 19692.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 17380 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 7840 starting.
10:54:48:  _hlmsMacroblockCreated 
10:54:48:  _hlmsBlendblockCreated 
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 2384 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 14028 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 19924 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 17684 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 5128 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 19560 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 20996 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 10888 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 4184 starting.
10:54:48: DefaultWorkQueue('Root')::WorkerFunc - thread 7860 starting.
10:54:48: Particle Renderer Type 'billboard' registered
10:54:48:  _hlmsSamplerblockCreated 
10:54:48:  _hlmsSamplerblockCreated 
10:54:48:  _hlmsSamplerblockCreated 
10:54:48:  _hlmsSamplerblockCreated 
10:54:48: Parsing scripts for resource group Autodetect
10:54:48: Finished parsing scripts for resource group Autodetect
10:54:48: Creating resources for group Autodetect
10:54:48: All done
10:54:48: Parsing scripts for resource group General
10:54:48: Finished parsing scripts for resource group General
10:54:48: Creating resources for group General
10:54:48: All done
10:54:48: Parsing scripts for resource group Internal
10:54:48: Finished parsing scripts for resource group Internal
10:54:48: Creating resources for group Internal
10:54:48: All done
10:54:48: Trying presentMode = IMMEDIATE_KHR
10:54:48: Chosen presentMode = IMMEDIATE_KHR
10:54:48: surfaceCaps.currentTransform = 1
10:54:48: Trying presentMode = IMMEDIATE_KHR
10:54:48: Chosen presentMode = IMMEDIATE_KHR
10:54:48: surfaceCaps.currentTransform = 1
10:54:48: Trying presentMode = IMMEDIATE_KHR
10:54:48: Chosen presentMode = IMMEDIATE_KHR
10:54:48: surfaceCaps.currentTransform = 1
10:54:48: Trying presentMode = IMMEDIATE_KHR
10:54:48: Chosen presentMode = IMMEDIATE_KHR
10:54:48: surfaceCaps.currentTransform = 1
10:54:48: Trying presentMode = IMMEDIATE_KHR
10:54:48: Chosen presentMode = IMMEDIATE_KHR
10:54:48: surfaceCaps.currentTransform = 1

Callstack

darksylinc commented 3 years ago

Hi!

Is there a small repo I can clone and test/repro this bug?

maz-1 commented 3 years ago

Hi!

Is there a small repo I can clone and test/repro this bug?

Qt5Ogre23.zip

Here you are

darksylinc commented 2 years ago

I ran into a bug (independently) that I think is the one causing this.

The texture is destroyed, but then when recreated the exact same address ptr is provided by malloc.

Thus later on when VulkanRenderPassDescriptor is recreating VulkanRenderPassDescriptor::calculateSharedKey looks up a cache and sees there is already a cached entry (which is for the old ptr). Then VulkanRenderPassDescriptor::setupFbo sees fboDesc.mRenderPass is already initialized.

This bug can cause crashes, not just wrong render areas.

I'm already on it.

darksylinc commented 2 years ago

OK I just pushed https://github.com/OGRECave/ogre-next/commit/15e41fddd517b19d59ad850a91e3335a52c8af78 to fix this bug.

Could you confirm if your bug is fixed or still present? Thanks

maz-1 commented 2 years ago

just upgraded ogre to master, problem still exists on win & linux

darksylinc commented 2 years ago

Ouch. Ok, I'll check out your sample when I get some time.

I tried last Monday but I had to setup several dependencies before it could build