Loading dom/webgpu/Queue.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -259,7 +259,7 @@ void Queue::CopyExternalImageToTexture( const dom::GPUImageCopyExternalImage& aSource, const dom::GPUImageCopyTextureTagged& aDestination, const dom::GPUExtent3D& aCopySize, ErrorResult& aRv) { const auto dstFormat = ToWebGLTexelFormat(aDestination.mTexture->mFormat); const auto dstFormat = ToWebGLTexelFormat(aDestination.mTexture->Format()); if (dstFormat == WebGLTexelFormat::FormatNotSupportingAnyConversion) { aRv.ThrowInvalidStateError("Unsupported destination format"); return; Loading dom/webgpu/Texture.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ #include "mozilla/webgpu/ffi/wgpu.h" #include "mozilla/webgpu/CanvasContext.h" #include "mozilla/dom/WebGPUBinding.h" #include "mozilla/webgpu/WebGPUTypes.h" #include "TextureView.h" #include "Utility.h" namespace mozilla::webgpu { Loading Loading @@ -91,7 +93,12 @@ Texture::Texture(Device* const aParent, RawId aId, : ChildOf(aParent), mId(aId), mFormat(aDesc.mFormat), mBytesPerBlock(GetBytesPerBlock(aDesc.mFormat)) {} mBytesPerBlock(GetBytesPerBlock(aDesc.mFormat)), mSize(ConvertExtent(aDesc.mSize)), mMipLevelCount(aDesc.mMipLevelCount), mSampleCount(aDesc.mSampleCount), mDimension(aDesc.mDimension), mUsage(aDesc.mUsage) {} Texture::~Texture() { Cleanup(); } Loading dom/webgpu/Texture.h +19 −3 Original line number Diff line number Diff line Loading @@ -6,22 +6,23 @@ #ifndef GPU_Texture_H_ #define GPU_Texture_H_ #include <cstdint> #include "mozilla/WeakPtr.h" #include "nsWrapperCache.h" #include "ObjectModel.h" #include "mozilla/webgpu/WebGPUTypes.h" #include "mozilla/webgpu/ffi/wgpu.h" namespace mozilla { namespace dom { struct GPUTextureDescriptor; struct GPUTextureViewDescriptor; enum class GPUTextureDimension : uint8_t; enum class GPUTextureFormat : uint8_t; enum class GPUTextureUsageFlags : uint32_t; } // namespace dom namespace webgpu { namespace ffi { struct WGPUTextureViewDescriptor; } // namespace ffi class CanvasContext; class Device; Loading @@ -45,10 +46,25 @@ class Texture final : public ObjectBase, public ChildOf<Device> { virtual ~Texture(); void Cleanup(); const ffi::WGPUExtent3d mSize; const uint32_t mMipLevelCount; const uint32_t mSampleCount; const dom::GPUTextureDimension mDimension; const uint32_t mUsage; public: already_AddRefed<TextureView> CreateView( const dom::GPUTextureViewDescriptor& aDesc); void Destroy(); uint32_t Width() const { return mSize.width; } uint32_t Height() const { return mSize.height; } uint32_t DepthOrArrayLayers() const { return mSize.depth_or_array_layers; } uint32_t MipLevelCount() const { return mMipLevelCount; } uint32_t SampleCount() const { return mSampleCount; } dom::GPUTextureDimension Dimension() const { return mDimension; } dom::GPUTextureFormat Format() const { return mFormat; } uint32_t Usage() const { return mUsage; } }; } // namespace webgpu Loading dom/webidl/WebGPU.webidl +12 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,18 @@ interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); undefined destroy(); // TODO: s/unsigned long/GPUIntegerCoordinate: https://github.com/gpuweb/gpuweb/issues/4080 readonly attribute unsigned long width; readonly attribute unsigned long height; readonly attribute unsigned long depthOrArrayLayers; readonly attribute unsigned long mipLevelCount; // TODO: s/unsigned long/GPUSize32: https://github.com/gpuweb/gpuweb/issues/4080 readonly attribute unsigned long sampleCount; readonly attribute GPUTextureDimension dimension; readonly attribute GPUTextureFormat format; // TODO: s/unsigned long/GPUSize32: https://github.com/gpuweb/gpuweb/issues/4080 readonly attribute unsigned long usage; }; GPUTexture includes GPUObjectBase; Loading Loading
dom/webgpu/Queue.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -259,7 +259,7 @@ void Queue::CopyExternalImageToTexture( const dom::GPUImageCopyExternalImage& aSource, const dom::GPUImageCopyTextureTagged& aDestination, const dom::GPUExtent3D& aCopySize, ErrorResult& aRv) { const auto dstFormat = ToWebGLTexelFormat(aDestination.mTexture->mFormat); const auto dstFormat = ToWebGLTexelFormat(aDestination.mTexture->Format()); if (dstFormat == WebGLTexelFormat::FormatNotSupportingAnyConversion) { aRv.ThrowInvalidStateError("Unsupported destination format"); return; Loading
dom/webgpu/Texture.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ #include "mozilla/webgpu/ffi/wgpu.h" #include "mozilla/webgpu/CanvasContext.h" #include "mozilla/dom/WebGPUBinding.h" #include "mozilla/webgpu/WebGPUTypes.h" #include "TextureView.h" #include "Utility.h" namespace mozilla::webgpu { Loading Loading @@ -91,7 +93,12 @@ Texture::Texture(Device* const aParent, RawId aId, : ChildOf(aParent), mId(aId), mFormat(aDesc.mFormat), mBytesPerBlock(GetBytesPerBlock(aDesc.mFormat)) {} mBytesPerBlock(GetBytesPerBlock(aDesc.mFormat)), mSize(ConvertExtent(aDesc.mSize)), mMipLevelCount(aDesc.mMipLevelCount), mSampleCount(aDesc.mSampleCount), mDimension(aDesc.mDimension), mUsage(aDesc.mUsage) {} Texture::~Texture() { Cleanup(); } Loading
dom/webgpu/Texture.h +19 −3 Original line number Diff line number Diff line Loading @@ -6,22 +6,23 @@ #ifndef GPU_Texture_H_ #define GPU_Texture_H_ #include <cstdint> #include "mozilla/WeakPtr.h" #include "nsWrapperCache.h" #include "ObjectModel.h" #include "mozilla/webgpu/WebGPUTypes.h" #include "mozilla/webgpu/ffi/wgpu.h" namespace mozilla { namespace dom { struct GPUTextureDescriptor; struct GPUTextureViewDescriptor; enum class GPUTextureDimension : uint8_t; enum class GPUTextureFormat : uint8_t; enum class GPUTextureUsageFlags : uint32_t; } // namespace dom namespace webgpu { namespace ffi { struct WGPUTextureViewDescriptor; } // namespace ffi class CanvasContext; class Device; Loading @@ -45,10 +46,25 @@ class Texture final : public ObjectBase, public ChildOf<Device> { virtual ~Texture(); void Cleanup(); const ffi::WGPUExtent3d mSize; const uint32_t mMipLevelCount; const uint32_t mSampleCount; const dom::GPUTextureDimension mDimension; const uint32_t mUsage; public: already_AddRefed<TextureView> CreateView( const dom::GPUTextureViewDescriptor& aDesc); void Destroy(); uint32_t Width() const { return mSize.width; } uint32_t Height() const { return mSize.height; } uint32_t DepthOrArrayLayers() const { return mSize.depth_or_array_layers; } uint32_t MipLevelCount() const { return mMipLevelCount; } uint32_t SampleCount() const { return mSampleCount; } dom::GPUTextureDimension Dimension() const { return mDimension; } dom::GPUTextureFormat Format() const { return mFormat; } uint32_t Usage() const { return mUsage; } }; } // namespace webgpu Loading
dom/webidl/WebGPU.webidl +12 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,18 @@ interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); undefined destroy(); // TODO: s/unsigned long/GPUIntegerCoordinate: https://github.com/gpuweb/gpuweb/issues/4080 readonly attribute unsigned long width; readonly attribute unsigned long height; readonly attribute unsigned long depthOrArrayLayers; readonly attribute unsigned long mipLevelCount; // TODO: s/unsigned long/GPUSize32: https://github.com/gpuweb/gpuweb/issues/4080 readonly attribute unsigned long sampleCount; readonly attribute GPUTextureDimension dimension; readonly attribute GPUTextureFormat format; // TODO: s/unsigned long/GPUSize32: https://github.com/gpuweb/gpuweb/issues/4080 readonly attribute unsigned long usage; }; GPUTexture includes GPUObjectBase; Loading