Ogre 2.1 to 2.2.1 migration

Problems building or running the engine, queries about how to use features etc.
Post Reply
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Ogre 2.1 to 2.2.1 migration

Post by tct »

Ogre Version: 2.1 -> 2.2.1
Operating System: Windows, Linux
Render System: OpenGL 3+

I'm currently migrating my minimum bare-bone Ogre 2.1 + Qt application to Ogre 2.2.1. I kept an eye on the migration guide. However, as this is a bare minimum application there's not much in there other than replacing RenderWindow with Window, Texture with TextureGpu etc. However, I did not touch the Hlms system at all (regirstration, loading PBS & Unlit etc).

When trying to load a mesh that works well within my Ogre 2.1 based application, an assertion is triggered:

Code: Select all

Assertion failed: mipLevel < mNumMipmaps, file C:\path\to\ogre-next-2.2.1\OgreMain\src\OgreImage2.
cpp, line 774
According to this forum post there haven't been any changes in the mesh file format between Ogre 2.1 and Ogre 2.2.1. Therefore, I expected this to be a problem not related to my meshes but instead to some missing part of the migration.

Unfortunately, I couldn't find anything in the migration guide that would directly concern my very basic application. Therefore, I resorted back to debugging.
I set a breakpoint at the assert location that is ruining the party. The mipLevel parameter passed to Ogre::Image2::getData() is zero.
The porting guide has the following to say:
In 2.1 getNumMipmaps() = 0 means having just 1 mip (the mip 0). Only the extra mips are counted.
In 2.2 getNumMipmaps() cannot return 0, as the 1 mip is counted.
My problem: None of my own application code directly does anything related to mip levels. Therefore, I must be missing some setup.

My Question: How can I further track down this problem?

A weird detail: While dicking around with the application source code to better understand the behavior, I did get to a state where a mesh would load but only in the default gray color. All the textures/materials were missing.

My assumption: The only place where I handle textures other than the mesh being loaded is the Qt window integration. My initialization looks like this:

Code: Select all

    // Init Ogre::Root
    mRoot = new Ogre::Root("plugins.cfg", "resources.cfg");

    // Use the first available Renderer
    Ogre::RenderSystem* renderSys = mRoot->getAvailableRenderers()[0];
    mRoot->setRenderSystem(renderSys);

    // Initialize Root
    mRoot->initialise(false);
    mRoot->addFrameListener(this);

    // Create a QtWindow with a widgetContainer
    mOgreWidget = new class ogre_widget;
    mOgreWidget->init();

    // Create the SceneManager
    sceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC, 4, "My Scene Manager");

    // Create the MainCamera
    Ogre::Camera* mainCamera = sceneManager->createCamera("Camera");
    mainCamera->setAutoAspectRatio(true);
    mainCamera->setNearClipDistance(0.01);
    mainCamera->setFarClipDistance(1000.0);
    // And attach it to a SceneNode
    mainCameraNode = sceneManager->getRootSceneNode()->createChildSceneNode();
    mainCamera->detachFromParent();
    mainCameraNode->attachObject(mainCamera);
    mainCamera->setPosition(0,300,300);
    mainCamera->setDirection(Ogre::Vector3(0,0,0)-mainCamera->getPosition());
    mOgreWidget->m_camera = mainCamera;
    mOgreWidget->m_camera_node = mainCameraNode;


    //Create a directional Light
    Ogre::Light *light = sceneManager->createLight();
    Ogre::SceneNode *lightNode = sceneManager->getRootSceneNode()->createChildSceneNode();
    lightNode->attachObject( light );
    light->setPowerScale( Ogre::Math::PI ); //Since we don't do HDR, counter the PBS' division by PI
    light->setType( Ogre::Light::LT_DIRECTIONAL );
    light->setDirection( Ogre::Vector3( -1, -1, -1 ).normalisedCopy() );

    // Add (hardcoded) media folders
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../ogre_media/","FileSystem");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../ogre_media/pbr_gun","FileSystem");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../ogre_media/skybox","FileSystem");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../ogre_media/cubes","FileSystem");
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(true);

    // Create a basic Workspace
    mRoot->getCompositorManager2()->createBasicWorkspaceDef("sceneworkspace", Ogre::ColourValue::Black);
    mRoot->getCompositorManager2()->addWorkspace(sceneManager, mOgreWidget->m_ogre_render_window->getTexture(), mainCamera, "sceneworkspace", true);
The ogre_widget class inherits from QWindow.

Am I missing anything here? Do I manually have to do something to the texture that I use in the addWorkspace() function call?

Any help is appreciated.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

Could you post the callstack of the error when it happens?

That could tell us a lot that will help us troubleshoot the problem.

