Skip to content
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

D bindings: Mark enum conversion functions nothrow @nogc pure @safe #3272

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions bindings/d/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ enum StateAlphaRef: StateAlphaRef_{
shift = 40, ///Alpha reference bit shift
mask = 0x0000_FF00_0000_0000, ///Alpha reference bit mask
}
StateAlphaRef_ toStateAlphaRef(ulong v){ return (v << StateAlphaRef.shift) & StateAlphaRef.mask; }
StateAlphaRef_ toStateAlphaRef(ulong v) nothrow @nogc pure @safe{ return (v << StateAlphaRef.shift) & StateAlphaRef.mask; }

alias StatePT_ = ulong;
enum StatePT: StatePT_{
Expand All @@ -123,7 +123,7 @@ enum StatePointSize: StatePointSize_{
shift = 52, ///Point size bit shift
mask = 0x00F0_0000_0000_0000, ///Point size bit mask
}
StatePointSize_ toStatePointSize(ulong v){ return (v << StatePointSize.shift) & StatePointSize.mask; }
StatePointSize_ toStatePointSize(ulong v) nothrow @nogc pure @safe{ return (v << StatePointSize.shift) & StatePointSize.mask; }

/**
Enable MSAA write when writing into MSAA frame buffer.
Expand Down Expand Up @@ -160,15 +160,15 @@ enum StencilFuncRef: StencilFuncRef_{
shift = 0,
mask = 0x0000_00FF,
}
StencilFuncRef_ toStencilFuncRef(uint v){ return (v << StencilFuncRef.shift) & StencilFuncRef.mask; }
StencilFuncRef_ toStencilFuncRef(uint v) nothrow @nogc pure @safe{ return (v << StencilFuncRef.shift) & StencilFuncRef.mask; }

///Set stencil rmask value.
alias StencilFuncRmask_ = uint;
enum StencilFuncRmask: StencilFuncRmask_{
shift = 8,
mask = 0x0000_FF00,
}
StencilFuncRmask_ toStencilFuncRmask(uint v){ return (v << StencilFuncRmask.shift) & StencilFuncRmask.mask; }
StencilFuncRmask_ toStencilFuncRmask(uint v) nothrow @nogc pure @safe{ return (v << StencilFuncRmask.shift) & StencilFuncRmask.mask; }

alias Stencil_ = uint;
enum Stencil: Stencil_{
Expand Down Expand Up @@ -427,7 +427,7 @@ enum SamplerBorderColor: SamplerBorderColor_{
mask = 0x0F00_0000,
}
alias SamplerBorderColour = SamplerBorderColor;
SamplerBorderColor_ toSamplerBorderColor(uint v){ return (v << SamplerBorderColor.shift) & SamplerBorderColor.mask; }
SamplerBorderColor_ toSamplerBorderColor(uint v) nothrow @nogc pure @safe{ return (v << SamplerBorderColor.shift) & SamplerBorderColor.mask; }
alias toSamplerBorderColour = toSamplerBorderColor;

alias SamplerReserved_ = uint;
Expand Down
2 changes: 1 addition & 1 deletion scripts/bindings-d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ extern(C++, "bgfx") package final abstract class %s{

if typ.helper then
yield(string.format(
"%s_ to%s(%s v){ return (v << %s) & %s; }",
"%s_ to%s(%s v) nothrow @nogc pure @safe{ return (v << %s) & %s; }",
typeName,
typeName,
enumType,
Expand Down
Loading