Some more minor fixes for D3D tests.
Change-Id: Ie0be9ef7f9aba1c91f03053311686905142b3814
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285498
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/d3d/GrD3DCaps.cpp b/src/gpu/d3d/GrD3DCaps.cpp
index ab399a9..4161900 100644
--- a/src/gpu/d3d/GrD3DCaps.cpp
+++ b/src/gpu/d3d/GrD3DCaps.cpp
@@ -124,10 +124,8 @@
void GrD3DCaps::initGrCaps(const D3D12_FEATURE_DATA_D3D12_OPTIONS& optionsDesc,
const D3D12_FEATURE_DATA_D3D12_OPTIONS2& options2Desc) {
- // There doesn't seem to be a property for this, and setting it to MAXINT makes tests which test
- // all the vertex attribs time out looping over that many. For now, we'll cap this at 64 max and
- // can raise it if we ever find that need.
- fMaxVertexAttributes = 64;
+ // We assume a minimum of Shader Model 5.1, which allows at most 32 vertex inputs.
+ fMaxVertexAttributes = 32;
// TODO: we can set locations but not sure if we can query them
fSampleLocationsSupport = false;
diff --git a/src/gpu/d3d/GrD3DGpu.cpp b/src/gpu/d3d/GrD3DGpu.cpp
index e772259..2c2c2b4 100644
--- a/src/gpu/d3d/GrD3DGpu.cpp
+++ b/src/gpu/d3d/GrD3DGpu.cpp
@@ -272,12 +272,20 @@
}
// Set up src location and box
- GrD3DTexture* d3dTex = static_cast<GrD3DTexture*>(surface->asTexture());
- if (!d3dTex) {
+ GrD3DTextureResource* texResource = nullptr;
+ GrD3DRenderTarget* rt = static_cast<GrD3DRenderTarget*>(surface->asRenderTarget());
+ if (rt) {
+ texResource = rt;
+ } else {
+ texResource = static_cast<GrD3DTexture*>(surface->asTexture());
+ }
+
+ if (!texResource) {
return false;
}
+
D3D12_TEXTURE_COPY_LOCATION srcLocation = {};
- srcLocation.pResource = d3dTex->d3dResource();
+ srcLocation.pResource = texResource->d3dResource();
SkASSERT(srcLocation.pResource);
srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
srcLocation.SubresourceIndex = 0;
@@ -300,7 +308,7 @@
nullptr, nullptr, &transferTotalBytes);
SkASSERT(transferTotalBytes);
size_t bpp = GrColorTypeBytesPerPixel(dstColorType);
- if (this->d3dCaps().bytesPerPixel(d3dTex->dxgiFormat()) != bpp) {
+ if (this->d3dCaps().bytesPerPixel(texResource->dxgiFormat()) != bpp) {
return false;
}
size_t tightRowBytes = bpp * width;
@@ -313,10 +321,10 @@
dstLocation.pResource = d3dBuf->d3dResource();
// Need to change the resource state to COPY_SOURCE in order to download from it
- d3dTex->setResourceState(this, D3D12_RESOURCE_STATE_COPY_SOURCE);
+ texResource->setResourceState(this, D3D12_RESOURCE_STATE_COPY_SOURCE);
fCurrentDirectCommandList->copyTextureRegion(d3dBuf->resource(), &dstLocation, 0, 0,
- d3dTex->resource(), &srcLocation, &srcBox);
+ texResource->resource(), &srcLocation, &srcBox);
this->submitDirectCommandList(SyncQueue::kForce);
const void* mappedMemory = transferBuffer->map();