Exemple #1
0
def versionInitCode(apis, args):

  code = ''
  for api in apis:
    name = api.name.lower()

    if name == 'gl':
      code += '  compat(false),\n'
      code += '  core(false),\n'
      code += '  es1(false),\n'
      code += '  es2(false),\n'
      code += '  webgl(false),\n'

    if name in ['gl', 'glx', 'egl']:
      code += '  %s_version_major(-1),\n' % name
      code += '  %s_version_minor(-1),\n' % name

    if hasattr(api, 'versions'):
      for version in sorted(api.versions):
        code += '  %s_version_%d_%d(false),\n' % (name, version[0], version[1])

    if name == 'gl':
      code += '  gles_version_major(-1),\n'
      code += '  gles_version_minor(-1),\n'
      code += '  glsl_version_major(-1),\n'
      code += '  glsl_version_minor(-1),\n'

  for api in apis:
    tmp = ''
    for c in sorted(api.categories):
      tmp += '  %s(false),\n' % (c.lower())
    code += wrapIf(cond.get(api.name.lower()),tmp)

  return code
Exemple #2
0
def versionInitCode(apis, args):

    code = ''
    for api in apis:
        name = api.name.lower()

        if name == 'gl':
            code += '  compat(false),\n'
            code += '  core(false),\n'
            code += '  es1(false),\n'
            code += '  es2(false),\n'
            code += '  webgl(false),\n'

        if name in ['gl', 'glx', 'egl']:
            code += '  %s_version_major(-1),\n' % name
            code += '  %s_version_minor(-1),\n' % name

        if hasattr(api, 'versions'):
            for version in sorted(api.versions):
                code += '  %s_version_%d_%d(false),\n' % (name, version[0],
                                                          version[1])

        if name == 'gl':
            code += '  gles_version_major(-1),\n'
            code += '  gles_version_minor(-1),\n'
            code += '  glsl_version_major(-1),\n'
            code += '  glsl_version_minor(-1),\n'

    for api in apis:
        tmp = ''
        for c in sorted(api.categories):
            tmp += '  %s(false),\n' % (c.lower())
        code += wrapIf(cond.get(api.name.lower()), tmp)

    return code
Exemple #3
0
def extensionStringCode(apis, args):

    code = ''

    for api in apis:
        tmp = ''
        for c in sorted(api.categories):
            tmp += '  %-50s = stringSetFind(e,"%s");\n' % (c.lower(), c)

        tmp = wrapIf(cond.get(api.name.lower()), tmp)

        code += tmp + '\n'

    return code
Exemple #4
0
def extensionStringCode(apis, args):

  code = ''

  for api in apis:
    tmp = ''
    for c in sorted(api.categories):
      tmp += '  %-50s = stringSetFind(e,"%s");\n' % (c.lower(),c)

    tmp = wrapIf(cond.get(api.name.lower()),tmp)

    code += tmp + '\n'

  return code
Exemple #5
0
def emuCodeGen(emue,section):

  tmp = []
  for i in emue:
    if i!=None and i.get(section)!=None:

      code = i[section]
      if not isinstance(code,list):
        code = code.strip().split('\n')

      if i.get('member')!=None:
        tmp.extend(wrapIf(i.get('ifdef'),wrapCIf('_context->%s'%i['member'],code)))
      else:
        tmp.extend(code)

  return tmp
Exemple #6
0
def versionDeclareCode(apis, args):

    code = ''
    for api in apis:
        name = api.name.lower()

        if name == 'gl':
            code += '  GLboolean compat : 1;\n'
            code += '  GLboolean core   : 1;\n'
            code += '  GLboolean es1    : 1;\n'
            code += '  GLboolean es2    : 1;\n'
            code += '  GLboolean webgl  : 1;\n\n'

        if name in ['gl', 'glx', 'egl']:
            code += '  GLint     %s_version_major;\n' % name
            code += '  GLint     %s_version_minor;\n' % name
            code += '\n'

        if hasattr(api, 'versions'):
            for version in sorted(api.versions):
                code += '  GLboolean %s_version_%d_%d : 1;\n' % (
                    name, version[0], version[1])
            code += '\n'

        if name == 'gl':
            code += '  GLint     gles_version_major;\n'
            code += '  GLint     gles_version_minor;\n'
            code += '\n'
            code += '  GLint     glsl_version_major;\n'
            code += '  GLint     glsl_version_minor;\n'
            code += '\n'

    for api in apis:
        tmp = ''
        for c in sorted(api.categories):
            tmp += '  GLboolean %s : 1;\n' % (c.lower())
        code += wrapIf(cond.get(api.name.lower()), tmp) + '\n'

    return code
Exemple #7
0
def versionDeclareCode(apis, args):

  code = ''
  for api in apis:
    name = api.name.lower()

    if name == 'gl':
      code += '  GLboolean compat : 1;\n'
      code += '  GLboolean core   : 1;\n'
      code += '  GLboolean es1    : 1;\n'
      code += '  GLboolean es2    : 1;\n'
      code += '  GLboolean webgl  : 1;\n\n'

    if name in ['gl', 'glx', 'egl']:
      code += '  GLint     %s_version_major;\n' % name
      code += '  GLint     %s_version_minor;\n' % name
      code += '\n'

    if hasattr(api, 'versions'):
      for version in sorted(api.versions):
        code += '  GLboolean %s_version_%d_%d : 1;\n' % (name, version[0], version[1])
      code += '\n'

    if name == 'gl':
      code += '  GLint     gles_version_major;\n'
      code += '  GLint     gles_version_minor;\n'
      code += '\n'
      code += '  GLint     glsl_version_major;\n'
      code += '  GLint     glsl_version_minor;\n'
      code += '\n'

  for api in apis:
    tmp = ''
    for c in sorted(api.categories):
      tmp += '  GLboolean %s : 1;\n' % (c.lower())
    code += wrapIf(cond.get(api.name.lower()),tmp) + '\n'

  return code
Exemple #8
0
def getExtensionCode(apis, args):

  code = ''
  code += 'bool\n'
  code += 'ContextInfo::getExtension(const char *ext) const\n'
  code += '{\n'
  code += '  Internal("ContextInfo::getExtension ",boost::print::quote(ext,\'"\'));\n'
  code += '\n'

  for api in apis:

    tmp = ''
    for c in sorted(api.categories):
      tmp += '  %-60s %s;\n'%('if (!strcmp(ext,"%s"))'%c,'return %s'%c.lower())

    tmp = wrapIf(cond.get(api.name.lower()),tmp)

    code += tmp + '\n'

  code += '  return false;\n'
  code += '}\n\n'

  return code
Exemple #9
0
def getExtensionCode(apis, args):

    code = ''
    code += 'bool\n'
    code += 'ContextInfo::getExtension(const char *ext) const\n'
    code += '{\n'
    code += '  Internal("ContextInfo::getExtension ",boost::print::quote(ext,\'"\'));\n'
    code += '\n'

    for api in apis:

        tmp = ''
        for c in sorted(api.categories):
            tmp += '  %-60s %s;\n' % ('if (!strcmp(ext,"%s"))' % c,
                                      'return %s' % c.lower())

        tmp = wrapIf(cond.get(api.name.lower()), tmp)

        code += tmp + '\n'

    code += '  return false;\n'
    code += '}\n\n'

    return code