Files
XCSDD/docs/api/rhi/device/create-texture.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

39 lines
919 B
Markdown

# RHIDevice::CreateTexture
```cpp
virtual RHITexture* CreateTexture(const TextureDesc& desc) = 0;
```
创建 GPU 纹理资源。
**参数:**
- `desc` - 纹理描述符,包含尺寸、格式、纹理类型等
**返回:** 新创建的纹理指针,失败返回 `nullptr`
**复杂度:** O(1)
**示例:**
```cpp
TextureDesc textureDesc;
textureDesc.width = 1024;
textureDesc.height = 1024;
textureDesc.depth = 1;
textureDesc.mipLevels = 1;
textureDesc.arraySize = 1;
textureDesc.format = (uint32_t)Format::R8G8B8A8_UNorm;
textureDesc.textureType = (uint32_t)TextureType::Texture2D;
textureDesc.sampleCount = 1;
textureDesc.sampleQuality = 0;
textureDesc.flags = 0;
RHITexture* texture = device->CreateTexture(textureDesc);
```
## 相关文档
- [RHIDevice 总览](device.md) - 返回类总览
- [RHITexture](../texture/texture.md) - 纹理类
- [TextureDesc](../types/types.md) - 纹理描述结构体