Cheers
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

Sure, here's a copy of the stack (Windows 10 64-bit, Ogre 2.2.1, Qt 5.13):

Code: Select all

Ogre::Image2::getData OgreImage2.cpp:774
Ogre::TextureGpuManager::processQueuedImage OgreTextureGpuManager.cpp:2320
Ogre::TextureGpuManager::processLoadRequest OgreTextureGpuManager.cpp:2729
Ogre::TextureGpuManager::_updateStreaming OgreTextureGpuManager.cpp:2828
Ogre::TextureGpuManager::_updateStreamingWorkerThread OgreTextureGpuManager.cpp:2425
Ogre::updateStreamingWorkerThread OgreTextureGpuManager.cpp:2417
Ogre::updateStreamingWorkerThread_internal OgreTextureGpuManager.cpp:79
KERNEL32!BaseThreadInitThunk 0x00007fff91f77bd4
ntdll!RtlUserThreadStart 0x00007fff926ace51
<unknown> 0x0000000000000000
This happens in Thread-17. This also happens when I comment mRoot->startRendering().
I just noticed that when the assert actually fires, the parameter is of course 1, not zero (while mNumMipmaps is also 1).
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

OK I did not expect that callstack.

Is this a 32-bit build or 64-bit build?
Are you able to send me the textures that are failing so I can repro this bug?

You can get the name of the texture that is failing by adding a call to texture->getName().getFriendlyText() in TextureGpuManager::processQueuedImage.

e.g. add in TextureGpuManager::processQueuedImage

Code: Select all

std::string name = texture->getName().getFriendlyText();
and hover the mouse over 'name' to see the texture that is failing.
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

dark_sylinc wrote: Sun Jun 28, 2020 4:37 pm OK I did not expect that callstack.
Facing the risk of sounding like a real idiot here: You expected me to post something different or is the callstack not looking the way you expected? i.e. should I provide different information?
dark_sylinc wrote: Sun Jun 28, 2020 4:37 pm Is this a 32-bit build or 64-bit build?
64-bit
dark_sylinc wrote: Sun Jun 28, 2020 4:37 pm Are you able to send me the textures that are failing so I can repro this bug?
I sent you a PM!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

tct wrote: Sun Jun 28, 2020 5:09 pm Facing the risk of sounding like a real idiot here: You expected me to post something different or is the callstack not looking the way you expected? i.e. should I provide different information?
Oops! Sorry.
I meant that I was expecting a callstack spotting out a problem in your code but instead the problem was deep inside Ogre, in a seemingly impossible place.
tct wrote: Sun Jun 28, 2020 5:09 pm I sent you a PM!
Got it!

Btw in the files you sent me there is a missing "env.dds" file.
Could you send me that file too? Thanks

Btw don't forget to look into the texture's name that is failing
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

Everything received!

Linux: Unable to reproduce
Windows (64-bit build): Unable to reproduce; BUT a different assert in D3D11 triggered. I'm gonna research that once I get back from lunch

Cheers
Matias
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

dark_sylinc wrote: Sun Jun 28, 2020 5:32 pm Btw in the files you sent me there is a missing "env.dds" file.
Could you send me that file too? Thanks
Done!
dark_sylinc wrote: Sun Jun 28, 2020 5:32 pm Btw don't forget to look into the texture's name that is failing
With the two different meshes I sent you, it's either nRegular1_1.2x1.2_2K_albedo.png or Cerberus_A.tga depending on which mesh I try to load.
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

dark_sylinc wrote: Sun Jun 28, 2020 5:51 pm Linux: Unable to reproduce
Windows (64-bit build): Unable to reproduce; BUT a different assert in D3D11 triggered. I'm gonna research that once I get back from lunch
In case of any of this helps, here's my setup/environment/tc:
  • Windows 10 64-bit (never tried this on Linux, kept it in the original post header because the application will need to work on Linux later on too)
  • MinGW-w64 GCC 9.2.0 (through MSYS2)
  • OpenGL 3+ rendering system
Here's the corresponding application log:

