Skip to content

Commit

Permalink
Update webgpu-headers submodule (#125)
Browse files Browse the repository at this point in the history
* Update webgpu-headers submodule

* Also update examples to new webgpu-header
  • Loading branch information
almarklein authored Aug 3, 2021
1 parent 5c304b5 commit aaa5dcc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions examples/capture/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main(
WGPUExtent3D textureExtent = (WGPUExtent3D) {
.width = bufferDimensions.width,
.height = bufferDimensions.height,
.depth = 1,
.depthOrArrayLayers = 1,
};
WGPUTexture texture = wgpuDeviceCreateTexture(device,
&(WGPUTextureDescriptor) {
Expand All @@ -74,18 +74,18 @@ int main(
.nextInChain = NULL,
.label = NULL,
.format = WGPUTextureFormat_Undefined,
.dimension = WGPUTextureViewDimension_Undefined,
.dimension = WGPUTextureViewDimension_Undefined,
.aspect = WGPUTextureAspect_All,
.arrayLayerCount = 0,
.arrayLayerCount = 0,
.baseArrayLayer = 0,
.baseMipLevel = 0,
.mipLevelCount = 0,
});

WGPURenderPassEncoder renderPass = wgpuCommandEncoderBeginRenderPass(encoder,
&(WGPURenderPassDescriptor) {
.colorAttachments = &(WGPURenderPassColorAttachmentDescriptor) {
.attachment = outputAttachment,
.colorAttachments = &(WGPURenderPassColorAttachment) {
.view = outputAttachment,
.resolveTarget = 0,
.loadOp = WGPULoadOp_Clear,
.storeOp = WGPUStoreOp_Store,
Expand All @@ -110,7 +110,7 @@ int main(
.x = 0,
.y = 0,
.z = 0,
},
},
},
&(WGPUImageCopyBuffer) {
.buffer = outputBuffer,
Expand Down
18 changes: 9 additions & 9 deletions examples/triangle/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ int main()
[ns_window.contentView setWantsLayer:YES];
metal_layer = [CAMetalLayer layer];
[ns_window.contentView setLayer:metal_layer];
surface = wgpuInstanceCreateSurface(NULL, &(WGPUSurfaceDescriptor) {
.label = NULL,
surface = wgpuInstanceCreateSurface(NULL, &(WGPUSurfaceDescriptor) {
.label = NULL,
.nextInChain = (const WGPUChainedStruct*)&(WGPUSurfaceDescriptorFromMetalLayer) {
.chain = (WGPUChainedStruct) {
.next = NULL,
.sType = WGPUSType_SurfaceDescriptorFromMetalLayer,
},
.layer = metal_layer,
},
});
});
}
#elif WGPU_TARGET == WGPU_TARGET_LINUX_X11
{
Expand All @@ -93,8 +93,8 @@ int main()
{
HWND hwnd = glfwGetWin32Window(window);
HINSTANCE hinstance = GetModuleHandle(NULL);
surface = wgpuInstanceCreateSurface(NULL, &(WGPUSurfaceDescriptor) {
.label = NULL,
surface = wgpuInstanceCreateSurface(NULL, &(WGPUSurfaceDescriptor) {
.label = NULL,
.nextInChain = (const WGPUChainedStruct*)&(WGPUSurfaceDescriptorFromWindowsHWND) {
.chain = (WGPUChainedStruct) {
.next = NULL,
Expand Down Expand Up @@ -163,7 +163,7 @@ int main()
.cullMode = WGPUCullMode_None
},
.multisample = (WGPUMultisampleState) {
.count = 1,
.count = 1,
.mask = ~0,
.alphaToCoverageEnabled = false,
},
Expand All @@ -188,7 +188,7 @@ int main()
.writeMask = WGPUColorWriteMask_All
},
},
.depthStencil = NULL,
.depthStencil = NULL,
});

int prevWidth = 0;
Expand Down Expand Up @@ -234,8 +234,8 @@ int main()

WGPURenderPassEncoder renderPass = wgpuCommandEncoderBeginRenderPass(encoder,
&(WGPURenderPassDescriptor) {
.colorAttachments = &(WGPURenderPassColorAttachmentDescriptor) {
.attachment = nextTexture,
.colorAttachments = &(WGPURenderPassColorAttachment) {
.view = nextTexture,
.resolveTarget = 0,
.loadOp = WGPULoadOp_Clear,
.storeOp = WGPUStoreOp_Store,
Expand Down
2 changes: 1 addition & 1 deletion ffi/webgpu-headers
Submodule webgpu-headers updated 1 files
+23 −17 webgpu.h
6 changes: 3 additions & 3 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub unsafe extern "C" fn wgpuCommandEncoderBeginRenderPass(
) -> id::RenderPassEncoderId {
let depth_stencil_attachment = descriptor.depthStencilAttachment.as_ref().map(|desc| {
wgc::command::RenderPassDepthStencilAttachment {
view: desc.attachment,
view: desc.view,
depth: wgc::command::PassChannel {
load_op: conv::map_load_op(desc.depthLoadOp),
store_op: conv::map_store_op(desc.depthStoreOp),
Expand All @@ -124,7 +124,7 @@ pub unsafe extern "C" fn wgpuCommandEncoderBeginRenderPass(
)
.iter()
.map(|color_attachment| wgc::command::RenderPassColorAttachment {
view: color_attachment.attachment,
view: color_attachment.view,
resolve_target: Some(color_attachment.resolveTarget),
channel: wgc::command::PassChannel {
load_op: conv::map_load_op(color_attachment.loadOp),
Expand Down Expand Up @@ -345,7 +345,7 @@ pub unsafe extern "C" fn wgpuRenderPassEncoderSetPushConstants(
}

#[no_mangle]
pub unsafe extern "C" fn wgpuRenderPassEncoderSetBlendColor(
pub unsafe extern "C" fn wgpuRenderPassEncoderSetBlendConstant(
pass: id::RenderPassEncoderId,
color: &native::WGPUColor,
) {
Expand Down
14 changes: 7 additions & 7 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ map_enum!(
"Unknown blend factor",
Zero: Zero,
One: One,
SrcColor: Src,
OneMinusSrcColor: OneMinusSrc,
Src: Src,
OneMinusSrc: OneMinusSrc,
SrcAlpha: SrcAlpha,
OneMinusSrcAlpha: OneMinusSrcAlpha,
DstColor: Dst,
OneMinusDstColor: OneMinusDst,
Dst: Dst,
OneMinusDst: OneMinusDst,
DstAlpha: DstAlpha,
OneMinusDstAlpha: OneMinusDstAlpha,
SrcAlphaSaturated: SrcAlphaSaturated,
BlendColor: Constant,
OneMinusBlendColor: OneMinusConstant
Constant: Constant,
OneMinusConstant: OneMinusConstant
);
map_enum!(
map_blend_operation,
Expand Down Expand Up @@ -177,7 +177,7 @@ pub fn map_extent3d(native: &native::WGPUExtent3D) -> wgt::Extent3d {
wgt::Extent3d {
width: native.width,
height: native.height,
depth_or_array_layers: native.depth,
depth_or_array_layers: native.depthOrArrayLayers,
}
}

Expand Down

0 comments on commit aaa5dcc

Please sign in to comment.