From 6e4479613620830fd39fe008e9474c93fa97111c Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Sat, 16 Dec 2023 17:32:53 +0200 Subject: [PATCH] update rlgl --- api/rlgl.json | 137 +++++++++++++++++++++++++++++++++---------- src/rlgl.nim | 35 +++++++---- tools/raylib_gen.nim | 2 +- tools/rlgl_gen.nim | 3 + 4 files changed, 135 insertions(+), 42 deletions(-) diff --git a/api/rlgl.json b/api/rlgl.json index 1b7b46d..67344da 100644 --- a/api/rlgl.json +++ b/api/rlgl.json @@ -522,6 +522,18 @@ "value": "RL_SHADER_LOC_MAP_METALNESS", "description": "" }, + { + "name": "GLAD_API_CALL_EXPORT", + "type": "GUARD", + "value": "", + "description": "" + }, + { + "name": "GLAD_API_CALL_EXPORT_BUILD", + "type": "GUARD", + "value": "", + "description": "" + }, { "name": "APIENTRY", "type": "UNKNOWN", @@ -553,13 +565,13 @@ "description": "" }, { - "name": "GLAD_GLES2_IMPLEMENTATION", + "name": "GL_GLEXT_PROTOTYPES", "type": "GUARD", "value": "", "description": "" }, { - "name": "GL_GLEXT_PROTOTYPES", + "name": "GLAD_GLES2_IMPLEMENTATION", "type": "GUARD", "value": "", "description": "" @@ -1269,7 +1281,7 @@ { "name": "RL_OPENGL_ES_30", "value": 6, - "description": "OpenGL ES 3.0 (GLSL 300 es) " + "description": "OpenGL ES 3.0 (GLSL 300 es)" } ] }, @@ -1374,58 +1386,73 @@ "description": "32*4 bpp (4 channels - float)" }, { - "name": "RL_PIXELFORMAT_COMPRESSED_DXT1_RGB", + "name": "RL_PIXELFORMAT_UNCOMPRESSED_R16", "value": 11, + "description": "16 bpp (1 channel - half float)" + }, + { + "name": "RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16", + "value": 12, + "description": "16*3 bpp (3 channels - half float)" + }, + { + "name": "RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16", + "value": 13, + "description": "16*4 bpp (4 channels - half float)" + }, + { + "name": "RL_PIXELFORMAT_COMPRESSED_DXT1_RGB", + "value": 14, "description": "4 bpp (no alpha)" }, { "name": "RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA", - "value": 12, + "value": 15, "description": "4 bpp (1 bit alpha)" }, { "name": "RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA", - "value": 13, + "value": 16, "description": "8 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA", - "value": 14, + "value": 17, "description": "8 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_ETC1_RGB", - "value": 15, + "value": 18, "description": "4 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_ETC2_RGB", - "value": 16, + "value": 19, "description": "4 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA", - "value": 17, + "value": 20, "description": "8 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_PVRT_RGB", - "value": 18, + "value": 21, "description": "4 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA", - "value": 19, + "value": 22, "description": "4 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA", - "value": 20, + "value": 23, "description": "8 bpp" }, { "name": "RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA", - "value": 21, + "value": 24, "description": "2 bpp" } ] @@ -2425,6 +2452,49 @@ } ] }, + { + "name": "rlBlitFramebuffer", + "description": "Blit active framebuffer to main framebuffer", + "returnType": "void", + "params": [ + { + "type": "int", + "name": "srcX" + }, + { + "type": "int", + "name": "srcY" + }, + { + "type": "int", + "name": "srcWidth" + }, + { + "type": "int", + "name": "srcHeight" + }, + { + "type": "int", + "name": "dstX" + }, + { + "type": "int", + "name": "dstY" + }, + { + "type": "int", + "name": "dstWidth" + }, + { + "type": "int", + "name": "dstHeight" + }, + { + "type": "int", + "name": "bufferMask" + } + ] + }, { "name": "rlEnableColorBlend", "description": "Enable color blending", @@ -2514,9 +2584,14 @@ "description": "Enable wire mode", "returnType": "void" }, + { + "name": "rlEnablePointMode", + "description": "Enable point mode", + "returnType": "void" + }, { "name": "rlDisableWireMode", - "description": "Disable wire mode", + "description": "Disable wire mode ( and point ) maybe rename", "returnType": "void" }, { @@ -2819,7 +2894,7 @@ }, { "name": "rlLoadVertexBuffer", - "description": "Load a vertex buffer attribute", + "description": "Load a vertex buffer object", "returnType": "unsigned int", "params": [ { @@ -2838,7 +2913,7 @@ }, { "name": "rlLoadVertexBufferElement", - "description": "Load a new attributes element buffer", + "description": "Load vertex buffer elements object", "returnType": "unsigned int", "params": [ { @@ -2857,7 +2932,7 @@ }, { "name": "rlUpdateVertexBuffer", - "description": "Update GPU buffer with new data", + "description": "Update vertex buffer object data on GPU buffer", "returnType": "void", "params": [ { @@ -2880,7 +2955,7 @@ }, { "name": "rlUpdateVertexBufferElements", - "description": "Update vertex buffer elements with new data", + "description": "Update vertex buffer elements data on GPU buffer", "returnType": "void", "params": [ { @@ -2903,7 +2978,7 @@ }, { "name": "rlUnloadVertexArray", - "description": "", + "description": "Unload vertex array (vao)", "returnType": "void", "params": [ { @@ -2914,7 +2989,7 @@ }, { "name": "rlUnloadVertexBuffer", - "description": "", + "description": "Unload vertex buffer object", "returnType": "void", "params": [ { @@ -2925,7 +3000,7 @@ }, { "name": "rlSetVertexAttribute", - "description": "", + "description": "Set vertex attribute data configuration", "returnType": "void", "params": [ { @@ -2956,7 +3031,7 @@ }, { "name": "rlSetVertexAttributeDivisor", - "description": "", + "description": "Set vertex attribute data divisor", "returnType": "void", "params": [ { @@ -2971,7 +3046,7 @@ }, { "name": "rlSetVertexAttributeDefault", - "description": "Set vertex attribute default value", + "description": "Set vertex attribute default value, when attribute to provided", "returnType": "void", "params": [ { @@ -2994,7 +3069,7 @@ }, { "name": "rlDrawVertexArray", - "description": "", + "description": "Draw vertex array (currently active vao)", "returnType": "void", "params": [ { @@ -3009,7 +3084,7 @@ }, { "name": "rlDrawVertexArrayElements", - "description": "", + "description": "Draw vertex array elements", "returnType": "void", "params": [ { @@ -3028,7 +3103,7 @@ }, { "name": "rlDrawVertexArrayInstanced", - "description": "", + "description": "Draw vertex array (currently active vao) with instancing", "returnType": "void", "params": [ { @@ -3047,7 +3122,7 @@ }, { "name": "rlDrawVertexArrayElementsInstanced", - "description": "", + "description": "Draw vertex array elements with instancing", "returnType": "void", "params": [ { @@ -3070,7 +3145,7 @@ }, { "name": "rlLoadTexture", - "description": "Load texture in GPU", + "description": "Load texture data", "returnType": "unsigned int", "params": [ { @@ -3116,7 +3191,7 @@ }, { "name": "rlLoadTextureCubemap", - "description": "Load texture cubemap", + "description": "Load texture cubemap data", "returnType": "unsigned int", "params": [ { @@ -3135,7 +3210,7 @@ }, { "name": "rlUpdateTexture", - "description": "Update GPU texture with new data", + "description": "Update texture with new data on GPU", "returnType": "void", "params": [ { diff --git a/src/rlgl.nim b/src/rlgl.nim index e28f38c..890090a 100644 --- a/src/rlgl.nim +++ b/src/rlgl.nim @@ -133,7 +133,7 @@ type Opengl33 ## OpenGL 3.3 (GLSL 330) Opengl43 ## OpenGL 4.3 (using GLSL 330) OpenglEs20 ## OpenGL ES 2.0 (GLSL 100) - OpenglEs30 ## OpenGL ES 3.0 (GLSL 300 es) + OpenglEs30 ## OpenGL ES 3.0 (GLSL 300 es) FramebufferAttachType* {.size: sizeof(int32).} = enum ## Framebuffer attachment type ColorChannel0 ## Framebuffer attachment type: color 0 @@ -282,6 +282,8 @@ proc disableFramebuffer*() {.importc: "rlDisableFramebuffer".} ## Disable render texture (fbo), return to default framebuffer proc activeDrawBuffers*(count: int32) {.importc: "rlActiveDrawBuffers".} ## Activate multiple draw color buffers +proc blitFramebuffer*(srcX: int32, srcY: int32, srcWidth: int32, srcHeight: int32, dstX: int32, dstY: int32, dstWidth: int32, dstHeight: int32, bufferMask: int32) {.importc: "rlBlitFramebuffer".} + ## Blit active framebuffer to main framebuffer proc enableColorBlend*() {.importc: "rlEnableColorBlend".} ## Enable color blending proc disableColorBlend*() {.importc: "rlDisableColorBlend".} @@ -308,8 +310,10 @@ proc scissor*(x: int32, y: int32, width: int32, height: int32) {.importc: "rlSci ## Scissor test proc enableWireMode*() {.importc: "rlEnableWireMode".} ## Enable wire mode +proc enablePointMode*() {.importc: "rlEnablePointMode".} + ## Enable point mode proc disableWireMode*() {.importc: "rlDisableWireMode".} - ## Disable wire mode + ## Disable wire mode ( and point ) maybe rename proc setLineWidth*(width: float32) {.importc: "rlSetLineWidth".} ## Set the line drawing width proc getLineWidth*(): float32 {.importc: "rlGetLineWidth".} @@ -375,31 +379,39 @@ proc setTexture*(id: uint32) {.importc: "rlSetTexture".} proc loadVertexArray*(): uint32 {.importc: "rlLoadVertexArray".} ## Load vertex array (vao) if supported proc loadVertexBuffer*(buffer: pointer, size: int32, dynamic: bool): uint32 {.importc: "rlLoadVertexBuffer".} - ## Load a vertex buffer attribute + ## Load a vertex buffer object proc loadVertexBufferElement*(buffer: pointer, size: int32, dynamic: bool): uint32 {.importc: "rlLoadVertexBufferElement".} - ## Load a new attributes element buffer + ## Load vertex buffer elements object proc updateVertexBuffer*(bufferId: uint32, data: pointer, dataSize: int32, offset: int32) {.importc: "rlUpdateVertexBuffer".} - ## Update GPU buffer with new data + ## Update vertex buffer object data on GPU buffer proc updateVertexBufferElements*(id: uint32, data: pointer, dataSize: int32, offset: int32) {.importc: "rlUpdateVertexBufferElements".} - ## Update vertex buffer elements with new data + ## Update vertex buffer elements data on GPU buffer proc unloadVertexArray*(vaoId: uint32) {.importc: "rlUnloadVertexArray".} + ## Unload vertex array (vao) proc unloadVertexBuffer*(vboId: uint32) {.importc: "rlUnloadVertexBuffer".} + ## Unload vertex buffer object proc setVertexAttribute*(index: uint32, compSize: int32, `type`: GlType, normalized: bool, stride: int32, pointer: pointer) {.importc: "rlSetVertexAttribute".} + ## Set vertex attribute data configuration proc setVertexAttributeDivisor*(index: uint32, divisor: int32) {.importc: "rlSetVertexAttributeDivisor".} + ## Set vertex attribute data divisor proc setVertexAttributeDefault*(locIndex: ShaderLocation, value: pointer, attribType: ShaderAttributeDataType, count: int32) {.importc: "rlSetVertexAttributeDefault".} - ## Set vertex attribute default value + ## Set vertex attribute default value, when attribute to provided proc drawVertexArray*(offset: int32, count: int32) {.importc: "rlDrawVertexArray".} + ## Draw vertex array (currently active vao) proc drawVertexArrayElements*(offset: int32, count: int32, buffer: pointer) {.importc: "rlDrawVertexArrayElements".} + ## Draw vertex array elements proc drawVertexArrayInstanced*(offset: int32, count: int32, instances: int32) {.importc: "rlDrawVertexArrayInstanced".} + ## Draw vertex array (currently active vao) with instancing proc drawVertexArrayElementsInstanced*(offset: int32, count: int32, buffer: pointer, instances: int32) {.importc: "rlDrawVertexArrayElementsInstanced".} + ## Draw vertex array elements with instancing proc loadTexture*(data: pointer, width: int32, height: int32, format: int32, mipmapCount: int32): uint32 {.importc: "rlLoadTexture".} - ## Load texture in GPU + ## Load texture data proc loadTextureDepth*(width: int32, height: int32, useRenderBuffer: bool): uint32 {.importc: "rlLoadTextureDepth".} ## Load depth texture/renderbuffer (to be attached to fbo) proc loadTextureCubemap*(data: pointer, size: int32, format: PixelFormat): uint32 {.importc: "rlLoadTextureCubemap".} - ## Load texture cubemap + ## Load texture cubemap data proc updateTexture*(id: uint32, offsetX: int32, offsetY: int32, width: int32, height: int32, format: PixelFormat, data: pointer) {.importc: "rlUpdateTexture".} - ## Update GPU texture with new data + ## Update texture with new data on GPU proc getGlTextureFormats*(format: PixelFormat, glInternalFormat: out uint32, glFormat: out uint32, glType: out uint32) {.importc: "rlGetGlTextureFormats".} ## Get OpenGL internal formats proc unloadTexture*(id: uint32) {.importc: "rlUnloadTexture".} @@ -603,6 +615,9 @@ proc getPixelFormatName*(format: PixelFormat): string = of UncompressedR16: "R16" ## 16 bpp (1 channel - half float) of UncompressedR16g16b16: "R16G16B16" ## 16*3 bpp (3 channels - half float) of UncompressedR16g16b16a16: "R16G16B16A16" ## 16*4 bpp (4 channels - half float) + of UncompressedR16: "UNCOMPRESSED_R16" ## 16 bpp (1 channel - half float) + of UncompressedR16g16b16: "UNCOMPRESSED_R16G16B16" ## 16*3 bpp (3 channels - half float) + of UncompressedR16g16b16a16: "UNCOMPRESSED_R16G16B16A16" ## 16*4 bpp (4 channels - half float) of CompressedDxt1Rgb: "DXT1_RGB" # 4 bpp (no alpha) of CompressedDxt1Rgba: "DXT1_RGBA" # 4 bpp (1 bit alpha) of CompressedDxt3Rgba: "DXT3_RGBA" # 8 bpp diff --git a/tools/raylib_gen.nim b/tools/raylib_gen.nim index 717866e..3e9cc18 100644 --- a/tools/raylib_gen.nim +++ b/tools/raylib_gen.nim @@ -668,7 +668,7 @@ proc genBindings(t: TopLevel, fname: string; header, middle: string) = lit enumInFuncs[j] break outer let many = (fnc.name, param.name) != ("LoadImageAnim", "frames") and - isPlural(param.name) and (fnc.name, param.name) == ("ImageKernelConvolution", "kernel") + isPlural(param.name) or (fnc.name, param.name) == ("ImageKernelConvolution", "kernel") const replacements = [ ("GenImageFontAtlas", "glyphRecs", "ptr ptr UncheckedArray[$1]"), diff --git a/tools/rlgl_gen.nim b/tools/rlgl_gen.nim index b7e235a..db5c6a7 100644 --- a/tools/rlgl_gen.nim +++ b/tools/rlgl_gen.nim @@ -255,6 +255,9 @@ proc getPixelFormatName*(format: PixelFormat): string = of UncompressedR16: "R16" ## 16 bpp (1 channel - half float) of UncompressedR16g16b16: "R16G16B16" ## 16*3 bpp (3 channels - half float) of UncompressedR16g16b16a16: "R16G16B16A16" ## 16*4 bpp (4 channels - half float) + of UncompressedR16: "UNCOMPRESSED_R16" ## 16 bpp (1 channel - half float) + of UncompressedR16g16b16: "UNCOMPRESSED_R16G16B16" ## 16*3 bpp (3 channels - half float) + of UncompressedR16g16b16a16: "UNCOMPRESSED_R16G16B16A16" ## 16*4 bpp (4 channels - half float) of CompressedDxt1Rgb: "DXT1_RGB" # 4 bpp (no alpha) of CompressedDxt1Rgba: "DXT1_RGBA" # 4 bpp (1 bit alpha) of CompressedDxt3Rgba: "DXT3_RGBA" # 8 bpp