Compute shader management and Buffer management.

This commit is contained in:
jussi
2023-10-31 11:52:36 +02:00
parent 65fababd8d
commit f8b4b709e6
7 changed files with 120 additions and 2 deletions

28
API.md
View File

@@ -6924,6 +6924,34 @@ Set shader currently active (id and locations)
--- ---
## RLGL - Compute shader management
---
> programId = RL.rlLoadComputeShaderProgram( int shaderId )
Load compute shader program
- Success return int
---
> RL.rlComputeShaderDispatch( int groupX, int groupY, int groupZ )
Dispatch compute shader (equivalent to *draw* for graphics pipeline)
---
## RLGL - Buffer management
---
> RL.rlBindImageTexture( int id, int index, int format, bool readonly )
Bind image texture
---
## RLGL - Matrix state management ## RLGL - Matrix state management
--- ---

View File

@@ -5561,6 +5561,31 @@ function RL.rlSetUniformSampler( locIndex, textureId ) end
---@return any RL.rlSetShader ---@return any RL.rlSetShader
function RL.rlSetShader( id, locs ) end function RL.rlSetShader( id, locs ) end
-- RLGL - Compute shader management
---Load compute shader program
---- Success return int
---@param shaderId integer
---@return any programId
function RL.rlLoadComputeShaderProgram( shaderId ) end
---Dispatch compute shader (equivalent to *draw* for graphics pipeline)
---@param groupX integer
---@param groupY integer
---@param groupZ integer
---@return any RL.rlComputeShaderDispatch
function RL.rlComputeShaderDispatch( groupX, groupY, groupZ ) end
-- RLGL - Buffer management
---Bind image texture
---@param id integer
---@param index integer
---@param format integer
---@param readonly boolean
---@return any RL.rlBindImageTexture
function RL.rlBindImageTexture( id, index, format, readonly ) end
-- RLGL - Matrix state management -- RLGL - Matrix state management
---Get internal modelview matrix ---Get internal modelview matrix

View File

@@ -10,6 +10,7 @@ KEY CHANGES:
- ADDED: GC_UNLOAD build time define for enabling/disabling Lua garbage collection for objects. - ADDED: GC_UNLOAD build time define for enabling/disabling Lua garbage collection for objects.
Can be checked with IsGCUnloadEnabled Can be checked with IsGCUnloadEnabled
- ADDED: Shaders management functions. - ADDED: Shaders management functions.
- ADDED: Compute shader management and Buffer management.
DETAILED CHANGES: DETAILED CHANGES:
- CHANGED: GenImageColor now takes Vector2 as size. - CHANGED: GenImageColor now takes Vector2 as size.

View File

@@ -2,8 +2,6 @@ Current {
} }
Backlog { Backlog {
* rlgl
* Compute shader management
* Text * Text
* Codepoints? * Codepoints?
* Audio * Audio
@@ -14,6 +12,8 @@ Backlog {
* Models * Models
* LoadMaterials (Load materials from model file). * LoadMaterials (Load materials from model file).
* LoadMaterialsFromModel (Could then for example edit and set back to model). * LoadMaterialsFromModel (Could then for example edit and set back to model).
* rlgl
* Shader buffer storage object management (ssbo)
* Extend color lib functionality. * Extend color lib functionality.
* Global variable descriptions for API. * Global variable descriptions for API.

View File

@@ -115,6 +115,11 @@ int lrlglSetUniform( lua_State *L );
int lrlglSetUniformMatrix( lua_State *L ); int lrlglSetUniformMatrix( lua_State *L );
int lrlglSetUniformSampler( lua_State *L ); int lrlglSetUniformSampler( lua_State *L );
int lrlglSetShader( lua_State *L ); int lrlglSetShader( lua_State *L );
/* Compute shader management */
int lrlglLoadComputeShaderProgram( lua_State *L );
int lrlglComputeShaderDispatch( lua_State *L );
/* Buffer management */
int lrlglBindImageTexture( lua_State *L );
/* Matrix state management */ /* Matrix state management */
int lrlglGetMatrixModelview( lua_State *L ); int lrlglGetMatrixModelview( lua_State *L );
int lrlglGetMatrixProjection( lua_State *L ); int lrlglGetMatrixProjection( lua_State *L );

View File

@@ -2296,6 +2296,11 @@ void luaRegister() {
assingGlobalFunction( "rlSetUniformMatrix", lrlglSetUniformMatrix ); assingGlobalFunction( "rlSetUniformMatrix", lrlglSetUniformMatrix );
assingGlobalFunction( "rlSetUniformSampler", lrlglSetUniformSampler ); assingGlobalFunction( "rlSetUniformSampler", lrlglSetUniformSampler );
assingGlobalFunction( "rlSetShader", lrlglSetShader ); assingGlobalFunction( "rlSetShader", lrlglSetShader );
/* Compute shader management */
assingGlobalFunction( "rlLoadComputeShaderProgram", lrlglLoadComputeShaderProgram );
assingGlobalFunction( "rlComputeShaderDispatch", lrlglComputeShaderDispatch );
/* Buffer management */
assingGlobalFunction( "rlBindImageTexture", lrlglBindImageTexture );
/* Matrix state management. */ /* Matrix state management. */
assingGlobalFunction( "rlGetMatrixModelview", lrlglGetMatrixModelview ); assingGlobalFunction( "rlGetMatrixModelview", lrlglGetMatrixModelview );
assingGlobalFunction( "rlGetMatrixProjection", lrlglGetMatrixProjection ); assingGlobalFunction( "rlGetMatrixProjection", lrlglGetMatrixProjection );

View File

@@ -1393,6 +1393,60 @@ int lrlglSetShader( lua_State *L ) {
return 0; return 0;
} }
/*
## RLGL - Compute shader management
*/
/*
> programId = RL.rlLoadComputeShaderProgram( int shaderId )
Load compute shader program
- Success return int
*/
int lrlglLoadComputeShaderProgram( lua_State *L ) {
unsigned int shaderId = (unsigned int)luaL_checkinteger( L, 1 );
lua_pushinteger( L, rlLoadComputeShaderProgram( shaderId ) );
return 1;
}
/*
> RL.rlComputeShaderDispatch( int groupX, int groupY, int groupZ )
Dispatch compute shader (equivalent to *draw* for graphics pipeline)
*/
int lrlglComputeShaderDispatch( lua_State *L ) {
unsigned int groupX = (unsigned int)luaL_checkinteger( L, 1 );
unsigned int groupY = (unsigned int)luaL_checkinteger( L, 2 );
unsigned int groupZ = (unsigned int)luaL_checkinteger( L, 3 );
rlComputeShaderDispatch( groupX, groupY, groupZ );
return 0;
}
/*
## RLGL - Buffer management
*/
/*
> RL.rlBindImageTexture( int id, int index, int format, bool readonly )
Bind image texture
*/
int lrlglBindImageTexture( lua_State *L ) {
unsigned int id = (unsigned int)luaL_checkinteger( L, 1 );
unsigned int index = (unsigned int)luaL_checkinteger( L, 2 );
int format = luaL_checkinteger( L, 3 );
bool readonly = uluaGetBoolean( L, 4 );
rlBindImageTexture( id, index, format, readonly );
return 0;
}
/* /*
## RLGL - Matrix state management ## RLGL - Matrix state management
*/ */