Commit Graph

3229 Commits

Author SHA1 Message Date
Kitchen
f76b678bef
support Metal renderer to auto generate mipmap for render target (#2784)
* support render target auto generate mipmap

* move autoGenMipmap check to s_textureFormat table
2022-04-25 07:11:14 -07:00
Sami Kyöstilä
09d8c34e34
GL: Properly reset FBO after emulated blit (#2782)
Reset the previously bound FBO after rendering an emulated blit instead
of binding the default framebuffer.

Co-authored-by: Sami Kyöstilä <sami.kyostila@unrealvoodoo.org>
2022-04-23 07:25:46 -07:00
Kitchen
33dd76eab5
fix metal renderer set image bug (#2779)
* fix metal renderer set image type bug

* add Binding::Image access check

* move s_accessNames outside of scope
2022-04-22 06:56:35 -07:00
Kitchen
2568ce7311
fix image is not set in pipeline state object in metal renderer (#2780)
* always set pipeline state object 'm_bindingTypes' when argument is texture

* fix the typo error casue cash
2022-04-21 20:11:37 -07:00
TooMuchVoltage Software Inc
f6e0db1969
Fixing shadow2DProj in GLSL (#2775)
Removing erroneous extra bracket for aliasing shadow2DProj in GLSL. Would have caused compilation failure if used.
2022-04-20 06:33:17 -07:00
Ravbug
e7fdfa73c1
Add support in Metal and Vulkan for [earlydepthstencil] (#2764) 2022-04-07 09:42:04 -07:00
Бранимир Караџић
5404a29540 Updated version number. 2022-04-06 18:54:03 -07:00
Miguel Ángel
5ae2271667
Replaced VK_FORMAT_D24_UNORM_S8_UINT with the more supported VK_FORMAT_D32_SFLOAT_S8_UINT (#2755)
Co-authored-by: Miguel Ángel Pérez Martínez <miguel_angel_perez_martinez@not_an_email.com>
2022-04-01 07:27:42 -07:00
Бранимир Караџић
f86499b726 Updated version number. 2022-03-31 18:42:28 -07:00
Christophe Dehais
f44818b548
Import glDrawBuffers() from WEBGL_draw_buffers extension (#2667) 2022-03-31 18:27:24 -07:00
James Fulop
d9cdc67993
add missing semicolon (#2751) 2022-03-30 07:26:40 -07:00
Sandy
251e35ae09
Fixes for shader texture array in GLES3 (#2750)
* opengl: use texture for texture2DArray

* shaderc: Add default precision for sampler2DArray on GLES3
2022-03-29 13:14:21 -07:00
Sandy
c0cbaf2a43
gl: Get maxTextureLayers on versions 3.0 and up (#2749) 2022-03-29 10:57:33 -07:00
pezcode
d7a8e50d26
Fix resource register macro expansion (#2747)
The preprocessor library (fcpp) has issues with ## and doesn't expand
properly. We can work around that by using the [reg] syntax which is
supported for all shader targets that internally use HLSL through glslang.
2022-03-22 20:47:29 -07:00
Alexander
6a1809baa2
Use depth in default sort mode (#2744)
submit param _depth is no longer ignored when using default sort mode
2022-03-14 08:58:59 -07:00
Branimir Karadžić
da9e2f0400 D3D12: Fixed texture array update. 2022-03-05 16:44:56 -08:00
Christophe Dehais
6c9248914e
Fix leaked FBO for depth/stencil only view (#2738) 2022-03-04 09:48:50 -08:00
Бранимир Караџић
ae7aeba72c GL: Fixed vertex layout binding. 2022-02-25 17:21:55 -08:00
Bruno Croci
4f3328edb3
Added textureCube macro for GLSL >= 130. (#2728)
`textureCube` requires extension `GL_NV_shadow_samplers_cube`, however `texture` can sample a cube sampler without the extension.
2022-02-21 19:41:28 -08:00
Бранимир Караџић
3d4bd88c06 Updated version number. 2022-02-12 10:01:31 -08:00
Kitchen
e42fe374c3
fix only msaa depth texutre in frame buffer error on iOS platform (#2725) 2022-02-09 06:29:14 -08:00
pezcode
4b04a8ced8
Vulkan: replace deprecated version macros (#2721) 2022-02-06 17:32:03 -08:00
luzpaz
6875e96bcb
Fix various typos (#2719)
Found via `codespell -q 3 -S ./3rdparty,*.ttf -L attribut,ba,clude,conly,indext,inout,lod,nclude,retur,utput`
2022-02-05 11:34:15 -08:00
Бранимир Караџић
9f04292f40 Metal: Fixed texture creation. 2022-01-30 20:18:48 -08:00
Fabio Soldati
4a922e34da
Fixed wrong comparison of maxTextureSize (#2718)
Co-authored-by: Fabiz <info@peakfinder.org>
2022-01-30 08:14:19 -08:00
Бранимир Караџић
134d1787e7 Updated version number. 2022-01-15 18:03:14 -08:00
Бранимир Караџић
4581f14cd4 Happy New Year! 2022-01-15 11:59:06 -08:00
ShuangLiu1992
a6511598db
Update glcontext_nsgl.mm (#2705)
[glContext update]; and [glContext setView:glView]; always needs to be called from main thread
2022-01-07 07:55:53 -08:00
Бранимир Караџић
af68e138fe Cleanup. 2021-12-31 09:43:21 -08:00
Бранимир Караџић
99a7af712f Added more info about transparency sort table. 2021-12-26 09:21:02 -08:00
Бранимир Караџић
0755f50fd2 Fixed #2690. 2021-12-20 16:59:13 -08:00
Ravbug
ffc66a4c3c
Fix use of constant only available on macOS 12+ (#2689) 2021-12-20 13:41:03 -08:00
Бранимир Караџић
949142a75f Metal: Added GPU vendorId/deviceId detection. Fixed #2688. 2021-12-19 23:11:33 -08:00
Aleš Mlakar
457cdf6db5
MTL: Use default frame latency if 0 provided (#2680)
Co-authored-by: Aleš Mlakar <ales.ambits@gmail.com>
2021-12-07 08:54:45 -08:00
Cedric Guillemet
64a28415a8
Disable Batch indirect mode for Microsoft WARP (#2672)
* Disable Batch indirect mode for Microsoft WARP

* idl

Co-authored-by: Cedric Guillemet <ceguille@microsoft.com>
2021-12-01 11:19:47 -08:00
Christophe Dehais
c0729cb09b
Use m_gles3 flag more extensively (instead of compile-time ES version) (#2665) 2021-11-19 07:26:47 -08:00
Christophe Dehais
08cd17e3b8
Check if gl_Frag[Data/Color] are not already patched (#2661) 2021-11-18 13:12:38 -08:00
Cedric Guillemet
77f36d79cc
no more optional param for bx:write (#2662)
Co-authored-by: Cedric Guillemet <ceguille@microsoft.com>
2021-11-18 13:10:59 -08:00
Бранимир Караџић
2cdba37415 GL: Fixed update surface size when texture is transcoded. 2021-11-11 20:00:18 -08:00
Branimir Karadžić
da8a5ff449 VK: Fixed update surface size when texture is transcoded. 2021-11-11 17:39:41 -08:00
Branimir Karadžić
67d1cce8f8 D3D1x: Fixed update surface size when texture is transcoded. 2021-11-11 15:46:29 -08:00
Christophe Dehais
65ae59a82b
Fix 3D blit test (#2651)
bi.m_depth == 1 for usual 2D blit
2021-11-08 09:44:16 -08:00
Бранимир Караџић
6d1791ae2c Cleanup. 2021-11-04 06:53:08 -07:00
Бранимир Караџић
fab6e8409b Cleanup. 2021-11-01 18:53:06 -07:00
Бранимир Караџић
5fd83e7a41 Added BGFX_TEXTURE_BLIT_DST validation. 2021-11-01 18:27:20 -07:00
Бранимир Караџић
5bc3b18227 Cleanup. 2021-10-31 20:51:13 -07:00
Christophe Dehais
dd7fb33595
Fix layout transitions during series of blit (#2640) 2021-10-31 20:40:17 -07:00
Christophe Dehais
149d870f19
Accept external WebGL context (#2643) 2021-10-28 07:16:50 -07:00
pezcode
9f3b3d38c5
Fix isTextureValid number of layers check (#2639) 2021-10-27 09:27:15 -07:00
Бранимир Караџић
932d2f21e7 Cleanup. 2021-10-27 08:17:41 -07:00
Бранимир Караџић
aa7bee3e2b Cleanup. 2021-06-19 13:45:39 -07:00
Бранимир Караџић
6a46e3dd52 Fixed OSX build. 2021-06-19 13:41:13 -07:00
Branimir Karadžić
7bfb8a7b38 More fixes. 2021-10-25 19:15:55 -07:00
Branimir Karadžić
2cfba5474d Fixed windows build. 2021-10-25 19:10:41 -07:00
Бранимир Караџић
8392a44b3a Fixed assert macros, and improved error handling. 2021-10-25 18:59:32 -07:00
Бранимир Караџић
2d9e6e7f4f Added setTexture validation to check for read back texture. 2021-10-14 21:03:26 -07:00
Branimir Karadžić
46384208ad Define WIN32_LEAN_AND_MEAN if it's not defined when including windows.h. 2021-10-13 20:18:03 -07:00
Бранимир Караџић
84a38eede0 Cleanup. 2021-10-13 19:54:27 -07:00
Бранимир Караџић
f99a6b4246 Fixed bug. 2021-10-03 09:13:28 -07:00
Бранимир Караџић
8bf13f7f4f dxgi: Prettify memory info. 2021-10-02 16:21:30 -07:00
Бранимир Караџић
03fbf9d42b dxgi: Fixed string format. 2021-10-02 16:13:13 -07:00
Бранимир Караџић
7b13de371a dxgi: Fixed string format. 2021-10-02 11:32:25 -07:00
Бранимир Караџић
73db386165 Added uniform name validation. 2021-09-30 17:24:36 -07:00
Бранимир Караџић
22d5747719 Cleanup. 2021-09-30 17:24:16 -07:00
pezcode
be2c110781
Vulkan: raise maximum number of swapchain images (#2619) 2021-09-30 15:01:39 -07:00
Cedric Guillemet
f9436baea3
store action was not set when clearWithRenderPass false and MSAA on (#2613)
Co-authored-by: Cedric Guillemet <ceguille@microsoft.com>
2021-09-30 11:26:18 -07:00
Gaetan de Villele
89b6c25c4a
fix usage of fatal() function when Clang analyzer is used (#2617) 2021-09-27 19:07:32 -07:00
Christophe Dehais
ad8e7eb974
Simplify vulkan texture resolve (#2611) 2021-09-22 09:20:48 -07:00
Gary Hsu
79d1b4db56
Fix bug when sampler min/mag is anisotropic but mip is point (#2609) 2021-09-21 18:13:49 -07:00
Бранимир Караџић
227ea05dee Fixed transient vertex buffer when vertex layout allocation fails. 2021-09-16 18:32:58 -07:00
Andrew Willmott
1a001a67db
Fix RG16F typo (#2603) 2021-09-16 07:23:27 -07:00
Бранимир Караџић
9ecd462538 Cleanup. 2021-09-09 09:50:17 -07:00
James Fulop
bbc2b76948
Dxgi tearing support (#2601)
* present tearing support

* use existing syncInterval variable
2021-09-09 07:20:01 -07:00
Julian Sikorski
9ab8494bdd
Fix crash when switching to fullscreen with vulkan (#2598)
Without this change, running examples under XWayland, SDL and vulkan
renderer results in a crash. Credit goes to @pezcode:
https://github.com/bkaradzic/bgfx/issues/2593#issuecomment-905462527
2021-08-30 08:33:37 -07:00
Бранимир Караџић
ee0fbea726 Added AGC renderer stub. 2021-08-24 19:35:09 -07:00
pezcode
f80d31f1f4
HLSL: add textureGather for all components (#2595) 2021-08-24 17:26:03 -07:00
pezcode
103179f74d
Vulkan: fix present elapsed calculation (#2592) 2021-08-20 07:15:27 -07:00
pezcode
d77f8686f9
Vulkan: fix layer calculation for (cubemap) array texture update (#2591) 2021-08-20 07:15:10 -07:00
Бранимир Караџић
925fbe30ae Cleanup. 2021-08-14 12:39:50 -07:00
Бранимир Караџић
962a446055 Cleanup. 2021-08-14 08:33:25 -07:00
James Fulop
82ed74ddb6
cleanup (#2579)
* cleanup

remove unused macro parameters

* de-macro CASE_IMPLEMENT_UNIFORM in d3d11, d3d12, mtl, vk

* fix whitespace

* remove undef of macro that was deleted

* collapse switch statements
2021-08-14 06:57:30 -07:00
pezcode
e8281f8656
Vulkan: correctly resolve attachments of destroyed framebuffer (#2576) 2021-08-09 13:42:54 -07:00
pezcode
ae111f1946
Vulkan: fix RGBA8 backbuffer capture (#2575) 2021-08-09 13:42:00 -07:00
jwdevel
59a73fe9d3
Improve detection of EXT_gpu_shader4 (#2572)
This extension is used to detect support for gl_InstanceID and gl_VertexID. However, in more recent
versions of OpenGL, this is built-in functionality. On my system, it does not list that extension,
even though it supports those features, but BGFX was not detecting that.

Updated detection to look for GL>=3.1.

Note 1: even with this change, you do need to compile BGFX with the appropriate
BGFX_CONFIG_RENDERER_OPENGL value (>=31). The default of 21 is not high enough.

Note 2: Even with all of the above, you will likely hit issues with duplicate '#version' lines in
the generated shader code. For that, see issue #xxxx.

fixes issue #2570
2021-08-07 18:02:08 -07:00
Matt Tytel
25ef0e5c85
Weird fix for frame rate doubling after second created window. (#2564)
* Weird fix for frame rate doubling after second created window.

* Don't double buffer with vsync in metal to prevent 2x fps instead.

* Setting number of back buffers in metal if available.

* Better function call syntax.

* Matching maxFrameLatency to maximumDrawableCount in Metal backend.
2021-07-30 08:39:11 -07:00
Nathan Reed
2f1e14ea82
Use already injected RenderDoc dll, or load it from default location (#2561)
* Use already injected RenderDoc dll, or load it from default location

- on Windows, if the process was launched from RenderDoc and the dll is already injected, use it
- otherwise try to load the dll from the default installation path in Program Files
- doesn't need the dll to be copied next to the exe or in the system PATH, which is not the supported way to do it according to BaldurK - see https://github.com/baldurk/renderdoc/issues/2279#issuecomment-844588691

* Restore previous implementation of findModule

* Address PR feedback

Co-authored-by: Nathan Reed <nareed@adobe.com>
2021-07-19 17:33:02 -07:00
James Fulop
9694171d1b
cleanup (#2545)
spelling: treshold -> threshold
2021-06-23 07:14:11 -07:00
James Fulop
684234c089
cleanup (#2544)
replace `long long` with `int64_t`
2021-06-23 07:13:37 -07:00
Бранимир Караџић
40f1d6b0e4 Merge branch 'master' of github.com:bkaradzic/bgfx 2021-06-16 15:19:34 -07:00
Бранимир Караџић
c2974e96d4 Android default is GLES 3.0. 2021-06-16 15:19:22 -07:00
kingscallop
17c9300afd
Allow shaders to be compiled on msys2 (#2539)
Adds support on tools.mk for the msys2 environment. The OS is still
considered windows but the command line tools for mkdir and rmdir
behave as if on linux.

The variable SHADER_TMP on the makefiles also had to be quoted to make
it work on msys2.
2021-06-12 11:36:54 -07:00
kingscallop
c0adb2a51e
Make the generated embedded shader headers the same between linux and gnuwin32 (#2538)
This echo command on the makefile behaves differently between linux and gnuwin32:
```
-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
```

On linux the semicolon immediately ends the echo command and its output is never piped to the embedded shader's header.
If you try to fix it by quoting the string:
```
-@echo "extern const uint8_t* $(basename $(<))_pssl;" >> $(@)
```

It will work on linux but not on gnuwin32 because the quotes will appear on the outputted string.
The solution was to use printf which works consistently between the two.

Also on gnuwin32 the outputted string has 'CRLF' line endings, which clashes with the rest of the 'LF' line endings
of the embedded shaders header which were produced by shaderc.
The solution was to remove the 'CR' from the outputted string by using the tr command.
2021-06-12 10:22:19 -07:00
Бранимир Караџић
e0d26507dc Added BGFX_CONFIG_ENCODER_API_ONLY configuration setting to enable/disable non-encoder API. 2021-06-11 08:05:58 -07:00
Branimir Karadžić
f569fe32a6 Rebuilt all embedded shaders. 2021-06-06 14:51:46 -07:00
Branimir Karadžić
24f047b078 Fixed VS warnings. 2021-06-06 14:51:39 -07:00
kingscallop
73784ac9eb
Split embedded shaders into essl and glsl - Part 1 (#2535)
In non-embedded shaders there is a separation between essl binaries (examples/runtime/shaders/essl)
and glsl binaries (examples/runtime/shaders/glsl). On embedded shaders there is no such separation
and by default essl shaders are being used by the OpenGL runtime. This usually doesn't cause any
issues but in the case of the debugdraw shaders, that started using uvec4, this now leads to a
runtime error. This patch fixes this by splitting the embedded shaders into essl and glsl.

As asked, this is the first part of the change.

To be able to compile the 'examples/common/debugdraw' shaders, pull
request #2362 is needed.
2021-06-06 13:53:26 -07:00
kingscallop
6a529fca4b
Fix usage of bx::findIdentifierMatch for gl_FragDepth (#2533)
When trying to find all the instances of gl_FragDepth
and replace them with bgfx_FragDepth it only finds
the first instance.
2021-06-05 13:56:00 -07:00
simon chen
0b179e59e2
fixed GLES3 bug, when "EGL_KHR_create_context" doesn't exist. (#2529)
* fixed gles3 bug

* fixed sdl bug on android platform
2021-06-05 07:54:14 -07:00
Бранимир Караџић
5db742a7b0 Fixed GLES3 build. 2021-06-03 21:28:10 -07:00
Mirko-Salm
c5dcd4ea9b
fixed missing brackets in ddy, ddy_coarse, and ddy_fine (#2525) 2021-05-31 08:59:41 -07:00