| 1 |
/* |
| 2 |
* Copyright 2020 Google LLC |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
#include "src/gpu/ganesh/d3d/GrD3DCaps.h" |
| 8 |
|
| 9 |
#include "include/core/SkTextureCompressionType.h" |
| 10 |
#include "include/gpu/ganesh/GrBackendSurface.h" |
| 11 |
#include "include/gpu/ganesh/GrContextOptions.h" |
| 12 |
#include "include/gpu/ganesh/d3d/GrD3DBackendContext.h" |
| 13 |
#include "include/gpu/ganesh/d3d/GrD3DTypes.h" |
| 14 |
#include "src/core/SkCompressedDataUtils.h" |
| 15 |
#include "src/gpu/KeyBuilder.h" |
| 16 |
#include "src/gpu/ganesh/GrBackendUtils.h" |
| 17 |
#include "src/gpu/ganesh/GrProgramDesc.h" |
| 18 |
#include "src/gpu/ganesh/GrProgramInfo.h" |
| 19 |
#include "src/gpu/ganesh/GrRenderTargetProxy.h" |
| 20 |
#include "src/gpu/ganesh/GrShaderCaps.h" |
| 21 |
#include "src/gpu/ganesh/GrStencilSettings.h" |
| 22 |
#include "src/gpu/ganesh/TestFormatColorTypeCombination.h" |
| 23 |
#include "src/gpu/ganesh/d3d/GrD3DGpu.h" |
| 24 |
#include "src/gpu/ganesh/d3d/GrD3DRenderTarget.h" |
| 25 |
#include "src/gpu/ganesh/d3d/GrD3DTexture.h" |
| 26 |
#include "src/gpu/ganesh/d3d/GrD3DUtil.h" |
| 27 |
|
| 28 |
GrD3DCaps::GrD3DCaps(const GrContextOptions& contextOptions, IDXGIAdapter1* adapter, |
| 29 |
ID3D12Device* device) |
| 30 |
: INHERITED(contextOptions) { |
| 31 |
/************************************************************************** |
| 32 |
* GrCaps fields |
| 33 |
**************************************************************************/ |
| 34 |
fNPOTTextureTileSupport = true; // available in feature level 10_0 and up |
| 35 |
fMipmapSupport = true; // always available in Direct3D |
| 36 |
fAnisoSupport = true; // always available in Direct3D |
| 37 |
fReuseScratchTextures = true; //TODO: figure this out |
| 38 |
fGpuTracingSupport = false; //TODO: figure this out |
| 39 |
fOversizedStencilSupport = false; //TODO: figure this out |
| 40 |
fDrawInstancedSupport = true; |
| 41 |
fNativeDrawIndirectSupport = true; |
| 42 |
|
| 43 |
fSemaphoreSupport = true; |
| 44 |
fBackendSemaphoreSupport = true; |
| 45 |
fFinishedProcAsyncCallbackSupport = true; |
| 46 |
// TODO: implement these |
| 47 |
fCrossContextTextureSupport = false; |
| 48 |
fHalfFloatVertexAttributeSupport = false; |
| 49 |
|
| 50 |
// We always copy in/out of a transfer buffer so it's trivial to support row bytes. |
| 51 |
fReadPixelsRowBytesSupport = true; |
| 52 |
fWritePixelsRowBytesSupport = true; |
| 53 |
fTransferPixelsToRowBytesSupport = true; |
| 54 |
|
| 55 |
fTransferFromBufferToTextureSupport = true; |
| 56 |
fTransferFromSurfaceToBufferSupport = true; |
| 57 |
fTransferFromBufferToBufferSupport = true; |
| 58 |
|
| 59 |
fMaxRenderTargetSize = 16384; // minimum required by feature level 11_0 |
| 60 |
fMaxTextureSize = 16384; // minimum required by feature level 11_0 |
| 61 |
|
| 62 |
fTransferBufferRowBytesAlignment = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT; |
| 63 |
|
| 64 |
// TODO: implement |
| 65 |
fDynamicStateArrayGeometryProcessorTextureSupport = false; |
| 66 |
|
| 67 |
fShaderCaps = std::make_unique<GrShaderCaps>(); |
| 68 |
|
| 69 |
this->init(contextOptions, adapter, device); |
| 70 |
} |
| 71 |
|
| 72 |
bool GrD3DCaps::canCopyTexture(DXGI_FORMAT dstFormat, int dstSampleCnt, |
| 73 |
DXGI_FORMAT srcFormat, int srcSampleCnt) const { |
| 74 |
if ((dstSampleCnt > 1 || srcSampleCnt > 1) && dstSampleCnt != srcSampleCnt) { |
| 75 |
return false; |
| 76 |
} |
| 77 |
|
| 78 |
// D3D allows us to copy within the same format family but doesn't do conversions |
| 79 |
// so we require strict identity. |
| 80 |
return srcFormat == dstFormat; |
| 81 |
} |
| 82 |
|
| 83 |
bool GrD3DCaps::canCopyAsResolve(DXGI_FORMAT dstFormat, int dstSampleCnt, |
| 84 |
DXGI_FORMAT srcFormat, int srcSampleCnt) const { |
| 85 |
// The src surface must be multisampled. |
| 86 |
if (srcSampleCnt <= 1) { |
| 87 |
return false; |
| 88 |
} |
| 89 |
|
| 90 |
// The dst must not be multisampled. |
| 91 |
if (dstSampleCnt > 1) { |
| 92 |
return false; |
| 93 |
} |
| 94 |
|
| 95 |
// Surfaces must have the same format. |
| 96 |
// D3D12 can resolve between typeless and non-typeless formats, but we are not using |
| 97 |
// typeless formats. It's not possible to resolve within the same format family otherwise. |
| 98 |
if (srcFormat != dstFormat) { |
| 99 |
return false; |
| 100 |
} |
| 101 |
|
| 102 |
return true; |
| 103 |
} |
| 104 |
|
| 105 |
bool GrD3DCaps::onCanCopySurface(const GrSurfaceProxy* dst, const SkIRect& dstRect, |
| 106 |
const GrSurfaceProxy* src, const SkIRect& srcRect) const { |
| 107 |
// D3D12 does not support scaling copies |
| 108 |
if (srcRect.size() != dstRect.size()) { |
| 109 |
return false; |
| 110 |
} |
| 111 |
if (src->isProtected() == GrProtected::kYes && dst->isProtected() != GrProtected::kYes) { |
| 112 |
return false; |
| 113 |
} |
| 114 |
|
| 115 |
int dstSampleCnt = 0; |
| 116 |
int srcSampleCnt = 0; |
| 117 |
if (const GrRenderTargetProxy* rtProxy = dst->asRenderTargetProxy()) { |
| 118 |
dstSampleCnt = rtProxy->numSamples(); |
| 119 |
} |
| 120 |
if (const GrRenderTargetProxy* rtProxy = src->asRenderTargetProxy()) { |
| 121 |
srcSampleCnt = rtProxy->numSamples(); |
| 122 |
} |
| 123 |
SkASSERT((dstSampleCnt > 0) == SkToBool(dst->asRenderTargetProxy())); |
| 124 |
SkASSERT((srcSampleCnt > 0) == SkToBool(src->asRenderTargetProxy())); |
| 125 |
|
| 126 |
DXGI_FORMAT dstFormat, srcFormat; |
| 127 |
SkAssertResult(dst->backendFormat().asDxgiFormat(&dstFormat)); |
| 128 |
SkAssertResult(src->backendFormat().asDxgiFormat(&srcFormat)); |
| 129 |
|
| 130 |
return this->canCopyTexture(dstFormat, dstSampleCnt, srcFormat, srcSampleCnt) || |
| 131 |
this->canCopyAsResolve(dstFormat, dstSampleCnt, srcFormat, srcSampleCnt); |
| 132 |
} |
| 133 |
|
| 134 |
void GrD3DCaps::init(const GrContextOptions& contextOptions, IDXGIAdapter1* adapter, |
| 135 |
ID3D12Device* device) { |
| 136 |
D3D_FEATURE_LEVEL featureLevels[] = { |
| 137 |
D3D_FEATURE_LEVEL_11_0, |
| 138 |
D3D_FEATURE_LEVEL_11_1, |
| 139 |
D3D_FEATURE_LEVEL_12_0, |
| 140 |
D3D_FEATURE_LEVEL_12_1, |
| 141 |
}; |
| 142 |
D3D12_FEATURE_DATA_FEATURE_LEVELS flDesc = {}; |
| 143 |
flDesc.NumFeatureLevels = _countof(featureLevels); |
| 144 |
flDesc.pFeatureLevelsRequested = featureLevels; |
| 145 |
GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &flDesc, |
| 146 |
sizeof(flDesc))); |
| 147 |
// This had better be true |
| 148 |
SkASSERT(flDesc.MaxSupportedFeatureLevel >= D3D_FEATURE_LEVEL_11_0); |
| 149 |
|
| 150 |
DXGI_ADAPTER_DESC adapterDesc; |
| 151 |
GR_D3D_CALL_ERRCHECK(adapter->GetDesc(&adapterDesc)); |
| 152 |
|
| 153 |
D3D12_FEATURE_DATA_D3D12_OPTIONS optionsDesc; |
| 154 |
GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &optionsDesc, |
| 155 |
sizeof(optionsDesc))); |
| 156 |
|
| 157 |
|
| 158 |
// See https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-support |
| 159 |
if (D3D12_RESOURCE_BINDING_TIER_1 == optionsDesc.ResourceBindingTier) { |
| 160 |
fMaxPerStageShaderResourceViews = 128; |
| 161 |
if (D3D_FEATURE_LEVEL_11_0 == flDesc.MaxSupportedFeatureLevel) { |
| 162 |
fMaxPerStageUnorderedAccessViews = 8; |
| 163 |
} else { |
| 164 |
fMaxPerStageUnorderedAccessViews = 64; |
| 165 |
} |
| 166 |
} else { |
| 167 |
// The doc above says "full heap", but practically it seems like it should be |
| 168 |
// limited by the maximum number of samplers in a heap |
| 169 |
fMaxPerStageUnorderedAccessViews = 2032; |
| 170 |
fMaxPerStageShaderResourceViews = 2032; |
| 171 |
} |
| 172 |
|
| 173 |
fStandardSwizzleLayoutSupport = (optionsDesc.StandardSwizzle64KBSupported); |
| 174 |
|
| 175 |
D3D12_FEATURE_DATA_D3D12_OPTIONS2 optionsDesc2; |
| 176 |
GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &optionsDesc2, |
| 177 |
sizeof(optionsDesc2))); |
| 178 |
fResolveSubresourceRegionSupport = (optionsDesc2.ProgrammableSamplePositionsTier != |
| 179 |
D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED); |
| 180 |
|
| 181 |
this->initGrCaps(optionsDesc, device); |
| 182 |
this->initShaderCaps(adapterDesc.VendorId, optionsDesc); |
| 183 |
|
| 184 |
this->initFormatTable(adapterDesc, device); |
| 185 |
this->initStencilFormat(device); |
| 186 |
|
| 187 |
if (!contextOptions.fDisableDriverCorrectnessWorkarounds) { |
| 188 |
this->applyDriverCorrectnessWorkarounds(adapterDesc.VendorId); |
| 189 |
} |
| 190 |
|
| 191 |
this->finishInitialization(contextOptions); |
| 192 |
} |
| 193 |
|
| 194 |
void GrD3DCaps::initGrCaps(const D3D12_FEATURE_DATA_D3D12_OPTIONS& optionsDesc, |
| 195 |
ID3D12Device* device) { |
| 196 |
// We assume a minimum of Shader Model 5.1, which allows at most 32 vertex inputs. |
| 197 |
fMaxVertexAttributes = 32; |
| 198 |
|
| 199 |
// Can use standard sample locations |
| 200 |
fSampleLocationsSupport = true; |
| 201 |
|
| 202 |
if (D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED != |
| 203 |
optionsDesc.ConservativeRasterizationTier) { |
| 204 |
fConservativeRasterSupport = true; |
| 205 |
} |
| 206 |
|
| 207 |
fWireframeSupport = true; |
| 208 |
|
| 209 |
// Feature level 11_0 and up support up to 16K in texture dimension |
| 210 |
fMaxTextureSize = 16384; |
| 211 |
// There's no specific cap for RT size, so use texture size |
| 212 |
fMaxRenderTargetSize = fMaxTextureSize; |
| 213 |
// Our render targets are always created with textures as the color |
| 214 |
// attachment, hence this min: |
| 215 |
fMaxRenderTargetSize = fMaxTextureSize; |
| 216 |
|
| 217 |
fMaxPreferredRenderTargetSize = fMaxRenderTargetSize; |
| 218 |
|
| 219 |
// Assuming since we will always map in the end to upload the data we might as well just map |
| 220 |
// from the get go. There is no hard data to suggest this is faster or slower. |
| 221 |
fBufferMapThreshold = 0; |
| 222 |
|
| 223 |
fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag | kAsyncRead_MapFlag; |
| 224 |
|
| 225 |
fOversizedStencilSupport = true; |
| 226 |
|
| 227 |
fTwoSidedStencilRefsAndMasksMustMatch = true; |
| 228 |
|
| 229 |
// Advanced blend modes don't appear to be supported. |
| 230 |
} |
| 231 |
|
| 232 |
void GrD3DCaps::initShaderCaps(int vendorID, const D3D12_FEATURE_DATA_D3D12_OPTIONS& optionsDesc) { |
| 233 |
GrShaderCaps* shaderCaps = fShaderCaps.get(); |
| 234 |
shaderCaps->fVersionDeclString = "#version 330\n"; |
| 235 |
|
| 236 |
shaderCaps->fFlatInterpolationSupport = true; // Supported by Shader Model 5 |
| 237 |
// Flat interpolation appears to be slow on Qualcomm GPUs. This was tested in GL and is assumed |
| 238 |
// to be true with D3D as well. |
| 239 |
shaderCaps->fPreferFlatInterpolation = kQualcomm_D3DVendor != vendorID; |
| 240 |
|
| 241 |
shaderCaps->fSampleMaskSupport = true; |
| 242 |
|
| 243 |
shaderCaps->fShaderDerivativeSupport = true; |
| 244 |
shaderCaps->fExplicitTextureLodSupport = true; |
| 245 |
|
| 246 |
shaderCaps->fDualSourceBlendingSupport = true; |
| 247 |
|
| 248 |
shaderCaps->fIntegerSupport = true; |
| 249 |
shaderCaps->fNonsquareMatrixSupport = true; |
| 250 |
// TODO(skbug.com/40043434) HLSL does not expose asinh/acosh/atanh |
| 251 |
shaderCaps->fInverseHyperbolicSupport = false; |
| 252 |
shaderCaps->fVertexIDSupport = true; |
| 253 |
shaderCaps->fInfinitySupport = true; |
| 254 |
shaderCaps->fNonconstantArrayIndexSupport = true; |
| 255 |
shaderCaps->fBitManipulationSupport = true; |
| 256 |
|
| 257 |
shaderCaps->fFloatIs32Bits = true; |
| 258 |
shaderCaps->fHalfIs32Bits = |
| 259 |
D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE == optionsDesc.MinPrecisionSupport; |
| 260 |
|
| 261 |
// See https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-support |
| 262 |
// The maximum number of samplers in a shader-visible descriptor heap is 2048, but |
| 263 |
// 16 of those are reserved for the driver. |
| 264 |
shaderCaps->fMaxFragmentSamplers = |
| 265 |
(D3D12_RESOURCE_BINDING_TIER_1 == optionsDesc.ResourceBindingTier) ? 16 : 2032; |
| 266 |
} |
| 267 |
|
| 268 |
void GrD3DCaps::applyDriverCorrectnessWorkarounds(int vendorID) { |
| 269 |
// Nothing yet. |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
bool stencil_format_supported(ID3D12Device* device, DXGI_FORMAT format) { |
| 274 |
D3D12_FEATURE_DATA_FORMAT_SUPPORT formatSupportDesc; |
| 275 |
formatSupportDesc.Format = format; |
| 276 |
GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, |
| 277 |
&formatSupportDesc, |
| 278 |
sizeof(formatSupportDesc))); |
| 279 |
return SkToBool(D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL & formatSupportDesc.Support1); |
| 280 |
} |
| 281 |
|
| 282 |
void GrD3DCaps::initStencilFormat(ID3D12Device* device) { |
| 283 |
if (stencil_format_supported(device, DXGI_FORMAT_D24_UNORM_S8_UINT)) { |
| 284 |
fPreferredStencilFormat = DXGI_FORMAT_D24_UNORM_S8_UINT; |
| 285 |
} else { |
| 286 |
SkASSERT(stencil_format_supported(device, DXGI_FORMAT_D32_FLOAT_S8X24_UINT)); |
| 287 |
fPreferredStencilFormat = DXGI_FORMAT_D32_FLOAT_S8X24_UINT; |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
// These are all the valid DXGI_FORMATs that we support in Skia. They are roughly ordered from most |
| 292 |
// frequently used to least to improve look up times in arrays. |
| 293 |
static constexpr DXGI_FORMAT kDxgiFormats[] = { |
| 294 |
DXGI_FORMAT_R8G8B8A8_UNORM, |
| 295 |
DXGI_FORMAT_R8_UNORM, |
| 296 |
DXGI_FORMAT_B8G8R8A8_UNORM, |
| 297 |
DXGI_FORMAT_B5G6R5_UNORM, |
| 298 |
DXGI_FORMAT_R16G16B16A16_FLOAT, |
| 299 |
DXGI_FORMAT_R16_FLOAT, |
| 300 |
DXGI_FORMAT_R8G8_UNORM, |
| 301 |
DXGI_FORMAT_R10G10B10A2_UNORM, |
| 302 |
DXGI_FORMAT_B4G4R4A4_UNORM, |
| 303 |
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, |
| 304 |
DXGI_FORMAT_BC1_UNORM, |
| 305 |
DXGI_FORMAT_R16_UNORM, |
| 306 |
DXGI_FORMAT_R16G16_UNORM, |
| 307 |
DXGI_FORMAT_R16G16B16A16_UNORM, |
| 308 |
DXGI_FORMAT_R16G16_FLOAT |
| 309 |
}; |
| 310 |
|
| 311 |
void GrD3DCaps::setColorType(GrColorType colorType, std::initializer_list<DXGI_FORMAT> formats) { |
| 312 |
#ifdef SK_DEBUG |
| 313 |
for (size_t i = 0; i < kNumDxgiFormats; ++i) { |
| 314 |
const auto& formatInfo = fFormatTable[i]; |
| 315 |
for (int j = 0; j < formatInfo.fColorTypeInfoCount; ++j) { |
| 316 |
const auto& ctInfo = formatInfo.fColorTypeInfos[j]; |
| 317 |
if (ctInfo.fColorType == colorType && |
| 318 |
!SkToBool(ctInfo.fFlags & ColorTypeInfo::kWrappedOnly_Flag)) { |
| 319 |
bool found = false; |
| 320 |
for (auto it = formats.begin(); it != formats.end(); ++it) { |
| 321 |
if (kDxgiFormats[i] == *it) { |
| 322 |
found = true; |
| 323 |
} |
| 324 |
} |
| 325 |
SkASSERT(found); |
| 326 |
} |
| 327 |
} |
| 328 |
} |
| 329 |
#endif |
| 330 |
int idx = static_cast<int>(colorType); |
| 331 |
for (auto it = formats.begin(); it != formats.end(); ++it) { |
| 332 |
const auto& info = this->getFormatInfo(*it); |
| 333 |
for (int i = 0; i < info.fColorTypeInfoCount; ++i) { |
| 334 |
if (info.fColorTypeInfos[i].fColorType == colorType) { |
| 335 |
fColorTypeToFormatTable[idx] = *it; |
| 336 |
return; |
| 337 |
} |
| 338 |
} |
| 339 |
} |
| 340 |
} |
| 341 |
|
| 342 |
const GrD3DCaps::FormatInfo& GrD3DCaps::getFormatInfo(DXGI_FORMAT format) const { |
| 343 |
GrD3DCaps* nonConstThis = const_cast<GrD3DCaps*>(this); |
| 344 |
return nonConstThis->getFormatInfo(format); |
| 345 |
} |
| 346 |
|
| 347 |
GrD3DCaps::FormatInfo& GrD3DCaps::getFormatInfo(DXGI_FORMAT format) { |
| 348 |
static_assert(std::size(kDxgiFormats) == GrD3DCaps::kNumDxgiFormats, |
| 349 |
"Size of DXGI_FORMATs array must match static value in header"); |
| 350 |
for (size_t i = 0; i < std::size(kDxgiFormats); ++i) { |
| 351 |
if (kDxgiFormats[i] == format) { |
| 352 |
return fFormatTable[i]; |
| 353 |
} |
| 354 |
} |
| 355 |
static FormatInfo kInvalidFormat; |
| 356 |
return kInvalidFormat; |
| 357 |
} |
| 358 |
|
| 359 |
void GrD3DCaps::initFormatTable(const DXGI_ADAPTER_DESC& adapterDesc, ID3D12Device* device) { |
| 360 |
static_assert(std::size(kDxgiFormats) == GrD3DCaps::kNumDxgiFormats, |
| 361 |
"Size of DXGI_FORMATs array must match static value in header"); |
| 362 |
|
| 363 |
std::fill_n(fColorTypeToFormatTable, kGrColorTypeCnt, DXGI_FORMAT_UNKNOWN); |
| 364 |
|
| 365 |
// Go through all the formats and init their support surface and data GrColorTypes. |
| 366 |
// Format: DXGI_FORMAT_R8G8B8A8_UNORM |
| 367 |
{ |
| 368 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; |
| 369 |
auto& info = this->getFormatInfo(format); |
| 370 |
info.init(adapterDesc, device, format); |
| 371 |
info.fFormatColorType = GrColorType::kRGBA_8888; |
| 372 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 373 |
info.fColorTypeInfoCount = 2; |
| 374 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 375 |
int ctIdx = 0; |
| 376 |
// Format: DXGI_FORMAT_R8G8B8A8_UNORM, Surface: kRGBA_8888 |
| 377 |
{ |
| 378 |
constexpr GrColorType ct = GrColorType::kRGBA_8888; |
| 379 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 380 |
ctInfo.fColorType = ct; |
| 381 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 382 |
} |
| 383 |
// Format: DXGI_FORMAT_R8G8B8A8_UNORM, Surface: kRGB_888x |
| 384 |
{ |
| 385 |
constexpr GrColorType ct = GrColorType::kRGB_888x; |
| 386 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 387 |
ctInfo.fColorType = ct; |
| 388 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag; |
| 389 |
ctInfo.fReadSwizzle = skgpu::Swizzle("rgb1"); |
| 390 |
} |
| 391 |
} |
| 392 |
} |
| 393 |
|
| 394 |
// Format: DXGI_FORMAT_R8_UNORM |
| 395 |
{ |
| 396 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R8_UNORM; |
| 397 |
auto& info = this->getFormatInfo(format); |
| 398 |
info.init(adapterDesc, device, format); |
| 399 |
info.fFormatColorType = GrColorType::kR_8; |
| 400 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 401 |
info.fColorTypeInfoCount = 3; |
| 402 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 403 |
int ctIdx = 0; |
| 404 |
// Format: DXGI_FORMAT_R8_UNORM, Surface: kR_8 |
| 405 |
{ |
| 406 |
constexpr GrColorType ct = GrColorType::kR_8; |
| 407 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 408 |
ctInfo.fColorType = ct; |
| 409 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 410 |
} |
| 411 |
// Format: DXGI_FORMAT_R8_UNORM, Surface: kAlpha_8 |
| 412 |
{ |
| 413 |
constexpr GrColorType ct = GrColorType::kAlpha_8; |
| 414 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 415 |
ctInfo.fColorType = ct; |
| 416 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 417 |
ctInfo.fReadSwizzle = skgpu::Swizzle("000r"); |
| 418 |
ctInfo.fWriteSwizzle = skgpu::Swizzle("a000"); |
| 419 |
} |
| 420 |
// Format: DXGI_FORMAT_R8_UNORM, Surface: kGray_8 |
| 421 |
{ |
| 422 |
constexpr GrColorType ct = GrColorType::kGray_8; |
| 423 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 424 |
ctInfo.fColorType = ct; |
| 425 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag; |
| 426 |
ctInfo.fReadSwizzle = skgpu::Swizzle("rrr1"); |
| 427 |
} |
| 428 |
} |
| 429 |
} |
| 430 |
// Format: DXGI_FORMAT_B8G8R8A8_UNORM |
| 431 |
{ |
| 432 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_B8G8R8A8_UNORM; |
| 433 |
auto& info = this->getFormatInfo(format); |
| 434 |
info.init(adapterDesc, device, format); |
| 435 |
info.fFormatColorType = GrColorType::kBGRA_8888; |
| 436 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 437 |
info.fColorTypeInfoCount = 1; |
| 438 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 439 |
int ctIdx = 0; |
| 440 |
// Format: DXGI_FORMAT_B8G8R8A8_UNORM, Surface: kBGRA_8888 |
| 441 |
{ |
| 442 |
constexpr GrColorType ct = GrColorType::kBGRA_8888; |
| 443 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 444 |
ctInfo.fColorType = ct; |
| 445 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 446 |
} |
| 447 |
} |
| 448 |
} |
| 449 |
// Format: DXGI_FORMAT_B5G6R5_UNORM |
| 450 |
{ |
| 451 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_B5G6R5_UNORM; |
| 452 |
auto& info = this->getFormatInfo(format); |
| 453 |
info.init(adapterDesc, device, format); |
| 454 |
info.fFormatColorType = GrColorType::kBGR_565; |
| 455 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 456 |
info.fColorTypeInfoCount = 1; |
| 457 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 458 |
int ctIdx = 0; |
| 459 |
// Format: DXGI_FORMAT_B5G6R5_UNORM, Surface: kBGR_565 |
| 460 |
{ |
| 461 |
constexpr GrColorType ct = GrColorType::kBGR_565; |
| 462 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 463 |
ctInfo.fColorType = ct; |
| 464 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 465 |
} |
| 466 |
} |
| 467 |
} |
| 468 |
// Format: DXGI_FORMAT_R16G16B16A16_FLOAT |
| 469 |
{ |
| 470 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R16G16B16A16_FLOAT; |
| 471 |
auto& info = this->getFormatInfo(format); |
| 472 |
info.init(adapterDesc, device, format); |
| 473 |
info.fFormatColorType = GrColorType::kRGBA_F16; |
| 474 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 475 |
info.fColorTypeInfoCount = 3; |
| 476 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 477 |
int ctIdx = 0; |
| 478 |
// Format: DXGI_FORMAT_R16G16B16A16_FLOAT, Surface: GrColorType::kRGBA_F16 |
| 479 |
{ |
| 480 |
constexpr GrColorType ct = GrColorType::kRGBA_F16; |
| 481 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 482 |
ctInfo.fColorType = ct; |
| 483 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 484 |
} |
| 485 |
// Format: DXGI_FORMAT_R16G16B16A16_FLOAT, Surface: GrColorType::kRGBA_F16_Clamped |
| 486 |
{ |
| 487 |
constexpr GrColorType ct = GrColorType::kRGBA_F16_Clamped; |
| 488 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 489 |
ctInfo.fColorType = ct; |
| 490 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 491 |
} |
| 492 |
// Format: DXGI_FORMAT_R16G16B16A16_FLOAT, Surface: GrColorType::kRGB_F16F16F16x |
| 493 |
{ |
| 494 |
constexpr GrColorType ct = GrColorType::kRGB_F16F16F16x; |
| 495 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 496 |
ctInfo.fColorType = ct; |
| 497 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag; |
| 498 |
ctInfo.fReadSwizzle = skgpu::Swizzle("rgb1"); |
| 499 |
} |
| 500 |
} |
| 501 |
} |
| 502 |
// Format: DXGI_FORMAT_R16_FLOAT |
| 503 |
{ |
| 504 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R16_FLOAT; |
| 505 |
auto& info = this->getFormatInfo(format); |
| 506 |
info.init(adapterDesc, device, format); |
| 507 |
info.fFormatColorType = GrColorType::kR_F16; |
| 508 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 509 |
info.fColorTypeInfoCount = 1; |
| 510 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 511 |
int ctIdx = 0; |
| 512 |
// Format: DXGI_FORMAT_R16_FLOAT, Surface: kAlpha_F16 |
| 513 |
{ |
| 514 |
constexpr GrColorType ct = GrColorType::kAlpha_F16; |
| 515 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 516 |
ctInfo.fColorType = ct; |
| 517 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 518 |
ctInfo.fReadSwizzle = skgpu::Swizzle("000r"); |
| 519 |
ctInfo.fWriteSwizzle = skgpu::Swizzle("a000"); |
| 520 |
} |
| 521 |
} |
| 522 |
} |
| 523 |
// Format: DXGI_FORMAT_R8G8_UNORM |
| 524 |
{ |
| 525 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R8G8_UNORM; |
| 526 |
auto& info = this->getFormatInfo(format); |
| 527 |
info.init(adapterDesc, device, format); |
| 528 |
info.fFormatColorType = GrColorType::kRG_88; |
| 529 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 530 |
info.fColorTypeInfoCount = 1; |
| 531 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 532 |
int ctIdx = 0; |
| 533 |
// Format: DXGI_FORMAT_R8G8_UNORM, Surface: kRG_88 |
| 534 |
{ |
| 535 |
constexpr GrColorType ct = GrColorType::kRG_88; |
| 536 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 537 |
ctInfo.fColorType = ct; |
| 538 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 539 |
} |
| 540 |
} |
| 541 |
} |
| 542 |
// Format: DXGI_FORMAT_R10G10B10A2_UNORM |
| 543 |
{ |
| 544 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R10G10B10A2_UNORM; |
| 545 |
auto& info = this->getFormatInfo(format); |
| 546 |
info.init(adapterDesc, device, format); |
| 547 |
info.fFormatColorType = GrColorType::kRGBA_1010102; |
| 548 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 549 |
info.fColorTypeInfoCount = 2; |
| 550 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 551 |
int ctIdx = 0; |
| 552 |
// Format: DXGI_FORMAT_R10G10B10A2_UNORM, Surface: kRGBA_1010102 |
| 553 |
{ |
| 554 |
constexpr GrColorType ct = GrColorType::kRGBA_1010102; |
| 555 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 556 |
ctInfo.fColorType = ct; |
| 557 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 558 |
} |
| 559 |
// Format: DXGI_FORMAT_R10G10B10A2_UNORM, Surface: kRGB_101010x |
| 560 |
{ |
| 561 |
constexpr GrColorType ct = GrColorType::kRGB_101010x; |
| 562 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 563 |
ctInfo.fColorType = ct; |
| 564 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag; |
| 565 |
ctInfo.fReadSwizzle = skgpu::Swizzle("rgb1"); |
| 566 |
} |
| 567 |
} |
| 568 |
} |
| 569 |
// Format: DXGI_FORMAT_B4G4R4A4_UNORM |
| 570 |
{ |
| 571 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_B4G4R4A4_UNORM; |
| 572 |
auto& info = this->getFormatInfo(format); |
| 573 |
info.init(adapterDesc, device, format); |
| 574 |
info.fFormatColorType = GrColorType::kBGRA_4444; |
| 575 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 576 |
info.fColorTypeInfoCount = 1; |
| 577 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 578 |
int ctIdx = 0; |
| 579 |
// Format: DXGI_FORMAT_B4G4R4A4_UNORM, Surface: kABGR_4444 |
| 580 |
{ |
| 581 |
constexpr GrColorType ct = GrColorType::kABGR_4444; |
| 582 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 583 |
ctInfo.fColorType = ct; |
| 584 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 585 |
ctInfo.fReadSwizzle = skgpu::Swizzle("argb"); |
| 586 |
ctInfo.fWriteSwizzle = skgpu::Swizzle("gbar"); |
| 587 |
} |
| 588 |
} |
| 589 |
} |
| 590 |
// Format: DXGI_FORMAT_R8G8B8A8_UNORM_SRGB |
| 591 |
{ |
| 592 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; |
| 593 |
auto& info = this->getFormatInfo(format); |
| 594 |
info.init(adapterDesc, device, format); |
| 595 |
info.fFormatColorType = GrColorType::kRGBA_8888_SRGB; |
| 596 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 597 |
info.fColorTypeInfoCount = 1; |
| 598 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 599 |
int ctIdx = 0; |
| 600 |
// Format: DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, Surface: kRGBA_8888_SRGB |
| 601 |
{ |
| 602 |
constexpr GrColorType ct = GrColorType::kRGBA_8888_SRGB; |
| 603 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 604 |
ctInfo.fColorType = ct; |
| 605 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 606 |
} |
| 607 |
} |
| 608 |
} |
| 609 |
// Format: DXGI_FORMAT_R16_UNORM |
| 610 |
{ |
| 611 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R16_UNORM; |
| 612 |
auto& info = this->getFormatInfo(format); |
| 613 |
info.init(adapterDesc, device, format); |
| 614 |
info.fFormatColorType = GrColorType::kR_16; |
| 615 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 616 |
info.fColorTypeInfoCount = 2; |
| 617 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 618 |
int ctIdx = 0; |
| 619 |
// Format: DXGI_FORMAT_R16_UNORM, Surface: kAlpha_16 |
| 620 |
{ |
| 621 |
constexpr GrColorType ct = GrColorType::kAlpha_16; |
| 622 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 623 |
ctInfo.fColorType = ct; |
| 624 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 625 |
ctInfo.fReadSwizzle = skgpu::Swizzle("000r"); |
| 626 |
ctInfo.fWriteSwizzle = skgpu::Swizzle("a000"); |
| 627 |
} |
| 628 |
// Format: DXGI_FORMAT_R16_UNORM, Surface: kR16_unorm |
| 629 |
{ |
| 630 |
constexpr GrColorType ct = GrColorType::kR_16; |
| 631 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 632 |
ctInfo.fColorType = ct; |
| 633 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 634 |
} |
| 635 |
} |
| 636 |
} |
| 637 |
// Format: DXGI_FORMAT_R16G16_UNORM |
| 638 |
{ |
| 639 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R16G16_UNORM; |
| 640 |
auto& info = this->getFormatInfo(format); |
| 641 |
info.init(adapterDesc, device, format); |
| 642 |
info.fFormatColorType = GrColorType::kRG_1616; |
| 643 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 644 |
info.fColorTypeInfoCount = 1; |
| 645 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 646 |
int ctIdx = 0; |
| 647 |
// Format: DXGI_FORMAT_R16G16_UNORM, Surface: kRG_1616 |
| 648 |
{ |
| 649 |
constexpr GrColorType ct = GrColorType::kRG_1616; |
| 650 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 651 |
ctInfo.fColorType = ct; |
| 652 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 653 |
} |
| 654 |
} |
| 655 |
} |
| 656 |
// Format: DXGI_FORMAT_R16G16B16A16_UNORM |
| 657 |
{ |
| 658 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R16G16B16A16_UNORM; |
| 659 |
auto& info = this->getFormatInfo(format); |
| 660 |
info.init(adapterDesc, device, format); |
| 661 |
info.fFormatColorType = GrColorType::kRGBA_16161616; |
| 662 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 663 |
info.fColorTypeInfoCount = 1; |
| 664 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 665 |
int ctIdx = 0; |
| 666 |
// Format: DXGI_FORMAT_R16G16B16A16_UNORM, Surface: kRGBA_16161616 |
| 667 |
{ |
| 668 |
constexpr GrColorType ct = GrColorType::kRGBA_16161616; |
| 669 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 670 |
ctInfo.fColorType = ct; |
| 671 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 672 |
} |
| 673 |
} |
| 674 |
} |
| 675 |
// Format: DXGI_FORMAT_R16G16_FLOAT |
| 676 |
{ |
| 677 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_R16G16_FLOAT; |
| 678 |
auto& info = this->getFormatInfo(format); |
| 679 |
info.init(adapterDesc, device, format); |
| 680 |
info.fFormatColorType = GrColorType::kRG_F16; |
| 681 |
if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { |
| 682 |
info.fColorTypeInfoCount = 1; |
| 683 |
info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); |
| 684 |
int ctIdx = 0; |
| 685 |
// Format: DXGI_FORMAT_R16G16_FLOAT, Surface: kRG_F16 |
| 686 |
{ |
| 687 |
constexpr GrColorType ct = GrColorType::kRG_F16; |
| 688 |
auto& ctInfo = info.fColorTypeInfos[ctIdx++]; |
| 689 |
ctInfo.fColorType = ct; |
| 690 |
ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; |
| 691 |
} |
| 692 |
} |
| 693 |
} |
| 694 |
|
| 695 |
// Format: DXGI_FORMAT_BC1_UNORM |
| 696 |
{ |
| 697 |
constexpr DXGI_FORMAT format = DXGI_FORMAT_BC1_UNORM; |
| 698 |
auto& info = this->getFormatInfo(format); |
| 699 |
info.init(adapterDesc, device, format); |
| 700 |
// No supported GrColorTypes. |
| 701 |
} |
| 702 |
|
| 703 |
//////////////////////////////////////////////////////////////////////////// |
| 704 |
// Map GrColorTypes (used for creating GrSurfaces) to DXGI_FORMATs. The order in which the |
| 705 |
// formats are passed into the setColorType function indicates the priority in selecting which |
| 706 |
// format we use for a given GrcolorType. |
| 707 |
|
| 708 |
this->setColorType(GrColorType::kAlpha_8, { DXGI_FORMAT_R8_UNORM }); |
| 709 |
this->setColorType(GrColorType::kBGR_565, { DXGI_FORMAT_B5G6R5_UNORM }); |
| 710 |
this->setColorType(GrColorType::kABGR_4444, { DXGI_FORMAT_B4G4R4A4_UNORM }); |
| 711 |
this->setColorType(GrColorType::kRGBA_8888, { DXGI_FORMAT_R8G8B8A8_UNORM }); |
| 712 |
this->setColorType(GrColorType::kRGBA_8888_SRGB, { DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }); |
| 713 |
this->setColorType(GrColorType::kRGB_888x, { DXGI_FORMAT_R8G8B8A8_UNORM }); |
| 714 |
this->setColorType(GrColorType::kR_8, { DXGI_FORMAT_R8_UNORM }); |
| 715 |
this->setColorType(GrColorType::kRG_88, { DXGI_FORMAT_R8G8_UNORM }); |
| 716 |
this->setColorType(GrColorType::kBGRA_8888, { DXGI_FORMAT_B8G8R8A8_UNORM }); |
| 717 |
this->setColorType(GrColorType::kRGBA_1010102, { DXGI_FORMAT_R10G10B10A2_UNORM }); |
| 718 |
this->setColorType(GrColorType::kRGB_101010x, { DXGI_FORMAT_R10G10B10A2_UNORM }); |
| 719 |
this->setColorType(GrColorType::kGray_8, { DXGI_FORMAT_R8_UNORM }); |
| 720 |
this->setColorType(GrColorType::kAlpha_F16, { DXGI_FORMAT_R16_FLOAT }); |
| 721 |
this->setColorType(GrColorType::kRGBA_F16, { DXGI_FORMAT_R16G16B16A16_FLOAT }); |
| 722 |
this->setColorType(GrColorType::kRGBA_F16_Clamped, { DXGI_FORMAT_R16G16B16A16_FLOAT }); |
| 723 |
this->setColorType(GrColorType::kRGB_F16F16F16x, { DXGI_FORMAT_R16G16B16A16_FLOAT }); |
| 724 |
this->setColorType(GrColorType::kAlpha_16, { DXGI_FORMAT_R16_UNORM }); |
| 725 |
this->setColorType(GrColorType::kR_16, { DXGI_FORMAT_R16_UNORM }); |
| 726 |
this->setColorType(GrColorType::kRG_1616, { DXGI_FORMAT_R16G16_UNORM }); |
| 727 |
this->setColorType(GrColorType::kRGBA_16161616, { DXGI_FORMAT_R16G16B16A16_UNORM }); |
| 728 |
this->setColorType(GrColorType::kRG_F16, { DXGI_FORMAT_R16G16_FLOAT }); |
| 729 |
} |
| 730 |
|
| 731 |
void GrD3DCaps::FormatInfo::InitFormatFlags(const D3D12_FEATURE_DATA_FORMAT_SUPPORT& formatSupport, |
| 732 |
uint16_t* flags) { |
| 733 |
if (SkToBool(D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE & formatSupport.Support1)) { |
| 734 |
*flags = *flags | kTexturable_Flag; |
| 735 |
|
| 736 |
// Ganesh assumes that all renderable surfaces are also texturable |
| 737 |
if (SkToBool(D3D12_FORMAT_SUPPORT1_RENDER_TARGET & formatSupport.Support1) && |
| 738 |
SkToBool(D3D12_FORMAT_SUPPORT1_BLENDABLE & formatSupport.Support1)) { |
| 739 |
*flags = *flags | kRenderable_Flag; |
| 740 |
} |
| 741 |
} |
| 742 |
|
| 743 |
if (SkToBool(D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET & formatSupport.Support1)) { |
| 744 |
*flags = *flags | kMSAA_Flag; |
| 745 |
} |
| 746 |
|
| 747 |
if (SkToBool(D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE & formatSupport.Support1)) { |
| 748 |
*flags = *flags | kResolve_Flag; |
| 749 |
} |
| 750 |
|
| 751 |
if (SkToBool(D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW & formatSupport.Support1)) { |
| 752 |
*flags = *flags | kUnorderedAccess_Flag; |
| 753 |
} |
| 754 |
} |
| 755 |
|
| 756 |
static bool multisample_count_supported(ID3D12Device* device, DXGI_FORMAT format, int sampleCount) { |
| 757 |
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msqLevels; |
| 758 |
msqLevels.Format = format; |
| 759 |
msqLevels.SampleCount = sampleCount; |
| 760 |
msqLevels.Flags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE; |
| 761 |
GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, |
| 762 |
&msqLevels, sizeof(msqLevels))); |
| 763 |
|
| 764 |
return msqLevels.NumQualityLevels > 0; |
| 765 |
} |
| 766 |
|
| 767 |
void GrD3DCaps::FormatInfo::initSampleCounts(const DXGI_ADAPTER_DESC& adapterDesc, |
| 768 |
ID3D12Device* device, DXGI_FORMAT format) { |
| 769 |
if (multisample_count_supported(device, format, 1)) { |
| 770 |
fColorSampleCounts.push_back(1); |
| 771 |
} |
| 772 |
// TODO: test these |
| 773 |
//if (kImagination_D3DVendor == adapterDesc.VendorId) { |
| 774 |
// // MSAA does not work on imagination |
| 775 |
// return; |
| 776 |
//} |
| 777 |
//if (kIntel_D3DVendor == adapterDesc.VendorId) { |
| 778 |
// // MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926 |
| 779 |
// return; |
| 780 |
//} |
| 781 |
if (multisample_count_supported(device, format, 2)) { |
| 782 |
fColorSampleCounts.push_back(2); |
| 783 |
} |
| 784 |
if (multisample_count_supported(device, format, 4)) { |
| 785 |
fColorSampleCounts.push_back(4); |
| 786 |
} |
| 787 |
if (multisample_count_supported(device, format, 8)) { |
| 788 |
fColorSampleCounts.push_back(8); |
| 789 |
} |
| 790 |
if (multisample_count_supported(device, format, 16)) { |
| 791 |
fColorSampleCounts.push_back(16); |
| 792 |
} |
| 793 |
// Standard sample locations are not defined for more than 16 samples, and we don't need more |
| 794 |
// than 16. Omit 32 and 64. |
| 795 |
} |
| 796 |
|
| 797 |
void GrD3DCaps::FormatInfo::init(const DXGI_ADAPTER_DESC& adapterDesc, ID3D12Device* device, |
| 798 |
DXGI_FORMAT format) { |
| 799 |
D3D12_FEATURE_DATA_FORMAT_SUPPORT formatSupportDesc; |
| 800 |
formatSupportDesc.Format = format; |
| 801 |
GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, |
| 802 |
&formatSupportDesc, |
| 803 |
sizeof(formatSupportDesc))); |
| 804 |
|
| 805 |
InitFormatFlags(formatSupportDesc, &fFlags); |
| 806 |
if (fFlags & kRenderable_Flag) { |
| 807 |
this->initSampleCounts(adapterDesc, device, format); |
| 808 |
} |
| 809 |
} |
| 810 |
|
| 811 |
bool GrD3DCaps::isFormatSRGB(const GrBackendFormat& format) const { |
| 812 |
DXGI_FORMAT dxgiFormat; |
| 813 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 814 |
return false; |
| 815 |
} |
| 816 |
|
| 817 |
switch (dxgiFormat) { |
| 818 |
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: |
| 819 |
return true; |
| 820 |
default: |
| 821 |
return false; |
| 822 |
} |
| 823 |
} |
| 824 |
|
| 825 |
bool GrD3DCaps::isFormatTexturable(const GrBackendFormat& format, GrTextureType) const { |
| 826 |
DXGI_FORMAT dxgiFormat; |
| 827 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 828 |
return false; |
| 829 |
} |
| 830 |
|
| 831 |
return this->isFormatTexturable(dxgiFormat); |
| 832 |
} |
| 833 |
|
| 834 |
bool GrD3DCaps::isFormatTexturable(DXGI_FORMAT format) const { |
| 835 |
const FormatInfo& info = this->getFormatInfo(format); |
| 836 |
return SkToBool(FormatInfo::kTexturable_Flag & info.fFlags); |
| 837 |
} |
| 838 |
|
| 839 |
bool GrD3DCaps::isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat& format, |
| 840 |
int sampleCount) const { |
| 841 |
DXGI_FORMAT dxgiFormat; |
| 842 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 843 |
return false; |
| 844 |
} |
| 845 |
if (!this->isFormatRenderable(dxgiFormat, sampleCount)) { |
| 846 |
return false; |
| 847 |
} |
| 848 |
const auto& info = this->getFormatInfo(dxgiFormat); |
| 849 |
if (!SkToBool(info.colorTypeFlags(ct) & ColorTypeInfo::kRenderable_Flag)) { |
| 850 |
return false; |
| 851 |
} |
| 852 |
return true; |
| 853 |
} |
| 854 |
|
| 855 |
bool GrD3DCaps::isFormatRenderable(const GrBackendFormat& format, int sampleCount) const { |
| 856 |
DXGI_FORMAT dxgiFormat; |
| 857 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 858 |
return false; |
| 859 |
} |
| 860 |
return this->isFormatRenderable(dxgiFormat, sampleCount); |
| 861 |
} |
| 862 |
|
| 863 |
bool GrD3DCaps::isFormatRenderable(DXGI_FORMAT format, int sampleCount) const { |
| 864 |
return sampleCount <= this->maxRenderTargetSampleCount(format); |
| 865 |
} |
| 866 |
|
| 867 |
bool GrD3DCaps::isFormatUnorderedAccessible(DXGI_FORMAT format) const { |
| 868 |
const FormatInfo& info = this->getFormatInfo(format); |
| 869 |
return SkToBool(FormatInfo::kUnorderedAccess_Flag & info.fFlags); |
| 870 |
} |
| 871 |
|
| 872 |
int GrD3DCaps::getRenderTargetSampleCount(int requestedCount, |
| 873 |
const GrBackendFormat& format) const { |
| 874 |
DXGI_FORMAT dxgiFormat; |
| 875 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 876 |
return 0; |
| 877 |
} |
| 878 |
|
| 879 |
return this->getRenderTargetSampleCount(requestedCount, dxgiFormat); |
| 880 |
} |
| 881 |
|
| 882 |
int GrD3DCaps::getRenderTargetSampleCount(int requestedCount, DXGI_FORMAT format) const { |
| 883 |
requestedCount = std::max(1, requestedCount); |
| 884 |
|
| 885 |
const FormatInfo& info = this->getFormatInfo(format); |
| 886 |
|
| 887 |
int count = info.fColorSampleCounts.size(); |
| 888 |
|
| 889 |
if (!count) { |
| 890 |
return 0; |
| 891 |
} |
| 892 |
|
| 893 |
if (1 == requestedCount) { |
| 894 |
SkASSERT(info.fColorSampleCounts.size() && info.fColorSampleCounts[0] == 1); |
| 895 |
return 1; |
| 896 |
} |
| 897 |
|
| 898 |
for (int i = 0; i < count; ++i) { |
| 899 |
if (info.fColorSampleCounts[i] >= requestedCount) { |
| 900 |
return info.fColorSampleCounts[i]; |
| 901 |
} |
| 902 |
} |
| 903 |
return 0; |
| 904 |
} |
| 905 |
|
| 906 |
int GrD3DCaps::maxRenderTargetSampleCount(const GrBackendFormat& format) const { |
| 907 |
DXGI_FORMAT dxgiFormat; |
| 908 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 909 |
return 0; |
| 910 |
} |
| 911 |
return this->maxRenderTargetSampleCount(dxgiFormat); |
| 912 |
} |
| 913 |
|
| 914 |
int GrD3DCaps::maxRenderTargetSampleCount(DXGI_FORMAT format) const { |
| 915 |
const FormatInfo& info = this->getFormatInfo(format); |
| 916 |
|
| 917 |
const auto& table = info.fColorSampleCounts; |
| 918 |
if (!table.size()) { |
| 919 |
return 0; |
| 920 |
} |
| 921 |
return table[table.size() - 1]; |
| 922 |
} |
| 923 |
|
| 924 |
GrColorType GrD3DCaps::getFormatColorType(DXGI_FORMAT format) const { |
| 925 |
const FormatInfo& info = this->getFormatInfo(format); |
| 926 |
return info.fFormatColorType; |
| 927 |
} |
| 928 |
|
| 929 |
GrCaps::SupportedWrite GrD3DCaps::supportedWritePixelsColorType( |
| 930 |
GrColorType surfaceColorType, const GrBackendFormat& surfaceFormat, |
| 931 |
GrColorType srcColorType) const { |
| 932 |
DXGI_FORMAT dxgiFormat; |
| 933 |
if (!surfaceFormat.asDxgiFormat(&dxgiFormat)) { |
| 934 |
return { GrColorType::kUnknown, 0 }; |
| 935 |
} |
| 936 |
|
| 937 |
// Any buffer data needs to be aligned to 512 bytes and that of a single texel. |
| 938 |
size_t offsetAlignment = SkAlignTo(GrDxgiFormatBytesPerBlock(dxgiFormat), |
| 939 |
(size_t) D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); |
| 940 |
|
| 941 |
const auto& info = this->getFormatInfo(dxgiFormat); |
| 942 |
for (int i = 0; i < info.fColorTypeInfoCount; ++i) { |
| 943 |
const auto& ctInfo = info.fColorTypeInfos[i]; |
| 944 |
if (ctInfo.fColorType == surfaceColorType) { |
| 945 |
return { surfaceColorType, offsetAlignment }; |
| 946 |
} |
| 947 |
} |
| 948 |
return { GrColorType::kUnknown, 0 }; |
| 949 |
} |
| 950 |
|
| 951 |
GrCaps::SurfaceReadPixelsSupport GrD3DCaps::surfaceSupportsReadPixels( |
| 952 |
const GrSurface* surface) const { |
| 953 |
if (surface->isProtected()) { |
| 954 |
return SurfaceReadPixelsSupport::kUnsupported; |
| 955 |
} |
| 956 |
if (auto tex = static_cast<const GrD3DTexture*>(surface->asTexture())) { |
| 957 |
// We can't directly read from a compressed format |
| 958 |
if (GrDxgiFormatIsCompressed(tex->dxgiFormat())) { |
| 959 |
return SurfaceReadPixelsSupport::kCopyToTexture2D; |
| 960 |
} |
| 961 |
return SurfaceReadPixelsSupport::kSupported; |
| 962 |
} else if (auto rt = static_cast<const GrD3DRenderTarget*>(surface->asRenderTarget())) { |
| 963 |
if (rt->numSamples() > 1) { |
| 964 |
return SurfaceReadPixelsSupport::kCopyToTexture2D; |
| 965 |
} |
| 966 |
return SurfaceReadPixelsSupport::kSupported; |
| 967 |
} |
| 968 |
return SurfaceReadPixelsSupport::kUnsupported; |
| 969 |
} |
| 970 |
|
| 971 |
bool GrD3DCaps::onSurfaceSupportsWritePixels(const GrSurface* surface) const { |
| 972 |
if (auto rt = surface->asRenderTarget()) { |
| 973 |
return rt->numSamples() <= 1 && SkToBool(surface->asTexture()); |
| 974 |
} |
| 975 |
return true; |
| 976 |
} |
| 977 |
|
| 978 |
bool GrD3DCaps::onAreColorTypeAndFormatCompatible(GrColorType ct, |
| 979 |
const GrBackendFormat& format) const { |
| 980 |
DXGI_FORMAT dxgiFormat; |
| 981 |
if (!format.asDxgiFormat(&dxgiFormat)) { |
| 982 |
return false; |
| 983 |
} |
| 984 |
|
| 985 |
const auto& info = this->getFormatInfo(dxgiFormat); |
| 986 |
for (int i = 0; i < info.fColorTypeInfoCount; ++i) { |
| 987 |
if (info.fColorTypeInfos[i].fColorType == ct) { |
| 988 |
return true; |
| 989 |
} |
| 990 |
} |
| 991 |
return false; |
| 992 |
} |
| 993 |
|
| 994 |
GrBackendFormat GrD3DCaps::onGetDefaultBackendFormat(GrColorType ct) const { |
| 995 |
DXGI_FORMAT format = this->getFormatFromColorType(ct); |
| 996 |
if (format == DXGI_FORMAT_UNKNOWN) { |
| 997 |
return {}; |
| 998 |
} |
| 999 |
return GrBackendFormat::MakeDxgi(format); |
| 1000 |
} |
| 1001 |
|
| 1002 |
GrBackendFormat GrD3DCaps::getBackendFormatFromCompressionType( |
| 1003 |
SkTextureCompressionType compressionType) const { |
| 1004 |
switch (compressionType) { |
| 1005 |
case SkTextureCompressionType::kBC1_RGBA8_UNORM: |
| 1006 |
if (this->isFormatTexturable(DXGI_FORMAT_BC1_UNORM)) { |
| 1007 |
return GrBackendFormat::MakeDxgi(DXGI_FORMAT_BC1_UNORM); |
| 1008 |
} |
| 1009 |
return {}; |
| 1010 |
default: |
| 1011 |
return {}; |
| 1012 |
} |
| 1013 |
|
| 1014 |
SkUNREACHABLE; |
| 1015 |
} |
| 1016 |
|
| 1017 |
skgpu::Swizzle GrD3DCaps::onGetReadSwizzle(const GrBackendFormat& format, |
| 1018 |
GrColorType colorType) const { |
| 1019 |
DXGI_FORMAT dxgiFormat; |
| 1020 |
SkAssertResult(format.asDxgiFormat(&dxgiFormat)); |
| 1021 |
const auto& info = this->getFormatInfo(dxgiFormat); |
| 1022 |
for (int i = 0; i < info.fColorTypeInfoCount; ++i) { |
| 1023 |
const auto& ctInfo = info.fColorTypeInfos[i]; |
| 1024 |
if (ctInfo.fColorType == colorType) { |
| 1025 |
return ctInfo.fReadSwizzle; |
| 1026 |
} |
| 1027 |
} |
| 1028 |
SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", |
| 1029 |
(int)colorType, (int)dxgiFormat); |
| 1030 |
return {}; |
| 1031 |
} |
| 1032 |
|
| 1033 |
skgpu::Swizzle GrD3DCaps::getWriteSwizzle(const GrBackendFormat& format, |
| 1034 |
GrColorType colorType) const { |
| 1035 |
DXGI_FORMAT dxgiFormat; |
| 1036 |
SkAssertResult(format.asDxgiFormat(&dxgiFormat)); |
| 1037 |
const auto& info = this->getFormatInfo(dxgiFormat); |
| 1038 |
for (int i = 0; i < info.fColorTypeInfoCount; ++i) { |
| 1039 |
const auto& ctInfo = info.fColorTypeInfos[i]; |
| 1040 |
if (ctInfo.fColorType == colorType) { |
| 1041 |
return ctInfo.fWriteSwizzle; |
| 1042 |
} |
| 1043 |
} |
| 1044 |
SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", |
| 1045 |
(int)colorType, (int)dxgiFormat); |
| 1046 |
return {}; |
| 1047 |
} |
| 1048 |
|
| 1049 |
uint64_t GrD3DCaps::computeFormatKey(const GrBackendFormat& format) const { |
| 1050 |
DXGI_FORMAT dxgiFormat; |
| 1051 |
SkAssertResult(format.asDxgiFormat(&dxgiFormat)); |
| 1052 |
|
| 1053 |
return (uint64_t)dxgiFormat; |
| 1054 |
} |
| 1055 |
|
| 1056 |
GrCaps::SupportedRead GrD3DCaps::onSupportedReadPixelsColorType( |
| 1057 |
GrColorType srcColorType, const GrBackendFormat& srcBackendFormat, |
| 1058 |
GrColorType dstColorType) const { |
| 1059 |
DXGI_FORMAT dxgiFormat; |
| 1060 |
if (!srcBackendFormat.asDxgiFormat(&dxgiFormat)) { |
| 1061 |
return { GrColorType::kUnknown, 0 }; |
| 1062 |
} |
| 1063 |
|
| 1064 |
SkTextureCompressionType compression = GrBackendFormatToCompressionType(srcBackendFormat); |
| 1065 |
if (compression != SkTextureCompressionType::kNone) { |
| 1066 |
return { SkTextureCompressionTypeIsOpaque(compression) ? GrColorType::kRGB_888x |
| 1067 |
: GrColorType::kRGBA_8888, 0 }; |
| 1068 |
} |
| 1069 |
|
| 1070 |
// Any subresource buffer data offset we copy to needs to be aligned to 512 bytes. |
| 1071 |
size_t offsetAlignment = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT; |
| 1072 |
|
| 1073 |
const auto& info = this->getFormatInfo(dxgiFormat); |
| 1074 |
for (int i = 0; i < info.fColorTypeInfoCount; ++i) { |
| 1075 |
const auto& ctInfo = info.fColorTypeInfos[i]; |
| 1076 |
if (ctInfo.fColorType == srcColorType) { |
| 1077 |
return { srcColorType, offsetAlignment }; |
| 1078 |
} |
| 1079 |
} |
| 1080 |
return { GrColorType::kUnknown, 0 }; |
| 1081 |
} |
| 1082 |
|
| 1083 |
void GrD3DCaps::addExtraSamplerKey(skgpu::KeyBuilder* b, |
| 1084 |
GrSamplerState samplerState, |
| 1085 |
const GrBackendFormat& format) const { |
| 1086 |
// TODO |
| 1087 |
} |
| 1088 |
|
| 1089 |
/** |
| 1090 |
* TODO: Determine what goes in the ProgramDesc |
| 1091 |
*/ |
| 1092 |
GrProgramDesc GrD3DCaps::makeDesc(GrRenderTarget* rt, |
| 1093 |
const GrProgramInfo& programInfo, |
| 1094 |
ProgramDescOverrideFlags overrideFlags) const { |
| 1095 |
SkASSERT(overrideFlags == ProgramDescOverrideFlags::kNone); |
| 1096 |
GrProgramDesc desc; |
| 1097 |
GrProgramDesc::Build(&desc, programInfo, *this); |
| 1098 |
|
| 1099 |
skgpu::KeyBuilder b(desc.key()); |
| 1100 |
|
| 1101 |
GrD3DRenderTarget* d3dRT = (GrD3DRenderTarget*) rt; |
| 1102 |
d3dRT->genKey(&b); |
| 1103 |
|
| 1104 |
GrStencilSettings stencil = programInfo.nonGLStencilSettings(); |
| 1105 |
stencil.genKey(&b, false); |
| 1106 |
|
| 1107 |
programInfo.pipeline().genKey(&b, *this); |
| 1108 |
// The num samples is already added in the render target key so we don't need to add it here. |
| 1109 |
|
| 1110 |
// D3D requires the full primitive type as part of its key |
| 1111 |
b.add32(programInfo.primitiveTypeKey()); |
| 1112 |
|
| 1113 |
b.flush(); |
| 1114 |
return desc; |
| 1115 |
} |
| 1116 |
|
| 1117 |
#if defined(GPU_TEST_UTILS) |
| 1118 |
std::vector<GrTest::TestFormatColorTypeCombination> GrD3DCaps::getTestingCombinations() const { |
| 1119 |
std::vector<GrTest::TestFormatColorTypeCombination> combos = { |
| 1120 |
{GrColorType::kAlpha_8, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8_UNORM) }, |
| 1121 |
{GrColorType::kBGR_565, GrBackendFormat::MakeDxgi(DXGI_FORMAT_B5G6R5_UNORM) }, |
| 1122 |
{GrColorType::kABGR_4444, GrBackendFormat::MakeDxgi(DXGI_FORMAT_B4G4R4A4_UNORM) }, |
| 1123 |
{GrColorType::kRGBA_8888, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8G8B8A8_UNORM) }, |
| 1124 |
{GrColorType::kRGBA_8888_SRGB, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB) }, |
| 1125 |
{GrColorType::kRGB_888x, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8G8B8A8_UNORM) }, |
| 1126 |
{GrColorType::kR_8, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8_UNORM) }, |
| 1127 |
{GrColorType::kRG_88, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8G8_UNORM) }, |
| 1128 |
{GrColorType::kBGRA_8888, GrBackendFormat::MakeDxgi(DXGI_FORMAT_B8G8R8A8_UNORM) }, |
| 1129 |
{GrColorType::kRGBA_1010102, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R10G10B10A2_UNORM) }, |
| 1130 |
{GrColorType::kRGB_101010x, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R10G10B10A2_UNORM) }, |
| 1131 |
{GrColorType::kGray_8, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R8_UNORM) }, |
| 1132 |
{GrColorType::kAlpha_F16, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16_FLOAT) }, |
| 1133 |
{GrColorType::kRGBA_F16, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16G16B16A16_FLOAT) }, |
| 1134 |
{GrColorType::kRGBA_F16_Clamped, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16G16B16A16_FLOAT)}, |
| 1135 |
{GrColorType::kRGB_F16F16F16x, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16G16B16A16_FLOAT)}, |
| 1136 |
{GrColorType::kAlpha_16, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16_UNORM) }, |
| 1137 |
{GrColorType::kR_16, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16_UNORM) }, |
| 1138 |
{GrColorType::kRG_1616, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16G16_UNORM) }, |
| 1139 |
{GrColorType::kRGBA_16161616, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16G16B16A16_UNORM) }, |
| 1140 |
{GrColorType::kRG_F16, GrBackendFormat::MakeDxgi(DXGI_FORMAT_R16G16_FLOAT) }, |
| 1141 |
{GrColorType::kRGBA_8888, GrBackendFormat::MakeDxgi(DXGI_FORMAT_BC1_UNORM) }, |
| 1142 |
}; |
| 1143 |
|
| 1144 |
return combos; |
| 1145 |
} |
| 1146 |
#endif |