mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement GPUTexture and GPUTextureView
This commit is contained in:
parent
d9db350df5
commit
af95d92231
15 changed files with 638 additions and 15 deletions
|
@ -13,11 +13,12 @@ dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
|
|||
};
|
||||
|
||||
dictionary GPUBindGroupLayoutEntry {
|
||||
required unsigned long binding;
|
||||
required GPUIndex32 binding;
|
||||
required GPUShaderStageFlags visibility;
|
||||
required GPUBindingType type;
|
||||
//GPUTextureViewDimension textureDimension = "2d";
|
||||
//GPUTextureComponentType textureComponentType = "float";
|
||||
GPUTextureViewDimension viewDimension = "2d";
|
||||
GPUTextureComponentType textureComponentType = "float";
|
||||
GPUTextureFormat storageTextureFormat;
|
||||
boolean multisampled = false;
|
||||
boolean hasDynamicOffset = false;
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// https://gpuweb.github.io/gpuweb/#gpudevice
|
||||
[Exposed=(Window, DedicatedWorker)/*, Serializable */, Pref="dom.webgpu.enabled"]
|
||||
interface GPUDevice : EventTarget {
|
||||
/*[SameObject]*/ readonly attribute GPUAdapter adapter;
|
||||
[SameObject] readonly attribute GPUAdapter adapter;
|
||||
readonly attribute object extensions;
|
||||
readonly attribute object limits;
|
||||
|
||||
|
@ -13,7 +13,7 @@ interface GPUDevice : EventTarget {
|
|||
|
||||
GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
|
||||
GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor);
|
||||
// GPUTexture createTexture(GPUTextureDescriptor descriptor);
|
||||
GPUTexture createTexture(GPUTextureDescriptor descriptor);
|
||||
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
|
||||
|
||||
GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
|
||||
|
|
|
@ -56,7 +56,7 @@ enum GPUCullMode {
|
|||
};
|
||||
|
||||
dictionary GPUColorStateDescriptor {
|
||||
//required GPUTextureFormat format;
|
||||
required GPUTextureFormat format;
|
||||
|
||||
GPUBlendDescriptor alphaBlend = {};
|
||||
GPUBlendDescriptor colorBlend = {};
|
||||
|
@ -107,7 +107,7 @@ enum GPUStencilOperation {
|
|||
typedef [EnforceRange] unsigned long GPUStencilValue;
|
||||
|
||||
dictionary GPUDepthStencilStateDescriptor {
|
||||
//required GPUTextureFormat format;
|
||||
required GPUTextureFormat format;
|
||||
|
||||
boolean depthWriteEnabled = false;
|
||||
GPUCompareFunction depthCompare = "always";
|
||||
|
|
94
components/script/dom/webidls/GPUTexture.webidl
Normal file
94
components/script/dom/webidls/GPUTexture.webidl
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* 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 https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gputexture
|
||||
[Exposed=(Window, DedicatedWorker), Serializable , Pref="dom.webgpu.enabled"]
|
||||
interface GPUTexture {
|
||||
GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
|
||||
|
||||
void destroy();
|
||||
};
|
||||
GPUTexture includes GPUObjectBase;
|
||||
|
||||
dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
|
||||
required GPUExtent3D size;
|
||||
GPUIntegerCoordinate mipLevelCount = 1;
|
||||
GPUSize32 sampleCount = 1;
|
||||
GPUTextureDimension dimension = "2d";
|
||||
required GPUTextureFormat format;
|
||||
required GPUTextureUsageFlags usage;
|
||||
};
|
||||
|
||||
enum GPUTextureDimension {
|
||||
"1d",
|
||||
"2d",
|
||||
"3d"
|
||||
};
|
||||
|
||||
enum GPUTextureFormat {
|
||||
// 8-bit formats
|
||||
"r8unorm",
|
||||
"r8snorm",
|
||||
"r8uint",
|
||||
"r8sint",
|
||||
|
||||
// 16-bit formats
|
||||
"r16uint",
|
||||
"r16sint",
|
||||
"r16float",
|
||||
"rg8unorm",
|
||||
"rg8snorm",
|
||||
"rg8uint",
|
||||
"rg8sint",
|
||||
|
||||
// 32-bit formats
|
||||
"r32uint",
|
||||
"r32sint",
|
||||
"r32float",
|
||||
"rg16uint",
|
||||
"rg16sint",
|
||||
"rg16float",
|
||||
"rgba8unorm",
|
||||
"rgba8unorm-srgb",
|
||||
"rgba8snorm",
|
||||
"rgba8uint",
|
||||
"rgba8sint",
|
||||
"bgra8unorm",
|
||||
"bgra8unorm-srgb",
|
||||
// Packed 32-bit formats
|
||||
"rgb10a2unorm",
|
||||
"rg11b10float",
|
||||
|
||||
// 64-bit formats
|
||||
"rg32uint",
|
||||
"rg32sint",
|
||||
"rg32float",
|
||||
"rgba16uint",
|
||||
"rgba16sint",
|
||||
"rgba16float",
|
||||
|
||||
// 128-bit formats
|
||||
"rgba32uint",
|
||||
"rgba32sint",
|
||||
"rgba32float",
|
||||
|
||||
// Depth and stencil formats
|
||||
"depth32float",
|
||||
"depth24plus",
|
||||
"depth24plus-stencil8"
|
||||
};
|
||||
|
||||
enum GPUTextureComponentType {
|
||||
"float",
|
||||
"sint",
|
||||
"uint"
|
||||
};
|
||||
|
||||
dictionary GPUExtent3DDict {
|
||||
required GPUIntegerCoordinate width;
|
||||
required GPUIntegerCoordinate height;
|
||||
required GPUIntegerCoordinate depth;
|
||||
};
|
||||
typedef [EnforceRange] unsigned long GPUIntegerCoordinate;
|
||||
typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D;
|
15
components/script/dom/webidls/GPUTextureUsage.webidl
Normal file
15
components/script/dom/webidls/GPUTextureUsage.webidl
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* 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 https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gputextureusage
|
||||
[Exposed=(Window, DedicatedWorker), Pref="dom.webgpu.enabled"]
|
||||
interface GPUTextureUsage {
|
||||
const GPUTextureUsageFlags COPY_SRC = 0x01;
|
||||
const GPUTextureUsageFlags COPY_DST = 0x02;
|
||||
const GPUTextureUsageFlags SAMPLED = 0x04;
|
||||
const GPUTextureUsageFlags STORAGE = 0x08;
|
||||
const GPUTextureUsageFlags OUTPUT_ATTACHMENT = 0x10;
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
34
components/script/dom/webidls/GPUTextureView.webidl
Normal file
34
components/script/dom/webidls/GPUTextureView.webidl
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* 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 https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gputextureview
|
||||
[Exposed=(Window, DedicatedWorker), Pref="dom.webgpu.enabled"]
|
||||
interface GPUTextureView {
|
||||
};
|
||||
GPUTextureView includes GPUObjectBase;
|
||||
|
||||
dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase {
|
||||
GPUTextureFormat format;
|
||||
GPUTextureViewDimension dimension;
|
||||
GPUTextureAspect aspect = "all";
|
||||
GPUIntegerCoordinate baseMipLevel = 0;
|
||||
GPUIntegerCoordinate mipLevelCount = 0;
|
||||
GPUIntegerCoordinate baseArrayLayer = 0;
|
||||
GPUIntegerCoordinate arrayLayerCount = 0;
|
||||
};
|
||||
|
||||
enum GPUTextureViewDimension {
|
||||
"1d",
|
||||
"2d",
|
||||
"2d-array",
|
||||
"cube",
|
||||
"cube-array",
|
||||
"3d"
|
||||
};
|
||||
|
||||
enum GPUTextureAspect {
|
||||
"all",
|
||||
"stencil-only",
|
||||
"depth-only"
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue