Closed bwrsandman closed 7 years ago
It seems like you've struck on the problem, I didn't realise there was a buffer sharing path so the code is assuming the input is either a renderbuffer or a texture.
I'll take a look at this in a day or two, thank you for providing a succinct repro case that makes it a lot easier!
I believe that commit should fix the problem, at least it did on a simple interop demo I wrote as well as your example code. Please let me know if it fixes it for you, the commit will be in the next nightly build.
I get an extra crash during replay in a more fleshed out application due to related wglDXLockObjectsNV
:
GLenum GetBaseFormat(GLenum internalFormat)
is called with internalFormat = eGL_NONE
and ends with "Unhandled Base Format case GL_NONE!"
> renderdoc.dll!GetBaseFormat(RDCGLenum internalFormat) Line 388 C++
renderdoc.dll!WrappedOpenGL::Serialise_wglDXLockObjectsNV(GLResource res) Line 436 C++
renderdoc.dll!WrappedOpenGL::ProcessChunk(unsigned __int64 offset, GLChunkType context) Line 3844 C++
renderdoc.dll!WrappedOpenGL::ContextProcessChunk(unsigned __int64 offset, GLChunkType chunk) Line 3983 C++
renderdoc.dll!WrappedOpenGL::ContextReplayLog(LogState readType, unsigned int startEventID, unsigned int endEventID, bool partial) Line 3941 C++
renderdoc.dll!WrappedOpenGL::ReadLogInitialisation() Line 3364 C++
renderdoc.dll!GLReplay::ReadLogInitialisation() Line 80 C++
renderdoc.dll!ReplayController::PostCreateInit(IReplayDriver * device) Line 1543 C++
renderdoc.dll!ReplayController::CreateDevice(const char * logfile) Line 1518 C++
renderdoc.dll!CaptureFile::OpenCapture(float * progress) Line 105 C++
renderdoc.dll!RENDERDOC_CreateReplayRenderer(const char * logfile, float * progress, IReplayController * * rend) Line 371 C++
[External Code]
renderdocui.exe!renderdoc.StaticExports.CreateReplayRenderer(string logfile, ref float progress) Line 169 C#
renderdocui.exe!renderdocui.Code.RenderManager.CreateReplayRenderer() Line 600 C#
renderdocui.exe!renderdocui.Code.RenderManager.RunThread() Line 615 C#
RDOC 002560: [15:42:10] gl_common.cpp( 54) - Log - Running GL replay on: NVIDIA Corporation / GeForce GTX 980/PCIe/SSE2 / 4.5.0 NVIDIA 382.33
RDOC 002560: [15:42:10] gl_common.cpp( 68) - Log - [0]: GL_AMD_multi_draw_indirect, [1]: GL_AMD_seamless_cubemap_per_texture, [2]: GL_AMD_vertex_shader_viewport_index, [3]: GL_AMD_vertex_shader_layer, [4]: GL_ARB_arrays_of_arrays, [5]: GL_ARB_base_instance, [6]: GL_ARB_bindless_texture, [7]: GL_ARB_blend_func_extended, [8]: GL_ARB_buffer_storage, [9]: GL_ARB_clear_buffer_object, [10]: GL_ARB_clear_texture, [11]: GL_ARB_clip_control, [12]: GL_ARB_color_buffer_float, [13]: GL_ARB_compressed_texture_pixel_storage, [14]: GL_ARB_conservative_depth, [15]: GL_ARB_compute_shader, [16]: GL_ARB_compute_variable_group_size, [17]: GL_ARB_conditional_render_inverted, [18]: GL_ARB_copy_buffer, [19]: GL_ARB_copy_image, [20]: GL_ARB_cull_distance, [21]: GL_ARB_debug_output, [22]: GL_ARB_depth_buffer_float, [23]: GL_ARB_depth_clamp, [24]: GL_ARB_depth_texture, [25]: GL_ARB_derivative_control, [26]: GL_ARB_direct_state_access, [27]: GL_ARB_draw_buffers, [28]: GL_ARB_draw_buffers_blend, [29]: GL_ARB_draw_indirect, [30]: GL_ARB_draw_elements_base_vertex, [31]: GL_ARB_draw_instanced, [32]: GL_ARB_enhanced_layouts, [33]: GL_ARB_ES2_compatibility, [34]: GL_ARB_ES3_compatibility, [35]: GL_ARB_ES3_1_compatibility, [36]: GL_ARB_ES3_2_compatibility, [37]: GL_ARB_explicit_attrib_location, [38]: GL_ARB_explicit_uniform_location, [39]: GL_ARB_fragment_coord_conventions, [40]: GL_ARB_fragment_layer_viewport, [41]: GL_ARB_fragment_program, [42]: GL_ARB_fragment_program_shadow, [43]: GL_ARB_fragment_shader, [44]: GL_ARB_fragment_shader_interlock, [45]: GL_ARB_framebuffer_no_attachments, [46]: GL_ARB_framebuffer_object, [47]: GL_ARB_framebuffer_sRGB, [48]: GL_ARB_geometry_shader4, [49]: GL_ARB_get_program_binary, [50]: GL_ARB_get_texture_sub_image, [51]: GL_ARB_gl_spirv, [52]: GL_ARB_gpu_shader5, [53]: GL_ARB_gpu_shader_fp64, [54]: GL_ARB_gpu_shader_int64, [55]: GL_ARB_half_float_pixel, [56]: GL_ARB_half_float_vertex, [57]: GL_ARB_imaging, [58]: GL_ARB_indirect_parameters, [59]: GL_ARB_instanced_arrays, [60]: GL_ARB_internalformat_query, [61]: GL_ARB_internalformat_query2, [62]: GL_ARB_invalidate_subdata, [63]: GL_ARB_map_buffer_alignment, [64]: GL_ARB_map_buffer_range, [65]: GL_ARB_multi_bind, [66]: GL_ARB_multi_draw_indirect, [67]: GL_ARB_multisample, [68]: GL_ARB_multitexture, [69]: GL_ARB_occlusion_query, [70]: GL_ARB_occlusion_query2, [71]: GL_ARB_parallel_shader_compile, [72]: GL_ARB_pipeline_statistics_query, [73]: GL_ARB_pixel_buffer_object, [74]: GL_ARB_point_parameters, [75]: GL_ARB_point_sprite, [76]: GL_ARB_post_depth_coverage, [77]: GL_ARB_program_interface_query, [78]: GL_ARB_provoking_vertex, [79]: GL_ARB_query_buffer_object, [80]: GL_ARB_robust_buffer_access_behavior, [81]: GL_ARB_robustness, [82]: GL_ARB_sample_locations, [83]: GL_ARB_sample_shading, [84]: GL_ARB_sampler_objects, [85]: GL_ARB_seamless_cube_map, [86]: GL_ARB_seamless_cubemap_per_texture, [87]: GL_ARB_separate_shader_objects, [88]: GL_ARB_shader_atomic_counter_ops, [89]: GL_ARB_shader_atomic_counters, [90]: GL_ARB_shader_ballot, [91]: GL_ARB_shader_bit_encoding, [92]: GL_ARB_shader_clock, [93]: GL_ARB_shader_draw_parameters, [94]: GL_ARB_shader_group_vote, [95]: GL_ARB_shader_image_load_store, [96]: GL_ARB_shader_image_size, [97]: GL_ARB_shader_objects, [98]: GL_ARB_shader_precision, [99]: GL_ARB_shader_storage_buffer_object, [100]: GL_ARB_shader_subroutine,
RDOC 002560: [15:42:10] gl_common.cpp( 68) - Log - [101]: GL_ARB_shader_texture_image_samples, [102]: GL_ARB_shader_texture_lod, [103]: GL_ARB_shading_language_100, [104]: GL_ARB_shader_viewport_layer_array, [105]: GL_ARB_shading_language_420pack, [106]: GL_ARB_shading_language_include, [107]: GL_ARB_shading_language_packing, [108]: GL_ARB_shadow, [109]: GL_ARB_sparse_buffer, [110]: GL_ARB_sparse_texture, [111]: GL_ARB_sparse_texture2, [112]: GL_ARB_sparse_texture_clamp, [113]: GL_ARB_stencil_texturing, [114]: GL_ARB_sync, [115]: GL_ARB_tessellation_shader, [116]: GL_ARB_texture_barrier, [117]: GL_ARB_texture_border_clamp, [118]: GL_ARB_texture_buffer_object, [119]: GL_ARB_texture_buffer_object_rgb32, [120]: GL_ARB_texture_buffer_range, [121]: GL_ARB_texture_compression, [122]: GL_ARB_texture_compression_bptc, [123]: GL_ARB_texture_compression_rgtc, [124]: GL_ARB_texture_cube_map, [125]: GL_ARB_texture_cube_map_array, [126]: GL_ARB_texture_env_add, [127]: GL_ARB_texture_env_combine, [128]: GL_ARB_texture_env_crossbar, [129]: GL_ARB_texture_env_dot3, [130]: GL_ARB_texture_filter_minmax, [131]: GL_ARB_texture_float, [132]: GL_ARB_texture_gather, [133]: GL_ARB_texture_mirror_clamp_to_edge, [134]: GL_ARB_texture_mirrored_repeat, [135]: GL_ARB_texture_multisample, [136]: GL_ARB_texture_non_power_of_two, [137]: GL_ARB_texture_query_levels, [138]: GL_ARB_texture_query_lod, [139]: GL_ARB_texture_rectangle, [140]: GL_ARB_texture_rg, [141]: GL_ARB_texture_rgb10_a2ui, [142]: GL_ARB_texture_stencil8, [143]: GL_ARB_texture_storage, [144]: GL_ARB_texture_storage_multisample, [145]: GL_ARB_texture_swizzle, [146]: GL_ARB_texture_view, [147]: GL_ARB_timer_query, [148]: GL_ARB_transform_feedback2, [149]: GL_ARB_transform_feedback3, [150]: GL_ARB_transform_feedback_instanced, [151]: GL_ARB_transform_feedback_overflow_query, [152]: GL_ARB_transpose_matrix, [153]: GL_ARB_uniform_buffer_object, [154]: GL_ARB_vertex_array_bgra, [155]: GL_ARB_vertex_array_object, [156]: GL_ARB_vertex_attrib_64bit, [157]: GL_ARB_vertex_attrib_binding, [158]: GL_ARB_vertex_buffer_object, [159]: GL_ARB_vertex_program, [160]: GL_ARB_vertex_shader, [161]: GL_ARB_vertex_type_10f_11f_11f_rev, [162]: GL_ARB_vertex_type_2_10_10_10_rev, [163]: GL_ARB_viewport_array, [164]: GL_ARB_window_pos, [165]: GL_ATI_draw_buffers, [166]: GL_ATI_texture_float, [167]: GL_ATI_texture_mirror_once, [168]: GL_S3_s3tc, [169]: GL_EXT_texture_env_add, [170]: GL_EXT_abgr, [171]: GL_EXT_bgra, [172]: GL_EXT_bindable_uniform, [173]: GL_EXT_blend_color, [174]: GL_EXT_blend_equation_separate, [175]: GL_EXT_blend_func_separate, [176]: GL_EXT_blend_minmax, [177]: GL_EXT_blend_subtract, [178]: GL_EXT_compiled_vertex_array, [179]: GL_EXT_Cg_shader, [180]: GL_EXT_depth_bounds_test, [181]: GL_EXT_direct_state_access, [182]: GL_EXT_draw_buffers2, [183]: GL_EXT_draw_instanced, [184]: GL_EXT_draw_range_elements, [185]: GL_EXT_fog_coord, [186]: GL_EXT_framebuffer_blit, [187]: GL_EXT_framebuffer_multisample, [188]: GL_EXTX_framebuffer_mixed_formats, [189]: GL_EXT_framebuffer_multisample_blit_scaled, [190]: GL_EXT_framebuffer_object, [191]: GL_EXT_framebuffer_sRGB, [192]: GL_EXT_geometry_shader4, [193]: GL_EXT_gpu_program_parameters, [194]: GL_EXT_gpu_shader4, [195]: GL_EXT_multi_draw_arrays, [196]: GL_EXT_packed_depth_stencil, [197]: GL_EXT_packed_float, [198]: GL_EXT_packed_pixels, [199]: GL_EXT_pixel_buffer_object, [200]: GL_EXT_point_parameters,
RDOC 002560: [15:42:10] gl_common.cpp( 68) - Log - [201]: GL_EXT_polygon_offset_clamp, [202]: GL_EXT_post_depth_coverage, [203]: GL_EXT_provoking_vertex, [204]: GL_EXT_raster_multisample, [205]: GL_EXT_rescale_normal, [206]: GL_EXT_secondary_color, [207]: GL_EXT_separate_shader_objects, [208]: GL_EXT_separate_specular_color, [209]: GL_EXT_shader_image_load_formatted, [210]: GL_EXT_shader_image_load_store, [211]: GL_EXT_shader_integer_mix, [212]: GL_EXT_shadow_funcs, [213]: GL_EXT_sparse_texture2, [214]: GL_EXT_stencil_two_side, [215]: GL_EXT_stencil_wrap, [216]: GL_EXT_texture3D, [217]: GL_EXT_texture_array, [218]: GL_EXT_texture_buffer_object, [219]: GL_EXT_texture_compression_dxt1, [220]: GL_EXT_texture_compression_latc, [221]: GL_EXT_texture_compression_rgtc, [222]: GL_EXT_texture_compression_s3tc, [223]: GL_EXT_texture_cube_map, [224]: GL_EXT_texture_edge_clamp, [225]: GL_EXT_texture_env_combine, [226]: GL_EXT_texture_env_dot3, [227]: GL_EXT_texture_filter_anisotropic, [228]: GL_EXT_texture_filter_minmax, [229]: GL_EXT_texture_integer, [230]: GL_EXT_texture_lod, [231]: GL_EXT_texture_lod_bias, [232]: GL_EXT_texture_mirror_clamp, [233]: GL_EXT_texture_object, [234]: GL_EXT_texture_shared_exponent, [235]: GL_EXT_texture_sRGB, [236]: GL_EXT_texture_sRGB_decode, [237]: GL_EXT_texture_storage, [238]: GL_EXT_texture_swizzle, [239]: GL_EXT_timer_query, [240]: GL_EXT_transform_feedback2, [241]: GL_EXT_vertex_array, [242]: GL_EXT_vertex_array_bgra, [243]: GL_EXT_vertex_attrib_64bit, [244]: GL_EXT_window_rectangles, [245]: GL_EXT_import_sync_object, [246]: GL_IBM_rasterpos_clip, [247]: GL_IBM_texture_mirrored_repeat, [248]: GL_KHR_context_flush_control, [249]: GL_KHR_debug, [250]: GL_KHR_no_error, [251]: GL_KHR_robust_buffer_access_behavior, [252]: GL_KHR_robustness, [253]: GL_KTX_buffer_region, [254]: GL_NV_alpha_to_coverage_dither_control, [255]: GL_NV_bindless_multi_draw_indirect, [256]: GL_NV_bindless_multi_draw_indirect_count, [257]: GL_NV_bindless_texture, [258]: GL_NV_blend_equation_advanced, [259]: GL_NV_blend_equation_advanced_coherent, [260]: GL_NV_blend_square, [261]: GL_NV_command_list, [262]: GL_NV_compute_program5, [263]: GL_NV_conditional_render, [264]: GL_NV_conservative_raster, [265]: GL_NV_conservative_raster_dilate, [266]: GL_NV_copy_depth_to_color, [267]: GL_NV_copy_image, [268]: GL_NV_depth_buffer_float, [269]: GL_NV_depth_clamp, [270]: GL_NV_draw_texture, [271]: GL_NV_draw_vulkan_image, [272]: GL_NV_ES1_1_compatibility, [273]: GL_NV_ES3_1_compatibility, [274]: GL_NV_explicit_multisample, [275]: GL_NV_fence, [276]: GL_NV_fill_rectangle, [277]: GL_NV_float_buffer, [278]: GL_NV_fog_distance, [279]: GL_NV_fragment_coverage_to_color, [280]: GL_NV_fragment_program, [281]: GL_NV_fragment_program_option, [282]: GL_NV_fragment_program2, [283]: GL_NV_fragment_shader_interlock, [284]: GL_NV_framebuffer_mixed_samples, [285]: GL_NV_framebuffer_multisample_coverage, [286]: GL_NV_geometry_shader4, [287]: GL_NV_geometry_shader_passthrough, [288]: GL_NV_gpu_program4, [289]: GL_NV_internalformat_sample_query, [290]: GL_NV_gpu_program4_1, [291]: GL_NV_gpu_program5, [292]: GL_NV_gpu_program5_mem_extended, [293]: GL_NV_gpu_program_fp64, [294]: GL_NV_gpu_shader5, [295]: GL_NV_half_float, [296]: GL_NV_light_max_exponent, [297]: GL_NV_multisample_coverage, [298]: GL_NV_multisample_filter_hint, [299]: GL_NV_occlusion_query, [300]: GL_NV_packed_depth_stencil,
RDOC 002560: [15:42:10] gl_common.cpp( 85) - Log - [301]: GL_NV_parameter_buffer_object, [302]: GL_NV_parameter_buffer_object2, [303]: GL_NV_path_rendering, [304]: GL_NV_path_rendering_shared_edge, [305]: GL_NV_pixel_data_range, [306]: GL_NV_point_sprite, [307]: GL_NV_primitive_restart, [308]: GL_NV_register_combiners, [309]: GL_NV_register_combiners2, [310]: GL_NV_sample_locations, [311]: GL_NV_sample_mask_override_coverage, [312]: GL_NV_shader_atomic_counters, [313]: GL_NV_shader_atomic_float, [314]: GL_NV_shader_atomic_fp16_vector, [315]: GL_NV_shader_atomic_int64, [316]: GL_NV_shader_buffer_load, [317]: GL_NV_shader_storage_buffer_object, [318]: GL_NV_texgen_reflection, [319]: GL_NV_texture_barrier, [320]: GL_NV_texture_compression_vtc, [321]: GL_NV_texture_env_combine4, [322]: GL_NV_texture_multisample, [323]: GL_NV_texture_rectangle, [324]: GL_NV_texture_shader, [325]: GL_NV_texture_shader2, [326]: GL_NV_texture_shader3, [327]: GL_NV_transform_feedback, [328]: GL_NV_transform_feedback2, [329]: GL_NV_uniform_buffer_unified_memory, [330]: GL_NV_vertex_array_range, [331]: GL_NV_vertex_array_range2, [332]: GL_NV_vertex_attrib_integer_64bit, [333]: GL_NV_vertex_buffer_unified_memory, [334]: GL_NV_vertex_program, [335]: GL_NV_vertex_program1_1, [336]: GL_NV_vertex_program2, [337]: GL_NV_vertex_program2_option, [338]: GL_NV_vertex_program3, [339]: GL_NV_viewport_array2, [340]: GL_NV_viewport_swizzle, [341]: GL_NVX_conditional_render, [342]: GL_NVX_gpu_memory_info, [343]: GL_NVX_multigpu_info, [344]: GL_NVX_nvenc_interop, [345]: GL_NV_shader_thread_group, [346]: GL_NV_shader_thread_shuffle, [347]: GL_KHR_blend_equation_advanced, [348]: GL_KHR_blend_equation_advanced_coherent, [349]: GL_SGIS_generate_mipmap, [350]: GL_SGIS_texture_lod, [351]: GL_SGIX_depth_texture, [352]: GL_SGIX_shadow, [353]: GL_SUN_slice_accum, [354]: GL_WIN_swap_hint, [355]: WGL_EXT_swap_control,
RDOC 002560: [15:42:10] gl_common.cpp( 406) - Log - Vendor checks for 45 (NVIDIA Corporation / GeForce GTX 980/PCIe/SSE2 / 4.5.0 NVIDIA 382.33)
RDOC 002560: [15:42:10] gl_common.cpp( 136) - Log - Function pointers available:
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111011111111111100000
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111111111111111111111111111111111111111111111111111111
RDOC 002560: [15:42:10] gl_common.cpp( 147) - Log - 1111111111111100000000000000000000000000000000000000000000000000
RDOC 002560: [15:42:10] serialiser.cpp( 673) - Debug - Opened capture file for read
RDOC 002560: [15:42:10] gl_driver.cpp( 918) - Debug - Debug Text enabled - for development! remove before release!
RDOC 002560: [15:42:10] gl_replay_win32.cpp( 299) - Log - Created device.
RDOC 002560: [15:42:10] gl_debug.cpp( 332) - Log - GLSL version 450
RDOC 002560: [15:42:12] gl_common.cpp( 688) - Warning - FBOs are shared on this implementation
RDOC 002560: [15:42:12] replay_controller.cpp(1517) - Log - Created replay driver.
RDOC 002560: [15:42:13] gl_manager.cpp(1478) - Debug - OpenGL not implemented - Not implemented - initial states of multisampled textures
RDOC 002560: [15:42:13] gl_manager.cpp(1478) - Debug - OpenGL not implemented - Not implemented - initial states of multisampled textures
RDOC 002560: [15:42:13] gl_manager.cpp(1608) - Warning - Technically you could try and readback the contents of a RenderBuffer via pixel copy.
RDOC 002560: [15:42:13] gl_manager.cpp(1609) - Warning - Currently we don't support that though, and initial contents will be uninitialised.
RDOC 002560: [15:42:13] gl_manager.cpp(1608) - Warning - Technically you could try and readback the contents of a RenderBuffer via pixel copy.
RDOC 002560: [15:42:13] gl_manager.cpp(1609) - Warning - Currently we don't support that though, and initial contents will be uninitialised.
RDOC 002560: [15:42:13] resource_manager.h( 838) - Debug - Applying initial contents
RDOC 002560: [15:42:13] resource_manager.h( 853) - Debug - Applied 21
RDOC 002560: [15:42:13] gl_resources.cpp( 388) - Error - Unhandled Base Format case GL_NONE!
Sorry for the delay, this was in the code that saved and restored the resource's contents in wglDXLockObjectsNV. It wasn't fatal (you could just continue past it and you ended up without the buffer contents), but I've fixed it now so it should work correctly for buffers too.
Can you please test that in the next nightly build, or compiling locally?
I believe this should now be working for buffers and textures from the above commit, which is included in the v0.90 release. If you're still running into issues then let me know and I'll investigate further.
Description
Capturing interop applications which run
wglDXRegisterObjectNV
for simpleBuffers
(vertex, index, constant) cause null pointer crash.It seems that rendererdoc will try to treat any Resource passed to
wglDXRegisterObjectNV
as a Texture.The culprit seems to be in
gl_interop_funcs.cpp
where type isGL_NONE
representing a buffer (vertex, index) and not a Renderbuffer or a Texture.Setting
wrapped->res = type == eGL_RENDERBUFFER ? RenderbufferRes(GetCtx(), name) : type == eGL_NONE ? BufferRes(GetCtx(), name) : TextureRes(GetCtx(), name)
allowsGetResourceManager()->GetResourceRecord(wrapped->res);
to get a non-null result butSerialise_wglDXRegisterObjectNV
will error after it fails to find a texture format.Environment
To reproduce
Sample code
main.c
fails when capturing