Direct3D needs to know the texture bind usage up front, in particular
whether the texture is going to be used as a render target.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It serves no purpose other than paranoia. Perhaps buggy drivers exists that
require unused texture slots cleared before drawing to a texture, but if so the
workaround belongs in the GL backend.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The offset argument to DrawElements is in 16-bit shorts, while the
underlying DrawElements use byte offsets.
No users of DrawElements use a non-zero offset, so nothing changed.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Emulate them for the OpenGL ES backend because 2.0 doesn't support uniform
buffers. The future d3d backend only supports uniform (constant) buffers.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
InputLayout is the abstraction for the mapping between vertex data and
shader inputs. The mapping is implicit in OpenGL but explicit in
Direct3D.
Infer the attribute name location index using shader reflection data,
and get rid of a parameter to NewProgram.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We're about to add Direct3D support, where shaders are written in
HLSL. Rather than write shaders twice (or more), convert them to
a GLSL variant understood by the glslcc cross-compiler and generate
the OpenGL ES 2.0 and HLSL variants. The HLSL is used by a future
change.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The GPU implementation only uses immutable buffers so far, so let's
make it easy and performant for the backends.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
A recent change made the OpenGL functions an interface of the functions
required for the implementation of GPU, a renderer for Gio operations.
That allowed for running Gio on external systems where OpenGL is
available.
However, to allow for non-OpenGL flavored backends such as Vulkan,
Metal and Direct3D, this change introduces Backend for the high-level
operations required by GPU. This change also adds a concrete backend
to package gl.
Type Backend is a first cut heavily based on OpenGL. Future changes will add
more backends, where the Backend interface quite possibly will need refinement.
Signed-off-by: Elias Naur <mail@eliasnaur.com>