igl icon indicating copy to clipboard operation
igl copied to clipboard

sample "tiny" error

Open adammaj1 opened this issue 2 years ago • 9 comments

Hi,

I try to compile tiny

a@zalman:~/igl/samples/desktop$  cmake .
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:21 (igl_set_cxxstd):
  Unknown CMake command "igl_set_cxxstd".
Call Stack (most recent call first):
  CMakeLists.txt:38 (add_demo)


-- Configuring incomplete, errors occurred!
See also "/home/a/igl/samples/desktop/CMakeFiles/CMakeOutput.log".

How can I do it ?

adammaj1 avatar Jul 08 '23 14:07 adammaj1

Hello! I believe it's because there's a cmake function defined in /igl/cmake/helpers.cmake, which was not defined in your case because you ran cmake into the desktop sample directory. This function is defined in the top level CMakeLists.txt file of the repo, with this line include(cmake/helpers.cmake).

The function in question:

function(igl_set_cxxstd target cpp_version)
  set_property(TARGET ${target} PROPERTY CXX_STANDARD ${cpp_version})
  set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
endfunction()

Try running the cmake command from the top level directory of the IGL project. I hope this works.

jwric avatar Jul 08 '23 17:07 jwric

Ok. I tried. It works, but timu is not compiled. How can I compile ?

adammaj1 avatar Jul 09 '23 12:07 adammaj1

You can run cmake --build . at the top level directory to build everything

jwric avatar Jul 09 '23 17:07 jwric

sudo apt-get install clang xorg-dev libxinerama-dev libxcursor-dev libgles2-mesa-dev libegl1-mesa-dev libglfw3-dev libglew-dev libstdc++-12-dev
git clone [email protected]:facebook/igl.git
cd igl
python3 deploy_content.py
python3 deploy_deps.py
cd build
cmake .. -G "Unix Makefiles"
cmake --build .  # You can run cmake --build . at the top level directory to build everything

then

~/igl/build/samples/desktop$ ./Tiny
[IGL] Error in (void igl::vulkan::VulkanContext::createInstance(size_t, const char**)).
Vulkan API call failed: /home/a/igl/src/igl/vulkan/VulkanContext.cpp:297
  ivkCreateInstance(VK_API_VERSION_1_1, config_.enableValidation, config_.enableGPUAssistedValidation, config_.enableSynchronizationValidation, instanceExtensions.size(), instanceExtensions.data(), &vkInstance_)
  VK_ERROR_LAYER_NOT_PRESENT
Tiny: /home/a/igl/src/igl/vulkan/VulkanContext.cpp:297: void igl::vulkan::VulkanContext::createInstance(size_t, const char**): Assertion `false' failed.
Aborted
~/igl/build/samples/desktop$ ./Tiny_Mesh
[IGL] Error in (void igl::vulkan::VulkanContext::createInstance(size_t, const char**)).
Vulkan API call failed: /home/a/igl/src/igl/vulkan/VulkanContext.cpp:297
  ivkCreateInstance(VK_API_VERSION_1_1, config_.enableValidation, config_.enableGPUAssistedValidation, config_.enableSynchronizationValidation, instanceExtensions.size(), instanceExtensions.data(), &vkInstance_)
  VK_ERROR_LAYER_NOT_PRESENT
Tiny_Mesh: /home/a/igl/src/igl/vulkan/VulkanContext.cpp:297: void igl::vulkan::VulkanContext::createInstance(size_t, const char**): Assertion `false' failed.
Aborted

adammaj1 avatar Jul 10 '23 10:07 adammaj1

@adammaj1 It looks like you have no Vulkan validation layers installed.

corporateshark avatar Jul 10 '23 18:07 corporateshark

is vulkaninfo enough ?

vulkaninfo
==========
VULKANINFO
==========

Vulkan Instance Version: 1.3.204


Instance Extensions: count = 19
===============================
	VK_EXT_acquire_drm_display             : extension revision 1
	VK_EXT_acquire_xlib_display            : extension revision 1
	VK_EXT_debug_report                    : extension revision 9
	VK_EXT_debug_utils                     : extension revision 2
	VK_EXT_direct_mode_display             : extension revision 1
	VK_EXT_display_surface_counter         : extension revision 1
	VK_KHR_device_group_creation           : extension revision 1
	VK_KHR_display                         : extension revision 23
	VK_KHR_external_fence_capabilities     : extension revision 1
	VK_KHR_external_memory_capabilities    : extension revision 1
	VK_KHR_external_semaphore_capabilities : extension revision 1
	VK_KHR_get_display_properties2         : extension revision 1
	VK_KHR_get_physical_device_properties2 : extension revision 2
	VK_KHR_get_surface_capabilities2       : extension revision 1
	VK_KHR_surface                         : extension revision 25
	VK_KHR_surface_protected_capabilities  : extension revision 1
	VK_KHR_wayland_surface                 : extension revision 6
	VK_KHR_xcb_surface                     : extension revision 6
	VK_KHR_xlib_surface                    : extension revision 6

Layers: count = 4
=================
VK_LAYER_INTEL_nullhw (INTEL NULL HW) Vulkan version 1.1.73, layer version 1:
	Layer Extensions: count = 0
	Devices: count = 2
		GPU id = 0 (NVIDIA GeForce GTX 770)
		Layer-Device Extensions: count = 0

		GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
		Layer-Device Extensions: count = 0

VK_LAYER_MESA_device_select (Linux device selection layer) Vulkan version 1.3.211, layer version 1:
	Layer Extensions: count = 0
	Devices: count = 2
		GPU id = 0 (NVIDIA GeForce GTX 770)
		Layer-Device Extensions: count = 0

		GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
		Layer-Device Extensions: count = 0

VK_LAYER_MESA_overlay (Mesa Overlay layer) Vulkan version 1.3.211, layer version 1:
	Layer Extensions: count = 0
	Devices: count = 2
		GPU id = 0 (NVIDIA GeForce GTX 770)
		Layer-Device Extensions: count = 0

		GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
		Layer-Device Extensions: count = 0

VK_LAYER_NV_optimus (NVIDIA Optimus layer) Vulkan version 1.2.175, layer version 1:
	Layer Extensions: count = 0
	Devices: count = 2
		GPU id = 0 (NVIDIA GeForce GTX 770)
		Layer-Device Extensions: count = 0

		GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
		Layer-Device Extensions: count = 0

Pre
....

adammaj1 avatar Jul 10 '23 19:07 adammaj1

@adammaj1 Are you on Wayland?

corporateshark avatar Jul 10 '23 19:07 corporateshark

echo $XDG_SESSION_TYPE
x11

adammaj1 avatar Jul 10 '23 19:07 adammaj1

@adammaj1 Then I can suggest trying to run the app with all validation layers disabled (change the VulkanContextConfig struct in the app).

corporateshark avatar Jul 10 '23 19:07 corporateshark

I have found only one

const igl::vulkan::VulkanContextConfig cfg{
        .maxTextures = 8,
        .maxSamplers = 8,
        .terminateOnValidationError = true,
        .swapChainColorSpace = igl::ColorSpace::SRGB_LINEAR,
    };

but cfg is used 4 times. Should I remove all 4 cfg ?

adammaj1 avatar Jul 13 '23 07:07 adammaj1

Just add .enableValidation = false in there.

corporateshark avatar Jul 13 '23 07:07 corporateshark

const igl::vulkan::VulkanContextConfig cfg{
    	.enableValidation = false
    	/*
        .maxTextures = 8,
        .maxSamplers = 8,
        .terminateOnValidationError = true,
        .swapChainColorSpace = igl::ColorSpace::SRGB_LINEAR,
        */
    };

then

~/igl/build/samples/desktop$ ./Tiny
Vulkan instance extensions:
  VK_KHR_device_group_creation
  VK_KHR_display
  VK_KHR_external_fence_capabilities
  VK_KHR_external_memory_capabilities
  VK_KHR_external_semaphore_capabilities
  VK_KHR_get_display_properties2
  VK_KHR_get_physical_device_properties2
  VK_KHR_get_surface_capabilities2
  VK_KHR_surface
  VK_KHR_surface_protected_capabilities
  VK_KHR_wayland_surface
  VK_KHR_xcb_surface
  VK_KHR_xlib_surface
  VK_EXT_acquire_xlib_display
  VK_EXT_debug_report
  VK_EXT_debug_utils
  VK_EXT_direct_mode_display
  VK_EXT_display_surface_counter
  VK_EXT_acquire_drm_display
  VK_KHR_portability_enumeration
  VK_LUNARG_direct_driver_loading
Vulkan physical device: NVIDIA GeForce GTX 770
           API version: 1.2.175.0
           Driver info: NVIDIA 470.199.02
Vulkan physical device extensions:
  VK_KHR_16bit_storage
  VK_KHR_8bit_storage
  VK_KHR_bind_memory2
  VK_KHR_buffer_device_address
  VK_KHR_copy_commands2
  VK_KHR_create_renderpass2
  VK_KHR_dedicated_allocation
  VK_KHR_depth_stencil_resolve
  VK_KHR_descriptor_update_template
  VK_KHR_device_group
  VK_KHR_draw_indirect_count
  VK_KHR_driver_properties
  VK_KHR_external_fence
  VK_KHR_external_fence_fd
  VK_KHR_external_memory
  VK_KHR_external_memory_fd
  VK_KHR_external_semaphore
  VK_KHR_external_semaphore_fd
  VK_KHR_get_memory_requirements2
  VK_KHR_image_format_list
  VK_KHR_imageless_framebuffer
  VK_KHR_maintenance1
  VK_KHR_maintenance2
  VK_KHR_maintenance3
  VK_KHR_multiview
  VK_KHR_pipeline_executable_properties
  VK_KHR_push_descriptor
  VK_KHR_relaxed_block_layout
  VK_KHR_sampler_mirror_clamp_to_edge
  VK_KHR_sampler_ycbcr_conversion
  VK_KHR_separate_depth_stencil_layouts
  VK_KHR_shader_clock
  VK_KHR_shader_draw_parameters
  VK_KHR_shader_float16_int8
  VK_KHR_shader_float_controls
  VK_KHR_shader_non_semantic_info
  VK_KHR_shader_subgroup_extended_types
  VK_KHR_shader_terminate_invocation
  VK_KHR_spirv_1_4
  VK_KHR_storage_buffer_storage_class
  VK_KHR_swapchain
  VK_KHR_swapchain_mutable_format
  VK_KHR_synchronization2
  VK_KHR_timeline_semaphore
  VK_KHR_uniform_buffer_standard_layout
  VK_KHR_variable_pointers
  VK_KHR_workgroup_memory_explicit_layout
  VK_KHR_zero_initialize_workgroup_memory
  VK_EXT_4444_formats
  VK_EXT_buffer_device_address
  VK_EXT_calibrated_timestamps
  VK_EXT_color_write_enable
  VK_EXT_conditional_rendering
  VK_EXT_custom_border_color
  VK_EXT_depth_clip_enable
  VK_EXT_depth_range_unrestricted
  VK_EXT_descriptor_indexing
  VK_EXT_discard_rectangles
  VK_EXT_display_control
  VK_EXT_extended_dynamic_state
  VK_EXT_extended_dynamic_state2
  VK_EXT_external_memory_host
  VK_EXT_global_priority
  VK_EXT_global_priority_query
  VK_EXT_host_query_reset
  VK_EXT_image_robustness
  VK_EXT_index_type_uint8
  VK_EXT_inline_uniform_block
  VK_EXT_line_rasterization
  VK_EXT_memory_budget
  VK_EXT_pci_bus_info
  VK_EXT_physical_device_drm
  VK_EXT_pipeline_creation_cache_control
  VK_EXT_pipeline_creation_feedback
  VK_EXT_private_data
  VK_EXT_provoking_vertex
  VK_EXT_robustness2
  VK_EXT_scalar_block_layout
  VK_EXT_separate_stencil_usage
  VK_EXT_shader_demote_to_helper_invocation
  VK_EXT_shader_subgroup_ballot
  VK_EXT_shader_subgroup_vote
  VK_EXT_subgroup_size_control
  VK_EXT_texel_buffer_alignment
  VK_EXT_tooling_info
  VK_EXT_transform_feedback
  VK_EXT_vertex_attribute_divisor
  VK_EXT_vertex_input_dynamic_state
  VK_EXT_ycbcr_image_arrays
  VK_NV_dedicated_allocation
  VK_NV_dedicated_allocation_image_aliasing
  VK_NV_device_diagnostic_checkpoints
  VK_NV_device_diagnostics_config
  VK_NV_device_generated_commands
  VK_NV_inherited_viewport_scissor
  VK_NV_shader_sm_builtins
  VK_NV_shader_subgroup_partitioned
  VK_NVX_multiview_per_view_attributes
Swapchain format: BGRA_SRGB; colorSpace: SRGB_NONLINEAR
Vulkan graphics pipelines created: 1
Vulkan compute pipelines created: 0

adammaj1 avatar Jul 13 '23 08:07 adammaj1

How it works if I'm not on Vulkan ?

adammaj1 avatar Jul 13 '23 08:07 adammaj1

How it works if I'm not on Vulkan ?

You can enable OpenGL here: https://github.com/facebook/igl/blob/main/samples/desktop/Tiny/Tiny.cpp#L30

corporateshark avatar Jul 13 '23 09:07 corporateshark