-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up WebGPUVertexInputDescriptor #146
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -368,13 +368,11 @@ interface WebGPUInputStepMode { | |
|
||
dictionary WebGPUVertexAttributeDescriptor { | ||
u32 shaderLocation; | ||
u32 inputSlot; | ||
u32 vertexBufferIndex; | ||
u32 offset; | ||
WebGPUVertexFormatEnum format; | ||
}; | ||
|
||
dictionary WebGPUVertexInputDescriptor { | ||
u32 inputSlot; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be in favor of keeping this, so that applications can define "holes" in their vertex buffers, which would allow minimizing state setting between two pipeline using very similar but different vertex buffers (they could match on VB 0 to 5 and one of them having VB 6 and the other VB 7). Actually having holes in interfaces like this is something I also wanted to bring up for the pipeline layout and color attachments as well. We already had at least on project prototyping on Dawn ask if we could have holes in the pipeline layout. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JavaScript arrays are sparse and heterogeneous, so they don't prevent us from having holes. With the change at [1], we could probably (if the IDL accepts it) have: { vertexBuffers: [buffer0, null, buffer2] } or
|
||
dictionary WebGPUVertexBufferDescriptor { | ||
u32 stride; | ||
WebGPUInputStepModeEnum stepMode; | ||
}; | ||
|
@@ -383,7 +381,7 @@ dictionary WebGPUInputStateDescriptor { | |
WebGPUIndexFormatEnum indexFormat; | ||
|
||
sequence<WebGPUVertexAttributeDescriptor> attributes; | ||
sequence<WebGPUVertexInputDescriptor> inputs; | ||
sequence<WebGPUVertexBufferDescriptor> vertexBuffers; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [1] This would probably have to be |
||
}; | ||
|
||
// ShaderModule | ||
|
@@ -483,7 +481,7 @@ interface WebGPURenderPassEncoder : WebGPUProgrammablePassEncoder { | |
void setScissorRect(u32 x, u32 y, u32 width, u32 height); | ||
|
||
void setIndexBuffer(WebGPUBuffer buffer, u32 offset); | ||
void setVertexBuffers(u32 startSlot, sequence<WebGPUBuffer> buffers, sequence<u32> offsets); | ||
void setVertexBuffers(u32 startVertexBufferIndex, sequence<WebGPUBuffer> buffers, sequence<u32> offsets); | ||
|
||
void draw(u32 vertexCount, u32 instanceCount, u32 firstVertex, u32 firstInstance); | ||
void drawIndexed(u32 indexCount, u32 instanceCount, u32 firstIndex, i32 baseVertex, u32 firstInstance); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep the format because for example a shader taking vec2 as an input can have data stored at in many different ways: