| 195 | } |
| 196 | |
| 197 | static WebGPUTexture* WebGPUNewTextureInternal(const TextureCreationParams& params) |
| 198 | { |
| 199 | TRACE_CALL; |
| 200 | WebGPUTexture* texture = new WebGPUTexture; |
| 201 | texture->m_Base.m_Type = params.m_Type; |
| 202 | texture->m_Base.m_Width = params.m_Width; |
| 203 | texture->m_Base.m_Height = params.m_Height; |
| 204 | texture->m_Base.m_Depth = params.m_Depth; |
| 205 | texture->m_Base.m_MipMapCount = params.m_MipMapCount; |
| 206 | #if defined(DM_GRAPHICS_WEBGPU_WAGYU) |
| 207 | if (params.m_UsageHintBits & TEXTURE_USAGE_FLAG_INPUT) |
| 208 | texture->m_UsageFlags |= WGPUTextureUsage_WagyuInputAttachment; |
| 209 | if (params.m_UsageHintBits & TEXTURE_USAGE_FLAG_MEMORYLESS) |
| 210 | texture->m_UsageFlags |= WGPUTextureUsage_WagyuTransientAttachment; |
| 211 | #endif |
| 212 | if (params.m_UsageHintBits & TEXTURE_USAGE_FLAG_SAMPLE) |
| 213 | texture->m_UsageFlags |= WGPUTextureUsage_TextureBinding; |
| 214 | if (params.m_UsageHintBits & TEXTURE_USAGE_FLAG_STORAGE) |
| 215 | texture->m_UsageFlags |= WGPUTextureUsage_StorageBinding; |
| 216 | if (params.m_UsageHintBits & TEXTURE_USAGE_FLAG_COLOR) |
| 217 | texture->m_UsageFlags |= WGPUTextureUsage_RenderAttachment; |
| 218 | texture->m_Base.m_UsageHintFlags = params.m_UsageHintBits; |
| 219 | texture->m_Base.m_PageCount = params.m_LayerCount; |
| 220 | |
| 221 | if (params.m_OriginalWidth == 0) |
| 222 | { |
| 223 | texture->m_Base.m_OriginalWidth = params.m_Width; |
| 224 | texture->m_Base.m_OriginalHeight = params.m_Height; |
| 225 | texture->m_Base.m_OriginalDepth = params.m_Depth; |
| 226 | } |
| 227 | else |
| 228 | { |
| 229 | texture->m_Base.m_OriginalWidth = params.m_OriginalWidth; |
| 230 | texture->m_Base.m_OriginalHeight = params.m_OriginalHeight; |
| 231 | texture->m_Base.m_OriginalDepth = params.m_OriginalDepth; |
| 232 | } |
| 233 | return texture; |
| 234 | } |
| 235 | |
| 236 | static void WebGPUSetTextureParamsInternal(WebGPUTexture* texture, TextureFilter minfilter, TextureFilter magfilter, TextureWrap uwrap, TextureWrap vwrap, float max_anisotropy) |
| 237 | { |
no outgoing calls
no test coverage detected