gecko-dev/dom/webgpu/CanvasContext.h
Dzmitry Malyshau b91906eeac Bug 1581710 - Update WebGPU IDL bindings r=jgilbert,bzbarsky
This mostly updates the bindings to the current state.
No actual logic backing them yet.

*Note*: the IDL does *not* need to be checked for matching the upstream spec precisely at this stage. The upstream is evolving, we just need to update in order to start integrating the implementation. What needs to be checked is - how C++ represents the IDL, esp with regards to derived classes, events, and hierarchies.

The trickiest points, arguably, are:
  - WebGPU -> GPU prefix change
  - the goop for interfaces that are not final

Differential Revision: https://phabricator.services.mozilla.com/D46166

--HG--
rename : dom/webgpu/InputState.cpp => dom/webgpu/DeviceLostInfo.cpp
rename : dom/webgpu/Fence.h => dom/webgpu/DeviceLostInfo.h
rename : dom/webgpu/BlendState.cpp => dom/webgpu/OutOfMemoryError.cpp
rename : dom/webgpu/LogEntry.h => dom/webgpu/OutOfMemoryError.h
rename : dom/webgpu/BindGroup.h => dom/webgpu/ProgrammablePassEncoder.cpp
rename : dom/webgpu/BlendState.cpp => dom/webgpu/RenderBundle.cpp
rename : dom/webgpu/BlendState.h => dom/webgpu/RenderBundle.h
rename : dom/webgpu/AttachmentState.cpp => dom/webgpu/ValidationError.cpp
rename : dom/webgpu/AttachmentState.h => dom/webgpu/ValidationError.h
extra : moz-landing-system : lando
2019-10-02 16:46:03 +00:00

88 lines
2.6 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GPU_CanvasContext_H_
#define GPU_CanvasContext_H_
#include "nsICanvasRenderingContextInternal.h"
#include "nsWrapperCache.h"
#include "ObjectModel.h"
#include "SwapChain.h"
namespace mozilla {
namespace dom {
class Promise;
}
namespace webgpu {
class Device;
class SwapChain;
class CanvasContext final : public nsICanvasRenderingContextInternal,
public nsWrapperCache {
private:
virtual ~CanvasContext();
public:
CanvasContext() = delete;
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsISupports interface + CC
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasContext)
public:
// nsICanvasRenderingContextInternal
int32_t GetWidth() override { return 0; }
int32_t GetHeight() override { return 0; }
NS_IMETHOD SetDimensions(int32_t aWidth, int32_t aHeight) override {
return NS_OK;
}
NS_IMETHOD InitializeWithDrawTarget(
nsIDocShell* aShell, NotNull<gfx::DrawTarget*> aTarget) override {
return NS_OK;
}
mozilla::UniquePtr<uint8_t[]> GetImageBuffer(int32_t* aFormat) override {
MOZ_CRASH("todo");
}
NS_IMETHOD GetInputStream(const char* aMimeType,
const nsAString& aEncoderOptions,
nsIInputStream** aStream) override {
*aStream = nullptr;
return NS_OK;
}
already_AddRefed<mozilla::gfx::SourceSurface> GetSurfaceSnapshot(
gfxAlphaType* aOutAlphaType) override {
return nullptr;
}
void SetOpaqueValueFromOpaqueAttr(bool aOpaqueAttrValue) override {}
bool GetIsOpaque() override { return true; }
NS_IMETHOD Reset() override { return NS_OK; }
already_AddRefed<Layer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
Layer* aOldLayer,
LayerManager* aManager) override {
return nullptr;
}
void MarkContextClean() override {}
NS_IMETHOD Redraw(const gfxRect& aDirty) override { return NS_OK; }
NS_IMETHOD SetIsIPC(bool aIsIPC) override { return NS_OK; }
void DidRefresh() override {}
void MarkContextCleanForFrameCapture() override {}
bool IsContextCleanForFrameCapture() override { return false; }
};
} // namespace webgpu
} // namespace mozilla
#endif // GPU_CanvasContext_H_