Did D will try to get the vulkan opportunity?
Vlad Levenfeld via Digitalmars-d
digitalmars-d at puremagic.com
Thu Mar 26 09:30:48 PDT 2015
On Wednesday, 25 March 2015 at 18:46:51 UTC, bioinfornatics wrote:
> Dear,
>
> I would like to know if D dev have a plan with vulkan :
> https://www.khronos.org/vulkan/ ?
>
> D lang will be at same level than others language, nothing
> exists !
>
> D could try to provide API and an environment around vulkan. To
> become a language "need to be used" in this field.
>
> Regards
I'm not one of the D devs, but I'm working on a lib that builds
shaders from composable templates (in a very pre-alpha stage
still, but this is a tough thing to get right).
I was going to do GPGPU through openGL compute shaders, but as
soon as there are actual details on the Vulkan API, I will
probably go after that instead.
Maybe not what you were looking for, but if it works out, D will
be the only language that I know of with something like this.
What I mean by "composable templates":
alias affine_transform = vertex_shader!(
`translation`, `rotation`, `scale`, q{
gl_Position.x = gl_Position.x * cos (rotation) -
gl_Position.y * sin (rotation);
gl_Position.y = gl_Position.x * sin (rotation) +
gl_Position.y * cos (rotation);
gl_Position.xy *= scale;
gl_Position.xy += translation;
}
);
and basically you tack stuff like that together using UFCS,
auto boxes = Lifetime.Shared!Texture (resolution)
.fill (transparent);
auto sq = square (1f).VertexBuffer;
borrow (sq).basic_shader (green (0.5))
.affine_transform (fvec (0, 0), 0,
(resolution[1]*1.5f/resolution[0])*vector (1f, 1f/3))
.line_loop.render_to (boxes);
and once you attach the shader to a canvas, it'll deduce the
argument types, generate the rest of the shader code, compile,
link, upload uniforms and attributes, and save the shader in a
global AA for recall in case you're visiting it in a loop. It's
designed to be as much like calling r.map!(x => ...) and friends
as possible; functional programming with the GPU.
Still working out how to get it to play nicely with compute
shaders (IO works differently than for regular shaders) but maybe
the Vulkan spec will reveal an easier way to unify them.
So, there you go; someday, it could be D's own ArrayFire +
graphics (with a good bit more work).
I've been incubating it as a private repo since its still so raw,
and I don't want to unveil before its ready and have it get a
reputation as being half-baked, but if there's legitimate
interest from people who have a good idea of what they would like
to see from a graphics/compute API of this nature, I can open it
up publicly. Or I can send invites, if anyone wants to help
incubate it by tossing use-cases my way, I'll gladly take them
and do my best to build this thing out to meet the needs.
More information about the Digitalmars-d
mailing list