dawn-cmake/src/dawn_native/d3d12/GPUDescriptorHeapAllocationD3D12.h
Corentin Wallez cac14e0067 D3D12: Use typed integers for the HeapVersionID
This will prevent mixing it up with other serial types in the future.

Bug: dawn:442
Change-Id: I32f356c62f19ef29f3bf51c19873369fb817bb16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28960
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-28 16:05:24 +00:00

45 lines
1.6 KiB
C++

// Copyright 2020 The Dawn Authors
//
// 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.
#ifndef DAWNNATIVE_D3D12_GPUDESCRIPTORHEAPALLOCATION_H_
#define DAWNNATIVE_D3D12_GPUDESCRIPTORHEAPALLOCATION_H_
#include "common/Serial.h"
#include "dawn_native/d3d12/IntegerTypes.h"
#include "dawn_native/d3d12/d3d12_platform.h"
namespace dawn_native { namespace d3d12 {
// Wrapper for a handle into a GPU-only descriptor heap.
class GPUDescriptorHeapAllocation {
public:
GPUDescriptorHeapAllocation() = default;
GPUDescriptorHeapAllocation(D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor,
Serial lastUsageSerial,
HeapVersionID heapSerial);
D3D12_GPU_DESCRIPTOR_HANDLE GetBaseDescriptor() const;
Serial GetLastUsageSerial() const;
HeapVersionID GetHeapSerial() const;
private:
D3D12_GPU_DESCRIPTOR_HANDLE mBaseDescriptor = {0};
Serial mLastUsageSerial = 0;
HeapVersionID mHeapSerial = HeapVersionID(0);
};
}} // namespace dawn_native::d3d12
#endif // DAWNNATIVE_D3D12_CPUDESCRIPTORHEAPALLOCATION_H_