Ejemplo n.º 1
0
static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level,
                           GLint internalFormat,
                           GLint width, GLint height, GLint border,
                           GLenum format, GLenum type, const GLvoid *pixels,
                           const struct gl_pixelstore_attrib *packing,
                           struct gl_texture_object *texObj,
                           struct gl_texture_image *texImage )
{
    sisContextPtr smesa = SIS_CONTEXT(ctx);
    sisTexObjPtr t;

    if ( texObj->DriverData == NULL )
        sisAllocTexObj( texObj );
    t = texObj->DriverData;

    /* Note, this will call sisChooseTextureFormat */
    _mesa_store_teximage2d(ctx, target, level, internalFormat,
                           width, height, border, format, type, pixels,
                           &ctx->Unpack, texObj, texImage);

    /* Allocate offscreen space for the texture */
    sisFreeTexImage(smesa, t, level);
    sisAllocTexImage(smesa, t, level, texImage);

    /* Upload the texture */
    WaitEngIdle(smesa);
    memcpy(t->image[level].Data, texImage->Data, t->image[level].size);

    if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
    {
        smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
        smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
    }
    smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
}
Ejemplo n.º 2
0
Archivo: sis_tris.c Proyecto: aosm/X11
/* Make sure there are more than num dwords left in the AGP queue. */
static void
sisMakeRoomAGP( sisContextPtr smesa, GLint num )
{
   int size = num * 4;
   
   if (size <= AGP_SpaceLeft) {
      AGP_SpaceLeft -= size;
      return;
   }
   /* Wrapping */
   if (AGP_WritePtr + num > (GLfloat *)(smesa->AGPCmdBufBase +
      smesa->AGPCmdBufSize))
   {
      sisFireVertsAGP( smesa );
      AGP_WritePtr = (GLfloat *)smesa->AGPCmdBufBase;
      AGP_StartPtr = AGP_WritePtr;
      sisUpdateAGP( smesa );
      WaitEngIdle( smesa ); /* XXX Why is this necessary? */
   }

   if (size > AGP_SpaceLeft) {
      /* Update the cached engine read pointer */
      AGP_ReadPtr = (GLfloat *)((long)MMIO_READ(REG_3D_AGPCmBase) -
         (long)smesa->AGPCmdBufAddr + (long)smesa->AGPCmdBufBase);
      sisUpdateAGP( smesa );
      while (size > AGP_SpaceLeft) {
         /* Spin until space is available. */
         AGP_ReadPtr = (GLfloat *)((long)MMIO_READ(REG_3D_AGPCmBase) -
            (long)smesa->AGPCmdBufAddr + (long)smesa->AGPCmdBufBase);
         sisUpdateAGP( smesa );
      }
   }
   AGP_SpaceLeft -= size;
}
Ejemplo n.º 3
0
void sisSpanRenderStart( GLcontext *ctx )
{
   sisContextPtr smesa = SIS_CONTEXT(ctx);

   SIS_FIREVERTICES(smesa);
   LOCK_HARDWARE();
   WaitEngIdle( smesa );
}
Ejemplo n.º 4
0
static void sisTexSubImage2D( GLcontext *ctx,
                              GLenum target,
                              GLint level,
                              GLint xoffset, GLint yoffset,
                              GLsizei width, GLsizei height,
                              GLenum format, GLenum type,
                              const GLvoid *pixels,
                              const struct gl_pixelstore_attrib *packing,
                              struct gl_texture_object *texObj,
                              struct gl_texture_image *texImage )
{
    sisContextPtr smesa = SIS_CONTEXT(ctx);
    sisTexObjPtr t;
    GLuint copySize;
    GLint texelBytes;
    const char *src;
    GLubyte *dst;
    int j;
    GLuint soffset;

    if ( texObj->DriverData == NULL )
        sisAllocTexObj( texObj );
    t = texObj->DriverData;

    _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
                              height, format, type, pixels, packing, texObj,
                              texImage);

    /* Allocate offscreen space for the texture */
    sisFreeTexImage(smesa, t, level);
    sisAllocTexImage(smesa, t, level, texImage);

    /* Upload the texture */
    WaitEngIdle(smesa);
    texelBytes = _mesa_get_format_bytes(texImage->TexFormat);

    copySize = width * texelBytes;
    src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) *
          texelBytes;
    dst = t->image[level].Data + (xoffset + yoffset * texImage->Width) *
          texelBytes;
    soffset = texImage->Width * texelBytes;

    for (j = yoffset; j < yoffset + height; j++) {
        memcpy( dst, src, copySize );
        src += soffset;
        dst += soffset;
    }

    smesa->clearTexCache = GL_TRUE;

    if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
    {
        smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
        smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
    }
    smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
}
Ejemplo n.º 5
0
/* Make sure all commands have been sent to the hardware and have
 * completed processing.
 */
static void
sisFinish( GLcontext *ctx )
{
   sisContextPtr smesa = SIS_CONTEXT(ctx);

   SIS_FIREVERTICES(smesa);
   LOCK_HARDWARE();
   WaitEngIdle( smesa );
   UNLOCK_HARDWARE();
}