Commit graph

84 commits

Author SHA1 Message Date
Denis Pauk
def5407ae0 Use first found optimal flags in select memory
Should fix #34, when NVIDIA card provides memory type with several
addional flags more than code has asked but retuns error on allocate.
Code has be changed to use first memory type with minimal prefered
properties.

E.g. if code needs VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, a first block should be used
instead a fourth as before:
```
Memory blocks:
   1: VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
   2: VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
   3: VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT VK_MEMORY_PROPERTY_HOST_COHERENT_BIT VK_MEMORY_PROPERTY_HOST_CACHED_BIT
   4: VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
```
2022-12-11 00:35:05 +02:00
Denis Pauk
335b8855e2 Apply shared filtering logic for lerplist 2022-12-11 00:06:18 +02:00
David CARLIER
aefe787eca trying out PRI* print formats 2022-12-09 15:38:40 +00:00
Denis Pauk
889ff7a067 Additional ugly hack to make apple clang happy
Otherwise on arm64 linux:
```
src/vk/vk_common.c:2513:37: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘VkDeviceSize’ {aka ‘long unsigned int’} [-Wformat=]
 2513 |                 R_Printf(PRINT_ALL, "%s: %d: Resize stanging buffer" YQ2_COM_PRIu64 "->" YQ2_COM_PRIu64 "\n",
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2514 |                         __func__, vk_activeStagingBuffer, stagingBuffer->resource.size, size);
      |                                                                                         ~~~~
      |                                                                                         |
      |                                                                                         VkDeviceSize {aka long unsigned int}
src/vk/header/../../common/header/common.h:722:28: note: format string is defined here
  722 | #define YQ2_COM_PRIu64 "%llu"
      |                         ~~~^
      |                            |
      |                            long long unsigned int
      |                         %lu
```
2022-12-08 23:25:33 +02:00
Denis Pauk
9b55cdb921 Add additional warnings for memory allocate error 2022-12-08 22:53:50 +02:00
Denis Pauk
d39193d419
Merge pull request #33 from devnexen/vk_common_arg_fix
fix printf format warnings to represent VkDeviceSize (aka uint64_t).
2022-12-08 22:20:23 +02:00
David CARLIER
68a1e5de14 fix printf format warnings to represent VkDeviceSize (aka uint64_t). 2022-12-07 23:32:25 +00:00
Denis Pauk
2b01442235 Fix vk build on debian stable with 1.2.162 headers 2022-11-26 13:15:13 +02:00
Denis Pauk
8a79f754d2 Rename vk_validation to r_validation
Prepare to merge share image load: https://github.com/yquake2/yquake2/pull/924
2022-11-19 14:39:55 +02:00
Denis Pauk
42ab79aa1d Add datasize parameter to LoadPic
Prepare to merge share image load: https://github.com/yquake2/yquake2/pull/924
2022-11-19 14:37:53 +02:00
Denis Pauk
646b65dfa8
Merge pull request #32 from devnexen/uninitialize2
Vk_LoadPic fix unitialized var.
2022-11-19 13:25:46 +02:00
David Carlier
44ab39c57c Vk_LoadPic fix unitialized var.
R_MarkLeaves data alignment to int when merging PVS clusters like GL renderers.
2022-11-19 10:46:12 +00:00
Denis Pauk
8bd731b89c
Merge pull request #31 from devnexen/fix_uninit
Vk_LoadPic uninitialized vars for 8 bits case.
2022-11-13 19:25:06 +02:00
David Carlier
25225b8ab9 Vk_LoadPic uninitialized vars for 8 bits case.
VK_DrawParticles rgb calculation align to color' table type.
2022-11-13 08:57:01 +00:00
Denis Pauk
925ed6a547 Update shared.c from yquake2
0bc3ac6079
2022-11-07 23:20:03 +02:00
Denis Pauk
425bc5ac5e Mod_LoadBrushModel: Sync varibale names with other renders 2022-10-30 12:28:54 +02:00
Denis Pauk
fd8077146d Port shared models load
898b87f0f4
2022-10-20 08:23:10 +03:00
David Carlier
a3e1346520 backport signed left shift from main quake2. 2022-10-16 10:57:11 +01:00
Denis Pauk
d7a11c33be Add const to scale functions 2022-09-17 13:19:26 +03:00
Denis Pauk
a62603b3c7 cppcheck: make parameters const 2022-09-14 00:13:34 +03:00
Denis Pauk
b2103fca46
Merge pull request #28 from devnexen/silent_warning
silent clang warning as SDL vulkan and vulkan define both same macros.
2022-09-12 20:54:45 +03:00
David CARLIER
4402657b5f silent clang warning as SDL vulkan and vulkan define both same macros. 2022-09-11 23:29:31 +01:00
Denis Pauk
674e634679 cppcheck: make parameters const 2022-08-28 15:01:06 +03:00
Denis Pauk
41f12687a4 Fix function propotypes -Wmissing-prototypes 2022-08-14 15:40:51 +03:00
Denis Pauk
2c4c8421fb Update shared.c files with headers from yquake2
Based on f9ab797c7c
2022-07-30 16:09:18 +03:00
David Carlier
e467107d45 Hunk_Begin/Alloc attr malloc addition. 2022-07-30 15:27:08 +03:00
Denis Pauk
1b91ee0f95 fix C --pedantic warnings
* extra semicolon in struct or union specified
* ISO C does not allow extra ‘;’ outside of a function
2022-07-30 15:27:02 +03:00
Daniel Gibson
0c4606973e Make basename() fully compliant and simplify it a bit 2022-07-30 15:26:56 +03:00
Daniel Gibson
955944a71a Make it work with VS2015 and newer
the workaround is a bit ugly but should work..
(I only tested VS2017, but I guess 2015 should also work)
2022-07-30 15:26:49 +03:00
Daniel Gibson
914441ff3a CMake: Make the game build with Visual Studio (2019 16.8 or newer)
The easiest way to build this is to check out the dhewm3-libs project
(https://github.com/dhewm/dhewm3-libs/) to provide the dependencies
(SDL2, OpenAL, cURL) and set YQUAKE2LIBS accordingly, by passing
-DYQUAKE2LIBS=c:/path/to/dhewm3-libs/i686-w64-mingw32 to cmake.

I wouldn't really recommend building with MSVC - I just somehow made it
work and ignored all the warnings and I have no idea how portable the
resulting binaries are etc. For binaries you actually want to use, please
continue using MinGW-w64. Especially my workaround for VLAs (C99 variable
length arrays) is kinda fishy, particularly if those arrays are allocated
in a loop (that's inly done in ref_gl1.dll's code).

The only reason I did this is that I had to debug on Windows and, at least
for my specific bug, gdb didn't really work with binaries produced by
MingGW-w64 and MSVC's debugger works well with binaries produced by MSVC.

Currently requires VS 2019 16.8 or newer with C11 (/std:c11) because I
couldn't get YQ2_ALIGNAS_TYPE() to work with MSVC without _Alignas().
If we can get this to work, VS2015 or newer might suffice (but not older
versions, because their so called C standardlib didn't provide exotic
functions like snprintf()).

# Conflicts:
#	CMakeLists.txt
2022-07-30 15:26:40 +03:00
Denis Pauk
36b41fc107 Revert "Temporary fix for MoltenVK"
This reverts commit 41057458e4.
2022-07-24 14:09:05 +03:00
Denis Pauk
e5f7bf7e82 Add additional logic for skip VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
Added checks for:
```
Memory types must not have both VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
and VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT set.
```
And
```
A memory type with this flag set is only allowed to be bound to a VkImage
whose usage flags include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT.
```

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkMemoryPropertyFlagBits.html
2022-07-24 00:10:31 +03:00
Denis Pauk
41057458e4 Temporary fix for MoltenVK
MoltenVK has issues with memory flags, partial revert of #25 and
apply #27
2022-07-23 17:50:31 +03:00
Denis Pauk
dcb6e9f7d0 Hide VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME for non MoltenVK
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME is a provisional extension
and must be used with caution.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_portability_subset.html
2022-07-23 14:41:51 +03:00
David CARLIER
8ca794ab68 Enables beta extensions for MoltenVK 2022-07-23 12:54:16 +03:00
Denis Pauk
48a73aa92f
Merge pull request #26 from devnexen/drawparticlessig
Apply similar change done for the gl1 renderer here.
2022-07-22 23:31:19 +03:00
Denis Pauk
592f847fca
Merge pull request #25 from yquake2/vma_heuristic
Support memory preferences cost logic
2022-07-22 23:30:52 +03:00
David Carlier
987011e319 Apply similar change done for the gl1 renderer here. 2022-07-22 13:20:13 +01:00
Denis Pauk
f2e439064e Support memory preferences cost logic
Port memory preferences cost logic from VMA allocator.
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/

Code selects memory that has more bits simular to asked preferences.
2022-07-17 20:25:47 +03:00
Denis Pauk
d8beb0ee78 Update messages 2022-07-17 20:09:20 +03:00
David Carlier
d147aa10c3 little memory related changes. 2022-07-11 21:00:58 +01:00
Denis Pauk
29c0fd21cc Update usage information. 2022-07-11 00:12:29 +03:00
David CARLIER
d0e903fd78 Follow-up on MoltenVK changes.
Loading earlier its calls and adding metal device infos to the device.
2022-07-10 00:46:44 +01:00
Denis Pauk
e5739a5a42 Update README 2022-07-09 19:38:16 +03:00
David CARLIER
b1ec44057e MoltenVK/macOs specific variables.
- vk_molten_metalbuffers: enable/disable Metal buffers to bind textures
more efficiently (>= Big Sur).
- vk_molten_fastmath: enable/disable float point op optimisations.
2022-07-09 11:31:30 +01:00
David Carlier
649279b587 reducing a bit more the debug infos scope, differentiate also
a bit more validation 2 level towards 1.
2022-07-02 12:01:04 +01:00
Denis Pauk
1458f68393 Simplify validaton init workaround 2022-07-02 00:20:18 +03:00
Denis Pauk
97be0f92df
Merge pull request #18 from devnexen/vk_instance_noval
Instance handling fallback.
2022-07-01 23:16:30 +03:00
David CARLIER
fe554ca0cc Instance handling fallback.
When the validation layers fails (or not present) then we "surprisingly"
 fallback to a GL renderer losing all settings too.
Here we try to create the instance but without the validation part then.
2022-06-28 22:04:05 +01:00
Denis Pauk
bfd5659abc
Merge pull request #16 from devnexen/volkloadinstance_postpone
QVk_Init: Load instance data only on success.
2022-06-26 13:50:20 +03:00