Code: Select all

Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Mesh2
Registering ResourceManager for type OldSkeleton
MovableObjectFactory for type 'ParticleSystem' registered.
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
ArchiveFactory for archive type EmbeddedZip registered.
DDS codec registering
FreeImage version: 3.18.0
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimag
e.sourceforge.net for details
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,ti
ff,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,cr
2,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
OITD codec registering
Registering ResourceManager for type HighLevelGpuProgram
MovableObjectFactory for type 'Decal' registered.
MovableObjectFactory for type 'InternalCubemapProbe' registered.
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Item' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'Rectangle2Dv2' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject2' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
MovableObjectFactory for type 'WireAabb' registered.
Loading library C:/install/bin/Debug\RenderSystem_GL3Plus_d
Installing plugin: GL 3+ RenderSystem
OpenGL 3+ Rendering Subsystem created.
Plugin successfully installed
Loading library C:/install/bin/Debug\Plugin_ParticleFX_d
Installing plugin: ParticleFX
Particle Emitter Type 'Point' registered
Particle Emitter Type 'Box' registered
Particle Emitter Type 'Ellipsoid' registered
Particle Emitter Type 'Cylinder' registered
Particle Emitter Type 'Ring' registered
Particle Emitter Type 'HollowEllipsoid' registered
Particle Affector Type 'LinearForce' registered
Particle Affector Type 'ColourFader' registered
Particle Affector Type 'ColourFader2' registered
Particle Affector Type 'ColourImage' registered
Particle Affector Type 'ColourInterpolator' registered
Particle Affector Type 'Scaler' registered
Particle Affector Type 'Rotator' registered
Particle Affector Type 'DirectionRandomiser' registered
Particle Affector Type 'DeflectorPlane' registered
Plugin successfully installed
*-*-* OGRE Initialising
*-*-* Version 2.2.1 (Cerberus)
CPU Identifier & Features
-------------------------
 *   CPU ID: GenuineIntel: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
 *   Logical cores: 12
 *      SSE: yes
 *     SSE2: yes
 *     SSE3: yes
 *      MMX: yes
 *   MMXEXT: yes
 *    3DNOW: no
 * 3DNOWEXT: no
 *     CMOV: yes
 *      TSC: yes
 *      FPU: yes
 *      PRO: yes
 *       HT: no
