Documentation ¶
Index ¶
- Constants
- func CalcSourceHash(fragmentSrc []byte) (shaderir.SourceHash, error)
- func CompileShader(fragmentSrc []byte) (*shaderir.Program, error)
- func InternalImageSize(x int) int
- func QuadIndices() []uint32
- func QuadVerticesFromDstAndSrc(dst []float32, dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1, cr, cg, cb, ca float32)
- func QuadVerticesFromSrcAndMatrix(dst []float32, sx0, sy0, sx1, sy1 float32, a, b, c, d, tx, ty float32, ...)
- type ManagedBytes
Constants ¶
const ( ShaderSrcImageCount = 4 // PreservedUniformVariablesCount represents the number of preserved uniform variables. // Any shaders in Ebitengine must have these uniform variables. PreservedUniformVariablesCount = 1 + 1 + 1 + 1 + 1 + 1 + 1 // the projection matrix ProjectionMatrixUniformVariableIndex = 6 PreservedUniformUint32Count = 2 + 2*ShaderSrcImageCount + 2 + 2 + 2*ShaderSrcImageCount + 2*ShaderSrcImageCount + 16 // the projection matrix )
const (
VertexFloatCount = 12
)
Variables ¶
This section is empty.
Functions ¶
func CalcSourceHash ¶ added in v2.8.0
func CalcSourceHash(fragmentSrc []byte) (shaderir.SourceHash, error)
func CompileShader ¶ added in v2.3.0
func InternalImageSize ¶
InternalImageSize returns a nearest appropriate size as an internal image.
func QuadIndices ¶
func QuadIndices() []uint32
func QuadVerticesFromDstAndSrc ¶ added in v2.8.0
func QuadVerticesFromDstAndSrc(dst []float32, dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1, cr, cg, cb, ca float32)
QuadVerticesFromDstAndSrc sets a float32 slice for a quadrangle.
Types ¶
type ManagedBytes ¶ added in v2.7.0
type ManagedBytes struct {
// contains filtered or unexported fields
}
ManagedBytes is a managed byte slice. The internal byte alice are managed in a pool. ManagedBytes is useful when its lifetime is explicit, as the underlying byte slice can be reused for another ManagedBytes later. This can reduce allocations and GCs.
func NewManagedBytes ¶ added in v2.7.0
func NewManagedBytes(size int, f func([]byte)) *ManagedBytes
NewManagedBytes returns a managed byte slice initialized by the given constructor f.
The byte slice is not zero-cleared at the constructor.
func (*ManagedBytes) Clone ¶ added in v2.7.0
func (m *ManagedBytes) Clone() *ManagedBytes
Clone creates a new ManagedBytes with the same content.
func (*ManagedBytes) GetAndRelease ¶ added in v2.7.0
func (m *ManagedBytes) GetAndRelease() ([]byte, func())
GetAndRelease returns the raw byte slice and a finalizer. A finalizer should be called when you can ensure that the slice is no longer used, e.g. when a graphics command using this slice is sent and executed.
After GetAndRelease is called, the underlying byte slice is no longer available.
func (*ManagedBytes) Len ¶ added in v2.7.0
func (m *ManagedBytes) Len() int
Len returns the length of the slice.
func (*ManagedBytes) Read ¶ added in v2.7.0
func (m *ManagedBytes) Read(dst []byte, from, to int)
Read reads the byte slice's content to dst.
func (*ManagedBytes) Release ¶ added in v2.7.8
func (m *ManagedBytes) Release()
Release releases the underlying byte slice.
After Release is called, the underlying byte slice is no longer available.