Commit Graph

7824 Commits

Author SHA1 Message Date
Branimir Karadžić
befe56f947 Fixed crash when program doesn't have fragment shader. 2021-02-25 19:00:54 -08:00
Branimir Karadžić
d25c14e52f Removed stupid todo assert. 2021-02-25 18:52:00 -08:00
Бранимир Караџић
f5cdf6e4bf Cleanup. 2021-02-25 18:40:30 -08:00
pezcode
8d51de5c5d
Various Vulkan fixes (#2408)
* Vulkan: query max anisotropy

...instead of hardcoding it to 4

* Vulkan: use BGFX_CONFIG_MIP_LOD_BIAS

* Vulkan: consider BGFX_CONFIG_PREFER_DISCRETE_GPU at device selection

* Vulkan: implement resizing for textures with backbuffer ratio size

* Vulkan: use correct framebuffer attachment layer and mip

* Vulkan: bind correct image mip

* Cleanup

* Vulkan: add indirect draw support

* Vulkan: add support for BGFX_DEBUG_WIREFRAME

* Vulkan: check all extensions and layers

... not just the first 64

* Vulkan: add support for VPRT

https://github.com/bkaradzic/bgfx/issues/2320
2021-02-25 14:31:18 -08:00
Бранимир Караџић
0afe0d2330 Cleanup. 2021-02-24 00:09:34 -08:00
Бранимир Караџић
8d622e4cfa Cleanup. 2021-02-23 21:16:07 -08:00
Бранимир Караџић
b157d15e43 Cleanup. 2021-02-23 12:54:14 -08:00
pezcode
fcc44dc107
Vulkan sync rewrite (#2402)
* Vulkan: allow setting image debug name

* Vulkan: record multiple frames ahead of the GPU

...instead of stalling on the CPU after each submit. Controllable with init.resolution.maxFrameLatency, same as the D3D11/12 backends.

* Vulkan: some additional checks at swapchain creation

* Vulkan: stall for screenshot

* Vulkan: move blit out of render pass

* Vulkan: deferred framebuffer deletion

* Vulkan: fix cubemap blit

* Cleanup

* Vulkan: storage image must have GENERAL layout and has no sampler

* Vulkan: use slightly more fine-grained barriers

* Vulkan: readTexture should stall, too

* Cleanup

* Vulkan: selective acquire

Don't acquire a swapchain image if no view renders to the backbuffer, avoiding stalls due to vsync or reaching the backbuffer limit

* Vulkan: deferred program and state cache deletion

* Vulkan: fix debug blit
2021-02-23 12:53:12 -08:00
Juan Carlos González Amestoy
8b209012b1
- Implemented BGFX_CAPS_SWAP_CHAIN in OpenGl on Macos (#2400) 2021-02-22 08:45:25 -08:00
Бранимир Караџић
efaa20b4a3 Cleanup. 2021-02-16 09:12:04 -08:00
Kitchen
966b4b8df2
fix update dynamic buffer with compute read flag only (#2394)
* fix resize buffer with compute read/write flag error

* only update dynamic buffer with compute read flag

Co-authored-by: chenjunjie <junjie020@163.com>
2021-02-16 09:06:46 -08:00
Бранимир Караџић
fb01f5a448 Updated spirv-cross. 2021-02-15 19:26:35 -08:00
Бранимир Караџић
9d44d85459 Updated spirv-tools. 2021-02-15 19:26:23 -08:00
Бранимир Караџић
c255c72ef5 Updated spirv-headers. 2021-02-15 19:26:10 -08:00
Бранимир Караџић
2f9efc1edc Updated glslang. 2021-02-15 19:25:55 -08:00
Бранимир Караџић
e2ac2e462d Updated vulkan headers. 2021-02-15 19:25:39 -08:00
Бранимир Караџић
fdd2eff360 Updated ImGui. 2021-02-15 19:17:21 -08:00
pheonix
d89ff312a7
Fix leak - using no fancy smanshy new age voodoo (#2390) 2021-02-11 21:43:22 -08:00
Бранимир Караџић
0cbc215c02 Cleanup. 2021-02-11 20:32:52 -08:00
pezcode
f983367d75
Vulkan synchronization fixes (#2386)
* Fix out of bounds index for unknown device types

* Vulkan: Insert barrier before image host reads

* Vulkan: Make commands wait for the wait semaphore

Making commands wait at BOTTOM_OF_PIPE is a no-op, resulting in instant execution

* Vulkan: Insert barrier between views/dispatches instead of waiting on the host

* Vulkan: Fix determination of access flag from image layout

This fixes two write-after-write races with copy commands after a layout transition to VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL

* Add BGFX_MAX_FRAME_LATENCY define

Affected backends either used a magic value of 3 or defined their own XX_MAX_FRAMES_IN_FLIGHT to be 3

* Vulkan: Include indirect draw in pipeline barrier

* Vulkan: honor init.resolution.numBackBuffers for swapchain size

* Make max frame latency configurable at compile time
2021-02-11 20:29:52 -08:00
Бранимир Караџић
0123d43c96 Fixed build. 2021-02-11 08:35:16 -08:00
Бранимир Караџић
b5afc2c81c Updated ImGui. 2021-02-10 22:28:11 -08:00
Бранимир Караџић
7daf5e0ba7 Cleanup. 2021-02-07 15:01:02 -08:00
Бранимир Караџић
239ce7a612 Fixed typo. 2021-02-07 07:35:18 -08:00
Бранимир Караџић
f12eba6bc0 Updated version number. 2021-02-05 19:58:50 -08:00
Бранимир Караџић
56e3c5e867 Updated spirv-cross. 2021-02-05 19:58:22 -08:00
Бранимир Караџић
b9d37691cf Updated spirv-tools. 2021-02-05 19:58:13 -08:00
Бранимир Караџић
b9d9a387eb Updated glslang. 2021-02-05 19:58:02 -08:00
Бранимир Караџић
c7d9bd833c Updated meshoptimizer. 2021-02-05 19:57:54 -08:00
Бранимир Караџић
69758816a0 Updated cgltf. 2021-02-05 19:57:41 -08:00
Бранимир Караџић
45234794d9 Don't interact with camera when mouse is over ImGui. 2021-02-05 17:24:56 -08:00
Lee Thomason
176ab53d45
Print error messages when shader doesn't compile. (#2378)
* Trace compile error if shader doesn't compile.

* remove redundant output

Co-authored-by: Lee Thomason <leet@unity3d.com>
2021-02-05 17:12:01 -08:00
Branimir Karadžić
3e30d7f42f Updated shaders. 2021-02-04 20:35:37 -08:00
Branimir Karadžić
820e0a0e03 Updated shaders. 2021-02-04 20:33:42 -08:00
elvencache
7f758a06a7
Improve Bokeh example (#2377)
* display bokeh sample pattern, add bokeh shape, improve look

draw sample pattern to texture and display in ui to see number of samples and their arrangment

add bokeh shape controls

remove adhoc 'sqrt' pattern since display makes existing pattern easier to understand and it looks nicer.

switch to floating point color texture and leave lighting results in linear space until after dof is performed. provides better results and bright spots can make more noticeable bokeh shapes.

change default values to use take more samples at reduced resolution so initial experience when loading the sample is better looking image

* update screenshot, minor change to ui

fix height of ui element so scrollbar not required by default layout
update screenshot

* fix typo in texturev

atleast, i'm pretty sure that's a typo don't see a reason to set width twice
2021-02-04 20:28:54 -08:00
Бранимир Караџић
eee065c59f 45-bokeh: Fixed OSX build. 2021-02-02 19:05:14 -08:00
XxXSVVPXxXx
e068453b53
Update entry_android.cpp (#2375)
- Fix Android Building
- "entry_android.cpp:157:29: error: no member named 'kErrorRederWriterEof' in namespace 'bx'; did you mean 'kErrorReaderWriterEof'?"
2021-02-01 09:08:19 -08:00
Бранимир Караџић
c8311f1a55 Merge branch 'master' of github.com:bkaradzic/bgfx 2021-01-31 15:47:21 -08:00
Бранимир Караџић
b92860be23 45-bokeh: Added screenshot. 2021-01-31 15:47:11 -08:00
Kartoffelsaft
c3c3f869f5
add newline at end of error (#2374) 2021-01-31 11:27:25 -08:00
Бранимир Караџић
298ffe0968 45-bokeh: Fixed build. 2021-01-31 10:09:22 -08:00
Branimir Karadžić
1401a5333d 45-bokeh: Built shaders and added example. 2021-01-31 10:07:49 -08:00
elvencache
4d272f4104
bokeh depth of field (#2372)
* Implement bokeh depth of field

Implement bokeh depth of field as described in the blog post here:
https://blog.tuxedolabs.com/2018/05/04/bokeh-depth-of-field-in-single-pass.html

Additionally, implement the optimizations discussed in the closing paragraph. Apply the effect in multiple passes. Calculate the circle of confusion and store in the alpha channel while downsampling the image. Then compute depth of field at this lower res, storing sample size in alpha. Then composite the blurred image, based on the sample size. Compositing the lower res like this can lead to blocky edges where there's a depth discontinuity and the blur is just enough. May be an area to improve on.

Provide an alternate means of determining radius of current sample when blurring. I find the blog post's sample pattern to be difficult to directly reason about. It is not obvious, given the parameters, how many samples will be taken. And it can be very many samples. Though the results are good. The 'sqrt' pattern chosen here looks alright and allows for the number of samples to be set directly. If you are going to use this in a project, may be worth exploring additional sample patterns. And certainly update the shader to remove the pattern choice from inside the sample loop.

* fix typo in shader of denoise example

copy/paste error, applying y offset to x component instead
2021-01-31 09:59:55 -08:00
Бранимир Караџић
7410288405 Updated spirv-cross. 2021-01-27 15:15:56 -08:00
Бранимир Караџић
59858de278 Updated spirv-tools. 2021-01-27 15:15:47 -08:00
Бранимир Караџић
e14a070c29 Updated spirv-headers. 2021-01-27 15:15:31 -08:00
Бранимир Караџић
93efa0c36b Updated glslang. 2021-01-27 14:56:11 -08:00
Бранимир Караџић
fc99801806 Removed glslang build files. 2021-01-27 14:45:28 -08:00
Бранимир Караџић
16f441758f Fixed #2368. 2021-01-25 12:24:12 -08:00
Бранимир Караџић
d8cfb8f64d Fixed issue #2368. 2021-01-22 07:33:59 -08:00