diff --git a/src/gpu/d3d/GrD3DCaps.cpp b/src/gpu/d3d/GrD3DCaps.cpp index 07de830b9d..16186e9fda 100644 --- a/src/gpu/d3d/GrD3DCaps.cpp +++ b/src/gpu/d3d/GrD3DCaps.cpp @@ -127,25 +127,21 @@ void GrD3DCaps::init(const GrContextOptions& contextOptions, IDXGIAdapter1* adap D3D12_FEATURE_DATA_FEATURE_LEVELS flDesc = {}; flDesc.NumFeatureLevels = _countof(featureLevels); flDesc.pFeatureLevelsRequested = featureLevels; - SkDEBUGCODE(HRESULT hr =) device->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &flDesc, - sizeof(flDesc)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &flDesc, + sizeof(flDesc))); // This had better be true SkASSERT(flDesc.MaxSupportedFeatureLevel >= D3D_FEATURE_LEVEL_11_0); DXGI_ADAPTER_DESC adapterDesc; - SkDEBUGCODE(hr =) adapter->GetDesc(&adapterDesc); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(adapter->GetDesc(&adapterDesc)); D3D12_FEATURE_DATA_D3D12_OPTIONS optionsDesc; - SkDEBUGCODE(hr =) device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &optionsDesc, - sizeof(optionsDesc)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &optionsDesc, + sizeof(optionsDesc))); D3D12_FEATURE_DATA_D3D12_OPTIONS2 options2Desc; - SkDEBUGCODE(hr =) device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &options2Desc, - sizeof(options2Desc)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &options2Desc, + sizeof(options2Desc))); // See https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-support if (D3D12_RESOURCE_BINDING_TIER_1 == optionsDesc.ResourceBindingTier) { @@ -267,10 +263,9 @@ void GrD3DCaps::applyDriverCorrectnessWorkarounds(int vendorID) { bool stencil_format_supported(ID3D12Device* device, DXGI_FORMAT format) { D3D12_FEATURE_DATA_FORMAT_SUPPORT formatSupportDesc; formatSupportDesc.Format = format; - SkDEBUGCODE(HRESULT hr = ) device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, - &formatSupportDesc, - sizeof(formatSupportDesc)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, + &formatSupportDesc, + sizeof(formatSupportDesc))); return SkToBool(D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL & formatSupportDesc.Support1); } @@ -736,9 +731,8 @@ static bool multisample_count_supported(ID3D12Device* device, DXGI_FORMAT format D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msqLevels; msqLevels.Format = format; msqLevels.SampleCount = sampleCount; - SkDEBUGCODE(HRESULT hr =) device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, - &msqLevels, sizeof(msqLevels)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, + &msqLevels, sizeof(msqLevels))); return msqLevels.NumQualityLevels > 0; } @@ -777,10 +771,9 @@ void GrD3DCaps::FormatInfo::init(const DXGI_ADAPTER_DESC& adapterDesc, ID3D12Dev DXGI_FORMAT format) { D3D12_FEATURE_DATA_FORMAT_SUPPORT formatSupportDesc; formatSupportDesc.Format = format; - SkDEBUGCODE(HRESULT hr =) device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, - &formatSupportDesc, - sizeof(formatSupportDesc)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, + &formatSupportDesc, + sizeof(formatSupportDesc))); InitFormatFlags(formatSupportDesc, &fFlags); if (fFlags & kRenderable_Flag) { diff --git a/src/gpu/d3d/GrD3DCommandList.cpp b/src/gpu/d3d/GrD3DCommandList.cpp index dafd89ae1c..1e67764e9b 100644 --- a/src/gpu/d3d/GrD3DCommandList.cpp +++ b/src/gpu/d3d/GrD3DCommandList.cpp @@ -50,10 +50,8 @@ GrD3DCommandList::SubmitResult GrD3DCommandList::submit(ID3D12CommandQueue* queu void GrD3DCommandList::reset() { SkASSERT(!fIsActive); - SkDEBUGCODE(HRESULT hr = ) fAllocator->Reset(); - SkASSERT(SUCCEEDED(hr)); - SkDEBUGCODE(hr = ) fCommandList->Reset(fAllocator.get(), nullptr); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(fAllocator->Reset()); + GR_D3D_CALL_ERRCHECK(fCommandList->Reset(fAllocator.get(), nullptr)); this->onReset(); this->releaseResources(); @@ -188,15 +186,13 @@ void GrD3DCommandList::addingWork() { std::unique_ptr GrD3DDirectCommandList::Make(ID3D12Device* device) { gr_cp allocator; - SkDEBUGCODE(HRESULT hr = ) device->CreateCommandAllocator( - D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CreateCommandAllocator( + D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator))); gr_cp commandList; - SkDEBUGCODE(hr = ) device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, - allocator.get(), nullptr, - IID_PPV_ARGS(&commandList)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, + allocator.get(), nullptr, + IID_PPV_ARGS(&commandList))); auto grCL = new GrD3DDirectCommandList(std::move(allocator), std::move(commandList)); return std::unique_ptr(grCL); @@ -447,14 +443,12 @@ void GrD3DDirectCommandList::addSampledTextureRef(GrD3DTexture* texture) { std::unique_ptr GrD3DCopyCommandList::Make(ID3D12Device* device) { gr_cp allocator; - SkDEBUGCODE(HRESULT hr = ) device->CreateCommandAllocator( - D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, + IID_PPV_ARGS(&allocator))); gr_cp commandList; - SkDEBUGCODE(hr = ) device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_COPY, allocator.get(), - nullptr, IID_PPV_ARGS(&commandList)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_COPY, allocator.get(), + nullptr, IID_PPV_ARGS(&commandList))); auto grCL = new GrD3DCopyCommandList(std::move(allocator), std::move(commandList)); return std::unique_ptr(grCL); } diff --git a/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp b/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp index 5c2b91f509..5704c1d675 100644 --- a/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp +++ b/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp @@ -21,6 +21,7 @@ #include "src/gpu/d3d/GrD3DGpu.h" #include "src/gpu/d3d/GrD3DRenderTarget.h" #include "src/gpu/d3d/GrD3DRootSignature.h" +#include "src/gpu/d3d/GrD3DUtil.h" #include "src/sksl/SkSLCompiler.h" #include @@ -527,9 +528,8 @@ gr_cp create_pipeline_state( psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE; gr_cp pipelineState; - SkDEBUGCODE(HRESULT hr = )gpu->device()->CreateGraphicsPipelineState( - &psoDesc, IID_PPV_ARGS(&pipelineState)); - SkASSERT(SUCCEEDED(hr)); + GR_D3D_CALL_ERRCHECK(gpu->device()->CreateGraphicsPipelineState( + &psoDesc, IID_PPV_ARGS(&pipelineState))); return pipelineState; }