2018-07-18 09:40:26 +00:00
|
|
|
// Copyright 2017 The Dawn Authors
|
2017-04-20 18:38:20 +00:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2018-07-24 11:53:51 +00:00
|
|
|
#include "dawn_native/CommandBuffer.h"
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2019-02-20 11:46:16 +00:00
|
|
|
#include "dawn_native/CommandEncoder.h"
|
2019-06-11 18:11:05 +00:00
|
|
|
#include "dawn_native/Texture.h"
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-07-24 14:45:45 +00:00
|
|
|
namespace dawn_native {
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2019-02-20 11:46:16 +00:00
|
|
|
CommandBufferBase::CommandBufferBase(DeviceBase* device, CommandEncoderBase* encoder)
|
|
|
|
: ObjectBase(device), mResourceUsages(encoder->AcquireResourceUsages()) {
|
2018-11-07 10:02:43 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 12:54:08 +00:00
|
|
|
CommandBufferBase::CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
|
|
|
: ObjectBase(device, tag) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
CommandBufferBase* CommandBufferBase::MakeError(DeviceBase* device) {
|
|
|
|
return new CommandBufferBase(device, ObjectBase::kError);
|
|
|
|
}
|
|
|
|
|
2018-11-07 10:02:43 +00:00
|
|
|
const CommandBufferResourceUsage& CommandBufferBase::GetResourceUsages() const {
|
|
|
|
return mResourceUsages;
|
2017-07-12 00:49:20 +00:00
|
|
|
}
|
|
|
|
|
2019-06-11 18:11:05 +00:00
|
|
|
bool IsCompleteSubresourceCopiedTo(const TextureBase* texture,
|
|
|
|
const Extent3D copySize,
|
|
|
|
const uint32_t mipLevel) {
|
|
|
|
if (texture->GetSize().depth == copySize.depth &&
|
|
|
|
(texture->GetSize().width >> mipLevel) == copySize.width &&
|
|
|
|
(texture->GetSize().height >> mipLevel) == copySize.height) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2018-07-24 14:45:45 +00:00
|
|
|
} // namespace dawn_native
|