Open anzhi0708 opened 3 years ago
Probably someone should take on this, I can’t I don’t have proper opencl support, but if someone wants to make a port, please save the original code (so that it continues to work on old systems) and through ifdef or through other mechanisms add work on modern systems.
@anzhi0708 If you have opencl support in your system and want to make this demo work, then I think everyone will be happy if you make it work. ^.^
for fast fix add #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
in Corange/demos/metaballs/include/kernel.h
after #define CL_USE_DEPRECATED_OPENCL_1_1_APIS
and build again
try and please report me ))
@fedor-elizarov Thanks for the reply ^^ The build was successful, I got a binary file but could not get it to run. Here's the debug info:
[DEBUG] (src/corange.c:corange_init:53) Starting Corange...
[DEBUG] (src/corange.c:corange_init:56) Creating Asset Manager...
[DEBUG] (src/corange.c:corange_init:57) Core Assets At '../../assets_core' ...
[DEBUG] (src/corange.c:corange_init:95) Creating Entity Manager...
[DEBUG] (src/corange.c:corange_init:110) Creating UI Manager...
[DEBUG] (src/corange.c:corange_init:127) Creating Graphics Manager...
OpenGL Info
Vendor: Intel
Renderer: Mesa Intel(R) HD Graphics 6000 (BDW GT3)
Version: 4.6 (Compatibility Profile) Mesa 20.0.8
Shader Version: 4.60
OpenGL Extensions: GL_ARB_multisample GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_copy_texture GL_EXT_subtexture GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture GL_EXT_texture3D GL_IBM_rasterpos_clip GL_ARB_point_parameters GL_EXT_draw_range_elements GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_separate_specular_color GL_EXT_texture_edge_clamp GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_ARB_framebuffer_sRGB GL_ARB_multitexture GL_EXT_framebuffer_sRGB GL_IBM_multimode_draw_arrays GL_IBM_texture_mirrored_repeat GL_3DFX_texture_compression_FXT1 GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_blend_func_separate GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_secondary_color GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_INGR_blend_func_separate GL_NV_blend_square GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_S3_s3tc GL_SUN_multi_draw_arrays GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_EXT_framebuffer_object GL_EXT_texture_compression_s3tc GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_MESA_window_pos GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_ARB_depth_texture GL_ARB_occlusion_query GL_ARB_shadow GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_window_pos GL_ATI_fragment_shader GL_EXT_stencil_two_side GL_EXT_texture_cube_map GL_NV_depth_clamp GL_NV_fog_distance GL_APPLE_packed_pixels GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_vertex_program GL_ARB_vertex_shader GL_ATI_draw_buffers GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_MESA_pack_invert GL_NV_primitive_restart GL_ARB_depth_clamp GL_ARB_fragment_program_shadow GL_ARB_half_float_pixel GL_ARB_occlusion_query2 GL_ARB_point_sprite GL_ARB_shading_language_100 GL_ARB_sync GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ATI_blend_equation_separate GL_EXT_blend_equation_separate GL_OES_read_format GL_ARB_color_buffer_float GL_ARB_pixel_buffer_object GL_ARB_texture_compression_rgtc GL_ARB_texture_float GL_ARB_texture_rectangle GL_EXT_packed_float GL_EXT_pixel_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_ARB_framebuffer_object GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_packed_depth_stencil GL_ARB_vertex_array_object GL_ATI_separate_stencil GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_texture_array GL_EXT_texture_integer GL_EXT_texture_sRGB_decode GL_EXT_timer_query GL_OES_EGL_image GL_AMD_performance_monitor GL_EXT_texture_buffer_object GL_AMD_texture_texture4 GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_texture_buffer_object GL_ARB_texture_rg GL_ARB_texture_swizzle GL_ARB_vertex_array_bgra GL_EXT_texture_swizzle GL_EXT_vertex_array_bgra GL_NV_conditional_render GL_AMD_conservative_depth GL_AMD_draw_buffers_blend GL_AMD_seamless_cubemap_per_texture GL_ARB_ES2_compatibility GL_ARB_blend_func_extended GL_ARB_compatibility GL_ARB_debug_output GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_provoking_vertex GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_shader_texture_lod GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_multisample GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui GL_ARB_uniform_buffer_object GL_ARB_vertex_type_2_10_10_10_rev GL_EXT_provoking_vertex GL_EXT_texture_snorm GL_MESA_texture_signed_rgba GL_NV_texture_barrier GL_ARB_draw_indirect GL_ARB_get_program_binary GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_precision GL_ARB_shader_subroutine GL_ARB_texture_compression_bptc GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit GL_ARB_viewport_array GL_EXT_direct_state_access GL_EXT_vertex_attrib_64bit GL_AMD_multi_draw_indirect GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ARB_base_instance GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_internalformat_query GL_ARB_map_buffer_alignment GL_ARB_shader_atomic_counters GL_ARB_shader_image_load_store GL_ARB_shading_language_420pack GL_ARB_shading_language_packing GL_ARB_texture_storage GL_ARB_transform_feedback_instanced GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_transform_feedback GL_AMD_query_buffer_object GL_AMD_shader_trinary_minmax GL_AMD_vertex_shader_layer GL_AMD_vertex_shader_viewport_index GL_ARB_ES3_compatibility GL_ARB_arrays_of_arrays GL_ARB_clear_buffer_object GL_ARB_compute_shader GL_ARB_copy_image GL_ARB_explicit_uniform_location GL_ARB_fragment_layer_viewport GL_ARB_framebuffer_no_attachments GL_ARB_invalidate_subdata GL_ARB_multi_draw_indirect GL_ARB_program_interface_query GL_ARB_robust_buffer_access_behavior GL_ARB_shader_image_size GL_ARB_shader_storage_buffer_object GL_ARB_stencil_texturing GL_ARB_texture_buffer_range GL_ARB_texture_query_levels GL_ARB_texture_storage_multisample GL_ARB_texture_view GL_ARB_vertex_attrib_binding GL_KHR_debug GL_KHR_robustness GL_KHR_texture_compression_astc_ldr GL_AMD_pinned_memory GL_ARB_buffer_storage GL_ARB_clear_texture GL_ARB_enhanced_layouts GL_ARB_indirect_parameters GL_ARB_internalformat_query2 GL_ARB_multi_bind GL_ARB_query_buffer_object GL_ARB_seamless_cubemap_per_texture GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote GL_ARB_shading_language_include GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_stencil8 GL_ARB_vertex_type_10f_11f_11f_rev GL_EXT_shader_integer_mix GL_INTEL_performance_query GL_ARB_ES3_1_compatibility GL_ARB_clip_control GL_ARB_conditional_render_inverted GL_ARB_cull_distance GL_ARB_derivative_control GL_ARB_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_pipeline_statistics_query GL_ARB_shader_texture_image_samples GL_ARB_texture_barrier GL_ARB_transform_feedback_overflow_query GL_EXT_polygon_offset_clamp GL_KHR_blend_equation_advanced GL_KHR_context_flush_control GL_KHR_robust_buffer_access_behavior GL_ARB_gpu_shader_int64 GL_ARB_parallel_shader_compile GL_ARB_shader_atomic_counter_ops GL_ARB_shader_ballot GL_ARB_shader_clock GL_ARB_shader_viewport_layer_array GL_EXT_shader_samples_identical GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_ARB_gl_spirv GL_ARB_spirv_extensions GL_MESA_shader_integer_functions GL_ARB_polygon_offset_clamp GL_ARB_texture_filter_anisotropic GL_KHR_parallel_shader_compile GL_EXT_EGL_image_storage GL_EXT_shader_framebuffer_fetch_non_coherent GL_EXT_texture_sRGB_R8 GL_EXT_texture_shadow_lod GL_INTEL_shader_integer_functions2 GL_MESA_framebuffer_flip_y GL_NV_compute_shader_derivatives GL_EXT_EGL_sync GL_EXT_demote_to_helper_invocation
[DEBUG] (src/corange.c:corange_init:131) Creating Audio Manager...
[DEBUG] (src/corange.c:corange_init:135) Creating Joystick Manager...
[DEBUG] (src/cjoystick.c:joystick_init:16) Found 0 joysticks
[DEBUG] (src/corange.c:corange_init:139) Creating Network Manager...
[DEBUG] (src/corange.c:corange_init:142) Finished!
[ERROR] (src/kernel.c:kernels_check_error:198) OpenCL error on clGetPlatformID id -1001
I would like to fix this by myself very much but unfortunately I'm only 16 and barely know anything about CS, sad...
I'm using Linux Mint and the CPU is Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
, OS Linux Ulyana 5.4.0-53-generic #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
After adding #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
and make
, the output was:
gcc src/volume_renderer.c -c -I ./include -I ../../include -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -o obj/volume_renderer.o
In file included from /usr/include/CL/cl.h:32,
from ./include/kernel.h:9,
from src/volume_renderer.c:4:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
| ^~~~~~~
gcc src/marching_cubes.c -c -I ./include -I ../../include -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -o obj/marching_cubes.o
In file included from /usr/include/CL/cl.h:32,
from ./include/kernel.h:9,
from ./include/marching_cubes.h:6,
from src/marching_cubes.c:3:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
| ^~~~~~~
gcc src/metaballs.c -c -I ./include -I ../../include -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -o obj/metaballs.o
In file included from /usr/include/CL/cl.h:32,
from ./include/kernel.h:9,
from ./include/particles.h:6,
from src/metaballs.c:2:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
| ^~~~~~~
gcc src/particles.c -c -I ./include -I ../../include -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -o obj/particles.o
In file included from /usr/include/CL/cl.h:32,
from ./include/kernel.h:9,
from ./include/particles.h:6,
from src/particles.c:1:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
| ^~~~~~~
gcc src/kernel.c -c -I ./include -I ../../include -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -o obj/kernel.o
In file included from /usr/include/CL/cl.h:32,
from ./include/kernel.h:9,
from src/kernel.c:1:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
| ^~~~~~~
gcc -g obj/volume_renderer.o obj/marching_cubes.o obj/metaballs.o obj/particles.o obj/kernel.o -lcorange -lGL -lSDL2 -lSDL2_mixer -lSDL2_net -lOpenCL -lm -o metaballs
pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined
for fix add #define CL_TARGET_OPENCL_VERSION 220
OpenCL error on clGetPlatformID id -1001
This https://www.docdroid.net/Ee5RTkS/opencl-error-codes-1x-and-2x-pdf#page=10
-1001 CL_PLATFORM_NOT_FOUND_KHRclGetPlatformNo valid ICDs found
You probably don't have software support, unfortunately I can't help here. Maybe someone else will come here and tell you what is needed to solve the problem.
I add in Corange/demos/metaballs/include/kernel.h
defines
#define CL_TARGET_OPENCL_VERSION 220
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
Аnd full build fine no warning and no errors. After execute i have error
DEBUG] (src/corange.c:corange_init:131) Creating Audio Manager...
[DEBUG] (src/corange.c:corange_init:135) Creating Joystick Manager...
[DEBUG] (src/cjoystick.c:joystick_init:16) Found 0 joysticks
[DEBUG] (src/corange.c:corange_init:139) Creating Network Manager...
[DEBUG] (src/corange.c:corange_init:142) Finished!
[DEBUG] (src/kernel.c:kernels_info:118) OpenCL Info for 1 Platforms
[DEBUG] (src/kernel.c:kernels_info:121) Platform: 0
[DEBUG] (src/kernel.c:kernels_info:125) Profile: FULL_PROFILE
[DEBUG] (src/kernel.c:kernels_info:129) Version: OpenCL 1.1 Mesa 20.1.9
[DEBUG] (src/kernel.c:kernels_info:133) Name: Clover
[DEBUG] (src/kernel.c:kernels_info:137) Vendor: Mesa
[DEBUG] (src/kernel.c:kernels_info:141) Extensions: cl_khr_icd
[ERROR] (src/kernel.c:kernels_check_error:198) OpenCL error on clCreateContext id -64
So it is probably not enough to simply specify permission to use the deprecated API, but rather explicitly fix the code. Here I am also powerless because I do not have the necessary support in the hardware and I cannot check the work.
Here I myself do not understand it is written that the default version is 220, but clinfo
reports that only the 110 version is supported. I have no experience with this, but it looks strange.
I'm only 16
Great, you have good interests. But since you have little experience, and I have no opportunity, then we will just leave this issue for now, maybe someone will read about the problem and try to solve it with the right hardware and skills and then offer a patch.
You can check other demos, they are interesting too :)
If something also does not work or is incomprehensible, let us know it will be useful for everyone.
...
Although it is not a fact that someone will take on corrections :smile: : ))))
@fedor-elizarov Thanks a lot man, appreciate your help, I love you :3 Appreciate you guys' work! Very cool! ^_^
@anzhi0708 Okay :D Maybe someone can figure out the problem. The error is somewhere in the code, and probably all in the context initialization. Okay, good luck. Dig into the code it's interesting Corange is basically a project for fun and experimentation. Don't close this issue. All the best.
@fedor-elizarov Thanks a lot mate :3
Sorry to join to this thread one year later :disappointed:. I'm on Linux and have problems compiling the demo "metaballs" too.
I've solved the openCL issue just by defining -D"CL_TARGET_OPENCL_VERSION=120"
. Well, almost...
On Linux I'm using the following command to compile "metaballs":
gcc -O3 -fno-pie -no-pie -DNDEBUG -D_NDEBUG -D"CL_TARGET_OPENCL_VERSION=120" ./src/*.c -I./include -I../../include -std=gnu99 -Wall -Werror -Wno-unused -L../../ -Wl,-rpath,../.. -lcorange -lGL -lSDL2 -lSDL2_net -lSDL2_mixer -lOpenCL -lm -o metaballs
(Note that here using rpath
I've hard-coded the path of corange.so
to ../..
for convenience).
I had a first issue about metaballs/kernels/particle.cl line 41
: that was easy to fix this way:
velocities[i].xyz = velocities[i].xyz * 0.75; // error
velocities[i].xyz = velocities[i].xyz * 0.75f; // correct!
But then I've found an unsolvable issue in: https://github.com/orangeduck/Corange/blob/9a7372d660dc469965297aea6935a85279a7b6f7/demos/metaballs/assets/podium/podium.mat#L1 because I get:
[ERROR] (src/casset.c:asset_hndl_ptr:182) Failed to get Asset '/.../Corange/assets_core/shaders/forward', is it loaded yet?
There is no Corange/assets_core/forward
directory...
Not sure what I can do to replace it...
[Edit] If I replace Corange/demos/metaballs/assets/podium
with Corange/demos/rendering/assets/podium
it compiles and run, but... I just see something dark with some tiny particles inside, like in this screenshot:
I suppose that something in my settings is wrong (maybe my OpenCL configuration).
Nevermind. The other demos work perfectly. Thanks for making and sharing this engine :smiley:
@Flix01
@CORANGE
is path to Corange/assets_core/
yes assets_core/shaders
not have forward directory. forvard
is OOOOLDD renderer is deprecated you can see him in old commits https://github.com/orangeduck/Corange/tree/e1a6688e1d0e6870f5a434ef878572f52ad2a8c9/core_assets/shaders
for current engine need replace forward
to deferred
in all *.mat
files
-$CORANGE/shaders/forward/static.vs
+$CORANGE/shaders/deferred/static.vs
Unfortunately I have a very old video card and I don't have OpenCL support so I just can't build the metaspheres. And check if anything works
But that's not all, you need to make a full-fledged transfer there, many paths are not correct. You need to port. There is clearly old code / configuration
@fedor-elizarov
Thanks for your quick feedback.
Basically even after having copied the old files (and re-addressed their references), the best I could get was the same output I already got in the last screenshot I posted above.
However, by looking at metaballs.c
, I've seen two extra definitions: -D"VOLUME_RENDERER" -D"MARCHING_CUBES"
. If I compile using both (or just MARCHING_CUBES
), I get an OpenCL error:
[...]
[DEBUG] (src/casset.c:file_load:282) Loading: '/.../Corange/assets_core/fonts/console_font.fnt'
[DEBUG] (src/casset.c:file_load:282) Loading: '/.../Corange/assets_core/fonts/console_font_0.dds'
[DEBUG] (src/cui.c:ui_elem_new_type_id:125) Creating UI Element score (ui_button)
[ERROR] (./src/kernel.c:kernels_check_error:156) OpenCL error on clEnqueueWriteBuffer: Out of resources
And, if I compile with VOLUME_RENDERER
only (without MARCHING_CUBES
) the program compiles, runs, hangs and in the worst case I have to turn off my PC.
Unluckily I know almost nothing about OpenCL programming, and I'm not going to use openCL with Corange anyway. So it's OK for me.
I'm just sad I cannot help further to port this demo :sob: !
@Flix01
Unluckily I know almost nothing about OpenCL programming, and I'm not going to use openCL with Corange anyway. So it's OK for me.
Me too :D
I'm just sad I cannot help further to port this demo sob !
Someone who understands will come and fix it =)
I'm just sad I cannot help further to port this demo sob !
It is worth making a contribution only in those things that you know and that will be useful to you and everyone. Personally, I offered solutions to those problems that I faced myself and they interfered with me and I was sure they interfere with others. I know at least 10 places where fixes and improvements are needed, but I pray for them. They do not bother me, I do not know how to correct them and others do not talk about them. The one who understands and fixes will come if he is not too lazy =)
relax :D Understand the code because you like it, not because you owe someone. :tea:
@ fedor-elizarov
Thank you again for your kind advice! :D