Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pcy
fnaglsl
Commits
34b3f35b
Commit
34b3f35b
authored
Jun 18, 2020
by
pcy
Browse files
glUniform bindings
parent
7497ac2b
Changes
2
Show whitespace changes
Inline
Side-by-side
README.md
View file @
34b3f35b
# FNAGLSL
Trying to hackily shoehorn GLSL shaders into FNA, trying to comply with
the
`Effect`
API as much as possible. (Which isn't always working.)
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.)
## Does it work?
...
...
@@ -13,6 +13,16 @@ interleaved w/ GLSL shader draw calls seems to work ok.
No. Don't.
## 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).
## How can I use it?
```
cs
...
...
src/GLUtil_GL.cs
View file @
34b3f35b
...
...
@@ -46,6 +46,29 @@ namespace PoroCYon.FNAGLSL {
_GetActiveUniformName
=
GetProcAddress
<
GetActiveUniformName_T
>(
"GetActiveUniformName"
);
_GetActiveUniformsiv
=
GetProcAddress
<
GetActiveUniformsiv_T
>(
"GetActiveUniformsiv"
);
_GetActiveUniform
=
GetProcAddress
<
GetActiveUniform_T
>(
"GetActiveUniform"
);
_Uniform1fv
=
GetProcAddress
<
Uniform1fv_T
>(
"Uniform1fv"
);
_Uniform2fv
=
GetProcAddress
<
Uniform2fv_T
>(
"Uniform2fv"
);
_Uniform3fv
=
GetProcAddress
<
Uniform3fv_T
>(
"Uniform3fv"
);
_Uniform4fv
=
GetProcAddress
<
Uniform4fv_T
>(
"Uniform4fv"
);
_Uniform1iv
=
GetProcAddress
<
Uniform1iv_T
>(
"Uniform1iv"
);
_Uniform2iv
=
GetProcAddress
<
Uniform2iv_T
>(
"Uniform2iv"
);
_Uniform3iv
=
GetProcAddress
<
Uniform3iv_T
>(
"Uniform3iv"
);
_Uniform4iv
=
GetProcAddress
<
Uniform4iv_T
>(
"Uniform4iv"
);
_Uniform1uiv
=
GetProcAddress
<
Uniform1uiv_T
>(
"Uniform1uiv"
);
_Uniform2uiv
=
GetProcAddress
<
Uniform2uiv_T
>(
"Uniform2uiv"
);
_Uniform3uiv
=
GetProcAddress
<
Uniform3uiv_T
>(
"Uniform3uiv"
);
_Uniform4uiv
=
GetProcAddress
<
Uniform4uiv_T
>(
"Uniform4uiv"
);
_UniformMatrix2fv
=
GetProcAddress
<
UniformMatrix2fv_T
>(
"UniformMatrix2fv"
);
_UniformMatrix3fv
=
GetProcAddress
<
UniformMatrix3fv_T
>(
"UniformMatrix3fv"
);
_UniformMatrix4fv
=
GetProcAddress
<
UniformMatrix4fv_T
>(
"UniformMatrix4fv"
);
_UniformMatrix2x3fv
=
GetProcAddress
<
UniformMatrix2x3fv_T
>(
"UniformMatrix2x3fv"
);
_UniformMatrix3x2fv
=
GetProcAddress
<
UniformMatrix3x2fv_T
>(
"UniformMatrix3x2fv"
);
_UniformMatrix2x4fv
=
GetProcAddress
<
UniformMatrix2x4fv_T
>(
"UniformMatrix2x4fv"
);
_UniformMatrix4x2fv
=
GetProcAddress
<
UniformMatrix4x2fv_T
>(
"UniformMatrix4x2fv"
);
_UniformMatrix3x4fv
=
GetProcAddress
<
UniformMatrix3x4fv_T
>(
"UniformMatrix3x4fv"
);
_UniformMatrix4x3fv
=
GetProcAddress
<
UniformMatrix4x3fv_T
>(
"UniformMatrix4x3fv"
);
}
static
void
DeinitProcs
()
{
_GetError
=
null
;
...
...
@@ -70,6 +93,29 @@ namespace PoroCYon.FNAGLSL {
_GetActiveUniformName
=
null
;
_GetActiveUniformsiv
=
null
;
_GetActiveUniform
=
null
;
_Uniform1fv
=
null
;
_Uniform2fv
=
null
;
_Uniform3fv
=
null
;
_Uniform4fv
=
null
;
_Uniform1iv
=
null
;
_Uniform2iv
=
null
;
_Uniform3iv
=
null
;
_Uniform4iv
=
null
;
_Uniform1uiv
=
null
;
_Uniform2uiv
=
null
;
_Uniform3uiv
=
null
;
_Uniform4uiv
=
null
;
_UniformMatrix2fv
=
null
;
_UniformMatrix3fv
=
null
;
_UniformMatrix4fv
=
null
;
_UniformMatrix2x3fv
=
null
;
_UniformMatrix3x2fv
=
null
;
_UniformMatrix2x4fv
=
null
;
_UniformMatrix4x2fv
=
null
;
_UniformMatrix3x4fv
=
null
;
_UniformMatrix4x3fv
=
null
;
}
delegate
GLenum
GetError_T
();
...
...
@@ -205,8 +251,6 @@ namespace PoroCYon.FNAGLSL {
return
parm
[
0
];
}
// TODO:
const
int
NAMEBUF_MAX_LEN
=
64
;
delegate
void
GetActiveAttrib_T
(
GLuint
prgm
,
GLuint
idx
,
GLsizei
bufSize
,
...
...
@@ -335,7 +379,113 @@ namespace PoroCYon.FNAGLSL {
}
}
// TODO: glUniform functions
// glUniform..() defs
delegate
void
Uniform1fv_T
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
);
static
Uniform1fv_T
_Uniform1fv
;
public
static
void
Uniform1fv
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
)
{
_Uniform1fv
(
location
,
count
,
value
);
}
delegate
void
Uniform2fv_T
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
);
static
Uniform2fv_T
_Uniform2fv
;
public
static
void
Uniform2fv
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
)
{
_Uniform2fv
(
location
,
count
,
value
);
}
delegate
void
Uniform3fv_T
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
);
static
Uniform3fv_T
_Uniform3fv
;
public
static
void
Uniform3fv
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
)
{
_Uniform3fv
(
location
,
count
,
value
);
}
delegate
void
Uniform4fv_T
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
);
static
Uniform4fv_T
_Uniform4fv
;
public
static
void
Uniform4fv
(
GLint
location
,
GLsizei
count
,
GLfloat
*
value
)
{
_Uniform4fv
(
location
,
count
,
value
);
}
delegate
void
Uniform1iv_T
(
GLint
location
,
GLsizei
count
,
GLint
*
value
);
static
Uniform1iv_T
_Uniform1iv
;
public
static
void
Uniform1iv
(
GLint
location
,
GLsizei
count
,
GLint
*
value
)
{
_Uniform1iv
(
location
,
count
,
value
);
}
delegate
void
Uniform2iv_T
(
GLint
location
,
GLsizei
count
,
GLint
*
value
);
static
Uniform2iv_T
_Uniform2iv
;
public
static
void
Uniform2iv
(
GLint
location
,
GLsizei
count
,
GLint
*
value
)
{
_Uniform2iv
(
location
,
count
,
value
);
}
delegate
void
Uniform3iv_T
(
GLint
location
,
GLsizei
count
,
GLint
*
value
);
static
Uniform3iv_T
_Uniform3iv
;
public
static
void
Uniform3iv
(
GLint
location
,
GLsizei
count
,
GLint
*
value
)
{
_Uniform3iv
(
location
,
count
,
value
);
}
delegate
void
Uniform4iv_T
(
GLint
location
,
GLsizei
count
,
GLint
*
value
);
static
Uniform4iv_T
_Uniform4iv
;
public
static
void
Uniform4iv
(
GLint
location
,
GLsizei
count
,
GLint
*
value
)
{
_Uniform4iv
(
location
,
count
,
value
);
}
delegate
void
Uniform1uiv_T
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
);
static
Uniform1uiv_T
_Uniform1uiv
;
public
static
void
Uniform1uiv
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
)
{
_Uniform1uiv
(
location
,
count
,
value
);
}
delegate
void
Uniform2uiv_T
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
);
static
Uniform2uiv_T
_Uniform2uiv
;
public
static
void
Uniform2uiv
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
)
{
_Uniform2uiv
(
location
,
count
,
value
);
}
delegate
void
Uniform3uiv_T
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
);
static
Uniform3uiv_T
_Uniform3uiv
;
public
static
void
Uniform3uiv
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
)
{
_Uniform3uiv
(
location
,
count
,
value
);
}
delegate
void
Uniform4uiv_T
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
);
static
Uniform4uiv_T
_Uniform4uiv
;
public
static
void
Uniform4uiv
(
GLint
location
,
GLsizei
count
,
GLuint
*
value
)
{
_Uniform4uiv
(
location
,
count
,
value
);
}
delegate
void
UniformMatrix2fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix2fv_T
_UniformMatrix2fv
;
public
static
void
UniformMatrix2fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix2fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix3fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix3fv_T
_UniformMatrix3fv
;
public
static
void
UniformMatrix3fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix3fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix4fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix4fv_T
_UniformMatrix4fv
;
public
static
void
UniformMatrix4fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix4fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix2x3fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix2x3fv_T
_UniformMatrix2x3fv
;
public
static
void
UniformMatrix2x3fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix2x3fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix3x2fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix3x2fv_T
_UniformMatrix3x2fv
;
public
static
void
UniformMatrix3x2fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix3x2fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix2x4fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix2x4fv_T
_UniformMatrix2x4fv
;
public
static
void
UniformMatrix2x4fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix2x4fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix4x2fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix4x2fv_T
_UniformMatrix4x2fv
;
public
static
void
UniformMatrix4x2fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix4x2fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix3x4fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix3x4fv_T
_UniformMatrix3x4fv
;
public
static
void
UniformMatrix3x4fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix3x4fv
(
location
,
count
,
transpose
,
value
);
}
delegate
void
UniformMatrix4x3fv_T
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
);
static
UniformMatrix4x3fv_T
_UniformMatrix4x3fv
;
public
static
void
UniformMatrix4x3fv
(
GLint
location
,
GLsizei
count
,
GLboolean
transpose
,
GLfloat
*
value
)
{
_UniformMatrix4x3fv
(
location
,
count
,
transpose
,
value
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment