README.md 1.27 KB
Newer Older
pcy's avatar
pcy committed
1
2
# FNAGLSL

pcy's avatar
pcy committed
3
4
Trying to hackily shoehorn GLSL shaders into FNA, while trying to comply with
the `Effect` API as much as possible. (Which isn't always working.)
pcy's avatar
pcy committed
5
6
7
8
9
10
11
12
13
14
15

## Does it work?

Kinda. Static shaders work. Passing vertex data is very hacky and brittle.
Uniforms, samples/textures, ... don't work at all yet. Using regular shaders
interleaved w/ GLSL shader draw calls seems to work ok.

## How does this work?

No. Don't.

pcy's avatar
pcy committed
16
17
18
19
20
21
22
23
24
25
## Are there things it can't do?

Yes:

* No uniform support (this is being worked on! FNA/mojoshader internals might
  throw a wrench tho)
* No texture support (will have to be researched)
* Passing this to a `SpriteBatch` will probably fail in a bad way (unlikely
  to be fixed).

pcy's avatar
pcy committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## How can I use it?

```cs
var glsl = new GLSLEffect(GraphicsDevice, new Dictionary<GLSLPurpose, string>()
{
	{ GLSLPurpose.  VertexShader, "vertex shader here"   },
	{ GLSLPurpose.FragmentShader, "fragment shader here" },
});

// ...

using (var bound = glsl.Bind())
{
	GraphicsDevice.DrawPrimitives(/*...*/);
}
```

## License

```
Copyright (C) 2020 PoroCYon <porocyon@titandemo.org>
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the LICENSE file for more details.
```