这是indexloc提供的服务,不要输入任何密码
Skip to content

Limit for the maximum resource size? #3916

@kainino0x

Description

@kainino0x

We added maxBufferSize in #3366, and searching for what this would be on D3D12 I found this D3D11 FL11 page (which probably applies to D3D12, but I don't know for sure):
https://learn.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-resources-limits

Resource size (in MB) for any of the preceding resources min(max(128,0.25f * (amount of dedicated VRAM)), 2048) MB

"preceding resources" seems to apply to constant buffers, non-constant buffers, and all dimensions of textures. Notably, it is not an error in usage of the API if you try to allocate larger than this size, and in fact it may even be allowed:

An app can try to allocate more memory for a resource than the maximum resource size specifies. That is, the Direct3D 11 runtime allows these memory allocation attempts in the event that the hardware might support them. However, the Direct3D 11 runtime only guarantees that allocations within the maximum resource size are supported by all feature level 11 hardware. If an app tries to allocate memory for a resource within the maximum resource size, the runtime fails the attempt only if the operating system runs out of resources. If an app tries to allocate memory for a resource above the maximum resource size, the runtime can fail the attempt because either the operating system is overextended or the hardware does not support allocations above the maximum resource size. The debug layer only checks D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM (128) MB.

Therefore I don't think it makes sense to add a maxResourceSize or maxTextureAllocation limit to WebGPU. But I wanted to document that.

As an aside on maxBufferSize implementation strategy, it may or may not make sense to determine the maxBufferSize based on this limit, since it's a soft limit. If the implementation knows the total VRAM size it could at least limit to min(4GiB, total VRAM) or something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions