Commit Graph

3229 Commits

Author SHA1 Message Date
Бранимир Караџић
6baa370801 Fixed transient index buffer functions to all have 32-bit indices support, and removed 16-bit only restriction from docs. 2021-05-25 12:47:28 -07:00
Бранимир Караџић
5ecddbf4d5 Updated version number. 2021-05-19 09:53:54 -07:00
Branimir Karadžić
c5aea5325d Fixed MSVC build. 2021-05-19 07:03:02 -07:00
Бранимир Караџић
a47a1c8917 Fixed WebGL instancing and EGL context upgrade. 2021-05-18 22:41:51 -07:00
Бранимир Караџић
3214539bad Fixing WebGL + Android instancing. 2021-05-18 20:22:46 -07:00
Бранимир Караџић
5c1d99cb8c Fixed build. 2021-05-13 20:31:20 -07:00
Бранимир Караџић
9d8e73f1c1 Fixed warnings. 2021-05-13 12:48:27 -07:00
Бранимир Караџић
41ab81fd51 Cleanup. 2021-05-06 10:59:28 -07:00
Sebastian Marketsmueller
582dfc1e4c
Fix texture validation logic (#2509)
* fix mip level computation for asmjs and add support for srgb textures in es2/webgl

* fix BX_TRACE in glcontext_html5.cpp

* fix wrong logic in texture validation

Co-authored-by: Sebastian Marketsmueller <sebastianm@hq.unity3d.com>
Co-authored-by: Vladimir Vukicevic <vladimir@pobox.com>
2021-05-06 10:58:37 -07:00
pezcode
97c4abef01
GLES: fix compilation (#2508) 2021-05-05 14:24:35 -07:00
pezcode
2c21f68998
VPRT support for D3D11, D3D12, GL (#2507)
* glsl-optimizer: whitelist ARB_shader_viewport_layer_array_enable

* D3D11: remove duplicate structs and enums

* D3D11: report BGFX_CAPS_VIEWPORT_LAYER_ARRAY

* D3D12: report BGFX_CAPS_VIEWPORT_LAYER_ARRAY

* GL: support for BGFX_CAPS_VIEWPORT_LAYER_ARRAY

* D3D11: multi-layer MSAA resolve

* D3D12: multi-layer MSAA resolve

* D3D12: fix binding multi-layer resolved textures

* GL: fix multi-layer rendertarget creation
2021-05-05 11:58:21 -07:00
pezcode
56fbe55b3d
Vulkan: occlusion queries, housekeeping - attempt 2 (#2506)
* Cleanup

* Request host-cached memory for readback

* Request device-visible memory for the uniform buffer

* Use more fine-grained image memory barrier stages

* Don't rebind vertex and index buffers if not necessary

* Timer queries

* Don't transition images during a renderpass

* Cache descriptor sets

* Trigger RenderDoc capture if requested

* Fix invalid command buffer after surface recreation

* Perform clear and blit before compute

* Use init.debug to enable validation layers

...instead of always enabling them in debug config

* Only resolve framebuffer once

* Report number of primitives without index buffer

* Minimize state changes

* Occlusion queries

* Transition swapchain image from undefined layout

* Make sure we have a combined graphics and compute queue family

Existing code already makes that assumption, otherwise we'd need different command queues and explicit resource queue transitions. The spec also guarantees that a device with such a queue family should exist.

* Release cached image views on texture destruction

* Fix stencil-only clear

* Fix non-zero integer format clear

* Annotate all optional functions with their extensions

* Support for BGFX_SAMPLER_SAMPLE_STENCIL

* Remove unused extension functions

* Support for BGFX_SAMPLER_BORDER_COLOR

* Undo descriptor set cache

Try this again in another PR... the hashing doesn't quite work with some bind combinations, and the cache needs a better eviction strategy

* Don't start renderpass for empty draw calls

* Advertize graphics debugger, if present

ie. RenderDoc

* Cleanup

* Only enable required features and extensions

* Don't spam warning about swapchain format fallback

* Cleanup
2021-05-03 10:17:43 -07:00
Бранимир Караџић
9528c5d68a Revert "Vulkan: occlusion queries, housekeeping (#2505)"
This reverts commit 2fb67a707b.
2021-05-02 20:15:16 -07:00
pezcode
2fb67a707b
Vulkan: occlusion queries, housekeeping (#2505)
* Cleanup

* Request host-cached memory for readback

* Request device-visible memory for the uniform buffer

* Use more fine-grained image memory barrier stages

* Don't rebind vertex and index buffers if not necessary

* Timer queries

* Don't transition images during a renderpass

* Cache descriptor sets

* Trigger RenderDoc capture if requested

* Fix invalid command buffer after surface recreation

* Perform clear and blit before compute

* Use init.debug to enable validation layers

...instead of always enabling them in debug config

* Only resolve framebuffer once

* Report number of primitives without index buffer

* Minimize state changes

* Occlusion queries

* Transition swapchain image from undefined layout

* Make sure we have a combined graphics and compute queue family

Existing code already makes that assumption, otherwise we'd need different command queues and explicit resource queue transitions. The spec also guarantees that a device with such a queue family should exist.

* Release cached image views on texture destruction

* Fix stencil-only clear

* Fix non-zero integer format clear

* Annotate all optional functions with their extensions

* Support for BGFX_SAMPLER_SAMPLE_STENCIL

* Remove unused extension functions

* Support for BGFX_SAMPLER_BORDER_COLOR

* Undo descriptor set cache

Try this again in another PR... the hashing doesn't quite work with some bind combinations, and the cache needs a better eviction strategy

* Don't start renderpass for empty draw calls

* Advertize graphics debugger, if present

ie. RenderDoc

* Cleanup

* Only enable required features and extensions

* Don't spam warning about swapchain format fallback

* Cleanup
2021-05-02 20:09:33 -07:00
James Fulop
43db77159d
fix unintialized memory (#2499)
this then caused `DX_RELEASE(m_msaaRt, 0);` in `error:` to fire an assert since it tries to deref the garbage ptr
2021-04-29 17:46:24 -07:00
Бранимир Караџић
9310d19141 Cleanup. 2021-04-27 09:18:22 -07:00
Бранимир Караџић
d01f86a6a9 Cleanup. 2021-04-26 19:54:58 -07:00
Бранимир Караџић
c319aa909e Fixed build. 2021-04-23 22:30:21 -07:00
SnapperTT
ffde01f8c9
Fix change in blend rgba not being detected as a state change (#2494) 2021-04-23 20:15:01 -07:00
Бранимир Караџић
117c999d6e Added bgfx::Init capabilities mask. 2021-04-22 20:18:48 -07:00
pezcode
87855128bb
Vulkan: merge shared shader bindings (#2492) 2021-04-22 12:09:54 -07:00
pezcode
8e76e5e85c
Vulkan: multiple windows, capture support (#2491)
* Use correct aspect masks for stencil-only textures

* Make vkEnumerateInstanceVersion optional

This makes init not abort on Vulkan 1.0

* Move swapchain into FrameBufferVK

* Remove duplicate render pass creation code

* Manually resolve MSAA backbuffer

not guaranteed to be supported, but reduces resolve operations from 2 * (num views using backbuffer) to 1

* Support for multiple windows (BGFX_CAPS_SWAP_CHAIN)

* Capture support (BGFX_RESET_CAPTURE)

* Display present timings

* Recreate surface if native window handle changed

* Delayed swapchain deletion on resize

no more vkDeviceWaitIdle

* Recreate surface if BGFX_RESET_HIDPI is toggled

* Don't recreate swapchain if only the MSAA sample count changed

* Some extra caps checks

* Configurable backbuffer depth format

* Configurable backbuffer color format
2021-04-21 18:41:49 -07:00
Hugo Amnov
9320a20e72
WebGPU: Don't need bindings backward compatibility (#2488) 2021-04-21 12:17:55 -07:00
Hugo Amnov
ec36cf9872
Simplify SPIRV bindings shifts (shaderc bin version 11) (#2487) 2021-04-21 09:33:12 -07:00
Hugo Amnov
9695c0b155
WebGPU: Update to Attachments changes (#2485) 2021-04-21 07:39:38 -07:00
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