CNA-PLAT-001: CANVAS, FREEDIRECT, SDL_RENDERER, HTML_DOM and SVG_DOM throw for any Texture2D mip level above 0, so mipmapped textures (including XNB textures with mip chains) cannot be uploaded there
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.
The texture renderers of CANVAS, FREEDIRECT, SDL_RENDERER, HTML_DOM and SVG_DOM throw std::runtime_error from UpdatePixelsLevel for level > 0 because Canvas 2D, DirectDraw, SDL_Renderer and DOM surfaces have no mip chain; the XNB Texture2D reader uploads every level it reads.
- Identifier
CNA-PLAT-001- Category
- Platform limitation
- Subsystem
- Graphics & renderers
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- Texture2D::SetData(level > 0, ...) and ContentManager::Load<Texture2D> of mipmapped assets on CANVAS and FREEDIRECT
Expected behaviour
On renderers without mip sampling a mip chain can only be ignored; XNA content commonly ships textures with generated mip levels.
Actual behaviour at TARGET
CanvasTextureRenderer::UpdatePixelsLevel (CanvasTextureRenderer.cpp), the FreeDirect texture and render-target renderers (ThrowMipLevelUnsupported in FreeDirectRenderer.cpp), SdlTextureRenderer::UpdatePixelsLevel (SdlRenderer.cpp), HtmlDomTextureRenderer::UpdatePixelsLevel and SvgDomTextureRenderer::UpdatePixelsLevel throw std::runtime_error for level != 0 ("does not support mip-level texture uploads ... Use Texture2D::SetData(level=0, ...) only"), and each renderer's doc marks this throws-by-design. The XNB reader (Texture2DContentTypeReader.cpp) creates the texture with mipMap = levelCount > 1 and calls SetData(level, ...) for every level; Texture2D::SetData forwards level > 0 to the renderer, so a mipmapped XNB texture fails to load on these renderers with a std::runtime_error rather than a NotSupportedException.
Source locations
modules/renderers/canvas/src/CanvasTextureRenderer.cpp— CanvasTextureRenderer::UpdatePixelsLevelmodules/renderers/freedirect/src/FreeDirectRenderer.cpp— ThrowMipLevelUnsupported and the texture renderers' level uploadsmodules/content/src/Xnb/Texture2DContentTypeReader.cpp— per-level SetData loop
Evidence
Checked by reading the named sources at 009d40f5; nothing was built or executed for this entry. The XNB consequence is inferred from the reader's upload loop; no mipmapped asset was loaded on either renderer.
Independent re-verification: Checked by reading the named sources at 009d40f5; nothing was built or executed for this entry. The XNB consequence is traced through Texture2DReader, Texture2D::SetData and the renderers' level uploads; no mipmapped asset was loaded on any renderer. Tests: Check C of freedirect_texture_rendertarget_test.cpp pins the FreeDirect throw; no CANVAS test exists and no test loads a mipmapped XNB texture on these renderers.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
No CANVAS or FREEDIRECT test loads a mipmapped texture.
Regression test
A test that loads a mipmapped XNB texture on each renderer and expects either success (levels ignored) or a documented NotSupportedException.
Blast radius
Games whose content was built with mipmaps and that target CANVAS or FREEDIRECT.
Workaround
Rebuild textures without mipmaps for these targets.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Known issues
- Platform limitation index