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>
This commit is contained in:
Jim Van Verth 2020-04-24 16:19:01 -04:00 committed by Skia Commit-Bot
parent 438775b19e
commit c12aad9485
2 changed files with 16 additions and 10 deletions

View File

@ -124,10 +124,8 @@ void GrD3DCaps::init(const GrContextOptions& contextOptions, IDXGIAdapter1* adap
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;

View File

@ -272,12 +272,20 @@ bool GrD3DGpu::onReadPixels(GrSurface* surface, int left, int top, int width, in
}
// 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 @@ bool GrD3DGpu::onReadPixels(GrSurface* surface, int left, int top, int width, in
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 @@ bool GrD3DGpu::onReadPixels(GrSurface* surface, int left, int top, int width, in
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();