Commit Graph

7956 Commits

Author SHA1 Message Date
Бранимир Караџић
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
Бранимир Караџић
e769cd7e9f Updated ImGui. 2021-01-21 12:23:03 -08:00
Бранимир Караџић
7783eb8169 Updated ImGui. 2021-01-20 19:02:16 -08:00
Бранимир Караџић
3773e66dda Fixed build. 2021-01-19 16:26:47 -08:00
Hugo Amnov
a515dd3c3d
WebGPU update (#2364)
* Update WebGPU renderer to match new state of API

* Update WebGPU files
2021-01-19 15:18:30 -08:00
kingscallop
5a6c1361ce
Fix compute on Vulkan when there is only one buffer but no uniforms (#2359)
When using this compute shader, the following validation errors appear.
This patch fixes the issue.

BUFFER_WR(cBuffer, uint, 1);

NUM_THREADS(1u, 1u, 1u)
void main()
{
	cBuffer[0] = 0u;
}

../../../src/renderer_vk.cpp (628): BGFX ---E-       CommandBuffer,
Validation, 0: Validation Error: [
VUID-vkCmdBindDescriptorSets-dynamicOffsetCount-00359 ] Object 0: handle =
0x7fffe453ec88, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID =
0x82756c54 | vkCmdBindDescriptorSets(): Attempting to bind 1 descriptorSets
with 0 dynamic descriptors, but dynamicOffsetCount is 1. It should exactly
match the number of dynamic descriptors. The Vulkan spec states:
dynamicOffsetCount must be equal to the total number of dynamic descriptors
in pDescriptorSets
(https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/
vkspec.html#VUID-vkCmdBindDescriptorSets-dynamicOffsetCount-00359)

../../../src/renderer_vk.cpp (628): BGFX ---E-            Pipeline,
Validation, 0: Validation Error: [ VUID-vkCmdDispatch-None-02697 ] Object 0:
handle = 0xcd00000000cd, type = VK_OBJECT_TYPE_PIPELINE; Object 1: handle =
0x630000000063, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; Object 2:
VK_NULL_HANDLE, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; | MessageID =
0xfd9e3152 | vkCmdDispatch(): VkPipeline 0xcd00000000cd[] defined with
VkPipelineLayout 0x630000000063[] is not compatible for maximum set
statically used 0 with bound descriptor sets, last bound with
VkPipelineLayout 0x0[] The Vulkan spec states: For each set n that is
statically used by the VkPipeline bound to the pipeline bind point used by
this command, a descriptor set must have been bound to n at the same
pipeline bind point, with a VkPipelineLayout that is compatible for set n,
with the VkPipelineLayout used to create the current VkPipeline, as
described in Pipeline Layout Compatibility
(https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/
vkspec.html#VUID-vkCmdDispatch-None-02697)

../../../src/renderer_vk.cpp (628): BGFX ---E-       CommandBuffer,
Validation, 0: Validation Error: [
UNASSIGNED-CoreValidation-DrawState-DescriptorSetNotBound ] Object 0: handle
= 0x7fffe453ec88, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID =
0xcde11083 | VkPipeline 0xcd00000000cd[] uses set #0 but that set is not
bound.
2021-01-16 14:00:40 -08:00
kingscallop
758566b3af
Make the provoking vertex consistent across OpenGL, D3D and Vulkan (#2360)
The default provoking vertex on OpenGL is the last of a triangle, but
on D3D and Vulkan it is the first.

This patch sets the provoking vertex to the first vertex on OpenGL.
2021-01-16 13:59:28 -08:00
kingscallop
26c3768cac
Fix typo in bgfx_shader.sh (#2361) 2021-01-16 13:58:32 -08:00
Бранимир Караџић
eab0833b82 Updated spirv-cross. 2021-01-15 20:33:57 -08:00
Бранимир Караџић
a867d872f4 Updated spirv-tools. 2021-01-15 20:33:45 -08:00
Бранимир Караџић
630263d1cb Updated ImGui. 2021-01-15 20:30:58 -08:00
Бранимир Караџић
9e7273506a Updated meshoptimizer. 2021-01-15 20:30:24 -08:00
Бранимир Караџић
af49c5d264 Happy New Year! 2021-01-14 15:53:49 -08:00
MooZ
465c13ad37
Set profile id for metal and pssl to avoid d3d9 codepath. (#2355) 2021-01-13 07:10:23 -08:00
Бранимир Караџић
6b061ffd4e Updated README. 2021-01-11 23:02:06 -08:00
Бранимир Караџић
415d850b01 44-sss: Added screenshot. 2021-01-10 17:53:41 -08:00
Бранимир Караџић
b6ae2d2709 Cleanup. 2021-01-10 14:44:30 -08:00
Бранимир Караџић
7b8ff41954 44-sss: Fixed build. Use D32F instead D24. 2021-01-10 11:27:13 -08:00
Бранимир Караџић
743682db67 Updated meshoptimizer. 2021-01-10 11:25:34 -08:00