-------------------------
*** Starting Win32GL Subsystem ***
GL3PlusRenderSystem::_createRenderWindow "OgreTest", 1280x720 windowed  miscParams: externalWindowHandle=2428310 gamma=t
rue
Created GL 4.5 context
GL Version = 4.5.0.0
GL_VERSION = 4.5.0 NVIDIA 436.30
GL_VENDOR = NVIDIA Corporation
GL_RENDERER = GeForce GTX 1080 Ti/PCIe/SSE2
GL_EXTENSIONS =
GL_AMD_multi_draw_indirect
GL_AMD_seamless_cubemap_per_texture
GL_AMD_vertex_shader_viewport_index
GL_AMD_vertex_shader_layer
GL_ARB_arrays_of_arrays
GL_ARB_base_instance
GL_ARB_bindless_texture
GL_ARB_blend_func_extended
GL_ARB_buffer_storage
GL_ARB_clear_buffer_object
GL_ARB_clear_texture
GL_ARB_clip_control
GL_ARB_color_buffer_float
GL_ARB_compressed_texture_pixel_storage
GL_ARB_conservative_depth
GL_ARB_compute_shader
GL_ARB_compute_variable_group_size
GL_ARB_conditional_render_inverted
GL_ARB_copy_buffer
GL_ARB_copy_image
GL_ARB_cull_distance
GL_ARB_debug_output
GL_ARB_depth_buffer_float
GL_ARB_depth_clamp
GL_ARB_depth_texture
GL_ARB_derivative_control
GL_ARB_direct_state_access
GL_ARB_draw_buffers
GL_ARB_draw_buffers_blend
GL_ARB_draw_indirect
GL_ARB_draw_elements_base_vertex
GL_ARB_draw_instanced
GL_ARB_enhanced_layouts
GL_ARB_ES2_compatibility
GL_ARB_ES3_compatibility
GL_ARB_ES3_1_compatibility
GL_ARB_ES3_2_compatibility
GL_ARB_explicit_attrib_location
GL_ARB_explicit_uniform_location
GL_ARB_fragment_coord_conventions
GL_ARB_fragment_layer_viewport
GL_ARB_fragment_program
GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader
GL_ARB_fragment_shader_interlock
GL_ARB_framebuffer_no_attachments
GL_ARB_framebuffer_object
GL_ARB_framebuffer_sRGB
GL_ARB_geometry_shader4
GL_ARB_get_program_binary
GL_ARB_get_texture_sub_image
GL_ARB_gl_spirv
GL_ARB_gpu_shader5
GL_ARB_gpu_shader_fp64
GL_ARB_gpu_shader_int64
GL_ARB_half_float_pixel
GL_ARB_half_float_vertex
GL_ARB_imaging
GL_ARB_indirect_parameters
GL_ARB_instanced_arrays
GL_ARB_internalformat_query
GL_ARB_internalformat_query2
GL_ARB_invalidate_subdata
GL_ARB_map_buffer_alignment
GL_ARB_map_buffer_range
GL_ARB_multi_bind
GL_ARB_multi_draw_indirect
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_occlusion_query
GL_ARB_occlusion_query2
GL_ARB_parallel_shader_compile
GL_ARB_pipeline_statistics_query
GL_ARB_pixel_buffer_object
GL_ARB_point_parameters
GL_ARB_point_sprite
GL_ARB_polygon_offset_clamp
GL_ARB_post_depth_coverage
GL_ARB_program_interface_query
GL_ARB_provoking_vertex
GL_ARB_query_buffer_object
GL_ARB_robust_buffer_access_behavior
GL_ARB_robustness
GL_ARB_sample_locations
GL_ARB_sample_shading
GL_ARB_sampler_objects
GL_ARB_seamless_cube_map
GL_ARB_seamless_cubemap_per_texture
GL_ARB_separate_shader_objects
GL_ARB_shader_atomic_counter_ops
GL_ARB_shader_atomic_counters
GL_ARB_shader_ballot
GL_ARB_shader_bit_encoding
GL_ARB_shader_clock
GL_ARB_shader_draw_parameters
GL_ARB_shader_group_vote
GL_ARB_shader_image_load_store
GL_ARB_shader_image_size
GL_ARB_shader_objects
GL_ARB_shader_precision
GL_ARB_shader_storage_buffer_object
GL_ARB_shader_subroutine
GL_ARB_shader_texture_image_samples
GL_ARB_shader_texture_lod
GL_ARB_shading_language_100
GL_ARB_shader_viewport_layer_array
GL_ARB_shading_language_420pack
GL_ARB_shading_language_include
GL_ARB_shading_language_packing
GL_ARB_shadow
GL_ARB_sparse_buffer
GL_ARB_sparse_texture
GL_ARB_sparse_texture2
GL_ARB_sparse_texture_clamp
GL_ARB_spirv_extensions
GL_ARB_stencil_texturing
GL_ARB_sync
GL_ARB_tessellation_shader
GL_ARB_texture_barrier
GL_ARB_texture_border_clamp
GL_ARB_texture_buffer_object
GL_ARB_texture_buffer_object_rgb32
GL_ARB_texture_buffer_range
GL_ARB_texture_compression
GL_ARB_texture_compression_bptc
GL_ARB_texture_compression_rgtc
GL_ARB_texture_cube_map
GL_ARB_texture_cube_map_array
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_texture_filter_anisotropic
GL_ARB_texture_filter_minmax
GL_ARB_texture_float
GL_ARB_texture_gather
GL_ARB_texture_mirror_clamp_to_edge
GL_ARB_texture_mirrored_repeat
GL_ARB_texture_multisample
GL_ARB_texture_non_power_of_two
GL_ARB_texture_query_levels
GL_ARB_texture_query_lod
GL_ARB_texture_rectangle
GL_ARB_texture_rg
GL_ARB_texture_rgb10_a2ui
GL_ARB_texture_stencil8
GL_ARB_texture_storage
GL_ARB_texture_storage_multisample
GL_ARB_texture_swizzle
GL_ARB_texture_view
GL_ARB_timer_query
GL_ARB_transform_feedback2
GL_ARB_transform_feedback3
GL_ARB_transform_feedback_instanced
GL_ARB_transform_feedback_overflow_query
GL_ARB_transpose_matrix
GL_ARB_uniform_buffer_object
GL_ARB_vertex_array_bgra
GL_ARB_vertex_array_object
GL_ARB_vertex_attrib_64bit
GL_ARB_vertex_attrib_binding
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_vertex_shader
GL_ARB_vertex_type_10f_11f_11f_rev
GL_ARB_vertex_type_2_10_10_10_rev
GL_ARB_viewport_array
GL_ARB_window_pos
GL_ATI_draw_buffers
GL_ATI_texture_float
GL_ATI_texture_mirror_once
GL_S3_s3tc
GL_EXT_texture_env_add
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_bindable_uniform
GL_EXT_blend_color
GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_compiled_vertex_array
GL_EXT_Cg_shader
GL_EXT_depth_bounds_test
GL_EXT_direct_state_access
GL_EXT_draw_buffers2
GL_EXT_draw_instanced
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample
GL_EXTX_framebuffer_mixed_formats
GL_EXT_framebuffer_multisample_blit_scaled
GL_EXT_framebuffer_object
GL_EXT_framebuffer_sRGB
GL_EXT_geometry_shader4
GL_EXT_gpu_program_parameters
GL_EXT_gpu_shader4
GL_EXT_multi_draw_arrays
GL_EXT_multiview_texture_multisample
GL_EXT_multiview_timer_query
GL_EXT_packed_depth_stencil
GL_EXT_packed_float
GL_EXT_packed_pixels
GL_EXT_pixel_buffer_object
GL_EXT_point_parameters
GL_EXT_polygon_offset_clamp
GL_EXT_post_depth_coverage
GL_EXT_provoking_vertex
GL_EXT_raster_multisample
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_shader_objects
GL_EXT_separate_specular_color
GL_EXT_shader_image_load_formatted
GL_EXT_shader_image_load_store
GL_EXT_shader_integer_mix
GL_EXT_shadow_funcs
GL_EXT_sparse_texture2
GL_EXT_stencil_two_side
GL_EXT_stencil_wrap
GL_EXT_texture3D
GL_EXT_texture_array
GL_EXT_texture_buffer_object
GL_EXT_texture_compression_dxt1
GL_EXT_texture_compression_latc
GL_EXT_texture_compression_rgtc
GL_EXT_texture_compression_s3tc
GL_EXT_texture_cube_map
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_combine
GL_EXT_texture_env_dot3
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_filter_minmax
GL_EXT_texture_integer
GL_EXT_texture_lod
GL_EXT_texture_lod_bias
GL_EXT_texture_mirror_clamp
GL_EXT_texture_object
GL_EXT_texture_shared_exponent
GL_EXT_texture_sRGB
GL_EXT_texture_sRGB_R8
GL_EXT_texture_sRGB_decode
GL_EXT_texture_storage
GL_EXT_texture_swizzle
GL_EXT_timer_query
GL_EXT_transform_feedback2
GL_EXT_vertex_array
GL_EXT_vertex_array_bgra
GL_EXT_vertex_attrib_64bit
GL_EXT_window_rectangles
GL_EXT_import_sync_object
GL_IBM_rasterpos_clip
GL_IBM_texture_mirrored_repeat
GL_KHR_context_flush_control
GL_KHR_debug
GL_EXT_memory_object
GL_EXT_memory_object_win32
GL_EXT_win32_keyed_mutex
GL_KHR_parallel_shader_compile
GL_KHR_no_error
GL_KHR_robust_buffer_access_behavior
GL_KHR_robustness
GL_EXT_semaphore
GL_EXT_semaphore_win32
GL_KHR_shader_subgroup
GL_KTX_buffer_region
GL_NV_alpha_to_coverage_dither_control
GL_NV_bindless_multi_draw_indirect
GL_NV_bindless_multi_draw_indirect_count
GL_NV_bindless_texture
GL_NV_blend_equation_advanced
GL_NV_blend_equation_advanced_coherent
GL_NVX_blend_equation_advanced_multi_draw_buffers
GL_NV_blend_minmax_factor
GL_NV_blend_square
GL_NV_clip_space_w_scaling
GL_NV_command_list
GL_NV_compute_program5
GL_NV_conditional_render
GL_NV_conservative_raster
GL_NV_conservative_raster_dilate
GL_NV_conservative_raster_pre_snap_triangles
GL_NV_copy_depth_to_color
GL_NV_copy_image
GL_NV_depth_buffer_float
GL_NV_depth_clamp
GL_NV_draw_texture
GL_NV_draw_vulkan_image
GL_NV_ES1_1_compatibility
GL_NV_ES3_1_compatibility
GL_NV_explicit_multisample
GL_NV_feature_query
GL_NV_fence
GL_NV_fill_rectangle
GL_NV_float_buffer
GL_NV_fog_distance
GL_NV_fragment_coverage_to_color
GL_NV_fragment_program
GL_NV_fragment_program_option
GL_NV_fragment_program2
GL_NV_fragment_shader_interlock
GL_NV_framebuffer_mixed_samples
GL_NV_framebuffer_multisample_coverage
GL_NV_geometry_shader4
GL_NV_geometry_shader_passthrough
GL_NV_gpu_program4
GL_NV_internalformat_sample_query
GL_NV_gpu_program4_1
GL_NV_gpu_program5
GL_NV_gpu_program5_mem_extended
GL_NV_gpu_program_fp64
GL_NV_gpu_shader5
GL_NV_half_float
GL_NV_light_max_exponent
GL_NV_memory_attachment
GL_NV_multisample_coverage
GL_NV_multisample_filter_hint
GL_NV_occlusion_query
GL_NV_packed_depth_stencil
GL_NV_parameter_buffer_object
GL_NV_parameter_buffer_object2
GL_NV_path_rendering
GL_NV_path_rendering_shared_edge
GL_NV_pixel_data_range
GL_NV_point_sprite
GL_NV_primitive_restart
GL_NV_query_resource
GL_NV_query_resource_tag
GL_NV_register_combiners
GL_NV_register_combiners2
GL_NV_sample_locations
GL_NV_sample_mask_override_coverage
GL_NV_shader_atomic_counters
GL_NV_shader_atomic_float
GL_NV_shader_atomic_float64
GL_NV_shader_atomic_fp16_vector
GL_NV_shader_atomic_int64
GL_NV_shader_buffer_load
GL_NV_shader_storage_buffer_object
GL_NV_shader_subgroup_partitioned
GL_NV_stereo_view_rendering
GL_NV_texgen_reflection
GL_NV_texture_barrier
GL_NV_texture_compression_vtc
GL_NV_texture_env_combine4
GL_NV_texture_multisample
GL_NV_texture_rectangle
GL_NV_texture_rectangle_compressed
GL_NV_texture_shader
GL_NV_texture_shader2
GL_NV_texture_shader3
GL_NV_transform_feedback
GL_NV_transform_feedback2
GL_NV_uniform_buffer_unified_memory
GL_NV_vertex_array_range
GL_NV_vertex_array_range2
GL_NV_vertex_attrib_integer_64bit
GL_NV_vertex_buffer_unified_memory
GL_NV_vertex_program
GL_NV_vertex_program1_1
GL_NV_vertex_program2
GL_NV_vertex_program2_option
GL_NV_vertex_program3
GL_NV_viewport_array2
GL_NV_viewport_swizzle
GL_NVX_conditional_render
GL_NVX_linked_gpu_multicast
GL_NV_gpu_multicast
GL_NVX_gpu_multicast2
GL_NVX_progress_fence
GL_NVX_gpu_memory_info
GL_NVX_multigpu_info
GL_NVX_nvenc_interop
GL_NV_shader_thread_group
GL_NV_shader_thread_shuffle
GL_KHR_blend_equation_advanced
GL_KHR_blend_equation_advanced_coherent
GL_OVR_multiview
GL_OVR_multiview2
GL_SGIS_generate_mipmap
GL_SGIS_texture_lod
GL_SGIX_depth_texture
GL_SGIX_shadow
GL_SUN_slice_accum
GL_WIN_swap_hint
WGL_EXT_swap_control
Supported WGL extensions: WGL_ARB_buffer_region WGL_ARB_create_context WGL_ARB_create_context_no_error WGL_ARB_create_co
ntext_profile WGL_ARB_create_context_robustness WGL_ARB_context_flush_control WGL_ARB_extensions_string WGL_ARB_make_cur
rent_read WGL_ARB_multisample WGL_ARB_pbuffer WGL_ARB_pixel_format WGL_ARB_pixel_format_float WGL_ARB_render_texture WGL
_ATI_pixel_format_float WGL_EXT_colorspace WGL_EXT_create_context_es_profile WGL_EXT_create_context_es2_profile WGL_EXT_
extensions_string WGL_EXT_framebuffer_sRGB WGL_EXT_pixel_format_packed_float WGL_EXT_swap_control WGL_EXT_swap_control_t
ear WGL_NVX_DX_interop WGL_NV_DX_interop WGL_NV_DX_interop2 WGL_NV_copy_image WGL_NV_delay_before_swap WGL_NV_float_buff
er WGL_NV_multisample_coverage WGL_NV_multigpu_context WGL_NV_render_depth_texture WGL_NV_render_texture_rectangle
**************************************
***   OpenGL 3+ Renderer Started   ***
**************************************
Registering ResourceManager for type GpuProgram
RenderSystem capabilities
-------------------------
RenderSystem Name: OpenGL 3+ Rendering Subsystem
GPU Vendor: nvidia
Device Name: GeForce GTX 1080 Ti/PCIe/SSE2
Driver Version: 4.5.0.0
 * Fixed function pipeline: no
 * Hardware generation of mipmaps: yes
 * Texture blending: yes
 * Anisotropic texture filtering: yes
 * Dot product texture operation: yes
 * Cube mapping: yes
 * Hardware stencil buffer: yes
   - Stencil depth: 8
   - Two sided stencil support: yes
   - Wrap stencil values: yes
 * Hardware vertex / index buffers: yes
 * 32-bit index buffers: yes
 * Vertex programs: yes
 * Number of floating-point constants for vertex programs: 4096
 * Number of integer constants for vertex programs: 4096
 * Number of boolean constants for vertex programs: 4096
 * Fragment programs: yes
 * Number of floating-point constants for fragment programs: 4096
 * Number of integer constants for fragment programs: 4096
 * Number of boolean constants for fragment programs: 4096
 * Geometry programs: yes
 * Number of floating-point constants for geometry programs: 2048
 * Number of integer constants for geometry programs: 2048
 * Number of boolean constants for geometry programs: 2048
 * Tessellation Hull programs: yes
 * Number of floating-point constants for tessellation hull programs: 2048
 * Number of integer constants for tessellation hull programs: 2048
 * Number of boolean constants for tessellation hull programs: 2048
 * Tessellation Domain programs: yes
 * Number of floating-point constants for tessellation domain programs: 2048
 * Number of integer constants for tessellation domain programs: 2048
 * Number of boolean constants for tessellation domain programs: 2048
 * Compute programs: yes
 * Number of floating-point constants for compute programs: 2048
 * Number of integer constants for compute programs: 2048
 * Number of boolean constants for compute programs: 2048
 * Supported Shader Profiles: glsl glsl130 glsl140 glsl150 glsl330 glsl400 glsl410 glsl420 glsl430 glsl440
 * Texture Compression: yes
   - DXT: yes
   - VTC: yes
   - PVRTC: no
   - ATC: no
   - ETC1: no
   - ETC2: yes
   - BC4/BC5: yes
   - BC6H/BC7: yes
   - ASTC: no
 * Hardware Occlusion Query: yes
 * User clip planes: yes
 * VET_UBYTE4 vertex element type: yes
 * Infinite far plane projection: yes
 * Hardware render-to-texture: yes
 * Floating point textures: yes
 * Non-power-of-two textures: yes
 * 1d textures: yes
 * Volume textures: yes
 * Max Texture resolution (2D) 32768
 * Max Texture resolution (3D) 16384
 * Max Texture resolution (Cubemaps) 32768
 * Multiple Render Targets: 8
   - With different bit depths: yes
 * Point Sprites: yes
 * Extended point parameters: yes
 * Max Point Size: 2047
 * Vertex texture fetch: yes
 * Number of world matrices: 0
 * Number of texture units: 16
 * Stencil buffer depth: 8
 * Number of vertex blend matrices: 0
   - Max vertex textures: 32
   - Vertex textures shared: yes
 * Render to Vertex Buffer : yes
 * Hardware Atomic Counters: yes
 * Compute max threads per threadgroup per axis: 1024, 1024, 64
 * Compute max threads per threadgroup total: 1024
 * GL 1.5 without VBO workaround: no
 * Frame Buffer objects: yes
 * Frame Buffer objects (ARB extension): no
 * Frame Buffer objects (ATI extension): no
 * PBuffer support: no
 * GL 1.5 without HW-occlusion workaround: no
 * Vertex Array Objects: yes
 * Separate shader objects: no
 * Using Reverse Z: yes
