CNA-BUG-118: GraphicsDevice::GetMaxTextureDimension() is documented as the renderer's real maximum, but most renderers return an unqueried 16384 that the capability profile marks as known
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
Only VULKAN, DIRECT2D and GDI report a real or bounded limit; the other families inherit a constant 16384 (no code in the repository queries GL_MAX_TEXTURE_SIZE), which the renderer capability profile nevertheless reports as a known limit.
- Identifier
CNA-BUG-118- Category
- Bug
- Subsystem
- Graphics & renderers
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Severity
- Low (a triage suggestion, not a project priority)
- Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- GraphicsDevice::GetMaxTextureDimension() (CNAEXT); RendererLimit::MaxTextureDimension in the renderer capability profile
Expected behaviour
GraphicsDevice.hpp: “Returns the active renderer's real maximum single-axis texture dimension”, to be queried before accepting a caller- or file-supplied size so that the native API does not fail or corrupt memory.
Actual behaviour at TARGET
IGraphicsRenderer::GetMaxTextureDimension in IGraphicsRenderer.hpp returns 16384. Its comment justifies the default as the guaranteed ceiling on every native API the project targets and says no renderer currently needs a tighter or looser override; that is stale (VULKAN, DIRECT2D and GDI override) and untrue for GLES, WebGL and Vulkan, whose guarantees are far lower. VULKAN (maxImageDimension2D), DIRECT2D (GetMaximumBitmapSize) and GDI (a fixed software-framebuffer ceiling) override; FNA3D overrides only to return the default because FNA3D has no query. EasyGL, OPENGL4, SDL_GPU, WEBGPU (which holds deviceLimits_.maxTextureDimension2D but does not return it) and the rest inherit 16384. GraphicsDevice.cpp sets RendererLimit::MaxTextureDimension known whenever the value is non-negative. The sized Texture2D constructors, Texture2D::FromStream, the XNB reader and every RenderTarget2D constructor check the GraphicsProfile ceiling (2048 Reach, 4096 HiDef) before the device maximum, so a device limited to 4096 or 8192 is not exposed through them; the CNAEXT file-path constructor Texture2D(assetName, device) and Texture2D::CreateFromPixels perform no size validation at all. The unqueried value reaches the native API through paths that trust the device limit and its known flag: StorageTexture2D and Texture2DArray preparation, engine-layer render-target sizes (EngineLayerTextureSizeScope::MaxRenderTargetSize), and any application that reads the reported value.
Source locations
modules/graphics/include/CNA/Internal/Renderers/Common/IGraphicsRenderer.hpp— GetMaxTextureDimension default and its 'no renderer overrides' commentmodules/graphics/src/Xna/GraphicsDevice.cpp— BuildRendererCapabilityProfileEXT: SetLimit(MaxTextureDimension, value >= 0, ...)modules/renderers/vulkan/src/VulkanRenderer.cpp— GetMaxTextureDimension from maxImageDimension2Dmodules/renderers/direct2d/src/Direct2DRenderer.cpp— GetMaxTextureDimension from GetMaximumBitmapSizemodules/renderers/gdi/src/GdiRenderer.cpp— GetMaxTextureDimension from SoftwareFramebufferMaxDimensionmodules/graphics/src/Xna/Texture2D.cpp— size validation against GetMaxTextureDimension
Evidence
Checked by reading at 009d40f5; not executed.
Independent re-verification: Checked by reading at 009d40f5; not executed. Blast radius is narrower than first written: the sized, stream and content-reader Texture2D paths and RenderTarget2D are bounded by the profile ceiling; the exposure is EXT texture types, engine-layer allocations and callers that treat the reported maximum as the truth on devices whose real limit is below 16384. The unvalidated file-path constructor is a separate missing check that a correct maximum would not fix.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
No test compares the reported maximum with a device query on the GL, SDL_GPU or WebGPU families.
Regression test
Per family, a test that the reported value equals the native limit (GL_MAX_TEXTURE_SIZE, SDL_GPU and WebGPU device limits), or that the profile marks the limit unknown when not queried.
Blast radius
Oversized textures from files or callers on devices whose limit is below 16384 (mobile GLES, WebGL); they reach the native API instead of being refused cleanly. Desktop devices at or above 16384 are unaffected.
Workaround
Clamp texture sizes to the target platform's known limit in content.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Deep dives
- Capability model: evidence · Content robustness
- Known issues
- Bug index