Beispiel #1
0
  void Filt::TexParameter(const RegalContext &ctx, GLenum target, GLenum pname, GLfloat param)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(target);
    UNUSED_PARAMETER(pname);
    UNUSED_PARAMETER(param);

    #if REGAL_SYS_ES2 || REGAL_SYS_GL
    if (ctx.isCore() || ctx.isES2())
      switch(pname)
      {
        case GL_TEXTURE_WRAP_S:
        case GL_TEXTURE_WRAP_T:
        case GL_TEXTURE_WRAP_R:
          switch(int(param))
          {
            case GL_CLAMP:
              Warning("Regal does not support GL_CLAMP wrap mode for core or ES 2.0 profiles - skipping.");
              filtered = true;
            default: break;
          }
        default: break;
      }
    #endif
  }
Beispiel #2
0
  void Filt::PolygonMode(const RegalContext &ctx, GLenum face, GLenum mode)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(face);
    UNUSED_PARAMETER(mode);

    #if REGAL_SYS_GL
    if (ctx.isCore())
    {
      if (face!=GL_FRONT_AND_BACK)
      {
        Warning("Regal does not support ", GLenumToString(face), " in glPolygonMode for core profile, only GL_FRONT_AND_BACK is supported - skipping.");
        filtered = true;
      }
    }
    #endif

    #if REGAL_SYS_ES2
    if (ctx.isES2())
    {
      Warning("Regal does not support glPolygonMode for ES 2.0 - skipping.");
      filtered = true;
    }
    #endif
  }
Beispiel #3
0
  bool Filt::FilterTexParameter(const RegalContext &ctx, GLenum target, GLenum pname, GLfloat param, GLfloat &newParam)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(target);

    if (!ctx.isES2() && !ctx.isCore())
      return false;

    switch (pname)
    {
      case GL_TEXTURE_WRAP_S:
      case GL_TEXTURE_WRAP_T:
      case GL_TEXTURE_WRAP_R:
        switch (int(param))
        {
          case GL_CLAMP:
            Warning("Regal does not support GL_CLAMP wrap mode for core or ES 2.0 profiles - remapping to equivalent GL_CLAMP_TO_EDGE");
            newParam = GL_CLAMP_TO_EDGE;
            return true;
          default:
            break;
        }
      default:
        break;
    }

    return false;
  }
Beispiel #4
0
  void Filt::RenderMode(const RegalContext &ctx, GLenum mode)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(mode);

    #if REGAL_SYS_ES2 || REGAL_SYS_GL
    if (ctx.isCore() || ctx.isES2())
      if (mode!=GL_RENDER)
      {
        Warning("Regal does not support ", GLenumToString(mode), " render mode for core or ES 2.0 profiles, only GL_RENDER is supported in those profiles - skipping.");
        filtered = true;
      }
    #endif
  }
Beispiel #5
0
  bool Filt::RenderMode(const RegalContext &ctx, GLenum mode)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(mode);

    if (ctx.isCore() || ctx.isES2())
      if (mode!=GL_RENDER)
      {
        Warning("Regal does not support ", GLenumToString(mode), " render mode for core or ES 2.0 profiles, only GL_RENDER is supported in those profiles - skipping.");
        return true;
      }

    return false;
  }
Beispiel #6
0
  bool Filt::PolygonMode(const RegalContext &ctx, GLenum face, GLenum mode)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(face);
    UNUSED_PARAMETER(mode);

    if (ctx.isCore())
    {
      if (face!=GL_FRONT_AND_BACK)
      {
        Warning("Regal does not support ", GLenumToString(face), " in glPolygonMode for core profile, only GL_FRONT_AND_BACK is supported - skipping.");
        return true;
      }
    }

    if (ctx.isES2())
    {
      Warning("Regal does not support glPolygonMode for ES 2.0 - skipping.");
      return true;
    }

    return false;
  }
Beispiel #7
0
  void Filt::FilterGet(const RegalContext &ctx, GLenum pname)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(pname);

    #if REGAL_SYS_ES2 || REGAL_SYS_GL
    if (ctx.isCore() || ctx.isES2())
    {
      filtered = true;
      switch (pname )
      {
        case GL_MAX_TEXTURE_SIZE:              retVal = 1024; break;
        case GL_MAX_PIXEL_MAP_TABLE:           retVal = 256;  break;
        case GL_MAX_NAME_STACK_DEPTH:          retVal = 128;  break;
        case GL_MAX_LIST_NESTING:              retVal = 64;   break;
        case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
        case GL_MAX_ATTRIB_STACK_DEPTH:        retVal = 16;   break;

        case GL_DEPTH_BITS:                    retVal = 24;   break;

        case GL_RED_BITS:
        case GL_GREEN_BITS:
        case GL_BLUE_BITS:
        case GL_ALPHA_BITS:
        case GL_STENCIL_BITS:
        case GL_SUBPIXEL_BITS:
          retVal = 8;
          break;

        case GL_INDEX_MODE:
        case GL_UNPACK_ROW_LENGTH:
        case GL_UNPACK_SKIP_ROWS:
        case GL_UNPACK_SKIP_PIXELS:
        case GL_UNPACK_LSB_FIRST:
        case GL_UNPACK_SWAP_BYTES:
        case GL_PACK_ROW_LENGTH:
        case GL_PACK_SKIP_ROWS:
        case GL_PACK_SKIP_PIXELS:
        case GL_PACK_LSB_FIRST:
        case GL_PACK_SWAP_BYTES:
          retVal = 0;
          break;
        default:
          filtered = false;
          break;
      }
      if (filtered)
      {
        Warning( "Regal does not support ", GLenumToString(pname), " as pname for glGet for core or ES 2.0 profiles - skipping." );
        return;
      }
    }
    #endif

    #if REGAL_SYS_GL
    if (ctx.isCore())
    {
      filtered = true;
      switch (pname )
      {
          /* just a test
           case GL_UNPACK_ALIGNMENT:
           retVal = 0;
           break;
           */
        default:
          filtered = false;
          break;
      }
      if (filtered)
      {
        Warning( "Regal does not support ", GLenumToString(pname), " as pname for glGet for core profile - skipping." );
        return;
      }
    }
    #endif

    #if REGAL_SYS_ES2
    if (ctx.isES2())
    {
      filtered = true;
      switch (pname ) {
        case GL_PACK_ALIGNMENT:
          retVal = 1;
          break;
        default:
          filtered = false;
          break;
      }
      if (filtered)
      {
        Warning( "Regal does not support ", GLenumToString(pname), " as pname for glGet for ES 2.0 profile - skipping." );
        return;
      }
    }
    #endif
  }
Beispiel #8
0
  bool Filt::FilterGet(const RegalContext &ctx, GLenum pname, int &retVal)
  {
    UNUSED_PARAMETER(ctx);
    UNUSED_PARAMETER(pname);

    bool filtered = false;
    if (ctx.isCore() || ctx.isES2())
    {
      filtered = true;
      switch (pname )
      {
        case GL_MAX_PIXEL_MAP_TABLE:           retVal = 256;  break;
        case GL_MAX_NAME_STACK_DEPTH:          retVal = 128;  break;
        case GL_MAX_LIST_NESTING:              retVal = 64;   break;
        case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: retVal = ctx.emuInfo->gl_max_client_attrib_stack_depth;   break;
        case GL_MAX_ATTRIB_STACK_DEPTH:        retVal = ctx.emuInfo->gl_max_attrib_stack_depth;          break;

        case GL_DEPTH_BITS:                    retVal = 24;   break;

        case GL_MAX_EVAL_ORDER:                retVal = 4;    break;

        case GL_RED_BITS:
        case GL_GREEN_BITS:
        case GL_BLUE_BITS:
        case GL_ALPHA_BITS:
        case GL_STENCIL_BITS:
          retVal = 8;
          break;

        case GL_INDEX_MODE:
        case GL_UNPACK_LSB_FIRST:
        case GL_UNPACK_SWAP_BYTES:
        case GL_PACK_LSB_FIRST:
        case GL_PACK_SWAP_BYTES:
          retVal = 0;
          break;
        default:
          filtered = false;
          break;
      }
      if (filtered)
      {
        Warning( "Regal does not support ", GLenumToString(pname), " as pname for glGet for core or ES 2.0 profiles - skipping." );
        return true;
      }
    }

    if (ctx.isCore())
    {
      filtered = true;
#if 0
      switch (pname )
      {
          /* just a test
           case GL_UNPACK_ALIGNMENT:
           retVal = 0;
           break;
           */
        default:
          filtered = false;
          break;
      }
#else
      filtered = false;
#endif
      if (filtered)
      {
        Warning( "Regal does not support ", GLenumToString(pname), " as pname for glGet for core profile - skipping." );
        return true;
      }
    }

    if (ctx.isES2())
    {
      filtered = true;
      switch (pname) {
        case GL_MAX_COLOR_ATTACHMENTS:
          if (ctx.info->gl_nv_fbo_color_attachments)
            filtered = false;
          else
            retVal = 1;
          break;

        case GL_PACK_ROW_LENGTH_NV:
        case GL_PACK_SKIP_ROWS_NV:
        case GL_PACK_SKIP_PIXELS_NV:
          if (ctx.info->gl_nv_pack_subimage)
            filtered = false;
          else
            retVal = 0;
          break;

        case GL_PACK_IMAGE_HEIGHT:
        case GL_PACK_SKIP_IMAGES:
          if (ctx.info->gl_nv_pack_subimage && ctx.info->gl_nv_texture_array)
            filtered = false;
          else
            retVal = 0;
          break;

        case GL_UNPACK_ROW_LENGTH_EXT:
        case GL_UNPACK_SKIP_ROWS_EXT:
        case GL_UNPACK_SKIP_PIXELS_EXT:
          if (ctx.info->gl_ext_unpack_subimage)
            filtered = false;
          else
            retVal = 0;
          break;

        case GL_UNPACK_IMAGE_HEIGHT_NV:
        case GL_UNPACK_SKIP_IMAGES_NV:
          if (ctx.info->gl_ext_unpack_subimage && ctx.info->gl_nv_texture_array)
            filtered = false;
          else
            retVal = 0;
          break;

        // need to filter on ES2.0 since this query returns an
        // INVALID_ENUM if no FBO is currently active
        case GL_DRAW_BUFFER0:
        case GL_DRAW_BUFFER1:
        case GL_DRAW_BUFFER2:
        case GL_DRAW_BUFFER3:
        case GL_DRAW_BUFFER4:
        case GL_DRAW_BUFFER5:
        case GL_DRAW_BUFFER6:
        case GL_DRAW_BUFFER7:
        case GL_DRAW_BUFFER8:
        case GL_DRAW_BUFFER9:
        case GL_DRAW_BUFFER10:
        case GL_DRAW_BUFFER11:
        case GL_DRAW_BUFFER12:
        case GL_DRAW_BUFFER13:
        case GL_DRAW_BUFFER14:
        case GL_DRAW_BUFFER15:
          if (ctx.info->gl_nv_draw_buffers)
          {
            if (fboID == 0)
              retVal = GL_NONE;
            else
              filtered = false;
          }
          else
            retVal = GL_NONE;
          break;

        // GL_CONTEXT_PROFILE_MASK not relevant for ES 2.0

        case GL_CONTEXT_PROFILE_MASK:
          retVal = GL_NONE;
          filtered = true;
          break;

        default:
          filtered = false;
          break;
      }
      if (filtered)
      {
        Warning( "Regal does not support ", GLenumToString(pname), " as pname for glGet for ES 2.0 profile - skipping." );
        return true;
      }
    }

    return false;
  }