Using FSAA.
DefaultWorkQueue('Root') initialising on thread main.
Particle Renderer Type 'billboard' registered
Added resource location '../ogre_media/' of type 'FileSystem' to resource group 'General'
Added resource location '../ogre_media/pbr_gun' of type 'FileSystem' to resource group 'General'
Added resource location '../ogre_media/skybox' of type 'FileSystem' to resource group 'General'
Added resource location '../ogre_media/cubes' of type 'FileSystem' to resource group 'General'
Parsing scripts for resource group Autodetect
Finished parsing scripts for resource group Autodetect
Creating resources for group Autodetect
All done
Parsing scripts for resource group General
Parsing script Material.material
Parsing script SkyPostprocess.material
Parsing script 08 - Default_0.material.json
Parsing script Material_0.material.json
Finished parsing scripts for resource group General
Creating resources for group General
All done
Parsing scripts for resource group Internal
Finished parsing scripts for resource group Internal
Creating resources for group Internal
All done
Creating resource group ViewerResc
Added resource location 'C:/Users/joel/Documents/projects/ogre_test_2.2.1_qt/ogre_media/pbr_gun' of type 'FileSystem' to
 resource group 'ViewerResc'
Mesh: Loading Mesh_0.mesh.
Corrupted chunk detected! Stream name: 'Mesh_0.mesh' Chunk id: 36864
Vertex Shader: 100000000VertexShader_vs
Fragment Shader: 100000000PixelShader_ps
 GLSL link result :
Fragment info
-------------
0(551) : warning C7050: "pixelData.envColourS" might be used before being initialized
0(551) : warning C7050: "pixelData.envColourD" might be used before being initialized
OpenGL:performance(medium) 131154: Pixel-path performance warning: Pixel transfer is synchronized with 3D rendering.
OpenGL:performance(medium) 131218: Program/shader state performance warning: Vertex shader in program 1 is being recompi
led based on GL state.
################ TEXTURE NAME ###############
Cerberus_A.tga
################ TEXTURE NAME ###############
Assertion failed: mipLevel < mNumMipmaps, file C:\Users\joel\Documents\projects\ogre-next-2.2.1\OgreMain\src\OgreImage2.
cpp, line 774

Process finished with exit code 3
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

The good news: Your sample data uncovered an unrelated a bug. Fixed.
The bad news: I was unable to reproduce your issue.
MinGW-w64 GCC 9.2.0 (through MSYS2)
I suspect this might be related to the problem.

The class QueuedImage stores all mips have that haven't been uploaded yet in a bitset, specifically QueuedImage::mipLevelBitSet.
Thus if mip 0 hasn't yet been uploaded then mipLevelBitSet[0] & 0x01 will be true.
If mip 1 hasn't yet been uploaded then mipLevelBitSet[0] & 0x02 will be true and so on.

