gpu: add CompilationInfo.getMessages slice helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
6497f0d27b
commit
093be3aa53
2 changed files with 9 additions and 1 deletions
|
|
@ -180,6 +180,7 @@ And, to initialize data structures with slices in them, the following helpers ar
|
||||||
* `VertexBufferLayout.init`
|
* `VertexBufferLayout.init`
|
||||||
* `VertexState.init`
|
* `VertexState.init`
|
||||||
* `FragmentState.init`
|
* `FragmentState.init`
|
||||||
|
* `CompilationInfo.getMessages`
|
||||||
|
|
||||||
### Typed callbacks
|
### Typed callbacks
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -618,9 +618,16 @@ pub const BlendState = extern struct {
|
||||||
|
|
||||||
pub const CompilationInfo = extern struct {
|
pub const CompilationInfo = extern struct {
|
||||||
next_in_chain: ?*const ChainedStruct = null,
|
next_in_chain: ?*const ChainedStruct = null,
|
||||||
// TODO: slice helper
|
|
||||||
message_count: u32,
|
message_count: u32,
|
||||||
messages: ?[*]const CompilationMessage = null,
|
messages: ?[*]const CompilationMessage = null,
|
||||||
|
|
||||||
|
/// Helper to get messages as a slice.
|
||||||
|
pub fn getMessages(info: CompilationInfo) ?[]const CompilationMessage {
|
||||||
|
if (info.messages) |messages| {
|
||||||
|
return messages[0..info.message_count];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const DepthStencilState = extern struct {
|
pub const DepthStencilState = extern struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue