mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-05 19:55:37 +00:00
This reverts commit b6a80b321e8fa0b79d9a947656ea0ad649ed5a3c. Reason for revert: dawn_end2end_tests are failing on the Chromium GPU FYI bots. Example here: https://ci.chromium.org/p/chromium/builders/ci/Win10%20FYI%20Release%20%28NVIDIA%29/4226 Original change's description: > Destroy backend implementation for Buffers > > Destroy can be used to free the GPU memory associated with resources > without waiting for javascript garbage collection to occur. > The buffer is validated at submission to the queue. > So any buffer that has been destroyed before submission, will then > invalidate the submit and result in an error. > > Bug: dawn:46 > Change-Id: I40df56ce97baef01deea7552d7a6d40b558fc985 > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5320 > Reviewed-by: Kai Ninomiya <kainino@chromium.org> > Commit-Queue: Natasha Lee <natlee@microsoft.com> TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,rafael.cintron@microsoft.com,natlee@microsoft.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: dawn:46 Change-Id: Iadf37a8a6675c744207ec7daaa3fd2fde7da3714 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5480 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
66 lines
1.8 KiB
Objective-C
66 lines
1.8 KiB
Objective-C
// Copyright 2017 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_METAL_BUFFERMTL_H_
|
|
#define DAWNNATIVE_METAL_BUFFERMTL_H_
|
|
|
|
#include "common/SerialQueue.h"
|
|
#include "dawn_native/Buffer.h"
|
|
|
|
#import <Metal/Metal.h>
|
|
|
|
namespace dawn_native { namespace metal {
|
|
|
|
class Device;
|
|
|
|
class Buffer : public BufferBase {
|
|
public:
|
|
Buffer(Device* device, const BufferDescriptor* descriptor);
|
|
~Buffer();
|
|
|
|
id<MTLBuffer> GetMTLBuffer();
|
|
|
|
void OnMapCommandSerialFinished(uint32_t mapSerial, bool isWrite);
|
|
|
|
private:
|
|
void MapReadAsyncImpl(uint32_t serial) override;
|
|
void MapWriteAsyncImpl(uint32_t serial) override;
|
|
void UnmapImpl() override;
|
|
|
|
id<MTLBuffer> mMtlBuffer = nil;
|
|
};
|
|
|
|
class MapRequestTracker {
|
|
public:
|
|
MapRequestTracker(Device* device);
|
|
~MapRequestTracker();
|
|
|
|
void Track(Buffer* buffer, uint32_t mapSerial, bool isWrite);
|
|
void Tick(Serial finishedSerial);
|
|
|
|
private:
|
|
Device* mDevice;
|
|
|
|
struct Request {
|
|
Ref<Buffer> buffer;
|
|
uint32_t mapSerial;
|
|
bool isWrite;
|
|
};
|
|
SerialQueue<Request> mInflightRequests;
|
|
};
|
|
|
|
}} // namespace dawn_native::metal
|
|
|
|
#endif // DAWNNATIVE_METAL_BUFFERMTL_H_
|