We use Bitwise::ctz64 to retrieve the first unset bit in getMinMipLevel
And we use Bitwise::clz64 to retrieve the last set bit in getMaxMipLevelPlusOne

ctz64 and clz64 are hard to get right for each platform, because each platform and compiler have their own details.
I suspect we got Bitwise::ctz64 and Bitwise::clz64 wrong for MinGW-w64 and it is not returning what we expect; which would explain why TextureGpuManager::processQueuedImage is trying to load past the last mipmap.

Question for you:
Does it get fixed if you change:

Code: Select all

#if OGRE_COMPILER == OGRE_COMPILER_MSVC
for:

Code: Select all

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
in both clz64, clz32, ctz32 and ctz64? (in OgreBitwise.h)

Btw what's the value of queuedImage.mipLevelBitSet[0] when it crashes?

Cheers
Matias
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

Glad to hear that you managed to fix something else :)

Unfortunately, I am stuck with MinGW-w64 GCC on this project as a later dependency only compiles with GCC and porting to MSVC would be a major undertaking given the size of the dependency.
Question for you:
Does it get fixed if you change:

#if OGRE_COMPILER == OGRE_COMPILER_MSVC

for:

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

in both clz64, clz32, ctz32 and ctz64? (in OgreBitwise.h)
I did that but already the IDE I'm using (currently CLion) did not indicate that anything would have changed. The code in question (previously OGRE_COMPILER_MSVC is still excluded when changing it to OGRE_COMPILER_WIN32.
I am not familiar with the code base of Ogre at all but I quickly looked for OGRE_COMPILER_ definitions and I couldn't find any reference to OGRE_COMPILER_WIN32 at all (which would mean it never gets defined anyway). I only found OGRE_COMPILER_WINSCW (in OgrePlatfrom.h). The platform definitions of course include OGRE_PLATFORM_WIN32 but that should be unrelated here (especially as that must be set correctly anyway) - right?
Anyway I built everything with the changes suggested by you and the behavior remained unchanged.
Btw what's the value of queuedImage.mipLevelBitSet[0] when it crashes?
Just to avoid misunderstandings: Technically it doesn't crash - it just hits an assert that is evaluating to false. When that happens, queuedImage.mipLevelBitSet[0] is 0. All other bits in there too.
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

