Commit Graph

3254 Commits

Author SHA1 Message Date
Hugo Amnov
24be4a38d0
WebGPU: Add texture format to shaderc (bin version 10) + streamline storage Images in shaders (#2482)
* WebGPU: Add texture format (shaderc bin version 10)

* WebGPU: Simplify storage images + Fix format decorations

* Shaderc: Cleanup Texture name assumption in textures
2021-04-20 20:18:49 -07:00
pezcode
e8d4b3dcce
Fixes for multiple windows and example 22 (#2483) 2021-04-19 15:30:03 -07:00
Hugo Amnov
cf8ff18263
WebGPU update (#2477)
* WebGPU: Update to latest changes + Fixes

* WebGPU: Fix RG11B10F format as framebuffer
2021-04-18 11:39:52 -07:00
Hugo Amnov
d8ef330967
Fix embedded shaders compilation (#2475) 2021-04-18 11:38:51 -07:00
Бранимир Караџић
e3f91f2895 Updated version number. 2021-04-17 08:36:19 -07:00
Бранимир Караџић
6a5ab30c6c In debug build assert on texture and frame buffer validation. 2021-04-17 08:35:34 -07:00
Бранимир Караџић
6109697ade Added bgfx::isFrameBufferValid API. 2021-04-16 22:13:26 -07:00
Бранимир Караџић
41df93f81d Cleanup. 2021-04-16 22:05:08 -07:00
pezcode
9e025301a9
Vulkan: add headless and MSAA backbuffer support (#2472)
* Swapchain class

* Headless support

* MSAA backbuffer

* Fix framebuffer resolve

layout transitions were missing and framebuffer mips and layers weren't used

* Fix blit with MSAA resolve source

only the main texture layout was transitioned

* Fix pipeline hash
2021-04-16 09:54:37 -07:00
Daniele Bartolini
83039433ee
Add textureSize() overloads for BgfxI/USampler2D (#2471) 2021-04-15 14:24:42 -07:00
Бранимир Караџић
0ff10648b6 Cleanup. 2021-04-13 20:30:14 -07:00
Matt Tytel
c6e17db9d6
Retain reset flags when creating a new metal frame buffer for a window. (#2469) 2021-04-12 12:42:53 -07:00
pezcode
900afe7644
GL: only unbind instance buffer if it changed (#2463) 2021-04-09 09:36:21 -07:00
pezcode
2240c591a1
Vulkan: ignore unused storage buffers (#2460) 2021-04-08 20:26:17 -07:00
pezcode
b298851bf0
Vertex buffer fixes (#2458)
* Vulkan: calculate vertex count from all streams, not just the first

...which might not exist in the first place

* Vulkan: use correct vertex stream offsets and handles

* D3D11: remember stream vertex count when no index buffer is bound
2021-04-08 10:28:42 -07:00
pezcode
cb49df3bca
Bind IMAGE2D_RO correctly as a texture2D without a sampler (#2454) 2021-04-07 20:05:17 -07:00
pezcode
870d14110b
Vulkan: allow writing to gl_FragColor without framebuffer color attachment (#2452) 2021-04-07 07:21:02 -07:00
Бранимир Караџић
9582f19483 Removed assert when viewport is zero size. 2021-04-05 16:07:23 -07:00
Бранимир Караџић
d61f78e263 Cleanup. 2021-04-05 12:27:48 -07:00
pezcode
db12a1d0e1
Vulkan: alias texture types in shaders + misc fixes (#2447)
* Don't enable optional extensions if BGFX_CONFIG_RENDERER_USE_EXTENSIONS is 0

* Support rendering to slices of 3D textures

* Create transient command pool

* Blit array layers for non-cube textures

* Clean up destroy and release functions

Simplifies CommandQueueVK code, automatically sets handles to NULL after release(), removes the need for explicit StateCacheT instantiations, and enables usage of StateCacheLru

* Fix renderpass hash calculation

* Allow sampling cube array textures

* Make StateCacheLru work with types overloading the address-of operator

* Alias textures to shader sampler type

Requires shaders with shaderc binary version 8 or higher

* Fix 32-bit compilation
2021-04-05 07:40:15 -07:00
pezcode
9d09088488
Additional framebuffer validation (#2448) 2021-04-05 07:23:25 -07:00
Бранимир Караџић
517942f8e1 Cleanup. 2021-04-02 20:17:42 -07:00
Бранимир Караџић
45c0b29470 Cleanup. 2021-04-02 16:46:42 -07:00
Paul Gruenbacher
3b34b6e68a
Update bgfx_p.h (#2444)
If you do 
```
bgfx::setIndexBuffer()
bgfx::submit(BGFX_DISCARD_NONE)
bgfx::submit()
```

then the second submit will be broken because even though it still uses the correct index buffer it will lose the BGFX_SUBMIT_INTERNAL_INDEX32 state.
Basically all multi-pass calls involving a 32index buffer are broken currently in bgfx master. 
This fixes bug introduced by 5c304dad3b
2021-04-02 16:43:52 -07:00
Бранимир Караџић
0df2e90edb Cleanup. 2021-04-01 20:09:16 -07:00
Vladimir Vukicevic
cb77d3bb46
Fix crash when hitting max draw call limit (#2440)
* Expand instancing demo to have non-instanced path

* Fix count vs. index off by one error when hitting max draw calls
2021-04-01 19:03:01 -07:00
pezcode
e38920c07b
View rect/scissor and framebuffer validation (#2439)
* Crop view rect and scissor to frame-/backbuffer size

* Validate framebuffer attachments

Check texture size, mip, layer range, layer count mismatch

* Remove framebuffer check from Vulkan backend

* Fix layer check for 3D attachment

* Cleanup
2021-04-01 16:18:09 -07:00
Christophe Dehais
2433b598e7
Fix BGFX_STATE_FRONT_CCW flag being ignored in DX12 and VK (#2438) 2021-04-01 08:47:45 -07:00
simon chen
0b8677ed06
fix update bug when compressed texture create with BGFX_TEXTURE_SRGB (#2437)
Co-authored-by: chenmou.cm <chenmou.cm@alibaba-inc.com>
2021-03-30 19:50:19 -07:00
C. M. Barth
f218d7ed13
Support dynamic SwapChainPanel changes for DirectX11 UWP scenarios (#2422)
* remove swap chain from consumer

* fix swap chain cleanup

* renderer workaround

* cleanup changes around platform data

* only update swapchainpanels

* revert spacing

* favor NULL over nullptr
2021-03-08 15:13:04 -08:00
pezcode
02e4786e04
Vulkan: fix sync hazards (#2419)
- write-after-write when blitting to the same image
- missing barrier between compute dispatches if a view has no draws
2021-03-06 18:56:55 -08:00
Бранимир Караџић
b3dcc83d66 Fixed warning. 2021-03-04 19:09:10 -08:00
Бранимир Караџић
38a559ea89 Fixed build. 2021-03-04 10:01:42 -08:00
Бранимир Караџић
cf1d24cb38 Fixed OSX build. 2021-03-04 09:57:28 -08:00
Бранимир Караџић
104a20754c VK: Enabled VK_EXT_line_rasterization. 2021-03-03 16:56:19 -08:00
pezcode
28be8bba61
Vulkan extension detection fix (#2418)
* Fix variable naming

* Check if VK_KHR_get_physical_device_properties2 is actually supported

* Fix extension detection logic

Device extension data wasn't cleared after enumerating each physical device, essentially checking if ANY device supports that extensions, not just the selected device
2021-03-03 16:55:01 -08:00
Бранимир Караџић
998947d58c VK: Disabled VK_EXT_line_rasterization. 2021-03-03 12:10:50 -08:00
Бранимир Караџић
696ab702fe Merge branch 'master' of github.com:bkaradzic/bgfx 2021-03-03 08:28:11 -08:00
Бранимир Караџић
3dd78ef893 Cleanup. 2021-03-03 08:27:57 -08:00
Бранимир Караџић
e30c32ed86 Fixed GCC errors & warnings. 2021-03-02 18:26:44 -08:00
pezcode
f9679fde50
Misc. Vulkan features and fixes (#2417)
* Vulkan: add conservative rasterization

* Vulkan: check device features for caps and state

* Vulkan: add line AA

* Don't assert in init()

* Vulkan: fix swapchain reset logic and handle lost surface

* Vulkan: report dedicated memory info in Stats

* Vulkan: fix sRGB backbuffer pipeline hash

* Vulkan: check BGFX_RESET_SUSPEND
2021-03-02 18:23:55 -08:00
Бранимир Караџић
58f0d55612 Cleanup. 2021-02-28 18:59:05 -08:00
pezcode
ece0c4e1a1
Vulkan: ignore BGFX_CLEAR_STENCIL if depth attachment has no stencil (#2413) 2021-02-28 15:16:19 -08:00
Branimir Karadžić
8e75b38207 Don't include compute on HLSL 3 and below. 2021-02-28 13:41:16 -08:00
pezcode
302c978b1d
Make shaderc output independent of backend enums (#2411)
* Fix typo in SPIR-V id

* Use backend-agnostic shaderc output

...as opposed to directly storing and comparing against Vulkan and WebGPU enums. This is backwards-compatible with existing code and shaders.

* Remove comments and Undefined value
2021-02-28 12:38:12 -08:00
Branimir Karadžić
005d119cae Fixed MinGW warning. 2021-02-26 18:48:43 -08:00
pezcode
9999d43374
Vulkan: fix scratch buffer size calculation (#2409) 2021-02-26 11:40:38 -08:00
Бранимир Караџић
e4d2451993 Made Vulkan default renderer backend on Linux. 2021-02-25 19:44:37 -08:00
Branimir Karadžić
befe56f947 Fixed crash when program doesn't have fragment shader. 2021-02-25 19:00:54 -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
Бранимир Караџић
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
Бранимир Караџић
f12eba6bc0 Updated version number. 2021-02-05 19:58:50 -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
Бранимир Караџић
16f441758f Fixed #2368. 2021-01-25 12:24:12 -08:00
Бранимир Караџић
d8cfb8f64d Fixed issue #2368. 2021-01-22 07:33:59 -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
Бранимир Караџић
af49c5d264 Happy New Year! 2021-01-14 15:53:49 -08:00
Бранимир Караџић
b6ae2d2709 Cleanup. 2021-01-10 14:44:30 -08:00
Alex-MSFT
68f79970e1
Don't skip reset if platform data has changed. (#2347)
(cherry picked from commit 8c4cc84c62)
2021-01-07 16:56:57 -08:00
MooZ
d65dac2000
Shaderc OpenGL fixes. (#2317)
* Reworked profile cli argument.

* Added missing GLSL profile.

* Fixed essl shader preambule.

* Fixed uniform "parsing" and hlsl profiles.

* Reworked hlsl profiles.

* Fixed missing extension for gl_FragDepth.

* Cleanup.

* Removed version preamble and reverted shadow samplers translation.

* Fixed HLSL profile tests.
2020-12-28 11:24:49 -08:00
Бранимир Караџић
534733fe3c Cleanup. 2020-12-21 09:07:33 -08:00
Antti Heinonen
40259e35f8
DX11: Fix draw vertex count not updating (#2337) 2020-12-21 09:05:04 -08:00
Бранимир Караџић
4967c29c14 Added missing caps to debug output. 2020-12-20 11:06:40 -08:00
Branimir Karadžić
7fe9e83393 Cleanup. 2020-12-17 19:30:38 -08:00
Бранимир Караџић
6f16d0e68c Cleanup. 2020-12-16 21:17:49 -08:00
Бранимир Караџић
2b99e3e5cb Updated version number. 2020-12-16 21:12:16 -08:00
Бранимир Караџић
db54d046e4 Cleanup. 2020-12-16 20:28:57 -08:00
Бранимир Караџић
600c7798fd Removed BGFX_CAPS_INDEX32 from D3D9. Added validation for BGFX_CAPS_INDEX32 support. 2020-12-15 20:23:01 -08:00
Branimir Karadžić
5c304dad3b Fixed issue #2330. Added support for 32-bit indices in transient index buffer. 2020-12-15 19:01:25 -08:00
attilaz
2bc35df070
Fixed metal screenshot sync issue (#2327) (#2329) 2020-12-14 12:26:08 -08:00
Cedric Guillemet
2556e68724
fix STAT wrong chunk copy (#2328)
Co-authored-by: Cedric Guillemet <ceguille@microsoft.com>
2020-12-14 10:31:16 -08:00
Бранимир Караџић
796acfa98b Added Attachment.numLayers needed for viewport layer array support. 2020-12-12 10:04:14 -08:00
Бранимир Караџић
23db05b990 DXGI: Disabled DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT since support for it is not implemented correctly. 2020-12-07 09:36:34 -08:00
Бранимир Караџић
4568dd7f89 Updated version number. 2020-12-02 21:08:35 -08:00
Бранимир Караџић
0714e7c41e Cleanup. 2020-12-01 21:58:01 -08:00
Бранимир Караџић
ab03a8ae60 Cleanup. 2020-11-30 22:14:05 -08:00
Бранимир Караџић
6425f3be51 Cleanup. 2020-11-30 21:12:02 -08:00
Бранимир Караџић
c1f7bf1b7f VK: Fixed memory corruption. 2020-11-30 21:11:20 -08:00
Branimir Karadžić
1cab71734c Cleanup. 2020-11-29 21:17:50 -08:00
Branimir Karadžić
52a33b8bd3 Fixed warnings. 2020-11-29 21:16:39 -08:00
Бранимир Караџић
740f405abb Updated version number. 2020-11-29 20:23:05 -08:00
Бранимир Караџић
475fea23bc Skip reset when nothing changes. 2020-11-29 17:55:06 -08:00
Бранимир Караџић
02ed265d2d Cleanup. 2020-11-29 17:14:07 -08:00
Бранимир Караџић
2dfc04e411 Cleanup. 2020-11-29 10:21:20 -08:00
Бранимир Караџић
f5179b385f Added resolution/reset debug info. 2020-11-29 10:14:37 -08:00
Бранимир Караџић
bd8204495f Cleanup. 2020-11-26 07:33:58 -08:00
Бранимир Караџић
86583e9bbd Cleanup. 2020-11-25 22:29:40 -08:00
C.Even
8c18906d97
Use emscripten_webgl2_get_proc_address for WebGL2 context (#2316) 2020-11-20 07:23:07 -08:00
Бранимир Караџић
13aafdcec0 Metal: Add BGFX_CAPS_VERTEX_ID support. 2020-11-19 06:46:48 -08:00
Бранимир Караџић
63a72092d8 Cleanup. 2020-11-14 11:13:44 -08:00
Vas Crabb
f082ca12e3
renderer_d3d12.h: Update __mingw_uuidof declaration for C++17 (#2311) 2020-11-14 11:11:24 -08:00
Cedric Guillemet
9e90a360e5
fix uint32 for none windows env (#2309)
Co-authored-by: Cedric Guillemet <ceguille@microsoft.com>
2020-11-13 10:25:59 -08:00
Cedric Guillemet
77184d5743
Added support for Resource Definition and Stats in DXBC (#2307)
Co-authored-by: Cedric Guillemet <ceguille@microsoft.com>
2020-11-13 06:47:09 -08:00
Бранимир Караџић
597ffc1aae Fixed request screenshot mechanism to work better with Metal. 2020-11-10 18:18:20 -08:00
Бранимир Караџић
2b4bf6d913 Metal: Fixed screenshot. 2020-11-10 17:14:54 -08:00
Christophe Dehais
6b790dc96b
Add opt-in compile flag for GL read back emulation (#2305)
Co-authored-by: Christophe Dehais <christophe.dehais@fittingbox.com>
2020-11-05 14:54:17 -08:00
Бранимир Караџић
925cee63c0 Cleanup. 2020-11-01 21:28:42 -08:00
Christophe Dehais
3a297ed3c0
Add support for OES_fbo_render_mipmap (#2303)
Co-authored-by: Christophe Dehais <christophe.dehais@fittingbox.com>
2020-10-30 11:58:36 -07:00
Christophe Dehais
3af46fd7dc
Explicitly enable WebGL extensions (#2302)
Co-authored-by: Christophe Dehais <christophe.dehais@fittingbox.com>
2020-10-30 11:57:09 -07:00
Бранимир Караџић
ad062bde3c Fixed #2301: Vertex layout leak. 2020-10-30 11:37:05 -07:00
Бранимир Караџић
fa97a50df0 VK: GPU timer stub. 2020-10-19 19:30:39 -07:00
Бранимир Караџић
6e86a2f074 Updated version number. 2020-10-19 07:31:29 -07:00
Бранимир Караџић
f953605343 Updated version number. 2020-10-17 22:52:29 -07:00
generalzzd
0cce398530
generalzzd fix ios compling error (#2288)
Co-authored-by: Zidi <zzd007@hotmail.com>
2020-10-17 20:02:25 -07:00
Бранимир Караџић
eae703399b Updated version number. 2020-10-14 07:14:51 -07:00
Бранимир Караџић
eaddeb98fa Cleanup. 2020-10-11 20:55:01 -07:00
pheonix
13bbf02a67
Vulkan API version auto selector (#2283)
* [vulkan] Vulkan API auto-selection for latest available.
- Selects for the maximum vulkan API version available on the host's vulkan driver for a created instance.
- Stores the created instance's vulkan API version on RendererContextVK.
- Created instance's vulkan API version dumped using BX_TRACE in MAJOR.MINOR.PATCH format.
- Physical Device's vulkan API version dumped in MAJOR.MINOR.PATCH format.

* Address code review notes.
- Actually use `vkEnumerateInstanceVersion` if it exists.
- Remove "bgfx supported" vulkan api static array.
2020-10-11 20:38:57 -07:00
Бранимир Караџић
8c2b99d81e Cleanup. 2020-10-09 20:50:03 -07:00
Бранимир Караџић
a94c5d7052 Updated version number. 2020-10-09 20:47:59 -07:00
Бранимир Караџић
3a8e0e2bb1 Fixed blit on cubemaps. 2020-10-09 20:47:50 -07:00
pezcode
09c11bca29
Mip + blit fixes (#2281)
* D3D12: Fix readback for non-zero mip

* Fix blit with non-zero mip

This required clamping the blit extents to the mip size, which is moved out of the renderers now

* Assert formatting
2020-10-09 15:32:50 -07:00
Бранимир Караџић
7f2861eceb Updated version number. 2020-10-09 13:07:58 -07:00
pezcode
2829df055c
Vulkan: Add texture readback (#2280)
* Vulkan: Add texture readback support

* Vulkan: Simplify screenshot code
2020-10-09 13:05:44 -07:00
Бранимир Караџић
5453faacf1 Fixed issue #2279. 2020-10-09 09:52:00 -07:00
pezcode
3142be44a5
D3D12: Fix readback src pitch calculation (#2278) 2020-10-08 16:47:29 -07:00
Бранимир Караџић
e878147cf9 Added version info to debug stats. 2020-10-05 19:45:22 -07:00
Бранимир Караџић
766ab668f8 Updated version number. 2020-10-05 10:17:31 -07:00
MooZ
9d369ab4a0
Fixed msaa for OpenGL ES targets. (#2277) 2020-10-05 10:17:01 -07:00
kingscallop
436b7fab9e
Adds UAV support for D3D12, Vulkan and reworked for OpenGL, D3D11 (#2119)
* Adds UAV support for D3D12, Vulkan and reworked support for OpenGL, D3D11

UAV support is now uniform across compute and draw.
To set a UAV you just use bgfx::setImage() and IMAGE2D in the shader, just like in compute.
Due to these changes shaders will have to be recompiled.

The changes include:
	- D3D11 requires patching of the UAV slot number (which is now done by modifying the DXBC instead of using a macro)
	- If the DXBC binary includes a debug chunk, that is also patched to match the new slot number
	- All the other renderers don't need any kind of patching
	- There are some shader annotations to better convert the UAV format used in hlsl to spirv

Possibility of further enhancements:
	- bgfx::setViewFrameBuffer() only supports binding to a framebuffer or, using BGFX_INVALID_HANDLE, to bind the default backbuffer. This doesn't allow for the case where there is no need to bind to either one of them, for example when using a fragment shader only to read and write to an UAV.

* Bump shader version, because they need to be recompiled.
2020-10-04 21:51:41 -07:00
Бранимир Караџић
32aa281147 Cleanup. 2020-10-04 15:01:05 -07:00
Branimir Karadžić
082b71676c Cleanup. 2020-10-04 14:23:33 -07:00
Бранимир Караџић
a1d12fe7f3 Cleanup. 2020-10-04 14:23:00 -07:00
Julian Xhokaxhiu
2c38e090d2
Various Vulkan/Direct3D 12 enhancements (#2246)
* [VK] Add RT MSAA support

* [VK] Add GenerateMips support

* [VK] Add Screenshot feature

* [D3D12] Add MSAA RT support

* [VK] Fix blit operation on MSAA RT textures

* [D3D12] Fix blit operation on MSAA RT textures
2020-10-04 14:21:12 -07:00
Бранимир Караџић
ffb2518d5a Cleanup. 2020-09-28 10:05:18 -07:00
Christophe Dehais
816026a8bf
Add blitting fallback for OGL (#2269)
Co-authored-by: Christophe Dehais <christophe.dehais@fittingbox.com>
2020-09-28 09:53:37 -07:00
Бранимир Караџић
942daad4e4 Fixed OSX build. 2020-09-17 08:31:03 -07:00
Бранимир Караџић
d402810fcf Fixed webgl build. 2020-09-17 08:30:01 -07:00
Бранимир Караџић
9b7f950cd6 Cleanup. 2020-09-16 20:03:04 -07:00
Бранимир Караџић
cce003c99f Fixed warning. 2020-09-16 09:12:09 -07:00
Бранимир Караџић
fa826a4935 Fixed webgl build. 2020-09-16 09:11:15 -07:00
Бранимир Караџић
4c0b7621d9 Fixed Encoder allocation alignment. 2020-09-14 09:30:33 -07:00
Kitchen
aa24588800
fix d3d12 error when create backbuffer with msaa and srgb format (#2261) 2020-09-09 19:29:00 -07:00
云风
95b4e6eaa5
Use getResourceDesc instead of GetDesc, See #1239 (#2260)
* Use getResourceDesc instead of GetDesc, See #1239

* Fix MSAA on d3d12
2020-09-09 05:52:13 -07:00
Branimir Karadžić
2996246a90 Cleanup. 2020-09-08 07:42:03 -07:00
Kitchen
14f8a097fc
fix error when create backbuffer with msaa and srgb format (#2258) 2020-09-07 08:05:33 -07:00
Бранимир Караџић
86402fec24 Updated version number. 2020-09-05 11:24:50 -07:00
Бранимир Караџић
d1685a366a Fixed build. 2020-09-03 23:45:20 -07:00
Бранимир Караџић
8f4750b199 Cleanup. 2020-09-02 20:43:47 -07:00
云风
03871f12db
fix gcc warnings (#2253) 2020-09-01 20:49:08 -07:00
云风
2480ea3dbe
avoid gcc warnings: cast-function-type (#2252) 2020-09-01 20:20:03 -07:00
云风
0e1c095c3b
add *_with_layout APIs (#2251) 2020-09-01 20:19:14 -07:00
云风
4d6445896e
Add missing VertexLayoutHandle for C APIs (#2249) 2020-09-01 08:36:52 -07:00
Бранимир Караџић
e272a31e19 Better frame buffer validation. 2020-08-27 12:42:37 -07:00
Doug Binks
ab036d2a05
Add support for non main thread rendering for WGL and NSGL when developer provides context (#2241)
* WGL support for passing a context when using renderFrame on non main thread

* NSGL support for passing a context when using renderFrame on non main thread

* WGL: Moved no window warning and added check prior to calling GetDC
2020-08-25 07:47:46 -07:00
Бранимир Караџић
f20fd61e4f Revert "[ VK/DX12] Bring setScissor on par with the other renderers (#2239)"
This reverts commit fbd7e9efd6.
2020-08-22 09:10:49 -07:00
Julian Xhokaxhiu
fbd7e9efd6
[ VK/DX12] Bring setScissor on par with the other renderers (#2239) 2020-08-22 09:09:11 -07:00
kingscallop
b297b48e88
Vulkan validation fixes (#2205)
When resizing the window, there's a race condition between the
validation of vkCreateSwapchainKHR's arguments and the actual
size of the window.
This ignores the validation warning when vkCreateSwapchainKHR succeeds.

On some graphic drivers vkAcquireNextImage and vkQueuePresentKHR
may return VK_SUBOPTIMAL_KHR. This is being handled as an error, which
leads to those frames being unnecessarily skipped.
2020-08-16 21:08:32 -07:00
kingscallop
cb8f6dfcec
Fixes example 08 when using OpenGL (#2233)
This example was broken on Windows and Linux when using OpenGL.
The code path when using immutable compressed textures was wrong.
2020-08-16 11:42:42 -07:00
Elliot Cuzzillo
9991b63259
improve explanatory comment about _SRGB backbuffers (#2230) 2020-08-13 16:00:35 -07:00
Elliot Cuzzillo
8244fdf54d
only use srgb views into non-srgb backbuffers to enable flip presentation model (#2229) 2020-08-13 15:45:45 -07:00
James Fulop
276598ad50
fixes for d3d12 texture update (#2220)
---
* support for compressed textures
* support for emulated textures
* fix for incorrect copyable footprint dims
2020-07-28 07:49:22 -07:00
Бранимир Караџић
825ce15d1f Cleanup. 2020-07-27 21:55:54 -07:00
Бранимир Караџић
18a7fa7f72 Cleanup. 2020-07-27 16:56:27 -07:00
Бранимир Караџић
046e930636 Cleanup. 2020-07-27 16:47:19 -07:00
Бранимир Караџић
725438583e DXGI: Fixed allow tear. 2020-07-27 14:57:34 -07:00
Бранимир Караџић
f89520db89 Cleanup. 2020-07-26 21:00:32 -07:00
Wencey Wang
1f53c6c246
Fix reference release (#2217)
* Fix reference release

* Use DX_RELEASE
2020-07-26 20:59:45 -07:00
Бранимир Караџић
81a2b8d46a Validate is texture created as readback. 2020-07-26 09:38:06 -07:00
Бранимир Караџић
679730fc4e Cleanup. 2020-07-25 16:24:24 -07:00
Wencey Wang
8524982c30
add SwapChainPanel support (#2215) 2020-07-25 16:17:05 -07:00
Бранимир Караџић
0123831126 Fixed release build. 2020-07-24 20:35:08 -07:00
Бранимир Караџић
486fdecbcc Cleanup. 2020-07-24 14:55:03 -07:00
Edu Garcia
f95a596851
Don't call vkCmdEndDebugUtilsLabelEXT when unsupported (#2211)
Validation will swamp your logs with a warning on every call
2020-07-24 08:58:31 -07:00
James Fulop
a40c3e6d45
add missing semicolon (#2207) 2020-07-22 20:31:08 -07:00
Cedric Guillemet
3d06fbe815
re-init metal swapchain when providing a new native window handle (#2206) 2020-07-22 08:47:57 -07:00
kingscallop
ff9f624b9b
Improves handling of window resizes on vulkan (avoids crashes) (#2123)
* Improves handling of window resizes on vulkan (avoids crashes)

* Change to previous commit as requested.
Rebased and added refresh swapchain check inside updateResolution(),
similar to renderer_d3d12.cpp.
2020-07-18 13:41:35 -07:00
kingscallop
6093250a3b
Fix crash on window minimize on vulkan renderer (#2204)
On some platforms (Windows) the framebuffer size becomes 0x0 when
the window is minimized. This leads to a validation error and
subsequently crashes.

This change correctly cleans up semaphores and the swapchain.
2020-07-18 11:42:53 -07:00
Бранимир Караџић
4f3d1875e6 Cleanup. 2020-07-17 19:59:43 -07:00
Бранимир Караџић
7f7e165bf2 Updated version number. 2020-07-15 10:42:46 -07:00
Julian Xhokaxhiu
daec25b6d0
OpenGL: Disable scissor testing while blitting framebuffers when MSAA is enabled (#2200) 2020-07-14 07:47:48 -07:00
Бранимир Караџић
7479651dc8 Added ability to disable discrete GPU selection. 2020-07-06 12:29:05 -07:00
Бранимир Караџић
006548e00f Fixes for D3D12 on Linux. 2020-07-02 19:50:09 -07:00
BorisShir
290ffcf341
Fixing problem with Android armv7 optmization which causes alignment violation (#2188)
* Fixing problem with Android armv7 optmization which causes alignment violation
2020-06-30 08:30:30 -07:00
Бранимир Караџић
5b05c6c09e Cleanup. 2020-06-24 17:57:35 -07:00
Gary Hsu
34fbc579ea
Fix some uninitialized variables (#2182) 2020-06-24 15:44:43 -07:00
Бранимир Караџић
a95ddd1c0c Reemoved use of old LineReader. 2020-06-20 15:14:54 -07:00
Бранимир Караџић
d5d3d29e9c Cleanup. 2020-06-20 14:29:25 -07:00
Бранимир Караџић
54e4b60055 Cleanup. 2020-06-20 14:05:18 -07:00
Бранимир Караџић
7f333698cc Cleanup. 2020-06-20 13:20:20 -07:00
Бранимир Караџић
ce4fecc53e Cleanup. 2020-06-19 20:39:19 -07:00
Бранимир Караџић
38ac02695d Fixed emscripten build. 2020-06-19 20:36:44 -07:00
Бранимир Караџић
3f6d049470 Fixed Emscripten function calls. 2020-06-19 09:31:32 -07:00
Бранимир Караџић
6af3f28935 Cleanup. 2020-06-18 21:22:09 -07:00
Бранимир Караџић
d86c16213e Cleanup. 2020-06-18 21:20:01 -07:00
Бранимир Караџић
4f0ff97ec7 Fixed build. 2020-06-17 23:17:47 -07:00
Бранимир Караџић
2cbcb6ea90 RRenamed BX_CHECK to BX_ASSERT. 2020-06-16 10:06:18 -07:00
Бранимир Караџић
ee78de075c Cleanup. 2020-06-16 08:25:54 -07:00
Бранимир Караџић
5b42be38ec Cleanup. 2020-06-15 16:21:55 -07:00
Бранимир Караџић
867b47bd40 Cleanup. 2020-06-15 10:34:47 -07:00
Бранимир Караџић
0f8c6aed5c Fixed max encoders in single-threaded mode bug. 2020-06-15 10:30:51 -07:00
Justin Murray
86bd3ad9ad
Broadened bypass mechanism for bgfx default headers in the OpenGL renderer. This reflects the fact that, if the first line of a shader is already a #version declaration, we never want to write lines above that regardless of what version is declared. (#2168) 2020-06-12 21:16:06 -07:00
Бранимир Караџић
ad09986c6c Cleanup. 2020-06-06 14:49:46 -07:00
Julian Xhokaxhiu
7c24f1bc24
Fix Intel GPU initialization context (#2161)
This will fix some weird green lines appearing only on Intel GPUs, while using OpenGL.
2020-06-06 21:45:39 +00:00
Бранимир Караџић
05dcebb53a Removed useless check. 2020-06-06 09:13:56 -07:00
juj
75384ccfe1
Add checks for Emscripten API return values to make sure API calls are not failing (#2160) 2020-06-05 07:34:11 -07:00
Бранимир Караџић
10dfece7ec VK: Fixed caps. 2020-06-03 20:38:34 -07:00
Бранимир Караџић
0ca67d5940 VK: Detect maxTextureLayers. 2020-06-03 19:04:15 -07:00
Бранимир Караџић
40d7c6e98f Cleanup. 2020-06-03 18:13:52 -07:00
Бранимир Караџић
d5f6a34a78 Updated version number. 2020-06-03 17:59:11 -07:00
Бранимир Караџић
8065659e90 Added configurable minimum resource command buffer size. 2020-06-03 17:58:54 -07:00
Бранимир Караџић
346b1af9e9 Cleanup. 2020-05-31 22:36:09 -07:00
Бранимир Караџић
3f5a38380c Removed VK_LAYER_RENDERDOC_Capture https://github.com/baldurk/renderdoc/issues/1392#issuecomment-495894791. 2020-05-31 17:04:29 -07:00
Бранимир Караџић
1329731f3c Cleanup. 2020-05-31 13:26:16 -07:00
Hugo Amnov
49687638ef
Remove some code duplication in D3D12 (#2144) 2020-05-31 13:22:21 -07:00
Бранимир Караџић
3aba9f6750 Fixed warning. 2020-05-31 11:09:30 -07:00
Бранимир Караџић
977188e9de Added weldVertices 32-bit indices support. 2020-05-30 21:38:41 -07:00
Бранимир Караџић
2baa857065 Fixed IDL generator mix of short/long Doxygen comments. 2020-05-30 09:21:49 -07:00
Бранимир Караџић
1c063fdc67 Fixed spelling. 2020-05-30 08:22:08 -07:00
juj
098e6194d9
Update examples to build on Emscripten Wasm. Add separate wasm and wasm2js targets. (#2145) 2020-05-16 19:45:55 -07:00
Бранимир Караџић
52f728b253 Updated vulkan headers. 2020-05-15 23:36:29 -07:00
Бранимир Караџић
7676a2f2bd Cleanup. 2020-05-15 21:58:43 -07:00
Бранимир Караџић
2928ba8c07 Fixed build. 2020-05-15 17:15:35 -07:00
Hugo Amnov
8ee6654695 Cleanup dead code (#2143) 2020-05-15 13:35:38 -07:00
Бранимир Караџић
594be53891 Reverted #2021. 2020-05-12 07:11:01 -07:00
Бранимир Караџић
cfaff9ba7c Updated version number. 2020-05-10 22:08:01 -07:00
Бранимир Караџић
30bda403f7 Cleanup. 2020-05-10 17:48:59 -07:00
Hugo Amnov
e1c211b537
WebGPU various small fixes (#2140) 2020-05-10 17:48:25 -07:00
Бранимир Караџић
c2e05d0554 Cleanup. 2020-05-09 19:12:18 -07:00
Бранимир Караџић
f13e5adf4b Cleanup. 2020-05-08 19:57:18 -07:00
Бранимир Караџић
25bf17fe3e Merge branch 'master' of github.com:bkaradzic/bgfx 2020-05-08 12:54:56 -07:00
Бранимир Караџић
311cfb4667 Remove crap. 2020-05-08 12:54:50 -07:00
Hugo Amnov
66ce0d59c9
Fix order of uniforms staging and render commands (#2137) 2020-05-08 12:51:02 -07:00
Бранимир Караџић
aaf7e2429b Cleanup. 2020-05-08 11:43:38 -07:00
Бранимир Караџић
12dce12b51 Fixed build. 2020-05-08 09:28:20 -07:00
Бранимир Караџић
7a687904c7 Cleanup. 2020-05-08 09:15:24 -07:00
Бранимир Караџић
4e41f3d0bd Fixed build. 2020-05-08 09:03:02 -07:00
Hugo Amnov
b62302631e
Add Webgpu backend (#2132)
* WebGPU first draft (shaderc bin version 8)

* WebGPU scripts
2020-05-08 08:53:53 -07:00
juj
486f8bde71
Optimize hot matrix maths in renderer draw call submission (#2135) 2020-05-06 07:38:54 -07:00
Бранимир Караџић
1ecaeea7bb Updated version number. 2020-05-03 19:58:30 -07:00
Бранимир Караџић
f2e79bbe41 Fixed #2133. 2020-05-03 19:58:15 -07:00
Hugo Amnov
6601a4a6f7
Fix Vulkan texture update/upload (#2130) 2020-05-03 14:22:20 -07:00
Hugo Amnov
b48b084d25
Vulkan cleanup for Webgpu (#2127)
* Harmonize and simplify Vulkan SPIRV bindings mappings

* Handle Vulkan V-flip properly

* Update Embedded shaders
2020-05-03 13:54:30 -07:00
Hugo Amnov
f9b1a9f5d4
Vulkan cleanup and minor bug fixes (#2129) 2020-05-03 13:27:31 -07:00
kingscallop
55a0427f93
Don't bind descriptorSetLayout if not present on program (#2124) 2020-05-01 09:39:30 -07:00
kingscallop
d619783769
Reworked vulkan layers and extensions support (#2117)
Better support for enabling and disabling vulkan instance layers and instance extensions and vulkan device layers and device extensions.
2020-05-01 07:39:21 -07:00
kingscallop
eaab1be079
Fix GpuShader5 extension on Intel and support 'bitsTo' functions (#2118)
GpuShader5 extension isn't supported on fragment shaders.
Bumps the GLSL version to support the 'bitsTo' functions when present on the shader.
2020-04-26 20:43:03 -07:00
kingscallop
cb113a95fb
Fix the missing clear of the depth buffer handle (#2122) 2020-04-26 20:32:27 -07:00
kingscallop
845f8692a5
Fix vulkan validation warning about alignment (#2121) 2020-04-26 20:32:10 -07:00