diff --git a/bindings/bf/bgfx.bf b/bindings/bf/bgfx.bf index 31eb191a9..89dfa303b 100644 --- a/bindings/bf/bgfx.bf +++ b/bindings/bf/bgfx.bf @@ -1334,6 +1334,11 @@ public static class bgfx /// Noop, + /// + /// AGC + /// + Agc, + /// /// Direct3D 9.0 /// diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 0d5ed0377..c445bece4 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -1331,6 +1331,11 @@ public static partial class bgfx /// Noop, + /// + /// AGC + /// + Agc, + /// /// Direct3D 9.0 /// diff --git a/bindings/d/types.d b/bindings/d/types.d index 9975858a6..c3c92790e 100644 --- a/bindings/d/types.d +++ b/bindings/d/types.d @@ -427,6 +427,7 @@ enum bgfx_fatal_t enum bgfx_renderer_type_t { BGFX_RENDERER_TYPE_NOOP, /// No rendering. + BGFX_RENDERER_TYPE_AGC, /// AGC BGFX_RENDERER_TYPE_DIRECT3D9, /// Direct3D 9.0 BGFX_RENDERER_TYPE_DIRECT3D11, /// Direct3D 11.0 BGFX_RENDERER_TYPE_DIRECT3D12, /// Direct3D 12.0 diff --git a/examples/common/bgfx_utils.cpp b/examples/common/bgfx_utils.cpp index 2ee9c0a6a..6573b8828 100644 --- a/examples/common/bgfx_utils.cpp +++ b/examples/common/bgfx_utils.cpp @@ -108,6 +108,7 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name case bgfx::RendererType::Direct3D9: shaderPath = "shaders/dx9/"; break; case bgfx::RendererType::Direct3D11: case bgfx::RendererType::Direct3D12: shaderPath = "shaders/dx11/"; break; + case bgfx::RendererType::Agc: case bgfx::RendererType::Gnm: shaderPath = "shaders/pssl/"; break; case bgfx::RendererType::Metal: shaderPath = "shaders/metal/"; break; case bgfx::RendererType::Nvn: shaderPath = "shaders/nvn/"; break; diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index 9af4c3a47..f1db8ba4a 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -52,6 +52,7 @@ namespace bgfx enum Enum { Noop, //!< No rendering. + Agc, //!< AGC Direct3D9, //!< Direct3D 9.0 Direct3D11, //!< Direct3D 11.0 Direct3D12, //!< Direct3D 12.0 diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index 40f43e9cb..cc03336b2 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -81,16 +81,17 @@ typedef enum bgfx_fatal typedef enum bgfx_renderer_type { BGFX_RENDERER_TYPE_NOOP, /** ( 0) No rendering. */ - BGFX_RENDERER_TYPE_DIRECT3D9, /** ( 1) Direct3D 9.0 */ - BGFX_RENDERER_TYPE_DIRECT3D11, /** ( 2) Direct3D 11.0 */ - BGFX_RENDERER_TYPE_DIRECT3D12, /** ( 3) Direct3D 12.0 */ - BGFX_RENDERER_TYPE_GNM, /** ( 4) GNM */ - BGFX_RENDERER_TYPE_METAL, /** ( 5) Metal */ - BGFX_RENDERER_TYPE_NVN, /** ( 6) NVN */ - BGFX_RENDERER_TYPE_OPENGLES, /** ( 7) OpenGL ES 2.0+ */ - BGFX_RENDERER_TYPE_OPENGL, /** ( 8) OpenGL 2.1+ */ - BGFX_RENDERER_TYPE_VULKAN, /** ( 9) Vulkan */ - BGFX_RENDERER_TYPE_WEBGPU, /** (10) WebGPU */ + BGFX_RENDERER_TYPE_AGC, /** ( 1) AGC */ + BGFX_RENDERER_TYPE_DIRECT3D9, /** ( 2) Direct3D 9.0 */ + BGFX_RENDERER_TYPE_DIRECT3D11, /** ( 3) Direct3D 11.0 */ + BGFX_RENDERER_TYPE_DIRECT3D12, /** ( 4) Direct3D 12.0 */ + BGFX_RENDERER_TYPE_GNM, /** ( 5) GNM */ + BGFX_RENDERER_TYPE_METAL, /** ( 6) Metal */ + BGFX_RENDERER_TYPE_NVN, /** ( 7) NVN */ + BGFX_RENDERER_TYPE_OPENGLES, /** ( 8) OpenGL ES 2.0+ */ + BGFX_RENDERER_TYPE_OPENGL, /** ( 9) OpenGL 2.1+ */ + BGFX_RENDERER_TYPE_VULKAN, /** (10) Vulkan */ + BGFX_RENDERER_TYPE_WEBGPU, /** (11) WebGPU */ BGFX_RENDERER_TYPE_COUNT diff --git a/include/bgfx/embedded_shader.h b/include/bgfx/embedded_shader.h index 311b26e58..6a9cd7d07 100644 --- a/include/bgfx/embedded_shader.h +++ b/include/bgfx/embedded_shader.h @@ -28,6 +28,7 @@ ) #define BGFX_PLATFORM_SUPPORTS_PSSL (0 \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_PS5 \ ) #define BGFX_PLATFORM_SUPPORTS_ESSL (0 \ || BX_PLATFORM_ANDROID \ diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index c0c094cb8..2544b0ec3 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -450,6 +450,7 @@ enum.Fatal { underscore, comment = "" } --- Renderer backend type enum. enum.RendererType { comment = "Renderer types:" } .Noop --- No rendering. + .Agc --- AGC .Direct3D9 --- Direct3D 9.0 .Direct3D11 --- Direct3D 11.0 .Direct3D12 --- Direct3D 12.0 diff --git a/scripts/bgfx.lua b/scripts/bgfx.lua index 0fba9be0a..7f176a2e2 100644 --- a/scripts/bgfx.lua +++ b/scripts/bgfx.lua @@ -171,6 +171,11 @@ function bgfxProjectBase(_kind, _defines) path.join(BGFX_DIR, "src/**.bin.h"), } + overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-agc"), { + path.join(BGFX_DIR, "src/renderer_agc.cpp"), + path.join(BGFX_DIR, "src/renderer_agc.h"), + }) + overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-gnm"), { path.join(BGFX_DIR, "src/renderer_gnm.cpp"), path.join(BGFX_DIR, "src/renderer_gnm.h"), diff --git a/src/amalgamated.cpp b/src/amalgamated.cpp index 3c6f067c5..60c8b1f21 100644 --- a/src/amalgamated.cpp +++ b/src/amalgamated.cpp @@ -11,6 +11,7 @@ #include "glcontext_wgl.cpp" #include "glcontext_html5.cpp" #include "nvapi.cpp" +#include "renderer_agc.cpp" #include "renderer_d3d11.cpp" #include "renderer_d3d12.cpp" #include "renderer_d3d9.cpp" diff --git a/src/bgfx.cpp b/src/bgfx.cpp index af96b5f37..24c2d846e 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -2584,6 +2584,7 @@ namespace bgfx } BGFX_RENDERER_CONTEXT(noop); + BGFX_RENDERER_CONTEXT(agc); BGFX_RENDERER_CONTEXT(d3d9); BGFX_RENDERER_CONTEXT(d3d11); BGFX_RENDERER_CONTEXT(d3d12); @@ -2607,6 +2608,7 @@ namespace bgfx static RendererCreator s_rendererCreator[] = { { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NOOP_NAME, true }, // Noop + { agc::rendererCreate, agc::rendererDestroy, BGFX_RENDERER_AGC_NAME, !!BGFX_CONFIG_RENDERER_AGC }, // GNM { d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9 { d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11 { d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12 diff --git a/src/bgfx_p.h b/src/bgfx_p.h index ab5a6bb83..2bef9ddfa 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -245,6 +245,8 @@ namespace stl = std; #define BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE UINT8_C(0x80) #define BGFX_SUBMIT_INTERNAL_RESERVED_MASK UINT8_C(0xff) +#define BGFX_RENDERER_NOOP_NAME "Noop" +#define BGFX_RENDERER_AGC_NAME "AGC" #define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9" #define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11" #define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12" @@ -253,7 +255,6 @@ namespace stl = std; #define BGFX_RENDERER_NVN_NAME "NVN" #define BGFX_RENDERER_VULKAN_NAME "Vulkan" #define BGFX_RENDERER_WEBGPU_NAME "WebGPU" -#define BGFX_RENDERER_NOOP_NAME "Noop" #if BGFX_CONFIG_RENDERER_OPENGL # if BGFX_CONFIG_RENDERER_OPENGL >= 31 && BGFX_CONFIG_RENDERER_OPENGL <= 33 diff --git a/src/config.h b/src/config.h index c744decf3..1566b321c 100644 --- a/src/config.h +++ b/src/config.h @@ -19,7 +19,8 @@ # define BGFX_CONFIG_DEBUG 0 #endif // BGFX_CONFIG_DEBUG -#if !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \ +#if !defined(BGFX_CONFIG_RENDERER_AGC) \ + && !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \ && !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \ && !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \ && !defined(BGFX_CONFIG_RENDERER_GNM) \ @@ -30,6 +31,12 @@ && !defined(BGFX_CONFIG_RENDERER_VULKAN) \ && !defined(BGFX_CONFIG_RENDERER_WEBGPU) +# ifndef BGFX_CONFIG_RENDERER_AGC +# define BGFX_CONFIG_RENDERER_AGC (0 \ + || BX_PLATFORM_PS5 \ + ? 1 : 0) +# endif // BGFX_CONFIG_RENDERER_AGC + # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \ || BX_PLATFORM_WINDOWS \ @@ -116,6 +123,10 @@ # endif // BGFX_CONFIG_RENDERER_WEBGPU #else +# ifndef BGFX_CONFIG_RENDERER_AGC +# define BGFX_CONFIG_RENDERER_AGC 0 +# endif // BGFX_CONFIG_RENDERER_AGC + # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 0 # endif // BGFX_CONFIG_RENDERER_DIRECT3D9 diff --git a/src/renderer_agc.cpp b/src/renderer_agc.cpp new file mode 100644 index 000000000..f1e41f98e --- /dev/null +++ b/src/renderer_agc.cpp @@ -0,0 +1,20 @@ +/* + * Copyright 2011-2021 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_p.h" + +namespace bgfx { namespace agc +{ + RendererContextI* rendererCreate(const Init& _init) + { + BX_UNUSED(_init); + return NULL; + } + + void rendererDestroy() + { + } + +} /* namespace agc */ } // namespace bgfx diff --git a/src/renderer_gnm.cpp b/src/renderer_gnm.cpp index 1592878b6..333bbb464 100644 --- a/src/renderer_gnm.cpp +++ b/src/renderer_gnm.cpp @@ -8,12 +8,12 @@ namespace bgfx { -#define BGFX_DECLARE_EMBEDDED_SHADER(_name) \ - extern const uint8_t* BX_CONCATENATE(_name, _pssl); \ - extern const uint32_t BX_CONCATENATE(_name, _pssl_size); \ - static const uint8_t BX_CONCATENATE(_name, _int_pssl)[] = { 0 }; \ - const uint8_t* BX_CONCATENATE(_name, _pssl) = &BX_CONCATENATE(_name, _int_pssl)[0]; \ - const uint32_t BX_CONCATENATE(_name, _pssl_size) = 1 +#define BGFX_DECLARE_EMBEDDED_SHADER(_name) \ + extern const uint8_t* BX_CONCATENATE(_name, _pssl); \ + extern const uint32_t BX_CONCATENATE(_name, _pssl_size); \ + static const uint8_t BX_CONCATENATE(_name, _int_pssl)[] = { 0 }; \ + const uint8_t* BX_CONCATENATE(_name, _pssl) = &BX_CONCATENATE(_name, _int_pssl)[0]; \ + const uint32_t BX_CONCATENATE(_name, _pssl_size) = 1 BGFX_DECLARE_EMBEDDED_SHADER(vs_debugfont); BGFX_DECLARE_EMBEDDED_SHADER(fs_debugfont); @@ -42,4 +42,5 @@ namespace bgfx { namespace gnm void rendererDestroy() { } + } /* namespace gnm */ } // namespace bgfx diff --git a/src/renderer_nvn.cpp b/src/renderer_nvn.cpp index a03f59bf0..799264a2c 100644 --- a/src/renderer_nvn.cpp +++ b/src/renderer_nvn.cpp @@ -8,10 +8,10 @@ namespace bgfx { -#define BGFX_DECLARE_EMBEDDED_SHADER(_name) \ - extern const uint8_t* BX_CONCATENATE(_name, _nvn); \ - extern const uint32_t BX_CONCATENATE(_name, _nvn_size); \ - static const uint8_t BX_CONCATENATE(_name, _int_nvn)[] = { 0 }; \ +#define BGFX_DECLARE_EMBEDDED_SHADER(_name) \ + extern const uint8_t* BX_CONCATENATE(_name, _nvn); \ + extern const uint32_t BX_CONCATENATE(_name, _nvn_size); \ + static const uint8_t BX_CONCATENATE(_name, _int_nvn)[] = { 0 }; \ const uint8_t* BX_CONCATENATE(_name, _nvn) = &BX_CONCATENATE(_name, _int_nvn)[0]; \ const uint32_t BX_CONCATENATE(_name, _nvn_size) = 1 @@ -42,4 +42,5 @@ namespace bgfx { namespace nvn void rendererDestroy() { } + } /* namespace nvn */ } // namespace bgfx diff --git a/src/vertexlayout.cpp b/src/vertexlayout.cpp index 2235bc36c..35bec28c0 100644 --- a/src/vertexlayout.cpp +++ b/src/vertexlayout.cpp @@ -44,6 +44,7 @@ namespace bgfx static const uint8_t (*s_attribTypeSize[])[AttribType::Count][4] = { &s_attribTypeSizeD3D9, // Noop + &s_attribTypeSizeD3D1x, // Agc &s_attribTypeSizeD3D9, // Direct3D9 &s_attribTypeSizeD3D1x, // Direct3D11 &s_attribTypeSizeD3D1x, // Direct3D12