Any news on this?

Would love to finish the migration of this basic minimal application and releasing it as a starting point for new users.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

I cannot fix it without a repro.

However something is odd. You said queuedImage.mipLevelBitSet[0] was 0.

That means queuedImage.getMaxMipLevelPlusOne() should've returned either 0 or 1 (unless any of the queuedImage.mipLevelBitSet[ i] is non-zero). But it is obviously higher than that. I suggest you step into getMaxMipLevelPlusOne and see what's going on: what is the value of each variable and what it is returning.

Because anything other than this:

Code: Select all

queuedImage.mipLevelBitSet[0] = either 0 or 1;
queuedImage.mipLevelBitSet[1] = 0;
queuedImage.mipLevelBitSet[2] = 0;
queuedImage.mipLevelBitSet[3] = 0;
getMaxMipLevelPlusOne returning either 0 or 1
Should be impossible.

To debug in a single thread, look for:

Code: Select all

//#define OGRE_FORCE_TEXTURE_STREAMING_ON_MAIN_THREAD 1
in OgreTextureGpuManager.cpp and uncomment it.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Ogre 2.1 to 2.2.1 migration

Post by dark_sylinc »

Fixed.

You were lucky I stumbled into this by accident while testing debugging D3D11 programs using Wine built with mingw-w64.

Cheers
Matias
tct
Gnoblar
Posts: 24
Joined: Wed May 20, 2020 3:11 pm
x 8

Re: Ogre 2.1 to 2.2.1 migration

Post by tct »

Hooray - It's working! \o/
I can confirm that the fix you published is working. I have now a working Ogre 2.2.1 + Qt application running.

Great timing too! I was just sitting down to start debugging this :)

I will publish this as a starting-point project once I cleaned everything up and added the irradiance background.
Post Reply