Sitelet https://github.com/gpuweb/gpuweb/pull/241/files
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 108 additions & 108 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ typedef unsigned long u32;
typedef unsigned long long u64;

dictionary GPUColor {
float r;
float g;
float b;
float a;
required float r;
required float g;
required float b;
required float a;
};

dictionary GPUOrigin3D {
u32 x;
u32 y;
u32 z;
u32 x = 0;
u32 y = 0;
u32 z = 0;
};

dictionary GPUExtent3D {
u32 width;
u32 height;
u32 depth;
required u32 width;
required u32 height;
required u32 depth;
};
</script>

Expand All @@ -62,8 +62,8 @@ interface GPUBufferUsage {
};

dictionary GPUBufferDescriptor {
u64 size;
GPUBufferUsageFlags usage;
required u64 size;
required GPUBufferUsageFlags usage;
};

interface GPUBuffer {
Expand Down Expand Up @@ -170,13 +170,13 @@ interface GPUTextureUsage {
};

dictionary GPUTextureDescriptor {
GPUExtent3D size;
u32 arrayLayerCount;
u32 mipLevelCount;
u32 sampleCount;
GPUTextureDimension dimension;
GPUTextureFormat format;
GPUTextureUsageFlags usage;
required GPUExtent3D size;
u32 arrayLayerCount = 1;
u32 mipLevelCount = 1;
u32 sampleCount = 1;
GPUTextureDimension dimension = "2d";
required GPUTextureFormat format;
required GPUTextureUsageFlags usage;
};

// Texture view
Expand All @@ -196,13 +196,13 @@ enum GPUTextureAspect {
};

dictionary GPUTextureViewDescriptor {
GPUTextureFormat format;
GPUTextureViewDimension dimension;
GPUTextureAspect aspect;
u32 baseMipLevel;
u32 mipLevelCount;
u32 baseArrayLayer;
u32 arrayLayerCount;
required GPUTextureFormat format;
required GPUTextureViewDimension dimension;
required GPUTextureAspect aspect;
u32 baseMipLevel = 0;
u32 mipLevelCount = 1;
u32 baseArrayLayer = 0;
u32 arrayLayerCount = 1;
};

interface GPUTextureView {
Expand Down Expand Up @@ -282,41 +282,41 @@ enum GPUBindingType {
};

dictionary GPUBindGroupLayoutBinding {
u32 binding;
GPUShaderStageFlags visibility;
GPUBindingType type;
required u32 binding;
required GPUShaderStageFlags visibility;
required GPUBindingType type;
};

dictionary GPUBindGroupLayoutDescriptor {
sequence<GPUBindGroupLayoutBinding> bindings;
required sequence<GPUBindGroupLayoutBinding> bindings;
};

interface GPUBindGroupLayout {
};

dictionary GPUPipelineLayoutDescriptor {
sequence<GPUBindGroupLayout> bindGroupLayouts;
required sequence<GPUBindGroupLayout> bindGroupLayouts;
};

interface GPUPipelineLayout {
};

dictionary GPUBufferBinding {
GPUBuffer buffer;
u64 offset;
u64 size;
required GPUBuffer buffer;
u64 offset = 0;
required u64 size;
};

typedef (GPUSampler or GPUTextureView or GPUBufferBinding) GPUBindingResource;

dictionary GPUBindGroupBinding {
u32 binding;
GPUBindingResource resource;
required u32 binding;
required GPUBindingResource resource;
};

dictionary GPUBindGroupDescriptor {
GPUBindGroupLayout layout;
sequence<GPUBindGroupBinding> bindings;
required GPUBindGroupLayout layout;
required sequence<GPUBindGroupBinding> bindings;
};

interface GPUBindGroup {
Expand Down Expand Up @@ -357,12 +357,12 @@ enum GPUCullMode {
};

dictionary GPURasterizationStateDescriptor {
GPUFrontFace frontFace;
GPUCullMode cullMode;
required GPUFrontFace frontFace;
GPUCullMode cullMode = "none";

i32 depthBias;
float depthBiasSlopeScale;
float depthBiasClamp;
i32 depthBias = 0;
float depthBiasSlopeScale = 0;
float depthBiasClamp = 0;
};

// BlendState
Expand Down Expand Up @@ -401,17 +401,17 @@ interface GPUColorWriteBits {
};

dictionary GPUBlendDescriptor {
GPUBlendFactor srcFactor;
GPUBlendFactor dstFactor;
GPUBlendOperation operation;
GPUBlendFactor srcFactor = "one";
GPUBlendFactor dstFactor = "zero";
GPUBlendOperation operation = "add";
};

dictionary GPUColorStateDescriptor {
GPUTextureFormat format;
required GPUTextureFormat format;

GPUBlendDescriptor alphaBlend;
GPUBlendDescriptor colorBlend;
GPUColorWriteFlags writeMask;
required GPUBlendDescriptor alphaBlend;
Comment thread
kainino0x marked this conversation as resolved.
required GPUBlendDescriptor colorBlend;
GPUColorWriteFlags writeMask = GPUColorWriteBits.ALL;
};

enum GPUStencilOperation {
Expand All @@ -426,23 +426,23 @@ enum GPUStencilOperation {
};

dictionary GPUStencilStateFaceDescriptor {
GPUCompareFunction compare;
GPUStencilOperation failOp;
GPUStencilOperation depthFailOp;
GPUStencilOperation passOp;
GPUCompareFunction compare = "always";
GPUStencilOperation failOp = "keep";
GPUStencilOperation depthFailOp = "keep";
GPUStencilOperation passOp = "keep";
};

dictionary GPUDepthStencilStateDescriptor {
GPUTextureFormat format;
required GPUTextureFormat format;

boolean depthWriteEnabled;
GPUCompareFunction depthCompare;
boolean depthWriteEnabled = false;
GPUCompareFunction depthCompare = "always";

GPUStencilStateFaceDescriptor stencilFront;
GPUStencilStateFaceDescriptor stencilBack;
required GPUStencilStateFaceDescriptor stencilFront;
required GPUStencilStateFaceDescriptor stencilBack;

u32 stencilReadMask;
u32 stencilWriteMask;
u32 stencilReadMask = 0xFFFFFFFF;
u32 stencilWriteMask = 0xFFFFFFFF;
};

// InputState
Expand Down Expand Up @@ -506,23 +506,23 @@ enum GPUInputStepMode {
};

dictionary GPUVertexAttributeDescriptor {
u32 shaderLocation;
u32 inputSlot;
u64 offset;
GPUVertexFormat format;
required u32 shaderLocation;
required u32 inputSlot;
u64 offset = 0;
required GPUVertexFormat format;
};

dictionary GPUVertexInputDescriptor {
u32 inputSlot;
u64 stride;
GPUInputStepMode stepMode;
required u32 inputSlot;
required u64 stride;
GPUInputStepMode stepMode = "vertex";
};

dictionary GPUInputStateDescriptor {
GPUIndexFormat indexFormat;
required GPUIndexFormat indexFormat;

sequence<GPUVertexAttributeDescriptor> attributes;
sequence<GPUVertexInputDescriptor> inputs;
required sequence<GPUVertexAttributeDescriptor> attributes;
required sequence<GPUVertexInputDescriptor> inputs;
};
</script>

Expand All @@ -531,13 +531,13 @@ Pipeline Descriptors {#pipeline-descriptors}

<script type=idl>
dictionary GPUPipelineStageDescriptor {
GPUShaderModule module;
DOMString entryPoint;
required GPUShaderModule module;
required DOMString entryPoint;
// TODO other stuff like specialization constants?
};

dictionary GPUPipelineDescriptorBase {
GPUPipelineLayout layout;
required GPUPipelineLayout layout;
};
</script>

Expand All @@ -546,7 +546,7 @@ Compute Pipeline {#compute-pipeline}

<script type=idl>
dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
GPUPipelineStageDescriptor computeStage;
required GPUPipelineStageDescriptor computeStage;
};

interface GPUComputePipeline {
Expand All @@ -566,17 +566,17 @@ enum GPUPrimitiveTopology {
};

dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
GPUPipelineStageDescriptor vertexStage;
GPUPipelineStageDescriptor fragmentStage;
required GPUPipelineStageDescriptor vertexStage;
GPUPipelineStageDescriptor? fragmentStage = null;

GPUPrimitiveTopology primitiveTopology;
GPURasterizationStateDescriptor rasterizationState;
sequence<GPUColorStateDescriptor> colorStates;
GPUDepthStencilStateDescriptor? depthStencilState;
GPUInputStateDescriptor inputState;
required GPUPrimitiveTopology primitiveTopology;
required GPURasterizationStateDescriptor rasterizationState;
required sequence<GPUColorStateDescriptor> colorStates;
GPUDepthStencilStateDescriptor? depthStencilState = null;
required GPUInputStateDescriptor inputState;

// Number of MSAA samples
u32 sampleCount;
u32 sampleCount = 1;
// TODO other properties
};

Expand Down Expand Up @@ -634,43 +634,43 @@ enum GPUStoreOp {
};

dictionary GPURenderPassColorAttachmentDescriptor {
GPUTextureView attachment;
GPUTextureView? resolveTarget;
required GPUTextureView attachment;
GPUTextureView? resolveTarget = null;

GPULoadOp loadOp;
GPUStoreOp storeOp;
GPUColor clearColor;
required GPULoadOp loadOp;
required GPUStoreOp storeOp;
GPUColor clearColor = {r: 0.0, g: 0.0, b: 0.0, a: 1.0};
};

dictionary GPURenderPassDepthStencilAttachmentDescriptor {
GPUTextureView attachment;
required GPUTextureView attachment;

GPULoadOp depthLoadOp;
GPUStoreOp depthStoreOp;
float clearDepth;
required GPULoadOp depthLoadOp;
required GPUStoreOp depthStoreOp;
required float clearDepth;

GPULoadOp stencilLoadOp;
GPUStoreOp stencilStoreOp;
u32 clearStencil;
required GPULoadOp stencilLoadOp;
required GPUStoreOp stencilStoreOp;
u32 clearStencil = 0;
};

dictionary GPURenderPassDescriptor {
sequence<GPURenderPassColorAttachmentDescriptor> colorAttachments;
GPURenderPassDepthStencilAttachmentDescriptor? depthStencilAttachment;
required sequence<GPURenderPassColorAttachmentDescriptor> colorAttachments;
GPURenderPassDepthStencilAttachmentDescriptor? depthStencilAttachment = null;
};

dictionary GPUBufferCopyView {
GPUBuffer buffer;
u64 offset;
u32 rowPitch;
u32 imageHeight;
required GPUBuffer buffer;
u64 offset = 0;
required u32 rowPitch;
required u32 imageHeight;
};

dictionary GPUTextureCopyView {
GPUTexture texture;
u32 mipLevel;
u32 arrayLayer;
GPUOrigin3D origin;
required GPUTexture texture;
u32 mipLevel = 0;
u32 arrayLayer = 0;
GPUOrigin3D origin = {x: 0, y: 0, z: 0};
};

interface GPUCommandBuffer {
Expand Down Expand Up @@ -765,11 +765,11 @@ Device {#device}

<script type=idl>
dictionary GPUExtensions {
boolean anisotropicFiltering;
boolean anisotropicFiltering = false;
};

dictionary GPULimits {
u32 maxBindGroups;
u32 maxBindGroups = 4;
Comment thread
kainino0x marked this conversation as resolved.
};

// Device
Expand Down Expand Up @@ -819,7 +819,7 @@ enum GPUPowerPreference {
};

dictionary GPURequestAdapterOptions {
GPUPowerPreference powerPreference;
GPUPowerPreference? powerPreference;
};

[Exposed=Window]
Expand Down