Added per-format MSAA sample count caps, and clamp MSAA requests per format. Closes #1396. (#4072)

This commit is contained in:
Branimir Karadžić
2026-10-20 20:35:15 -07:00
committed by GitHub
parent 1845ed5d8e
commit 8b8050788c
20 changed files with 302 additions and 66 deletions
@@ -646,7 +646,7 @@ public final class Bgfx {
* <strong>Attention:</strong> This call doesn’t change the window size, it just resizes
* the back-buffer. Your windowing code controls the window size.
* @param _flags See: {@code BGFX_RESET_*} for more info. - {@code BGFX_RESET_NONE} - No reset flags. - {@code BGFX_RESET_VSYNC} - Enable V-Sync. - {@code BGFX_RESET_MAXANISOTROPY} - Turn on/off max anisotropy. - {@code BGFX_RESET_CAPTURE} - Begin screen capture. - {@code BGFX_RESET_FLUSH_AFTER_RENDER} - Flush rendering after submitting to GPU. - {@code BGFX_RESET_FLIP_AFTER_RENDER} - This flag specifies where flip occurs. Default behaviour is that flip occurs before rendering new frame. This flag only has effect when {@code BGFX_CONFIG_MULTITHREADED=0}. - {@code BGFX_RESET_LOW_LATENCY_ON} - Enable low latency mode (NVIDIA Reflex). Availability depends on: {@code BGFX_CAPS_LOW_LATENCY}. - {@code BGFX_RESET_LOW_LATENCY_BOOST} - Enable low latency mode, and keep GPU clocks high even when GPU is mostly idle. Availability depends on: {@code BGFX_CAPS_LOW_LATENCY}. Set either {@code BGFX_RESET_LOW_LATENCY_ON} or {@code BGFX_RESET_LOW_LATENCY_BOOST}, not both. Per-surface settings are not here. {@code BGFX_SWAP_CHAIN_*} flags belong on {@code SwapChain.flags}, and are ignored if passed here.
* @param _swapChain Main window swap chain. When {@code NULL} the main window is left untouched and only the device and frame globals above are applied, which is what an application driving its own swap chains wants. Otherwise the main window takes on this description: resize it, change its format, or change its per-surface flags. Fields left neutral keep their current value, and {@code nwh}/{@code ndt} are ignored -- main's are bgfx's own. Must be {@code NULL} when {@code init} created no main window.
* @param _swapChain Main window swap chain. When {@code NULL} the main window is left untouched and only the device and frame globals above are applied, which is what an application driving its own swap chains wants. Otherwise the main window takes on this description: resize it, change its format, or change its per-surface flags. Fields left neutral keep their current value. A new {@code nwh} moves the main window to another native window: the renderer recreates the main swap chain for it and keeps the device, context and every GPU resource. {@code ndt} must stay what {@code init} received. Must be {@code NULL} when {@code init} created no main window.
*/
public static void reset(@Unsigned int _flags, @Nullable SwapChain _swapChain) {
try {
@@ -2435,7 +2435,7 @@ public final class Bgfx {
/**
* Set shader uniform parameter for frame.
* <p>
* <strong>Attention:</strong> Uniform must be created with {@code UniformFreq.VIEW} argument.
* <strong>Attention:</strong> Uniform must be created with {@code UniformFreq.FRAME} argument.
* @param _handle Uniform.
* @param _value Pointer to uniform data.
* @param _num Number of elements. Passing {@code UINT16_MAX} will use the _num passed on uniform creation.
@@ -5063,6 +5063,26 @@ public final class Bgfx {
* Texture format can be used as video decode destination.
*/
public static final int TextureVideoDecodeDst = 0x00020000;
/**
* Texture format can be used as MSAA frame buffer with 2 samples.
*/
public static final int TextureFramebufferMsaaX2 = 0x00040000;
/**
* Texture format can be used as MSAA frame buffer with 4 samples.
*/
public static final int TextureFramebufferMsaaX4 = 0x00080000;
/**
* Texture format can be used as MSAA frame buffer with 8 samples.
*/
public static final int TextureFramebufferMsaaX8 = 0x00100000;
/**
* Texture format can be used as MSAA frame buffer with 16 samples.
*/
public static final int TextureFramebufferMsaaX16 = 0x00200000;
}
/**