From: Mikko Rasa Date: Sun, 7 Nov 2021 09:54:01 +0000 (+0200) Subject: Add unsigned integer types to Program reflection and ProgramData X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=282a10854eda602d874e200c8301cf57d6501e81;p=libs%2Fgl.git Add unsigned integer types to Program reflection and ProgramData --- diff --git a/source/backends/opengl/program_backend.cpp b/source/backends/opengl/program_backend.cpp index bd54fbaa..76781180 100644 --- a/source/backends/opengl/program_backend.cpp +++ b/source/backends/opengl/program_backend.cpp @@ -312,6 +312,14 @@ void OpenGLProgram::query_uniforms() func = &uniform_wrapper; else if(u.type==INT_VEC4) func = &uniform_wrapper; + else if(u.type==UNSIGNED_INT) + func = &uniform_wrapper; + else if(u.type==UINT_VEC2) + func = &uniform_wrapper; + else if(u.type==UINT_VEC3) + func = &uniform_wrapper; + else if(u.type==UINT_VEC4) + func = &uniform_wrapper; else if(u.type==FLOAT_MAT2) func = &uniform_matrix_wrapper; else if(u.type==FLOAT_MAT3) diff --git a/source/render/programdata.cpp b/source/render/programdata.cpp index 8defce5a..40eba5e5 100644 --- a/source/render/programdata.cpp +++ b/source/render/programdata.cpp @@ -149,6 +149,11 @@ void ProgramData::uniform(Tag tag, int v) uniform(tag, INT, 1, &v); } +void ProgramData::uniform(Tag tag, unsigned v) +{ + uniform(tag, UNSIGNED_INT, 1, &v); +} + void ProgramData::uniform(Tag tag, float v) { uniform(tag, FLOAT, 1, &v); @@ -160,6 +165,12 @@ void ProgramData::uniform(Tag tag, int v0, int v1) uniform2(tag, va); } +void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1) +{ + unsigned va[2] = { v0, v1 }; + uniform2(tag, va); +} + void ProgramData::uniform(Tag tag, float v0, float v1) { float va[2] = { v0, v1 }; @@ -171,6 +182,11 @@ void ProgramData::uniform2(Tag tag, const int *v) uniform(tag, INT_VEC2, 1, v); } +void ProgramData::uniform2(Tag tag, const unsigned *v) +{ + uniform(tag, UINT_VEC2, 1, v); +} + void ProgramData::uniform2(Tag tag, const float *v) { uniform(tag, FLOAT_VEC2, 1, v); @@ -182,6 +198,12 @@ void ProgramData::uniform(Tag tag, int v0, int v1, int v2) uniform3(tag, va); } +void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2) +{ + unsigned va[3] = { v0, v1, v2 }; + uniform3(tag, va); +} + void ProgramData::uniform(Tag tag, float v0, float v1, float v2) { float va[3] = { v0, v1, v2 }; @@ -193,6 +215,11 @@ void ProgramData::uniform3(Tag tag, const int *v) uniform(tag, INT_VEC3, 1, v); } +void ProgramData::uniform3(Tag tag, const unsigned *v) +{ + uniform(tag, UINT_VEC3, 1, v); +} + void ProgramData::uniform3(Tag tag, const float *v) { uniform(tag, FLOAT_VEC3, 1, v); @@ -204,6 +231,12 @@ void ProgramData::uniform(Tag tag, int v0, int v1, int v2, int v3) uniform4(tag, va); } +void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2, unsigned v3) +{ + unsigned va[4] = { v0, v1, v2, v3 }; + uniform4(tag, va); +} + void ProgramData::uniform(Tag tag, float v0, float v1, float v2, float v3) { float va[4] = { v0, v1, v2, v3 }; @@ -220,6 +253,11 @@ void ProgramData::uniform4(Tag tag, const int *v) uniform(tag, INT_VEC4, 1, v); } +void ProgramData::uniform4(Tag tag, const unsigned *v) +{ + uniform(tag, UINT_VEC4, 1, v); +} + void ProgramData::uniform4(Tag tag, const float *v) { uniform(tag, FLOAT_VEC4, 1, v); @@ -280,6 +318,11 @@ void ProgramData::uniform_array(Tag tag, unsigned n, const int *v) uniform(tag, INT, n, v); } +void ProgramData::uniform_array(Tag tag, unsigned n, const unsigned *v) +{ + uniform(tag, UNSIGNED_INT, n, v); +} + void ProgramData::uniform_array(Tag tag, unsigned n, const float *v) { uniform(tag, FLOAT, n, v); @@ -290,6 +333,11 @@ void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v) uniform(tag, INT, n, v); } +void ProgramData::uniform1_array(Tag tag, unsigned n, const unsigned *v) +{ + uniform(tag, UNSIGNED_INT, n, v); +} + void ProgramData::uniform1_array(Tag tag, unsigned n, const float *v) { uniform(tag, FLOAT, n, v); @@ -300,6 +348,11 @@ void ProgramData::uniform2_array(Tag tag, unsigned n, const int *v) uniform(tag, INT_VEC2, n, v); } +void ProgramData::uniform2_array(Tag tag, unsigned n, const unsigned *v) +{ + uniform(tag, UINT_VEC2, n, v); +} + void ProgramData::uniform2_array(Tag tag, unsigned n, const float *v) { uniform(tag, FLOAT_VEC2, n, v); @@ -310,6 +363,11 @@ void ProgramData::uniform3_array(Tag tag, unsigned n, const int *v) uniform(tag, INT_VEC3, n, v); } +void ProgramData::uniform3_array(Tag tag, unsigned n, const unsigned *v) +{ + uniform(tag, INT_VEC3, n, v); +} + void ProgramData::uniform3_array(Tag tag, unsigned n, const float *v) { uniform(tag, FLOAT_VEC3, n, v); @@ -320,6 +378,11 @@ void ProgramData::uniform4_array(Tag tag, unsigned n, const int *v) uniform(tag, INT_VEC4, n, v); } +void ProgramData::uniform4_array(Tag tag, unsigned n, const unsigned *v) +{ + uniform(tag, UINT_VEC4, n, v); +} + void ProgramData::uniform4_array(Tag tag, unsigned n, const float *v) { uniform(tag, FLOAT_VEC4, n, v); diff --git a/source/render/programdata.h b/source/render/programdata.h index 9d08219e..9b8a25cb 100644 --- a/source/render/programdata.h +++ b/source/render/programdata.h @@ -173,19 +173,26 @@ private: void mark_dirty(Mask); public: void uniform(Tag, int); + void uniform(Tag, unsigned); void uniform(Tag, float); void uniform(Tag, int, int); + void uniform(Tag, unsigned, unsigned); void uniform(Tag, float, float); void uniform2(Tag, const int *); + void uniform2(Tag, const unsigned *); void uniform2(Tag, const float *); void uniform(Tag, int, int, int); + void uniform(Tag, unsigned, unsigned, unsigned); void uniform(Tag, float, float, float); void uniform3(Tag, const int *); + void uniform3(Tag, const unsigned *); void uniform3(Tag, const float *); void uniform(Tag, int, int, int, int); + void uniform(Tag, unsigned, unsigned, unsigned, unsigned); void uniform(Tag, float, float, float, float); void uniform(Tag, const Color &); void uniform4(Tag, const int *); + void uniform4(Tag, const unsigned *); void uniform4(Tag, const float *); void uniform_matrix2(Tag, const float *); void uniform_matrix3x2(Tag, const float *); @@ -198,14 +205,19 @@ public: void uniform(Tag, const Matrix &); void uniform_matrix4(Tag, const float *); void uniform_array(Tag, unsigned, const int *); + void uniform_array(Tag, unsigned, const unsigned *); void uniform_array(Tag, unsigned, const float *); void uniform1_array(Tag, unsigned, const int *); + void uniform1_array(Tag, unsigned, const unsigned *); void uniform1_array(Tag, unsigned, const float *); void uniform2_array(Tag, unsigned, const int *); + void uniform2_array(Tag, unsigned, const unsigned *); void uniform2_array(Tag, unsigned, const float *); void uniform3_array(Tag, unsigned, const int *); + void uniform3_array(Tag, unsigned, const unsigned *); void uniform3_array(Tag, unsigned, const float *); void uniform4_array(Tag, unsigned, const int *); + void uniform4_array(Tag, unsigned, const unsigned *); void uniform4_array(Tag, unsigned, const float *); void uniform_matrix2_array(Tag, unsigned, const float *); void uniform_matrix3x2_array(Tag, unsigned, const float *);