Commit Graph

729 Commits

Author SHA1 Message Date
twinaphex 4958e30d8f (slang shader backends) Cleanups 2020-08-16 02:29:54 +02:00
twinaphex e35d2cb527 CLeanups 2020-08-16 02:20:13 +02:00
twinaphex bb58b0d6e3 (GLSLANG) Move more common code out of shader_gl_core and shader_vulkan
and into glslang_util.h
2020-08-16 02:05:38 +02:00
twinaphex a1ce1e4f1d gl_glsl_set_proc_address unneeded - remove it 2020-08-04 03:58:51 +02:00
twinaphex f8b8f2a07d (slang) Cut down on code duplication 2020-08-03 18:37:07 +02:00
twinaphex 86d302099e Move build_vec4 to glslang_util.c 2020-08-03 18:34:33 +02:00
twinaphex cce2ac6904 (shaders slang) Cut down on code duplication 2020-08-03 18:13:08 +02:00
twinaphex c387071298 Add static globals TODO/FIXME note 2020-07-20 02:02:00 +02:00
twinaphex 46fd40b574 Use std::string concatenation instead of std::ostringstream 2020-07-11 08:24:13 +02:00
twinaphex e10f4eed8d (Vulkan) Cleanups 2020-07-09 03:48:42 +02:00
HyperspaceMadness 5ceb30fc1b Changed SLANG_NUM_BINDINGS to 16 for D3D11 Fix 2020-07-08 12:06:59 -04:00
HyperspaceMadness 7c6bb925c4 Increased Slang Max Params, Textures & Passes 2020-07-05 13:45:58 -04:00
twinaphex 09180e64b5 Start unifying more macros 2020-07-03 18:00:40 +02:00
twinaphex 7a22eb1f44 Turn vulkan_image_layout_transition_levels into macro 2020-07-03 08:32:33 +02:00
twinaphex 87b9c2a367 Add HAVE_REWIND switch 2020-07-01 21:04:05 +02:00
twinaphex f83f0b2d44 Fix static code analysis warnings 2020-06-29 20:27:34 +02:00
twinaphex cf1eb2e989 Silence more warnings 2020-06-29 20:17:54 +02:00
twinaphex 479058d1a3 Prevent implicit memsets 2020-06-29 16:42:51 +02:00
twinaphex b2dbbeb386 (glslang_util_cxx.cpp) Use string_starts_with_size 2020-06-28 21:53:28 +02:00
twinaphex fe8a191012 (glslang_util_cxx.cpp) Use string_starts_with 2020-06-28 21:46:08 +02:00
twinaphex c600fbc6ff Cleanups 2020-06-28 21:33:07 +02:00
twinaphex 503c8e089f (shader_vulkan) Cleanup 2020-06-28 01:17:36 +02:00
twinaphex 808c00db41 (drivers_shader) Move static functions to top of files 2020-06-26 18:54:30 +02:00
twinaphex 601a73fa8b Use string_starts_with_size where possible - avoids the strlen 2020-06-25 12:51:04 +02:00
twinaphex d903d684a0 (glslang) Group together more strings 2020-06-12 05:24:34 +02:00
twinaphex c2044beedd Fix shader regression with MinProgramTexelOffset 2020-06-12 05:18:38 +02:00
twinaphex 7ee5ffcd1c Further optimize SlangProcess 2020-06-11 05:51:03 +02:00
twinaphex 58b22b0a6e Optimize some long iterations of string_is_equal 2020-06-08 07:00:22 +02:00
Higor Eurípedes 1f45018ee8 shader_glsl.c: Move buffer null pointer check in gl_glsl_set_coords()
`buffer` is initialized to a statically allocated variable and can only be NULL
when the allocation of a bigger buffer fails. When only the core frame is being
displayed, the buffer never points to the heap thanks to the small buffer
optimization.
2020-06-06 20:08:28 -03:00
twinaphex e030986837 Replace fprintfs with RARCH_LOG/RARCH_ERR 2020-05-24 19:29:55 +02:00
twinaphex 6408da2ae4 Silence warnings 2020-05-23 03:19:25 +02:00
twinaphex a9cf718e75 Get rid of auto variable in glslang.cpp 2020-05-21 20:04:36 +02:00
twinaphex 2a36fa0855 Remove double ';' 2020-05-19 21:29:35 +02:00
jdgleaver 548c5dc925 (glcore/slang) Set filter and wrap mode correctly when intialising shader textures 2020-04-30 17:04:02 +01:00
twinaphex 62bd4960e1 Fix MSVC include paths 2020-03-06 03:01:47 +01:00
twinaphex d3bc82d2c3 Header cleanups 2020-03-05 14:12:20 +01:00
twinaphex da60c1bb96 Header cleanups 2020-03-05 14:06:04 +01:00
twinaphex 6232e0abd3 Buildfix 2020-03-03 11:08:16 +01:00
twinaphex d5f7839d12 Cleanups 2020-03-03 10:58:04 +01:00
twinaphex d1ebb58580 Cleanups - change function signature of compile_spirv to const char * 2020-03-03 10:49:47 +01:00
orbea def374c2b9 Fix the header paths with the system glslang. 2020-03-02 14:20:18 -08:00
twinaphex 75eef8a2c9 (drivers shader slang) Put logging behind DEBUG ifdef - and
turn some conditionals into a switch
2020-02-19 16:25:41 +01:00
twinaphex c6bd3da1c3 (drivers_shader) Cleanups 2020-02-19 03:23:30 +01:00
twinaphex 5280286415 (shader_vulkan.cpp) Cleanup 2020-02-19 03:11:45 +01:00
orbea baf7013941 Silence warning with clang-9.0.1.
gfx/drivers_shader/shader_vulkan.cpp:2372:4: warning: field 'device' will be initialized after field 'size' [-Wreorder]
   device(device),
   ^
1 warning generated.
2020-02-01 16:52:00 -08:00
twinaphex d89fb0e7c4 (shader_slang.cpp) Simplify usage of functions that are only
ever used as C-strings
2020-02-01 07:04:27 +01:00
twinaphex 9ddd8417c8 Replace some more auto variables 2020-01-23 04:49:51 +01:00
twinaphex a4564b8939 Move C oriented code from slang_reflection.cpp to glslang_util.c 2020-01-22 19:36:49 +01:00
twinaphex ff9701685f Remove some auto variables 2020-01-22 19:07:10 +01:00
twinaphex 920e89a506 Move pass set texture to vulkan_common.c 2020-01-22 14:27:24 +01:00
twinaphex 8f1aa8c2c3 (shader_gl_core.cpp) Cleanups 2020-01-22 13:52:14 +01:00
twinaphex 376ad6d61d move more C functions over to gl_core.c 2020-01-22 13:12:00 +01:00
twinaphex 90874b434e (shader_vulkan.cpp) Move more C code to vulkan_common.c 2020-01-22 12:09:08 +01:00
twinaphex bcf8ff3d0a (shader_gl_core) Get rid of ConfigDeleter - move C code to gl_core.c 2020-01-22 11:57:06 +01:00
twinaphex c8227c95dd (shader_gl_core) get rid of ConfigDeleter 2020-01-22 11:35:00 +01:00
twinaphex b8cd37aef7 (shader_vulkan.cpp) Get rid of ConfigDeleter 2020-01-22 11:29:40 +01:00
twinaphex f853632260 Move framebuffer generate_mips function to vulkan_common.c 2020-01-22 10:52:20 +01:00
twinaphex e9c73bd9a6 (Vulkan) Move more C code to vulkan_common.c 2020-01-22 10:41:38 +01:00
twinaphex ef27a660a7 (shader vulkan) Cleanups - moving C code out of the C++ file 2020-01-22 10:11:42 +01:00
twinaphex 1fd6d024eb More buildfixes for ANGLE 2019-12-07 07:24:20 +01:00
twinaphex a0486c3cd7 Revert "Simplify slang_process.cpp"
This reverts commit 25a417cdd7.
2019-11-12 01:34:03 +01:00
twinaphex 25a417cdd7 Simplify slang_process.cpp 2019-11-11 18:55:33 +01:00
twinaphex b94b9e2adb Go back to plain strlcpy/strlcat - probably best to look at
opportunities to reduce these calls vs. replacing them with
unsafe macros
2019-09-23 00:19:01 +02:00
twinaphex 3b057d9605 Start using STRLCAT_CONST_INCR and STRLCPY_CONST 2019-09-20 23:33:17 +02:00
twinaphex db624a7c99 Start cleaning up the rather messy manual assignment 2019-09-20 02:03:26 +02:00
twinaphex 3fbeb0617b (glslang_util_cxx.cpp) Get rid of this strlcpy too 2019-09-18 08:03:49 +02:00
twinaphex 306d7f6f8a glsl_find_uniforms_frame - get rid of the remaining strlcats 2019-09-18 07:53:59 +02:00
twinaphex ab60005cdc (GLSL) Avoid snprintf, prefer strlcpy/strlcat where possible 2019-09-18 07:32:06 +02:00
LazyBumHorse a882901e39 save unmodified auto-shaders as a reference instead of a copy, see:
- implement #reference directive for auto-shaders
 - replace usual preset saving and loading functions with video_shader_read_preset() and video_shader_write_preset()
 - apply saved presets automatically for console menus
 - move auto-shader saving logic from menus into menu_shader.c menu_shader_manager_save_auto_preset()
 - refactor menu_shader_manager_save_preset() into menu_shader_manager_save_preset_internal()
2019-08-22 16:57:28 +02:00
twinaphex d52c573e13 Merge slang_preprocess.cpp into slang_process.cpp 2019-08-18 18:55:22 +02:00
twinaphex 0905c8d2ed (shader_gl_core.cpp) Simplify some code 2019-08-18 18:32:01 +02:00
twinaphex d48b5b78f8 Cleanups 2019-08-18 18:05:26 +02:00
twinaphex aaeff6c888 Move C code over to glslang_util.c 2019-08-18 18:01:21 +02:00
twinaphex 3aa1a03a08 glslang_util cleanups 2019-08-18 14:40:26 +02:00
Themaister f957bf0d16 Validate non-causal filter chain for texture inputs.
We only validated for UBO inputs apparently.
2019-08-13 13:57:20 +02:00
twinaphex 69a195fc5c Cleanups 2019-08-12 19:35:36 +02:00
twinaphex 3ae447420e Cleanups 2019-08-12 19:33:50 +02:00
jdgleaver 5ac152a5f3 (glslang_util) Remove C++ 'isms' (where possible) 2019-08-12 13:10:50 +01:00
twinaphex ecbd58d3af Small cleanup 2019-08-08 17:04:45 +02:00
twinaphex faa55b4dff glslang_read_shader_file - potential leak here 2019-08-08 16:55:39 +02:00
twinaphex b282125107 Revert "Refactor code for glslang shader presets - buffer entire file"
This reverts commit 0fee6a9ef4.
2019-08-08 16:36:34 +02:00
twinaphex 0fee6a9ef4 Refactor code for glslang shader presets - buffer entire file
into memory before passing it on
2019-08-08 04:55:22 +02:00
LazyBumHorse 5e0aba0589 Revert "(UWP) UWP cannot deal with relative paths, turn them into absolute"
This reverts commit 8b0f083a4e.
2019-07-25 14:31:18 +02:00
LazyBumHorse 6285c05948 add resolve_symlinks parameter to path_resolve_realpath() and cleanup playlist_resolve_path() 2019-07-22 13:44:35 +02:00
LazyBumHorse f8b92770d4 simplify video_shader_read_conf_preset() calls 2019-07-21 18:15:28 +02:00
Twinaphex 388c4857d3
Merge pull request #9140 from LazyBumHorse/shader_paths
much improved handling of relative shader paths
2019-07-20 21:54:58 +02:00
twinaphex 14dfb91a60 Buildfix for C89 2019-07-20 21:33:09 +02:00
LazyBumHorse 2245af23e9 much improved handling of relative shader paths
- save texture paths in relative format as well
 - always write portable relative paths on Windows using '/' instead of '\'
 - remove an ancient piece of code that could sometimes fail loading relative paths
 - fix absolute path handling between different drives for Windows
 - integrate video_shader_resolve_relative() into video_shader_parse_* functions
2019-07-20 18:29:46 +02:00
twinaphex da29fd61bb (shader_vulkan.cpp) Fix another 'declaration hides parameter' warning 2019-07-18 19:25:25 +02:00
twinaphex 18e67c12c7 (GLSL) Set prg ID to 0 after running glDeleteProgram 2019-07-18 18:31:37 +02:00
twinaphex c0787accc3 Use config_file_new_from_path_to_string 2019-07-18 12:13:09 +02:00
twinaphex 41a2fabb4e Create config_file_new_from_path_to_string 2019-07-18 12:03:50 +02:00
twinaphex f0f5c32b51 Remove state tracker - legacy code - we can revisit this later
and integrate it in a way so that it scales across all drivers
2019-07-09 07:39:38 +02:00
Hans-Kristian Arntzen 135ff5e7a5 Fixup resource remapping in MSL/HLSL.
Seemed rather sketchy, but this must be tested a bit.
2019-06-24 14:25:04 +02:00
Hans-Kristian Arntzen 50ea084385 Update SPIRV-Cross. 2019-06-24 13:42:46 +02:00
Twinaphex a9a1ff0047
Merge pull request #8979 from LazyBumHorse/fix_dolphin_crash
workaround for crash due to glcore not always using at least OpenGL 3.2
2019-06-18 20:18:14 +02:00
LazyBumHorse 692dc9f6a9 refactor shader checks affected by last commit and more:
- gl.c: refactor backend fallback into more general gl2_get_fallback_shader_type
 - d3d9-12, gl_core, gx2_gfx, gl, vulkan: more consistent shader init and `set_shader` behavior
 - configuration.c: remove check_shader_compatibility
 - shader_glsl.c, shader_gl_cg.c: use `video_shader_get_type_from_ext`
 - shader_gl_cg.c: add shader type check with fallback to stock like in shader_glsl.c
 - menu_shader.c: use `enum rarch_shader_type` instead of `unsigned`
 - video_shader_parse.c: add `video_shader_to_str` for easier logging
 - remove `type` from `struct video_shader`, which was always set to CG and wrongly used in lang_process.cpp's `slang_process()` (has no further consequences because the code is unused)
2019-06-18 13:44:19 +02:00
LazyBumHorse 42e35c825f refactor some video_shader_parse functions
- video_shader_parse_type()'s fallback only worked for NULL paths and was wrongly used, now returns RARCH_SHADER_NONE like video_shader_get_type_from_ext().
 - video_shader_get_type_from_ext() should not be checking video driver flags, this is instead done by video_shader_is_supported()
 - video_driver_get_all_flags() did not actually 'get' flags, changed to video_driver_test_all_flags()

workaround for crash due to glcore not always using at least OpenGL 3.2
2019-06-18 13:12:56 +02:00
LazyBumHorse 76438fa098 workaround for crash due to glcore not always using at least OpenGL 3.2 2019-06-17 18:28:04 +02:00
twinaphex ee3208ac39 Integrate video_driver.c into retroarch.c 2019-06-17 15:10:22 +02:00
twinaphex b26a5badfd Fix typo 2019-06-15 10:00:20 +02:00
twinaphex fc62f7afaa Update 2019-06-15 09:58:34 +02:00
twinaphex f60306b232 Rename read_conf_cgp/write_conf_cgp to
read_conf_preset/write_conf_preset
2019-06-15 09:00:35 +02:00
LazyBumHorse 4c272973f1 fix frame_direction type for vulkan 2019-05-29 15:29:37 +02:00
LazyBumHorse d12dba6db4 (hotfix) Don't poll vendor specific 'patch' version 2019-05-25 17:51:03 +02:00
LazyBumHorse 9894f48fb0
added paranoid NULL check 2019-05-25 13:10:13 +02:00
LazyBumHorse 662b473e9f don't hardcode shader cross compilation target version but poll it 2019-05-25 12:32:34 +02:00
LazyBumHorse ee3cda8abf added "FrameDirection" slang semantic and implementation for glcore and vulkan 2019-05-24 22:11:12 +02:00
twinaphex 74388d8490 Remove string_concat 2019-05-10 18:05:58 +02:00
twinaphex 8b0f083a4e (UWP) UWP cannot deal with relative paths, turn them into absolute
paths first before reading shader pass files
2019-05-02 18:24:54 +02:00
twinaphex 39eadbab6f Use string_concat in more performance critical areas 2019-04-30 21:17:51 +02:00
twinaphex bc2bdd5734 config_file_read not needed anymore 2019-04-30 13:37:10 +02:00
twinaphex 4c3e0d44b8 Revert "Start using string_is_equal_memcmp and"
This reverts commit 26d6aee1eb.
2019-04-29 04:04:33 +02:00
twinaphex 26d6aee1eb Start using string_is_equal_memcmp and
string_is_equal_memcmp_fast
2019-04-28 17:23:11 +02:00
twinaphex 3e72c502a8 strlen optimizations :
- use STRLEN_CONST for constant strings, translates to sizeof
which should be computed at compile-time
- found some places where we are needlessly calling strlen two
times instead of just once
2019-04-27 04:21:10 +02:00
twinaphex ff40ae2486 Refactor slang_preprocess.cpp - try to remove auto variables 2019-04-25 04:07:18 +02:00
twinaphex a42b8f616f (slang reflection) Cleanups - start getting rid of most auto
variables
2019-04-25 03:54:04 +02:00
twinaphex 0bae77d199 (Shaders Vulkan/GLcore) Cleanups 2019-04-25 02:37:13 +02:00
twinaphex 15afaedaa8 (Shaders vulkan/GLcore) Simplify 2019-04-25 02:34:26 +02:00
twinaphex e40c3ec07b (Shader Vulkan/GL core) Make code more the same 2019-04-25 01:42:56 +02:00
twinaphex 55b53929db (shader GL/Vulkan) Cleanups 2019-04-24 23:45:57 +02:00
twinaphex 604403fe90 (shader_vulkan) Simplifications - start making shader_gl_Core
and shader_vulkan more alike
2019-04-24 23:13:42 +02:00
twinaphex e42dae928e (gl shader core) Simplifications 2019-04-24 22:20:48 +02:00
twinaphex 51a69dff44 (gl core shaders) Simplification 2019-04-24 22:10:21 +02:00
twinaphex 3225876f0b (shader_gl_core.cpp) Simplify 2019-04-24 20:25:37 +02:00
twinaphex a60844897f (Shader GL core) Simplify some code 2019-04-24 04:24:48 +02:00
twinaphex 955a149ce9 Use config_file_read where we can assume we are reading a file 2019-04-22 01:56:24 +02:00
twinaphex 3619fae2d9 (LGTM) Silence some warnings 2019-04-13 02:15:26 +02:00
twinaphex 27928081cf Cleanups 2019-03-18 15:27:37 +01:00
Themaister beff1144f6 Fix uniform override mistake in glcore shader stack.
glGetUniformLocation returned -1 after 0, and dropped uniforms on the
floor.
2019-03-13 18:28:05 +01:00
twinaphex cd77093588 Reimplement gl2_get_flags to no longer be reliant on shader driver's
get flags implementation
2019-03-13 12:12:02 +01:00
twinaphex 191d0c0309 Add get_flags to GL shader interface 2019-03-13 11:21:00 +01:00
Themaister 1ba8c626ed Minor build fixes. 2019-03-09 12:42:23 +01:00
Themaister 3029f96511 Add a new "glcore" driver with slang support.
This driver should sunset the old gl2 driver, but that driver will
likely live on to support really ancient and terrible GL stacks.
All the worst legacy cruft has been ripped out, and it's almost a decent
backend now.

Requirements for slang are GL 3.2+ or GLES3.
Some shaders require features which are not directly compatible with
GLES2 or legacy GL.

This driver shares a lot of concepts from the Vulkan driver.
The slang shader stack and SPIRV-Cross are used to implement the shader
spec, and the menu shaders are also shared with Vulkan.
2019-03-09 12:30:49 +01:00
twinaphex 5102eff399 (GL) Move GL-only shader code to gl.c 2019-02-05 01:13:39 +01:00
orbea 28ff4b391a Clean up white space. 2019-02-03 16:00:50 -08:00
orbea 4c56167446 Convert to linux line endings. 2019-02-03 15:43:42 -08:00
twinaphex dd366cd5c5 Revert "Simplify set_coords"
This reverts commit e10eb51f71.
2019-02-03 18:05:14 +01:00
twinaphex e10eb51f71 Simplify set_coords 2019-02-03 18:03:07 +01:00
twinaphex 62bea6ad11 SOme header cleanups 2019-02-02 22:02:24 +01:00
twinaphex 90f1317498 Cut down on code duplication - create gl_load_luts 2019-02-02 21:32:37 +01:00
twinaphex 6b3fad0f53 This can be removed now 2019-02-02 17:26:12 +01:00
twinaphex 7c74f0abe8 Create gl_add_lut 2019-02-02 17:25:27 +01:00
twinaphex 0abe271909 Take out some header includes 2019-01-19 23:15:48 +01:00
twinaphex 1a0d5030f9 shader_vulkan.cpp - doesn't need math.h 2019-01-19 23:02:48 +01:00
orbea e062b98088 Remove trailing blank lines.
find . -type f -exec sed -i '${/^[[:space:]]*$/d;}' {} \+
2019-01-17 19:39:38 -08:00
twinaphex 6ca9afbd57 Silence more warnings with CXX_BUILD 2019-01-12 18:51:06 +01:00
orbea bfc366decc Squeeze extra blank lines with cat(1).
Example:

find . -type f -iname '*.c' | while read -r i; do
  cat -s "$i" > "$i.new"
  mv "$i.new" "$i"
done
2019-01-08 11:04:58 -08:00
orbea 4bc0aacd8b Fix clang -Wreorder warnings.
gfx/drivers_shader/shader_vulkan.cpp:1109:6: warning: field 'id' will be initialized after field 'device' [-Wreorder]
   : id(move(id)),
     ^
gfx/drivers_shader/shader_vulkan.cpp:2107:4: warning: field 'device' will be initialized after field 'memory_properties' [-Wreorder]
   device(device),
   ^
2 warnings generated.
2018-12-16 16:16:07 -08:00
Themaister 124d9b57d6 Vulkan: Fix blue/red flip when using HW rendered cores with history.
Was using frontend format of BGRA8 when core was RGBA8, with blind
vkCmdCopyImage. Fix is to use the same format as core is pushing to
history buffer.
2018-12-06 11:38:30 +01:00