Commit Graph

872 Commits

Author SHA1 Message Date
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
Бранимир Караџић
e878147cf9 Added version info to debug stats. 2020-10-05 19:45:22 -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
Бранимир Караџић
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
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
Julian Xhokaxhiu
daec25b6d0 OpenGL: Disable scissor testing while blitting framebuffers when MSAA is enabled (#2200) 2020-07-14 07:47:48 -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
Бранимир Караџић
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
Бранимир Караџић
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
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
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
Бранимир Караџић
594be53891 Reverted #2021. 2020-05-12 07:11:01 -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
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
Бранимир Караџић
23998f3d78 Fixed typo. 2020-04-08 08:05:11 -07:00
Бранимир Караџић
5555c73b3a Cleanup. 2020-04-07 23:59:16 -07:00
Бранимир Караџић
1361ccf211 Revert "Revert "Avoid redundant uniform uploads (#2090)""
This reverts commit c023ac4620.
2020-04-07 23:43:21 -07:00
Бранимир Караџић
c023ac4620 Revert "Avoid redundant uniform uploads (#2090)"
This reverts commit d9d9865ad9.
2020-04-07 23:23:54 -07:00
juj
d9d9865ad9 Avoid redundant uniform uploads (#2090)
* Avoid redundant uniform uploads

* Fix placement of GL_CHECK()s and import of glUniform4f.

* Fix typo

* Migrate GL uniform cache to use tinystl to conform to BGFX data structures

* Address review

* Address review
2020-04-07 23:08:09 -07:00
G
f07a0f5179 Added support for the extension OES_EGL_image_external(_essl3) for GLES2/3 (#2021)
Co-authored-by: Gabriel <gabriel.sulka@visiarc.com>
2020-04-06 08:20:49 -07:00
Pablo Escobar
1b85139371 Revert "Remove debug label quotes"
This reverts commit 08b3ec5814.
2020-04-03 21:56:54 +00:00
Pablo Escobar
fdcdeae23a Remove debug label quotes 2020-04-03 21:56:54 +00:00
Бранимир Караџић
ebc55f8083 Cleanup. 2020-03-31 18:52:02 -07:00
paul gruenbacher
c92e647b1a add missing flags to conditional check 2020-03-31 23:47:40 +00:00
Бранимир Караџић
f2290c1b57 Move GL_CHECK to GL callsites. 2020-03-30 09:08:10 -07:00
paul gruenbacher
5b9dd78383 make sure depth textures are resolved as well when blitting frameBuffer 2020-03-30 15:57:13 +00:00
Бранимир Караџић
a594cfa391 Cleanup. 2020-03-30 08:38:33 -07:00
Jukka Jylänki
7aed93f392 Adjust integer texture format enums for desktop OpenGL < 4.0 2020-03-30 15:35:15 +00:00
Jukka Jylänki
3ad3227595 Revert back to using GL_HALF_FLOAT (that is GL_HALF_FLOAT_OES) 2020-03-30 15:35:15 +00:00
Jukka Jylänki
43bd07f825 Fix OpenGL ES texture formats and remove runtime texture probing on WebGL. 2020-03-30 15:35:15 +00:00
Бранимир Караџић
e495c613a5 Cleanup. 2020-03-30 08:34:58 -07:00
Jukka Jylänki
4a8276cb29 Optimize glUniform1iv and glUniform4fv to use faster glUniform1i and glUniform4f on WebGL. 2020-03-30 15:26:49 +00:00
Jukka Jylänki
bab9dc752e Avoid redundant GL calls to glEnableVertexAttribArray() and glDisableVertexAttribArray(). #1960 2020-03-30 15:26:15 +00:00
Бранимир Караџић
29dc60b068 Revert "Fix RGBA4 and RGB5A1 format & internalFormat"
This reverts commit 5b9b75abb2.
2020-03-02 22:09:05 -08:00
Бранимир Караџић
09de2467d5 Revert "Fix RGBA4 and RGB5_A1 type. GL_UNSIGNED_SHORT_4_4_4_4_REV and GL_UNSIGNED_SHORT_1_5_5_5_REV do not exist in GLES, only in desktop OpenGL, but the non _REV verrsion is present in both"
This reverts commit c56d843565.
2020-03-02 22:09:00 -08:00
Jukka Jylänki
c56d843565 Fix RGBA4 and RGB5_A1 type. GL_UNSIGNED_SHORT_4_4_4_4_REV and GL_UNSIGNED_SHORT_1_5_5_5_REV do not exist in GLES, only in desktop OpenGL, but the non _REV verrsion is present in both 2020-03-03 06:04:45 +00:00
Jukka Jylänki
5b9b75abb2 Fix RGBA4 and RGB5A1 format & internalFormat 2020-03-03 04:08:27 +00:00
Jukka Jylänki
e1b3fe6d75 Fix OpenGL ES depth&stencil format querying. 2020-03-02 16:55:39 +00:00
Jukka Jylänki
d539f3425f Avoid querying GL_MAX_ARRAY_TEXTURE_LAYERS and GL_MAX_LABEL_LENGTH if it is known at compile time that the GL context is not new enough to have them. 2020-03-02 16:54:25 +00:00
Sandy Carter
d7e3f03780 shaderc_glsl: Fix error when mixing SamplerArray and flat keyword
Use of the `flat` keyword will have `glslopt_optimize` run with glsl
version 130. In this mode, it will change calls of `texture2DArray` to
the more general `textureArray`. However, this call results in an error
when reading the compiled shader:

```
bgfx/src/renderer_gl.cpp:5904: BGFX Failed to compile shader.
0: 0(45) : error C1503: undefined variable "textureArray"
```
Defining this call to be `texture` avoids this error.
2020-02-20 16:05:00 +00:00
Sandy Carter
77fdc487ab opengl: Fix color ordering of RGBA4 2020-02-08 09:21:12 -08:00
Бранимир Караџић
3002159da9 Fixed state tracking. 2020-02-04 09:51:21 -08:00
Sandy Carter
5924652151 rebind instance data buffer if index offset changes
Fix case of drawing different offsets of indices of same vertex buffer
using same instance data.

This can happen in the case of conditionally drawing subsets of vertex
buffer stored in different offsets of the same index buffer while re-using
non-transient instance buffers.
2020-02-04 07:38:36 -08:00