treeform / shady

Nim to GPU shader language compiler and supporting utilities.
MIT License
152 stars 12 forks source link

Filtering all glsl functions #15

Open arkanoid87 opened 1 year ago

arkanoid87 commented 1 year ago

I'm finding myself editing const glslFunctions quite a lot, so I've added them all

Not sure if this beneficial or not, but I'll share it here for your consideration

how about making it a set for performance reason?

const glslFunctions* = [

    # base 
    "bool", "array",

    # vmath

    "vec2", "vec3", "vec4", "mat2", "mat3", "mat4",
    "Vec2", "Vec3", "Vec4", "mat2", "Mat3", "Mat4",
    "uvec2", "uvec3", "uvec4",
    "UVec2", "UVec3", "UVec4",
    "ivec2", "ivec3", "ivec4",
    "IVec2", "IVec3", "IVec4",

    # --------------------------
    # https://registry.khronos.org/OpenGL-Refpages/gl4/index.php

    #a

    "abs",
    "acos",
    "acosh",
    "glActiveShaderProgram",
    "glActiveTexture",
    "all",
    "any",
    "asin",
    "asinh",
    "atan",
    "atanh",
    "atomicAdd",
    "atomicAnd",
    "atomicCompSwap",
    "atomicCounter",
    "atomicCounterDecrement",
    "atomicCounterIncrement",
    "atomicExchange",
    "atomicMax",
    "atomicMin",
    "atomicOr",
    "atomicXor",
    "glAttachShader",

    #b

    "barrier",
    "glBeginConditionalRender",
    "glBeginQuery",
    "glBeginQueryIndexed",
    "glBeginTransformFeedback",
    "glBindAttribLocation",
    "glBindBuffer",
    "glBindBufferBase",
    "glBindBufferRange",
    "glBindBuffersBase",
    "glBindBuffersRange",
    "glBindFragDataLocation",
    "glBindFragDataLocationIndexed",
    "glBindFramebuffer",
    "glBindImageTexture",
    "glBindImageTextures",
    "glBindProgramPipeline",
    "glBindRenderbuffer",
    "glBindSampler",
    "glBindSamplers",
    "glBindTexture",
    "glBindTextures",
    "glBindTextureUnit",
    "glBindTransformFeedback",
    "glBindVertexArray",
    "glBindVertexBuffer",
    "glBindVertexBuffers",
    "bitCount",
    "bitfieldExtract",
    "bitfieldInsert",
    "bitfieldReverse",
    "glBlendColor",
    "glBlendEquation",
    "glBlendEquationi",
    "glBlendEquationSeparate",
    "glBlendEquationSeparatei",
    "glBlendFunc",
    "glBlendFunci",
    "glBlendFuncSeparate",
    "glBlendFuncSeparatei",
    "glBlitFramebuffer",
    "glBlitNamedFramebuffer",
    "glBufferData",
    "glBufferStorage",
    "glBufferSubData",

    #c

    "ceil",
    "glCheckFramebufferStatus",
    "glCheckNamedFramebufferStatus",
    "clamp",
    "glClampColor",
    "glClear",
    "glClearBuffer",
    "glClearBufferData",
    "glClearBufferfi",
    "glClearBufferfv",
    "glClearBufferiv",
    "glClearBufferSubData",
    "glClearBufferuiv",
    "glClearColor",
    "glClearDepth",
    "glClearDepthf",
    "glClearNamedBufferData",
    "glClearNamedBufferSubData",
    "glClearNamedFramebufferfi",
    "glClearNamedFramebufferfv",
    "glClearNamedFramebufferiv",
    "glClearNamedFramebufferuiv",
    "glClearStencil",
    "glClearTexImage",
    "glClearTexSubImage",
    "glClientWaitSync",
    "glClipControl",
    "glColorMask",
    "glColorMaski",
    "glCompileShader",
    "glCompressedTexImage1D",
    "glCompressedTexImage2D",
    "glCompressedTexImage3D",
    "glCompressedTexSubImage1D",
    "glCompressedTexSubImage2D",
    "glCompressedTexSubImage3D",
    "glCompressedTextureSubImage1D",
    "glCompressedTextureSubImage2D",
    "glCompressedTextureSubImage3D",
    "glCopyBufferSubData",
    "glCopyImageSubData",
    "glCopyNamedBufferSubData",
    "glCopyTexImage1D",
    "glCopyTexImage2D",
    "glCopyTexSubImage1D",
    "glCopyTexSubImage2D",
    "glCopyTexSubImage3D",
    "glCopyTextureSubImage1D",
    "glCopyTextureSubImage2D",
    "glCopyTextureSubImage3D",
    "cos",
    "cosh",
    "glCreateBuffers",
    "glCreateFramebuffers",
    "glCreateProgram",
    "glCreateProgramPipelines",
    "glCreateQueries",
    "glCreateRenderbuffers",
    "glCreateSamplers",
    "glCreateShader",
    "glCreateShaderProgram",
    "glCreateShaderProgramv",
    "glCreateTextures",
    "glCreateTransformFeedbacks",
    "glCreateVertexArrays",
    "cross",
    "glCullFace",

    #d

    "glDebugMessageCallback",
    "glDebugMessageControl",
    "glDebugMessageInsert",
    "degrees",
    "glDeleteBuffers",
    "glDeleteFramebuffers",
    "glDeleteProgram",
    "glDeleteProgramPipelines",
    "glDeleteQueries",
    "glDeleteRenderbuffers",
    "glDeleteSamplers",
    "glDeleteShader",
    "glDeleteSync",
    "glDeleteTextures",
    "glDeleteTransformFeedbacks",
    "glDeleteVertexArrays",
    "glDepthFunc",
    "glDepthMask",
    "glDepthRange",
    "glDepthRangeArray",
    "glDepthRangeArrayv",
    "glDepthRangef",
    "glDepthRangeIndexed",
    "glDetachShader",
    "determinant",
    "dFdx",
    "dFdxCoarse",
    "dFdxFine",
    "dFdy",
    "dFdyCoarse",
    "dFdyFine",
    "glDisable",
    "glDisablei",
    "glDisableVertexArrayAttrib",
    "glDisableVertexAttribArray",
    "glDispatchCompute",
    "glDispatchComputeIndirect",
    "distance",
    "dot",
    "glDrawArrays",
    "glDrawArraysIndirect",
    "glDrawArraysInstanced",
    "glDrawArraysInstancedBaseInstance",
    "glDrawBuffer",
    "glDrawBuffers",
    "glDrawElements",
    "glDrawElementsBaseVertex",
    "glDrawElementsIndirect",
    "glDrawElementsInstanced",
    "glDrawElementsInstancedBaseInstance",
    "glDrawElementsInstancedBaseVertex",
    "glDrawElementsInstancedBaseVertexBaseInstance",
    "glDrawRangeElements",
    "glDrawRangeElementsBaseVertex",
    "glDrawTransformFeedback",
    "glDrawTransformFeedbackInstanced",
    "glDrawTransformFeedbackStream",
    "glDrawTransformFeedbackStreamInstanced",

    #e

    "EmitStreamVertex",
    "EmitVertex",
    "glEnable",
    "glEnablei",
    "glEnableVertexArrayAttrib",
    "glEnableVertexAttribArray",
    "glEndConditionalRender",
    "EndPrimitive",
    "glEndQuery",
    "glEndQueryIndexed",
    "EndStreamPrimitive",
    "glEndTransformFeedback",
    "equal",
    "exp",
    "exp2",

    #f

    "faceforward",
    "glFenceSync",
    "findLSB",
    "findMSB",
    "glFinish",
    "floatBitsToInt",
    "floatBitsToUint",
    "floor",
    "glFlush",
    "glFlushMappedBufferRange",
    "glFlushMappedNamedBufferRange",
    "fma",
    "fract",
    "glFramebufferParameteri",
    "glFramebufferRenderbuffer",
    "glFramebufferTexture",
    "glFramebufferTexture1D",
    "glFramebufferTexture2D",
    "glFramebufferTexture3D",
    "glFramebufferTextureLayer",
    "frexp",
    "glFrontFace",
    "fwidth",
    "fwidthCoarse",
    "fwidthFine",

    #g

    "glGenBuffers",
    "glGenerateMipmap",
    "glGenerateTextureMipmap",
    "glGenFramebuffers",
    "glGenProgramPipelines",
    "glGenQueries",
    "glGenRenderbuffers",
    "glGenSamplers",
    "glGenTextures",
    "glGenTransformFeedbacks",
    "glGenVertexArrays",
    "glGet",
    "glGetActiveAtomicCounterBufferiv",
    "glGetActiveAttrib",
    "glGetActiveSubroutineName",
    "glGetActiveSubroutineUniform",
    "glGetActiveSubroutineUniformiv",
    "glGetActiveSubroutineUniformName",
    "glGetActiveUniform",
    "glGetActiveUniformBlock",
    "glGetActiveUniformBlockiv",
    "glGetActiveUniformBlockName",
    "glGetActiveUniformName",
    "glGetActiveUniformsiv",
    "glGetAttachedShaders",
    "glGetAttribLocation",
    "glGetBooleani_v",
    "glGetBooleanv",
    "glGetBufferParameter",
    "glGetBufferParameteri64v",
    "glGetBufferParameteriv",
    "glGetBufferPointerv",
    "glGetBufferSubData",
    "glGetCompressedTexImage",
    "glGetCompressedTextureImage",
    "glGetCompressedTextureSubImage",
    "glGetDebugMessageLog",
    "glGetDoublei_v",
    "glGetDoublev",
    "glGetError",
    "glGetFloati_v",
    "glGetFloatv",
    "glGetFragDataIndex",
    "glGetFragDataLocation",
    "glGetFramebufferAttachmentParameter",
    "glGetFramebufferAttachmentParameteriv",
    "glGetFramebufferParameter",
    "glGetFramebufferParameteriv",
    "glGetGraphicsResetStatus",
    "glGetInteger64i_v",
    "glGetInteger64v",
    "glGetIntegeri_v",
    "glGetIntegerv",
    "glGetInternalformat",
    "glGetInternalformati64v",
    "glGetInternalformativ",
    "glGetMultisample",
    "glGetMultisamplefv",
    "glGetNamedBufferParameteri64v",
    "glGetNamedBufferParameteriv",
    "glGetNamedBufferPointerv",
    "glGetNamedBufferSubData",
    "glGetNamedFramebufferAttachmentParameteriv",
    "glGetNamedFramebufferParameteriv",
    "glGetNamedRenderbufferParameteriv",
    "glGetnCompressedTexImage",
    "glGetnTexImage",
    "glGetnUniformdv",
    "glGetnUniformfv",
    "glGetnUniformiv",
    "glGetnUniformuiv",
    "glGetObjectLabel",
    "glGetObjectPtrLabel",
    "glGetPointerv",
    "glGetProgram",
    "glGetProgramBinary",
    "glGetProgramInfoLog",
    "glGetProgramInterface",
    "glGetProgramInterfaceiv",
    "glGetProgramiv",
    "glGetProgramPipeline",
    "glGetProgramPipelineInfoLog",
    "glGetProgramPipelineiv",
    "glGetProgramResource",
    "glGetProgramResourceIndex",
    "glGetProgramResourceiv",
    "glGetProgramResourceLocation",
    "glGetProgramResourceLocationIndex",
    "glGetProgramResourceName",
    "glGetProgramStage",
    "glGetProgramStageiv",
    "glGetQueryBufferObjecti64v",
    "glGetQueryBufferObjectiv",
    "glGetQueryBufferObjectui64v",
    "glGetQueryBufferObjectuiv",
    "glGetQueryIndexed",
    "glGetQueryIndexediv",
    "glGetQueryiv",
    "glGetQueryObject",
    "glGetQueryObjecti64v",
    "glGetQueryObjectiv",
    "glGetQueryObjectui64v",
    "glGetQueryObjectuiv",
    "glGetRenderbufferParameter",
    "glGetRenderbufferParameteriv",
    "glGetSamplerParameter",
    "glGetSamplerParameterfv",
    "glGetSamplerParameterIiv",
    "glGetSamplerParameterIuiv",
    "glGetSamplerParameteriv",
    "glGetShader",
    "glGetShaderInfoLog",
    "glGetShaderiv",
    "glGetShaderPrecisionFormat",
    "glGetShaderSource",
    "glGetString",
    "glGetStringi",
    "glGetSubroutineIndex",
    "glGetSubroutineUniformLocation",
    "glGetSync",
    "glGetSynciv",
    "glGetTexImage",
    "glGetTexLevelParameter",
    "glGetTexLevelParameterfv",
    "glGetTexLevelParameteriv",
    "glGetTexParameter",
    "glGetTexParameterfv",
    "glGetTexParameterIiv",
    "glGetTexParameterIuiv",
    "glGetTexParameteriv",
    "glGetTextureImage",
    "glGetTextureLevelParameterfv",
    "glGetTextureLevelParameteriv",
    "glGetTextureParameterfv",
    "glGetTextureParameterIiv",
    "glGetTextureParameterIuiv",
    "glGetTextureParameteriv",
    "glGetTextureSubImage",
    "glGetTransformFeedback",
    "glGetTransformFeedbacki64_v",
    "glGetTransformFeedbacki_v",
    "glGetTransformFeedbackiv",
    "glGetTransformFeedbackVarying",
    "glGetUniform",
    "glGetUniformBlockIndex",
    "glGetUniformdv",
    "glGetUniformfv",
    "glGetUniformIndices",
    "glGetUniformiv",
    "glGetUniformLocation",
    "glGetUniformSubroutine",
    "glGetUniformSubroutineuiv",
    "glGetUniformuiv",
    "glGetVertexArrayIndexed",
    "glGetVertexArrayIndexed64iv",
    "glGetVertexArrayIndexediv",
    "glGetVertexArrayiv",
    "glGetVertexAttrib",
    "glGetVertexAttribdv",
    "glGetVertexAttribfv",
    "glGetVertexAttribIiv",
    "glGetVertexAttribIuiv",
    "glGetVertexAttribiv",
    "glGetVertexAttribLdv",
    "glGetVertexAttribPointerv",
    "gl_ClipDistance",
    "gl_CullDistance",
    "gl_FragCoord",
    "gl_FragDepth",
    "gl_FrontFacing",
    "gl_GlobalInvocationID",
    "gl_HelperInvocation",
    "gl_InstanceID",
    "gl_InvocationID",
    "gl_Layer",
    "gl_LocalInvocationID",
    "gl_LocalInvocationIndex",
    "gl_NumSamples",
    "gl_NumWorkGroups",
    "gl_PatchVerticesIn",
    "gl_PointCoord",
    "gl_PointSize",
    "gl_Position",
    "gl_PrimitiveID",
    "gl_PrimitiveIDIn",
    "gl_SampleID",
    "gl_SampleMask",
    "gl_SampleMaskIn",
    "gl_SamplePosition",
    "gl_TessCoord",
    "gl_TessLevelInner",
    "gl_TessLevelOuter",
    "gl_VertexID",
    "gl_ViewportIndex",
    "gl_WorkGroupID",
    "gl_WorkGroupSize",
    "greaterThan",
    "greaterThanEqual",
    "groupMemoryBarrier",

    #h

    "glHint",

    #i

    "imageAtomicAdd",
    "imageAtomicAnd",
    "imageAtomicCompSwap",
    "imageAtomicExchange",
    "imageAtomicMax",
    "imageAtomicMin",
    "imageAtomicOr",
    "imageAtomicXor",
    "imageLoad",
    "imageSamples",
    "imageSize",
    "imageStore",
    "imulExtended",
    "intBitsToFloat",
    "interpolateAtCentroid",
    "interpolateAtOffset",
    "interpolateAtSample",
    "glInvalidateBufferData",
    "glInvalidateBufferSubData",
    "glInvalidateFramebuffer",
    "glInvalidateNamedFramebufferData",
    "glInvalidateNamedFramebufferSubData",
    "glInvalidateSubFramebuffer",
    "glInvalidateTexImage",
    "glInvalidateTexSubImage",
    "inverse",
    "inversesqrt",
    "glIsBuffer",
    "glIsEnabled",
    "glIsEnabledi",
    "glIsFramebuffer",
    "isinf",
    "isnan",
    "glIsProgram",
    "glIsProgramPipeline",
    "glIsQuery",
    "glIsRenderbuffer",
    "glIsSampler",
    "glIsShader",
    "glIsSync",
    "glIsTexture",
    "glIsTransformFeedback",
    "glIsVertexArray",

    #l

    "ldexp",
    "length",
    "lessThan",
    "lessThanEqual",
    "glLineWidth",
    "glLinkProgram",
    "log",
    "log2",
    "glLogicOp",

    #m

    "glMapBuffer",
    "glMapBufferRange",
    "glMapNamedBuffer",
    "glMapNamedBufferRange",
    "matrixCompMult",
    "max",
    "memoryBarrier",
    "glMemoryBarrier",
    "memoryBarrierAtomicCounter",
    "memoryBarrierBuffer",
    "glMemoryBarrierByRegion",
    "memoryBarrierImage",
    "memoryBarrierShared",
    "min",
    "glMinSampleShading",
    "mix",
    "mod",
    "modf",
    "glMultiDrawArrays",
    "glMultiDrawArraysIndirect",
    "glMultiDrawElements",
    "glMultiDrawElementsBaseVertex",
    "glMultiDrawElementsIndirect",

    #n

    "glNamedBufferData",
    "glNamedBufferStorage",
    "glNamedBufferSubData",
    "glNamedFramebufferDrawBuffer",
    "glNamedFramebufferDrawBuffers",
    "glNamedFramebufferParameteri",
    "glNamedFramebufferReadBuffer",
    "glNamedFramebufferRenderbuffer",
    "glNamedFramebufferTexture",
    "glNamedFramebufferTextureLayer",
    "glNamedRenderbufferStorage",
    "glNamedRenderbufferStorageMultisample",
    "noise",
    "noise1",
    "noise2",
    "noise3",
    "noise4",
    "normalize",
    "not",
    "notEqual",

    #o

    "glObjectLabel",
    "glObjectPtrLabel",
    "outerProduct",

    #p

    "packDouble2x32",
    "packHalf2x16",
    "packSnorm2x16",
    "packSnorm4x8",
    "packUnorm",
    "packUnorm2x16",
    "packUnorm4x8",
    "glPatchParameter",
    "glPatchParameterfv",
    "glPatchParameteri",
    "glPauseTransformFeedback",
    "glPixelStore",
    "glPixelStoref",
    "glPixelStorei",
    "glPointParameter",
    "glPointParameterf",
    "glPointParameterfv",
    "glPointParameteri",
    "glPointParameteriv",
    "glPointSize",
    "glPolygonMode",
    "glPolygonOffset",
    "glPopDebugGroup",
    "pow",
    "glPrimitiveRestartIndex",
    "glProgramBinary",
    "glProgramParameter",
    "glProgramParameteri",
    "glProgramUniform",
    "glProgramUniform1f",
    "glProgramUniform1fv",
    "glProgramUniform1i",
    "glProgramUniform1iv",
    "glProgramUniform1ui",
    "glProgramUniform1uiv",
    "glProgramUniform2f",
    "glProgramUniform2fv",
    "glProgramUniform2i",
    "glProgramUniform2iv",
    "glProgramUniform2ui",
    "glProgramUniform2uiv",
    "glProgramUniform3f",
    "glProgramUniform3fv",
    "glProgramUniform3i",
    "glProgramUniform3iv",
    "glProgramUniform3ui",
    "glProgramUniform3uiv",
    "glProgramUniform4f",
    "glProgramUniform4fv",
    "glProgramUniform4i",
    "glProgramUniform4iv",
    "glProgramUniform4ui",
    "glProgramUniform4uiv",
    "glProgramUniformMatrix2fv",
    "glProgramUniformMatrix2x3fv",
    "glProgramUniformMatrix2x4fv",
    "glProgramUniformMatrix3fv",
    "glProgramUniformMatrix3x2fv",
    "glProgramUniformMatrix3x4fv",
    "glProgramUniformMatrix4fv",
    "glProgramUniformMatrix4x2fv",
    "glProgramUniformMatrix4x3fv",
    "glProvokingVertex",
    "glPushDebugGroup",

    #q

    "glQueryCounter",

    #r

    "radians",
    "glReadBuffer",
    "glReadnPixels",
    "glReadPixels",
    "reflect",
    "refract",
    "glReleaseShaderCompiler",
    "removedTypes",
    "glRenderbufferStorage",
    "glRenderbufferStorageMultisample",
    "glResumeTransformFeedback",
    "round",
    "roundEven",

    #s

    "glSampleCoverage",
    "glSampleMaski",
    "glSamplerParameter",
    "glSamplerParameterf",
    "glSamplerParameterfv",
    "glSamplerParameteri",
    "glSamplerParameterIiv",
    "glSamplerParameterIuiv",
    "glSamplerParameteriv",
    "glScissor",
    "glScissorArray",
    "glScissorArrayv",
    "glScissorIndexed",
    "glScissorIndexedv",
    "glShaderBinary",
    "glShaderSource",
    "glShaderStorageBlockBinding",
    "sign",
    "sin",
    "sinh",
    "smoothstep",
    "sqrt",
    "glStencilFunc",
    "glStencilFuncSeparate",
    "glStencilMask",
    "glStencilMaskSeparate",
    "glStencilOp",
    "glStencilOpSeparate",
    "step",

    #t

    "tan",
    "tanh",
    "glTexBuffer",
    "glTexBufferRange",
    "texelFetch",
    "texelFetchOffset",
    "glTexImage1D",
    "glTexImage2D",
    "glTexImage2DMultisample",
    "glTexImage3D",
    "glTexImage3DMultisample",
    "glTexParameter",
    "glTexParameterf",
    "glTexParameterfv",
    "glTexParameteri",
    "glTexParameterIiv",
    "glTexParameterIuiv",
    "glTexParameteriv",
    "glTexStorage1D",
    "glTexStorage2D",
    "glTexStorage2DMultisample",
    "glTexStorage3D",
    "glTexStorage3DMultisample",
    "glTexSubImage1D",
    "glTexSubImage2D",
    "glTexSubImage3D",
    "texture",
    "glTextureBarrier",
    "glTextureBuffer",
    "glTextureBufferRange",
    "textureGather",
    "textureGatherOffset",
    "textureGatherOffsets",
    "textureGrad",
    "textureGradOffset",
    "textureLod",
    "textureLodOffset",
    "textureOffset",
    "glTextureParameterf",
    "glTextureParameterfv",
    "glTextureParameteri",
    "glTextureParameterIiv",
    "glTextureParameterIuiv",
    "glTextureParameteriv",
    "textureProj",
    "textureProjGrad",
    "textureProjGradOffset",
    "textureProjLod",
    "textureProjLodOffset",
    "textureProjOffset",
    "textureQueryLevels",
    "textureQueryLod",
    "textureSamples",
    "textureSize",
    "glTextureStorage1D",
    "glTextureStorage2D",
    "glTextureStorage2DMultisample",
    "glTextureStorage3D",
    "glTextureStorage3DMultisample",
    "glTextureSubImage1D",
    "glTextureSubImage2D",
    "glTextureSubImage3D",
    "glTextureView",
    "glTransformFeedbackBufferBase",
    "glTransformFeedbackBufferRange",
    "glTransformFeedbackVaryings",
    "transpose",
    "trunc",

    #u

    "uaddCarry",
    "uintBitsToFloat",
    "umulExtended",
    "glUniform",
    "glUniform1f",
    "glUniform1fv",
    "glUniform1i",
    "glUniform1iv",
    "glUniform1ui",
    "glUniform1uiv",
    "glUniform2f",
    "glUniform2fv",
    "glUniform2i",
    "glUniform2iv",
    "glUniform2ui",
    "glUniform2uiv",
    "glUniform3f",
    "glUniform3fv",
    "glUniform3i",
    "glUniform3iv",
    "glUniform3ui",
    "glUniform3uiv",
    "glUniform4f",
    "glUniform4fv",
    "glUniform4i",
    "glUniform4iv",
    "glUniform4ui",
    "glUniform4uiv",
    "glUniformBlockBinding",
    "glUniformMatrix2fv",
    "glUniformMatrix2x3fv",
    "glUniformMatrix2x4fv",
    "glUniformMatrix3fv",
    "glUniformMatrix3x2fv",
    "glUniformMatrix3x4fv",
    "glUniformMatrix4fv",
    "glUniformMatrix4x2fv",
    "glUniformMatrix4x3fv",
    "glUniformSubroutines",
    "glUniformSubroutinesuiv",
    "glUnmapBuffer",
    "glUnmapNamedBuffer",
    "unpackDouble2x32",
    "unpackHalf2x16",
    "unpackSnorm2x16",
    "unpackSnorm4x8",
    "unpackUnorm",
    "unpackUnorm2x16",
    "unpackUnorm4x8",
    "glUseProgram",
    "glUseProgramStages",
    "usubBorrow",

    #v

    "glValidateProgram",
    "glValidateProgramPipeline",
    "glVertexArrayAttribBinding",
    "glVertexArrayAttribFormat",
    "glVertexArrayAttribIFormat",
    "glVertexArrayAttribLFormat",
    "glVertexArrayBindingDivisor",
    "glVertexArrayElementBuffer",
    "glVertexArrayVertexBuffer",
    "glVertexArrayVertexBuffers",
    "glVertexAttrib",
    "glVertexAttrib1d",
    "glVertexAttrib1dv",
    "glVertexAttrib1f",
    "glVertexAttrib1fv",
    "glVertexAttrib1s",
    "glVertexAttrib1sv",
    "glVertexAttrib2d",
    "glVertexAttrib2dv",
    "glVertexAttrib2f",
    "glVertexAttrib2fv",
    "glVertexAttrib2s",
    "glVertexAttrib2sv",
    "glVertexAttrib3d",
    "glVertexAttrib3dv",
    "glVertexAttrib3f",
    "glVertexAttrib3fv",
    "glVertexAttrib3s",
    "glVertexAttrib3sv",
    "glVertexAttrib4bv",
    "glVertexAttrib4d",
    "glVertexAttrib4dv",
    "glVertexAttrib4f",
    "glVertexAttrib4fv",
    "glVertexAttrib4iv",
    "glVertexAttrib4Nbv",
    "glVertexAttrib4Niv",
    "glVertexAttrib4Nsv",
    "glVertexAttrib4Nub",
    "glVertexAttrib4Nubv",
    "glVertexAttrib4Nuiv",
    "glVertexAttrib4Nusv",
    "glVertexAttrib4s",
    "glVertexAttrib4sv",
    "glVertexAttrib4ubv",
    "glVertexAttrib4uiv",
    "glVertexAttrib4usv",
    "glVertexAttribBinding",
    "glVertexAttribDivisor",
    "glVertexAttribFormat",
    "glVertexAttribI1i",
    "glVertexAttribI1iv",
    "glVertexAttribI1ui",
    "glVertexAttribI1uiv",
    "glVertexAttribI2i",
    "glVertexAttribI2iv",
    "glVertexAttribI2ui",
    "glVertexAttribI2uiv",
    "glVertexAttribI3i",
    "glVertexAttribI3iv",
    "glVertexAttribI3ui",
    "glVertexAttribI3uiv",
    "glVertexAttribI4bv",
    "glVertexAttribI4i",
    "glVertexAttribI4iv",
    "glVertexAttribI4sv",
    "glVertexAttribI4ubv",
    "glVertexAttribI4ui",
    "glVertexAttribI4uiv",
    "glVertexAttribI4usv",
    "glVertexAttribIFormat",
    "glVertexAttribIPointer",
    "glVertexAttribL1d",
    "glVertexAttribL1dv",
    "glVertexAttribL2d",
    "glVertexAttribL2dv",
    "glVertexAttribL3d",
    "glVertexAttribL3dv",
    "glVertexAttribL4d",
    "glVertexAttribL4dv",
    "glVertexAttribLFormat",
    "glVertexAttribLPointer",
    "glVertexAttribP1ui",
    "glVertexAttribP2ui",
    "glVertexAttribP3ui",
    "glVertexAttribP4ui",
    "glVertexAttribPointer",
    "glVertexBindingDivisor",
    "glViewport",
    "glViewportArray",
    "glViewportArrayv",
    "glViewportIndexed",
    "glViewportIndexedf",
    "glViewportIndexedfv",

    #w

    "glWaitSync"
]
treeform commented 1 year ago

Yes we could probably add them. I just did not find a complete list. I do also want a nim implementation of them for the GLSL on the CPU path. But that can wait.

arkanoid87 commented 1 year ago

I've implemented just 4 (bitops like) function so far. Surely implementing them all seems a large job

mantielero commented 1 year ago

I think I am facing an issue related to this. I got the error:

Error: undeclared identifier: 'step'

Reading this issue, I though about adding step to glslFunctions, but I continue getting the error.

Besides, I would like to know what is the appropriate way to add the CPU version. I bet it will be something like:

proc step(edge, x: float): float =
  if x <= edge:
    result = 0.0
  else:
    result = 1.0
mantielero commented 1 year ago

So it looks like, I have to include the name of the function in glslFunctions and then just define the CPU version functions somewhere else:

import chroma, shady, shady/demo, vmath

proc step(edge, x: float): float =
  if x <= edge:
    result = 0.0
  else:
    result = 1.0

proc step[T:Vec4|Vec3|Vec2](edge, x: T): T =
  var len:int = if x is Vec2:
                  2
                elif x is Vec3:
                  3
                else:
                  4
  for i in 0 ..< len:
    if x[i] <= edge[i]:
      result[i] = 0.0
    else:
      result[i] = 1.0

proc main(gl_FragColor: var Vec4, uv: Vec2, time: Uniform[float32]) =
  if step(vec2(50.0, 80.0), uv) == vec2(0.0,0.0): 
      gl_FragColor = vec4(1, 1, 1, 1)
  else:
      gl_FragColor = vec4(0, 0, 0, 1)

# CPU test
echo step(vec2(200.0,200.0), vec2(300.0,100.0) ) == vec2(1.0,0.0)

# compile to a GPU shader:
var shader = toGLSL(main)
echo shader
run("Tutorial", shader)
treeform commented 1 year ago

Yes that is how its meant to be. More GLSL functions need to be added.