gpu: make RenderPipeline.fragment optional (#212)
pipeline with vertex stage only is perfectly valid Helps hexops/mach#182
This commit is contained in:
parent
d0782d24d1
commit
a943fbed3e
2 changed files with 13 additions and 11 deletions
|
|
@ -807,15 +807,17 @@ inline fn convertRenderPipelineDescriptor(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_fragment_state.* = c.WGPUFragmentState{
|
if (d.fragment) |frag| {
|
||||||
.nextInChain = null,
|
tmp_fragment_state.* = c.WGPUFragmentState{
|
||||||
.module = @ptrCast(c.WGPUShaderModule, d.fragment.module.ptr),
|
.nextInChain = null,
|
||||||
.entryPoint = d.vertex.entry_point,
|
.module = @ptrCast(c.WGPUShaderModule, frag.module.ptr),
|
||||||
.constantCount = if (d.fragment.constants) |v| @intCast(u32, v.len) else 0,
|
.entryPoint = frag.entry_point,
|
||||||
.constants = if (d.fragment.constants) |v| @ptrCast([*]const c.WGPUConstantEntry, v.ptr) else null,
|
.constantCount = if (frag.constants) |v| @intCast(u32, v.len) else 0,
|
||||||
.targetCount = if (d.fragment.targets) |v| @intCast(u32, v.len) else 0,
|
.constants = if (frag.constants) |v| @ptrCast([*]const c.WGPUConstantEntry, v.ptr) else null,
|
||||||
.targets = if (d.fragment.targets) |v| @ptrCast([*]const c.WGPUColorTargetState, v.ptr) else null,
|
.targetCount = if (frag.targets) |v| @intCast(u32, v.len) else 0,
|
||||||
};
|
.targets = if (frag.targets) |v| @ptrCast([*]const c.WGPUColorTargetState, v.ptr) else null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return c.WGPURenderPipelineDescriptor{
|
return c.WGPURenderPipelineDescriptor{
|
||||||
.nextInChain = null,
|
.nextInChain = null,
|
||||||
|
|
@ -844,7 +846,7 @@ inline fn convertRenderPipelineDescriptor(
|
||||||
.mask = d.multisample.mask,
|
.mask = d.multisample.mask,
|
||||||
.alphaToCoverageEnabled = d.multisample.alpha_to_coverage_enabled,
|
.alphaToCoverageEnabled = d.multisample.alpha_to_coverage_enabled,
|
||||||
},
|
},
|
||||||
.fragment = tmp_fragment_state,
|
.fragment = if (d.fragment != null) tmp_fragment_state else null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ pub const Descriptor = struct {
|
||||||
primitive: PrimitiveState,
|
primitive: PrimitiveState,
|
||||||
depth_stencil: ?*const DepthStencilState,
|
depth_stencil: ?*const DepthStencilState,
|
||||||
multisample: MultisampleState,
|
multisample: MultisampleState,
|
||||||
fragment: *const FragmentState,
|
fragment: ?*const FragmentState,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CreateStatus = enum(u32) {
|
pub const CreateStatus = enum(u32) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue