add changelog to docs

main
Dominik Madarász 2023-09-08 22:14:11 +02:00
parent fb3e0c55e8
commit 208a5d8772
10 changed files with 400 additions and 55 deletions

View File

@ -340,11 +340,13 @@ if "%1"=="docs" (
set /p GIT_BRANCH=<info.obj set /p GIT_BRANCH=<info.obj
date /t > info.obj date /t > info.obj
set /p LAST_MODIFIED=<info.obj set /p LAST_MODIFIED=<info.obj
git --no-pager log --pretty="format:%%h: %%s (**%%cN**)" > changelog.txt
rem ...and generate docs rem ...and generate docs
cl tools\docs\docs.c engine\v4k.c -Iengine %2 cl tools\docs\docs.c engine\v4k.c -Iengine %2
docs engine\v4k.h --excluded=3rd_glad.h,v4k.h,v4k_compat.h, > v4k.html docs engine\v4k.h --excluded=3rd_glad.h,v4k.h,v4k_compat.h, > v4k.html
move /y v4k.html engine\ move /y v4k.html engine\
del changelog.txt
exit /b exit /b
) )
@ -461,7 +463,6 @@ if "%1"=="web" (
) )
if "%1"=="vps" ( if "%1"=="vps" (
call make.bat git
tools\pscp -4 -batch -agent -P 22 -l app engine\v4k.html 128.140.14.212:/home/app/microblog/app/static/v4k/index.html tools\pscp -4 -batch -agent -P 22 -l app engine\v4k.html 128.140.14.212:/home/app/microblog/app/static/v4k/index.html
rem tools\pscp -4 -batch -agent -P 22 -l app engine\joint\v4k.h 128.140.14.212:/home/app/microblog/app/static/v4k/v4k.h rem tools\pscp -4 -batch -agent -P 22 -l app engine\joint\v4k.h 128.140.14.212:/home/app/microblog/app/static/v4k/v4k.h
exit /b exit /b

View File

@ -26,7 +26,7 @@ int main() {
ssbo_bind(buf, 1); ssbo_bind(buf, 1);
ssbo_update(0, sizeof(data), &data); ssbo_update(0, sizeof(data), &data);
dispatch(TEX_WIDTH/10, TEX_WIDTH/10, 1); compute_dispatch(TEX_WIDTH/10, TEX_WIDTH/10, 1);
image_write_barrier(); image_write_barrier();
fullscreen_quad_rgb(tex, 2.2); fullscreen_quad_rgb(tex, 2.2);

View File

@ -2366,9 +2366,9 @@ WRITE,
READ_WRITE READ_WRITE
}; };
unsigned compute(const char *cs); unsigned compute(const char *cs);
void dispatch(unsigned wx, unsigned wy, unsigned wz); void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
void shader_image(texture_t t, unsigned unit, unsigned level, int layer , unsigned access); void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer , unsigned texel_type, unsigned access); void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
void image_write_barrier(); void image_write_barrier();
void write_barrier(); void write_barrier();
enum USAGE_MODE { enum USAGE_MODE {

View File

@ -16490,14 +16490,51 @@ enum ACCESS_MODE {
READ_WRITE READ_WRITE
}; };
/// Loads the compute shader and compiles a GL program.
/// return: GL program, 0 if failed.
/// cs: shader source code
API unsigned compute(const char *cs); API unsigned compute(const char *cs);
API void dispatch(unsigned wx, unsigned wy, unsigned wz);
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer /* -1 to disable layered access */, unsigned access); /// Runs the compute program with provided global workgroup size on x y z grid.
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer /* -1 to disable layered access */, unsigned texel_type, unsigned access); /// wx: global workgroup size x
/// wy: global workgroup size y
/// wz: global workgroup size z
API void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
/// Binds a texture to the program
/// !!! Set `layer` to -1 to disable layered access.
/// t: texture to bind
/// unit: texture unit bind index
/// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer
/// access: texture access policy
/// see: ACCESS_MODE
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
/// Binds a texture to the program
/// !!! Set `layer` to -1 to disable layered access.
/// texture: GL texture handle
/// unit: texture unit bind index
/// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer
/// texel_type: image texel format (RGBA8, RGBA32F, ...)
/// access: texture access policy
/// see: ACCESS_MODE
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
// gpu memory barriers
/// Blocks main thread until all image operations are done by the GPU.
API void image_write_barrier(); API void image_write_barrier();
/// Blocks main thread until all memory operations are done by the GPU.
API void write_barrier(); API void write_barrier();
// ssbo // ssbo
/// `STATIC`, `DYNAMIC` AND `STREAM` specify the frequency at which we intend to access the data.
/// `DRAW` favors CPU->GPU operations.
/// `READ` favors GPU->CPU operations.
/// `COPY` favors CPU->GPU->CPU operations.
enum USAGE_MODE { enum USAGE_MODE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
@ -16512,12 +16549,41 @@ enum USAGE_MODE {
STREAM_COPY STREAM_COPY
}; };
/// Create Shader Storage Buffer Object
/// !!! `data` can be NULL
/// data: optional pointer to data to upload
/// len: buffer size, must not be 0
/// usage: buffer usage policy
/// see: USAGE_MODE
API unsigned ssbo_create(const void *data, int len, unsigned usage); API unsigned ssbo_create(const void *data, int len, unsigned usage);
/// Destroys an SSBO resource
API void ssbo_destroy(unsigned ssbo); API void ssbo_destroy(unsigned ssbo);
/// Updates an existing SSBO
/// !!! `len` can not exceed the original buffer size specified in `ssbo_create` !
/// offset: offset to buffer memory
/// len: amount of data to write
/// data: pointer to data we aim to write, can not be NULL
API void ssbo_update(int offset, int len, const void *data); API void ssbo_update(int offset, int len, const void *data);
/// Bind an SSBO resource to the provided bind unit index
/// ssbo: resource object
/// unit: bind unit index
API void ssbo_bind(unsigned ssbo, unsigned unit); API void ssbo_bind(unsigned ssbo, unsigned unit);
/// Map an SSBO resource to the system memory
/// !!! Make sure to `ssbo_unmap` the buffer once done working with it.
/// access: buffer access policy
/// return: pointer to physical memory of the buffer
/// see: ACCESS_MODE
API void *ssbo_map(unsigned access); API void *ssbo_map(unsigned access);
/// Unmaps an SSBO resource
/// !!! Pointer provided by `ssbo_map` becomes invalid.
API void ssbo_unmap(); API void ssbo_unmap();
/// Unbinds an SSBO resource
API void ssbo_unbind(); API void ssbo_unbind();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -340165,7 +340231,7 @@ unsigned compute(const char *cs){
#endif #endif
} }
void dispatch(unsigned wx, unsigned wy, unsigned wz){ void compute_dispatch(unsigned wx, unsigned wy, unsigned wz){
glDispatchCompute(wx, wy, wz); glDispatchCompute(wx, wy, wz);
} }

View File

@ -225,7 +225,7 @@ unsigned compute(const char *cs){
#endif #endif
} }
void dispatch(unsigned wx, unsigned wy, unsigned wz){ void compute_dispatch(unsigned wx, unsigned wy, unsigned wz){
glDispatchCompute(wx, wy, wz); glDispatchCompute(wx, wy, wz);
} }

View File

@ -335,14 +335,51 @@ enum ACCESS_MODE {
READ_WRITE READ_WRITE
}; };
/// Loads the compute shader and compiles a GL program.
/// return: GL program, 0 if failed.
/// cs: shader source code
API unsigned compute(const char *cs); API unsigned compute(const char *cs);
API void dispatch(unsigned wx, unsigned wy, unsigned wz);
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer /* -1 to disable layered access */, unsigned access); /// Runs the compute program with provided global workgroup size on x y z grid.
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer /* -1 to disable layered access */, unsigned texel_type, unsigned access); /// wx: global workgroup size x
/// wy: global workgroup size y
/// wz: global workgroup size z
API void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
/// Binds a texture to the program
/// !!! Set `layer` to -1 to disable layered access.
/// t: texture to bind
/// unit: texture unit bind index
/// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer
/// access: texture access policy
/// see: ACCESS_MODE
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
/// Binds a texture to the program
/// !!! Set `layer` to -1 to disable layered access.
/// texture: GL texture handle
/// unit: texture unit bind index
/// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer
/// texel_type: image texel format (RGBA8, RGBA32F, ...)
/// access: texture access policy
/// see: ACCESS_MODE
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
// gpu memory barriers
/// Blocks main thread until all image operations are done by the GPU.
API void image_write_barrier(); API void image_write_barrier();
/// Blocks main thread until all memory operations are done by the GPU.
API void write_barrier(); API void write_barrier();
// ssbo // ssbo
/// `STATIC`, `DYNAMIC` AND `STREAM` specify the frequency at which we intend to access the data.
/// `DRAW` favors CPU->GPU operations.
/// `READ` favors GPU->CPU operations.
/// `COPY` favors CPU->GPU->CPU operations.
enum USAGE_MODE { enum USAGE_MODE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
@ -357,12 +394,41 @@ enum USAGE_MODE {
STREAM_COPY STREAM_COPY
}; };
/// Create Shader Storage Buffer Object
/// !!! `data` can be NULL
/// data: optional pointer to data to upload
/// len: buffer size, must not be 0
/// usage: buffer usage policy
/// see: USAGE_MODE
API unsigned ssbo_create(const void *data, int len, unsigned usage); API unsigned ssbo_create(const void *data, int len, unsigned usage);
/// Destroys an SSBO resource
API void ssbo_destroy(unsigned ssbo); API void ssbo_destroy(unsigned ssbo);
/// Updates an existing SSBO
/// !!! `len` can not exceed the original buffer size specified in `ssbo_create` !
/// offset: offset to buffer memory
/// len: amount of data to write
/// data: pointer to data we aim to write, can not be NULL
API void ssbo_update(int offset, int len, const void *data); API void ssbo_update(int offset, int len, const void *data);
/// Bind an SSBO resource to the provided bind unit index
/// ssbo: resource object
/// unit: bind unit index
API void ssbo_bind(unsigned ssbo, unsigned unit); API void ssbo_bind(unsigned ssbo, unsigned unit);
/// Map an SSBO resource to the system memory
/// !!! Make sure to `ssbo_unmap` the buffer once done working with it.
/// access: buffer access policy
/// return: pointer to physical memory of the buffer
/// see: ACCESS_MODE
API void *ssbo_map(unsigned access); API void *ssbo_map(unsigned access);
/// Unmaps an SSBO resource
/// !!! Pointer provided by `ssbo_map` becomes invalid.
API void ssbo_unmap(); API void ssbo_unmap();
/// Unbinds an SSBO resource
API void ssbo_unbind(); API void ssbo_unbind();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -11139,7 +11139,7 @@ unsigned compute(const char *cs){
#endif #endif
} }
void dispatch(unsigned wx, unsigned wy, unsigned wz){ void compute_dispatch(unsigned wx, unsigned wy, unsigned wz){
glDispatchCompute(wx, wy, wz); glDispatchCompute(wx, wy, wz);
} }

View File

@ -2573,14 +2573,51 @@ enum ACCESS_MODE {
READ_WRITE READ_WRITE
}; };
/// Loads the compute shader and compiles a GL program.
/// return: GL program, 0 if failed.
/// cs: shader source code
API unsigned compute(const char *cs); API unsigned compute(const char *cs);
API void dispatch(unsigned wx, unsigned wy, unsigned wz);
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer /* -1 to disable layered access */, unsigned access); /// Runs the compute program with provided global workgroup size on x y z grid.
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer /* -1 to disable layered access */, unsigned texel_type, unsigned access); /// wx: global workgroup size x
/// wy: global workgroup size y
/// wz: global workgroup size z
API void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
/// Binds a texture to the program
/// !!! Set `layer` to -1 to disable layered access.
/// t: texture to bind
/// unit: texture unit bind index
/// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer
/// access: texture access policy
/// see: ACCESS_MODE
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
/// Binds a texture to the program
/// !!! Set `layer` to -1 to disable layered access.
/// texture: GL texture handle
/// unit: texture unit bind index
/// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer
/// texel_type: image texel format (RGBA8, RGBA32F, ...)
/// access: texture access policy
/// see: ACCESS_MODE
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
// gpu memory barriers
/// Blocks main thread until all image operations are done by the GPU.
API void image_write_barrier(); API void image_write_barrier();
/// Blocks main thread until all memory operations are done by the GPU.
API void write_barrier(); API void write_barrier();
// ssbo // ssbo
/// `STATIC`, `DYNAMIC` AND `STREAM` specify the frequency at which we intend to access the data.
/// `DRAW` favors CPU->GPU operations.
/// `READ` favors GPU->CPU operations.
/// `COPY` favors CPU->GPU->CPU operations.
enum USAGE_MODE { enum USAGE_MODE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
@ -2595,12 +2632,41 @@ enum USAGE_MODE {
STREAM_COPY STREAM_COPY
}; };
/// Create Shader Storage Buffer Object
/// !!! `data` can be NULL
/// data: optional pointer to data to upload
/// len: buffer size, must not be 0
/// usage: buffer usage policy
/// see: USAGE_MODE
API unsigned ssbo_create(const void *data, int len, unsigned usage); API unsigned ssbo_create(const void *data, int len, unsigned usage);
/// Destroys an SSBO resource
API void ssbo_destroy(unsigned ssbo); API void ssbo_destroy(unsigned ssbo);
/// Updates an existing SSBO
/// !!! `len` can not exceed the original buffer size specified in `ssbo_create` !
/// offset: offset to buffer memory
/// len: amount of data to write
/// data: pointer to data we aim to write, can not be NULL
API void ssbo_update(int offset, int len, const void *data); API void ssbo_update(int offset, int len, const void *data);
/// Bind an SSBO resource to the provided bind unit index
/// ssbo: resource object
/// unit: bind unit index
API void ssbo_bind(unsigned ssbo, unsigned unit); API void ssbo_bind(unsigned ssbo, unsigned unit);
/// Map an SSBO resource to the system memory
/// !!! Make sure to `ssbo_unmap` the buffer once done working with it.
/// access: buffer access policy
/// return: pointer to physical memory of the buffer
/// see: ACCESS_MODE
API void *ssbo_map(unsigned access); API void *ssbo_map(unsigned access);
/// Unmaps an SSBO resource
/// !!! Pointer provided by `ssbo_map` becomes invalid.
API void ssbo_unmap(); API void ssbo_unmap();
/// Unbinds an SSBO resource
API void ssbo_unbind(); API void ssbo_unbind();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

File diff suppressed because one or more lines are too long

View File

@ -73,6 +73,7 @@
int DO_CSS = 1; int DO_CSS = 1;
int DO_DEBUG = 0; int DO_DEBUG = 0;
int DO_README = 1; int DO_README = 1;
int DO_CHANGELOG = 1;
// C preprocessor: // C preprocessor:
// 1. remove all /* C comments */ // 1. remove all /* C comments */
@ -892,6 +893,16 @@ int main(int argc, char **argv) {
array_unique(macros, sort_strcmp); array_unique(macros, sort_strcmp);
{ char *sep = ""; for(int i = 0, end = array_count(macros); i < end; ++i) printf("%s[%s](#%s)", sep, macros[i], macros[i]), sep = ", "; } { char *sep = ""; for(int i = 0, end = array_count(macros); i < end; ++i) printf("%s[%s](#%s)", sep, macros[i], macros[i]), sep = ", "; }
if ( DO_CHANGELOG ) {
printf("\n## c h a n g e l o g\n\n");
char *chg = file_read("changelog.txt");
strrepl(&chg, "\r\n", "\n");
for each_substring(chg, "\n", it) {
// printf("<details><summary>%s</summary></details>\n", it);
printf("* %s\n", it);
}
}
puts("\n<script>"); puts("\n<script>");
puts("\nmarkdeepOptions = {"); puts("\nmarkdeepOptions = {");
puts("\n tocStyle:'medium', /* auto,none,short,medium,long */"); puts("\n tocStyle:'medium', /* auto,none,short,medium,long */");