diff options
-rw-r--r-- | src/mesa/drivers/dri/cxx/mesa.cxx | 547 | ||||
-rw-r--r-- | src/mesa/drivers/dri/cxx/mesa.hxx | 115 |
2 files changed, 337 insertions, 325 deletions
diff --git a/src/mesa/drivers/dri/cxx/mesa.cxx b/src/mesa/drivers/dri/cxx/mesa.cxx index bb1ffcf39d..1b47ef8b2c 100644 --- a/src/mesa/drivers/dri/cxx/mesa.cxx +++ b/src/mesa/drivers/dri/cxx/mesa.cxx @@ -26,23 +26,23 @@ extern "C" { extern "C" { static const GLubyte *GetString(GLcontext *ctx, GLenum name) { - return ((Mesa::Context *)ctx->DriverCtx)->GetString(name); + return ((Mesa::Context *)ctx)->GetString(name); } static void UpdateState(GLcontext *ctx, GLuint new_state) { - ((Mesa::Context *)ctx->DriverCtx)->UpdateState(new_state); + ((Mesa::Context *)ctx)->UpdateState(new_state); } static void Clear(GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { - ((Mesa::Context *)ctx->DriverCtx)->Clear(mask, all, x, y, width, height); + ((Mesa::Context *)ctx)->Clear(mask, all, x, y, width, height); } static void DrawBuffer(GLcontext *ctx, GLenum buffer) { - ((Mesa::Context *)ctx->DriverCtx)->DrawBuffer(buffer); + ((Mesa::Context *)ctx)->DrawBuffer(buffer); } static void ReadBuffer(GLcontext *ctx, GLenum buffer) { - ((Mesa::Context *)ctx->DriverCtx)->ReadBuffer(buffer); + ((Mesa::Context *)ctx)->ReadBuffer(buffer); } static void GetBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) { @@ -54,39 +54,39 @@ static void ResizeBuffers(GLframebuffer *buffer) { } static void Finish(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->Finish(); + ((Mesa::Context *)ctx)->Finish(); } static void Flush(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->Flush(); + ((Mesa::Context *)ctx)->Flush(); } static void Error(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->Error(ctx->ErrorValue); + ((Mesa::Context *)ctx)->Error(ctx->ErrorValue); } static void Accum(GLcontext *ctx, GLenum op, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height) { - ((Mesa::Context *)ctx->DriverCtx)->Accum(op, value, xpos, ypos, width, height); + ((Mesa::Context *)ctx)->Accum(op, value, xpos, ypos, width, height); } static void DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { - ((Mesa::Context *)ctx->DriverCtx)->DrawPixels(x, y, width, height, format, type, unpack, pixels); + ((Mesa::Context *)ctx)->DrawPixels(x, y, width, height, format, type, unpack, pixels); } static void ReadPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest) { - ((Mesa::Context *)ctx->DriverCtx)->ReadPixels(x, y, width, height, format, type, unpack, dest); + ((Mesa::Context *)ctx)->ReadPixels(x, y, width, height, format, type, unpack, dest); } static void CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type) { - ((Mesa::Context *)ctx->DriverCtx)->CopyPixels(srcx, srcy, width, height, dstx, dsty, type); + ((Mesa::Context *)ctx)->CopyPixels(srcx, srcy, width, height, dstx, dsty, type); } static void Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap) { - ((Mesa::Context *)ctx->DriverCtx)->Bitmap(x, y, width, height, unpack, bitmap); + ((Mesa::Context *)ctx)->Bitmap(x, y, width, height, unpack, bitmap); } static const struct gl_texture_format *ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) { - return ((Mesa::Context *)ctx->DriverCtx)->ChooseTextureFormat(internalFormat, srcFormat, srcType); + return ((Mesa::Context *)ctx)->ChooseTextureFormat(internalFormat, srcFormat, srcType); } static void TexImage1D(GLcontext *ctx, @@ -101,8 +101,8 @@ static void TexImage1D(GLcontext *ctx, struct gl_texture_image *texImage ) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->image1D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->image1D( + (Mesa::Context *)ctx, target, level, internalFormat, width, @@ -126,8 +126,8 @@ static void TexImage2D(GLcontext *ctx, struct gl_texture_image *texImage ) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->image2D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->image2D( + (Mesa::Context *)ctx, target, level, internalFormat, width, @@ -157,8 +157,8 @@ static void TexImage3D(GLcontext *ctx, struct gl_texture_image *texImage ) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->image3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->image3D( + (Mesa::Context *)ctx, target, level, internalFormat, @@ -187,8 +187,8 @@ static void TexSubImage1D(GLcontext *ctx, struct gl_texture_image *texImage ) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->subImage1D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->subImage1D( + (Mesa::Context *)ctx, target, level, xoffset, @@ -213,8 +213,8 @@ static void TexSubImage2D( struct gl_texture_image *texImage ) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->subImage2D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->subImage2D( + (Mesa::Context *)ctx, target, level, xoffset, yoffset, @@ -242,8 +242,8 @@ static void TexSubImage3D(GLcontext *ctx, struct gl_texture_image *texImage ) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->subImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->subImage3D( + (Mesa::Context *)ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, @@ -255,33 +255,33 @@ static void TexSubImage3D(GLcontext *ctx, } static void CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { - ((Mesa::Context *)ctx->DriverCtx)->CopyTexImage1D(target, level, internalFormat, x, y, width, border); + ((Mesa::Context *)ctx)->CopyTexImage1D(target, level, internalFormat, x, y, width, border); } static void CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - ((Mesa::Context *)ctx->DriverCtx)->CopyTexImage2D(target, level, internalFormat, x, y, width, height, border); + ((Mesa::Context *)ctx)->CopyTexImage2D(target, level, internalFormat, x, y, width, height, border); } static void CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { - ((Mesa::Context *)ctx->DriverCtx)->CopyTexSubImage1D(target, level, xoffset, x, y, width); + ((Mesa::Context *)ctx)->CopyTexSubImage1D(target, level, xoffset, x, y, width); } static void CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - ((Mesa::Context *)ctx->DriverCtx)->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + ((Mesa::Context *)ctx)->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } static void CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - ((Mesa::Context *)ctx->DriverCtx)->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); + ((Mesa::Context *)ctx)->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); } static GLboolean TestProxyTexImage(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border) { - return ((Mesa::Context *)ctx->DriverCtx)->TestProxyTexImage(target, level, internalFormat, format, type, width, height, depth, border); + return ((Mesa::Context *)ctx)->TestProxyTexImage(target, level, internalFormat, format, type, width, height, depth, border); } static void CompressedTexImage1D(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->compressedImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->compressedImage3D( + (Mesa::Context *)ctx, target, level, internalFormat, width, @@ -293,8 +293,8 @@ static void CompressedTexImage1D(GLcontext *ctx, GLenum target, GLint level, GLi static void CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->compressedImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->compressedImage3D( + (Mesa::Context *)ctx, target, level, internalFormat, width, height, @@ -306,8 +306,8 @@ static void CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, GLi static void CompressedTexImage3D(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->compressedImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->compressedImage3D( + (Mesa::Context *)ctx, target, level, internalFormat, width, height, depth, @@ -319,8 +319,8 @@ static void CompressedTexImage3D(GLcontext *ctx, GLenum target, GLint level, GLi static void CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { assert(texObj->DriverData); - ((Mesa::Texture *)texObj->DriverData)->compressedSubImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->compressedSubImage3D( + (Mesa::Context *)ctx, target, level, xoffset, width, @@ -331,8 +331,8 @@ static void CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, } static void CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - ((Mesa::Texture *)texObj->DriverData)->compressedSubImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->compressedSubImage3D( + (Mesa::Context *)ctx, target, level, xoffset, yoffset, width, height, @@ -343,8 +343,8 @@ static void CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, } static void CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLint height, GLint depth, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - ((Mesa::Texture *)texObj->DriverData)->compressedSubImage3D( - (Mesa::Context *)ctx->DriverCtx, + ((Mesa::Texture *)texObj)->compressedSubImage3D( + (Mesa::Context *)ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, @@ -354,317 +354,320 @@ static void CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, ); } -static void BindTexture(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj) { - Mesa::Texture *texture = (Mesa::Texture *)tObj->DriverData; - if(!texture) { - texture = ((Mesa::Context *)ctx->DriverCtx)->AllocTexture(target); - texture->init(tObj); - } - ((Mesa::Context *)ctx->DriverCtx)->BindTexture(target, texture); +static void BindTexture(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) { + ((Mesa::Context *)ctx)->BindTexture(target, (Mesa::Texture *)texObj); } -static void DeleteTexture(GLcontext *ctx, struct gl_texture_object *t) { - delete ((Mesa::Texture *)(t->DriverData)); +static gl_texture_object *NewTextureObject(GLcontext *ctx, GLuint name, GLenum target) { + return ((Mesa::Context *)ctx)->NewTexture(name, target); } -static GLboolean IsTextureResident(GLcontext *ctx, struct gl_texture_object *t) { - return ((Mesa::Texture *)t->DriverData)->isResident(); +static gl_texture_image *NewTextureImage(GLcontext *ctx) { + return ((Mesa::Context *)ctx)->NewImage(); } -static void PrioritizeTexture(GLcontext *ctx, struct gl_texture_object *t, GLclampf priority) { - return ((Mesa::Texture *)t->DriverData)->prioritize(priority); +static void DeleteTexture(GLcontext *ctx, struct gl_texture_object *texObj) { + delete (Mesa::Texture *)texObj; +} + +static GLboolean IsTextureResident(GLcontext *ctx, struct gl_texture_object *texObj) { + return ((Mesa::Texture *)texObj)->isResident(); +} + +static void PrioritizeTexture(GLcontext *ctx, struct gl_texture_object *texObj, GLclampf priority) { + return ((Mesa::Texture *)texObj)->prioritize(priority); } static void ActiveTexture(GLcontext *ctx, GLuint texUnitNumber) { - ((Mesa::Context *)ctx->DriverCtx)->ActiveTexture(texUnitNumber); + ((Mesa::Context *)ctx)->ActiveTexture(texUnitNumber); } -static void UpdateTexturePalette(GLcontext *ctx, struct gl_texture_object *tObj) { - ((Mesa::Context *)ctx->DriverCtx)->UpdateTexturePalette((Mesa::Texture *)tObj->DriverData); +static void UpdateTexturePalette(GLcontext *ctx, struct gl_texture_object *texObj) { + ((Mesa::Context *)ctx)->UpdateTexturePalette((Mesa::Texture *)texObj); } static void CopyColorTable(GLcontext *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - ((Mesa::Context *)ctx->DriverCtx)->CopyColorTable(target, internalformat, x, y, width); + ((Mesa::Context *)ctx)->CopyColorTable(target, internalformat, x, y, width); } static void CopyColorSubTable(GLcontext *ctx, GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { - ((Mesa::Context *)ctx->DriverCtx)->CopyColorSubTable(target, start, x, y, width); + ((Mesa::Context *)ctx)->CopyColorSubTable(target, start, x, y, width); } static void CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { - ((Mesa::Context *)ctx->DriverCtx)->CopyConvolutionFilter1D(target, internalFormat, x, y, width); + ((Mesa::Context *)ctx)->CopyConvolutionFilter1D(target, internalFormat, x, y, width); } static void CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { - ((Mesa::Context *)ctx->DriverCtx)->CopyConvolutionFilter2D(target, internalFormat, x, y, width, height); + ((Mesa::Context *)ctx)->CopyConvolutionFilter2D(target, internalFormat, x, y, width, height); } static void AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) { - ((Mesa::Context *)ctx->DriverCtx)->AlphaFunc(func, ref); + ((Mesa::Context *)ctx)->AlphaFunc(func, ref); } static void BlendColor(GLcontext *ctx, const GLfloat color[4]) { - ((Mesa::Context *)ctx->DriverCtx)->BlendColor(color); + ((Mesa::Context *)ctx)->BlendColor(color); } static void BlendEquation(GLcontext *ctx, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->BlendEquation(mode); + ((Mesa::Context *)ctx)->BlendEquation(mode); } static void BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) { - ((Mesa::Context *)ctx->DriverCtx)->BlendFunc(sfactor, dfactor); + ((Mesa::Context *)ctx)->BlendFunc(sfactor, dfactor); } static void BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { - ((Mesa::Context *)ctx->DriverCtx)->BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorA, dfactorA); + ((Mesa::Context *)ctx)->BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorA, dfactorA); } static void ClearColor(GLcontext *ctx, const GLfloat color[4]) { - ((Mesa::Context *)ctx->DriverCtx)->ClearColor(color); + ((Mesa::Context *)ctx)->ClearColor(color); } static void ClearDepth(GLcontext *ctx, GLclampd d) { - ((Mesa::Context *)ctx->DriverCtx)->ClearDepth(d); + ((Mesa::Context *)ctx)->ClearDepth(d); } static void ClearIndex(GLcontext *ctx, GLuint index) { - ((Mesa::Context *)ctx->DriverCtx)->ClearIndex(index); + ((Mesa::Context *)ctx)->ClearIndex(index); } static void ClearStencil(GLcontext *ctx, GLint s) { - ((Mesa::Context *)ctx->DriverCtx)->ClearStencil(s); + ((Mesa::Context *)ctx)->ClearStencil(s); } static void ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation) { - ((Mesa::Context *)ctx->DriverCtx)->ClipPlane(plane, equation); + ((Mesa::Context *)ctx)->ClipPlane(plane, equation); } static void ColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { - ((Mesa::Context *)ctx->DriverCtx)->ColorMask(rmask, gmask, bmask, amask); + ((Mesa::Context *)ctx)->ColorMask(rmask, gmask, bmask, amask); } static void ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->ColorMaterial(face, mode); + ((Mesa::Context *)ctx)->ColorMaterial(face, mode); } static void CullFace(GLcontext *ctx, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->CullFace(mode); + ((Mesa::Context *)ctx)->CullFace(mode); } static void FrontFace(GLcontext *ctx, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->FrontFace(mode); + ((Mesa::Context *)ctx)->FrontFace(mode); } static void DepthFunc(GLcontext *ctx, GLenum func) { - ((Mesa::Context *)ctx->DriverCtx)->DepthFunc(func); + ((Mesa::Context *)ctx)->DepthFunc(func); } static void DepthMask(GLcontext *ctx, GLboolean flag) { - ((Mesa::Context *)ctx->DriverCtx)->DepthMask(flag); + ((Mesa::Context *)ctx)->DepthMask(flag); } static void DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval) { - ((Mesa::Context *)ctx->DriverCtx)->DepthRange(nearval, farval); + ((Mesa::Context *)ctx)->DepthRange(nearval, farval); } static void Enable(GLcontext*ctx, GLenum cap, GLboolean state) { - ((Mesa::Context *)ctx->DriverCtx)->Enable(cap, state); + ((Mesa::Context *)ctx)->Enable(cap, state); } static void Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *params) { - ((Mesa::Context *)ctx->DriverCtx)->Fogfv(pname, params); + ((Mesa::Context *)ctx)->Fogfv(pname, params); } static void Hint(GLcontext *ctx, GLenum target, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->Hint(target, mode); + ((Mesa::Context *)ctx)->Hint(target, mode); } static void IndexMask(GLcontext *ctx, GLuint mask) { - ((Mesa::Context *)ctx->DriverCtx)->IndexMask(mask); + ((Mesa::Context *)ctx)->IndexMask(mask); } static void Lightfv(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params) { - ((Mesa::Context *)ctx->DriverCtx)->Lightfv(light, pname, params); + ((Mesa::Context *)ctx)->Lightfv(light, pname, params); } static void LightModelfv(GLcontext *ctx, GLenum pname, const GLfloat *params) { - ((Mesa::Context *)ctx->DriverCtx)->LightModelfv(pname, params); + ((Mesa::Context *)ctx)->LightModelfv(pname, params); } static void LineStipple(GLcontext *ctx, GLint factor, GLushort pattern) { - ((Mesa::Context *)ctx->DriverCtx)->LineStipple(factor, pattern); + ((Mesa::Context *)ctx)->LineStipple(factor, pattern); } static void LineWidth(GLcontext *ctx, GLfloat width) { - ((Mesa::Context *)ctx->DriverCtx)->LineWidth(width); + ((Mesa::Context *)ctx)->LineWidth(width); } static void LogicOpcode(GLcontext *ctx, GLenum opcode) { - ((Mesa::Context *)ctx->DriverCtx)->LogicOpcode(opcode); + ((Mesa::Context *)ctx)->LogicOpcode(opcode); } static void PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *params) { - ((Mesa::Context *)ctx->DriverCtx)->PointParameterfv(pname, params); + ((Mesa::Context *)ctx)->PointParameterfv(pname, params); } static void PointSize(GLcontext *ctx, GLfloat size) { - ((Mesa::Context *)ctx->DriverCtx)->PointSize(size); + ((Mesa::Context *)ctx)->PointSize(size); } static void PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->PolygonMode(face, mode); + ((Mesa::Context *)ctx)->PolygonMode(face, mode); } static void PolygonOffset(GLcontext *ctx, GLfloat factor, GLfloat units) { - ((Mesa::Context *)ctx->DriverCtx)->PolygonOffset(factor, units); + ((Mesa::Context *)ctx)->PolygonOffset(factor, units); } static void PolygonStipple(GLcontext *ctx, const GLubyte *mask) { - ((Mesa::Context *)ctx->DriverCtx)->PolygonStipple(mask); + ((Mesa::Context *)ctx)->PolygonStipple(mask); } static void RenderMode(GLcontext *ctx, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->RenderMode(mode); + ((Mesa::Context *)ctx)->RenderMode(mode); } static void Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { - ((Mesa::Context *)ctx->DriverCtx)->Scissor(x, y, w, h); + ((Mesa::Context *)ctx)->Scissor(x, y, w, h); } static void ShadeModel(GLcontext *ctx, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->ShadeModel(mode); + ((Mesa::Context *)ctx)->ShadeModel(mode); } static void StencilFunc(GLcontext *ctx, GLenum func, GLint ref, GLuint mask) { - ((Mesa::Context *)ctx->DriverCtx)->StencilFunc(func, ref, mask); + ((Mesa::Context *)ctx)->StencilFunc(func, ref, mask); } static void StencilMask(GLcontext *ctx, GLuint mask) { - ((Mesa::Context *)ctx->DriverCtx)->StencilMask(mask); + ((Mesa::Context *)ctx)->StencilMask(mask); } static void StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass) { - ((Mesa::Context *)ctx->DriverCtx)->StencilOp(fail, zfail, zpass); + ((Mesa::Context *)ctx)->StencilOp(fail, zfail, zpass); } static void ActiveStencilFace(GLcontext *ctx, GLuint face) { - ((Mesa::Context *)ctx->DriverCtx)->ActiveStencilFace(face); + ((Mesa::Context *)ctx)->ActiveStencilFace(face); } static void TexGen(GLcontext *ctx, GLenum coord, GLenum pname, const GLfloat *params) { - ((Mesa::Context *)ctx->DriverCtx)->TexGen(coord, pname, params); + ((Mesa::Context *)ctx)->TexGen(coord, pname, params); } static void TexEnv(GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param) { - ((Mesa::Context *)ctx->DriverCtx)->TexEnv(target, pname, param); + ((Mesa::Context *)ctx)->TexEnv(target, pname, param); } static void TexParameter(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params) { - ((Mesa::Context *)ctx->DriverCtx)->TexParameter(target, texObj, pname, params); + ((Mesa::Context *)ctx)->TexParameter(target, texObj, pname, params); } static void TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat) { - ((Mesa::Context *)ctx->DriverCtx)->TextureMatrix(unit, mat); + ((Mesa::Context *)ctx)->TextureMatrix(unit, mat); } static void Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { - ((Mesa::Context *)ctx->DriverCtx)->Viewport(x, y, w, h); + ((Mesa::Context *)ctx)->Viewport(x, y, w, h); } static void VertexPointer(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->VertexPointer(size, type, stride, ptr); + ((Mesa::Context *)ctx)->VertexPointer(size, type, stride, ptr); } static void NormalPointer(GLcontext *ctx, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->NormalPointer(type, stride, ptr); + ((Mesa::Context *)ctx)->NormalPointer(type, stride, ptr); } static void ColorPointer(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->ColorPointer(size, type, stride, ptr); + ((Mesa::Context *)ctx)->ColorPointer(size, type, stride, ptr); } static void FogCoordPointer(GLcontext *ctx, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->FogCoordPointer(type, stride, ptr); + ((Mesa::Context *)ctx)->FogCoordPointer(type, stride, ptr); } static void IndexPointer(GLcontext *ctx, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->IndexPointer(type, stride, ptr); + ((Mesa::Context *)ctx)->IndexPointer(type, stride, ptr); } static void SecondaryColorPointer(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->SecondaryColorPointer(size, type, stride, ptr); + ((Mesa::Context *)ctx)->SecondaryColorPointer(size, type, stride, ptr); } static void TexCoordPointer(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->TexCoordPointer(size, type, stride, ptr); + ((Mesa::Context *)ctx)->TexCoordPointer(size, type, stride, ptr); } static void EdgeFlagPointer(GLcontext *ctx, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->EdgeFlagPointer(stride, ptr); + ((Mesa::Context *)ctx)->EdgeFlagPointer(stride, ptr); } static void VertexAttribPointer(GLcontext *ctx, GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - ((Mesa::Context *)ctx->DriverCtx)->VertexAttribPointer(index, size, type, stride, ptr); + ((Mesa::Context *)ctx)->VertexAttribPointer(index, size, type, stride, ptr); } static GLboolean GetBooleanv(GLcontext *ctx, GLenum pname, GLboolean *result) { - return ((Mesa::Context *)ctx->DriverCtx)->GetBooleanv(pname, result); + return ((Mesa::Context *)ctx)->GetBooleanv(pname, result); } static GLboolean GetDoublev(GLcontext *ctx, GLenum pname, GLdouble *result) { - return ((Mesa::Context *)ctx->DriverCtx)->GetDoublev(pname, result); + return ((Mesa::Context *)ctx)->GetDoublev(pname, result); } static GLboolean GetFloatv(GLcontext *ctx, GLenum pname, GLfloat *result) { - return ((Mesa::Context *)ctx->DriverCtx)->GetFloatv(pname, result); + return ((Mesa::Context *)ctx)->GetFloatv(pname, result); } static GLboolean GetIntegerv(GLcontext *ctx, GLenum pname, GLint *result) { - return ((Mesa::Context *)ctx->DriverCtx)->GetIntegerv(pname, result); + return ((Mesa::Context *)ctx)->GetIntegerv(pname, result); } static GLboolean GetPointerv(GLcontext *ctx, GLenum pname, GLvoid **result) { - return ((Mesa::Context *)ctx->DriverCtx)->GetPointerv(pname, result); + return ((Mesa::Context *)ctx)->GetPointerv(pname, result); } static void ValidateTnlModule(GLcontext *ctx, GLuint new_state) { - ((Mesa::Context *)ctx->DriverCtx)->ValidateTnlModule(new_state); + ((Mesa::Context *)ctx)->ValidateTnlModule(new_state); } static void FlushVertices(GLcontext *ctx, GLuint flags) { - ((Mesa::Context *)ctx->DriverCtx)->FlushVertices(flags); + ((Mesa::Context *)ctx)->FlushVertices(flags); } static void LightingSpaceChange(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->LightingSpaceChange(); + ((Mesa::Context *)ctx)->LightingSpaceChange(); } static void NewList(GLcontext *ctx, GLuint list, GLenum mode) { - ((Mesa::Context *)ctx->DriverCtx)->NewList(list, mode); + ((Mesa::Context *)ctx)->NewList(list, mode); } static void EndList(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->EndList(); + ((Mesa::Context *)ctx)->EndList(); } static void BeginCallList(GLcontext *ctx, GLuint list) { - ((Mesa::Context *)ctx->DriverCtx)->BeginCallList(list); + ((Mesa::Context *)ctx)->BeginCallList(list); } static void EndCallList(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->EndCallList(); + ((Mesa::Context *)ctx)->EndCallList(); } static void MakeCurrent(GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer) { -// ((Mesa::Context *)ctx->DriverCtx)->MakeCurrent((Mesa::Framebuffer *)drawBuffer, (Mesa::Framebuffer *)readBuffer); +// ((Mesa::Context *)ctx)->MakeCurrent((Mesa::Framebuffer *)drawBuffer, (Mesa::Framebuffer *)readBuffer); } static void LockArraysEXT(GLcontext *ctx, GLint first, GLsizei count) { - ((Mesa::Context *)ctx->DriverCtx)->LockArraysEXT(first, count); + ((Mesa::Context *)ctx)->LockArraysEXT(first, count); } static void UnlockArraysEXT(GLcontext *ctx) { - ((Mesa::Context *)ctx->DriverCtx)->UnlockArraysEXT(); + ((Mesa::Context *)ctx)->UnlockArraysEXT(); } } @@ -678,122 +681,127 @@ static void UnlockArraysEXT(GLcontext *ctx) { namespace Mesa { -bool Context::init(const Visual *visual, Context *sharedCtx, bool direct) { - if(!_mesa_initialize_context(&glCtx, &visual->glVisual, sharedCtx ? &sharedCtx->glCtx : NULL, (void *)this, direct)) +bool Context::init(const Mesa::Visual *visual, Context *sharedCtx, bool direct) { + memset((GLcontext *)this, 0, sizeof(GLcontext)); + + Driver.NewTextureObject = ::NewTextureObject; + Driver.NewTextureImage = ::NewTextureImage; + + if(!_mesa_initialize_context((GLcontext *)this, (GLvisual *)visual, sharedCtx ? (GLcontext *)sharedCtx : NULL, (void *)this, direct)) return false; - glCtx.Driver.GetString = ::GetString; - glCtx.Driver.UpdateState = ::UpdateState; - glCtx.Driver.Clear = ::Clear; - glCtx.Driver.DrawBuffer = ::DrawBuffer; - glCtx.Driver.ReadBuffer = ::ReadBuffer; - glCtx.Driver.GetBufferSize = ::GetBufferSize; - glCtx.Driver.ResizeBuffers = ::ResizeBuffers; - glCtx.Driver.Finish = ::Finish; - glCtx.Driver.Flush = ::Flush; - glCtx.Driver.Error = ::Error; - glCtx.Driver.Accum = ::Accum; - glCtx.Driver.DrawPixels = ::DrawPixels; - glCtx.Driver.ReadPixels = ::ReadPixels; - glCtx.Driver.CopyPixels = ::CopyPixels; - glCtx.Driver.Bitmap = ::Bitmap; - glCtx.Driver.ChooseTextureFormat = ::ChooseTextureFormat; - glCtx.Driver.TexImage1D = ::TexImage1D; - glCtx.Driver.TexImage2D = ::TexImage2D; - glCtx.Driver.TexImage3D = ::TexImage3D; - glCtx.Driver.TexSubImage1D = ::TexSubImage1D; - glCtx.Driver.TexSubImage2D = ::TexSubImage2D; - glCtx.Driver.TexSubImage3D = ::TexSubImage3D; - glCtx.Driver.CopyTexImage1D = ::CopyTexImage1D; - glCtx.Driver.CopyTexImage2D = ::CopyTexImage2D; - glCtx.Driver.CopyTexSubImage1D = ::CopyTexSubImage1D; - glCtx.Driver.CopyTexSubImage2D = ::CopyTexSubImage2D; - glCtx.Driver.CopyTexSubImage3D = ::CopyTexSubImage3D; - glCtx.Driver.TestProxyTexImage = ::TestProxyTexImage; - glCtx.Driver.CompressedTexImage1D = ::CompressedTexImage1D; - glCtx.Driver.CompressedTexImage2D = ::CompressedTexImage2D; - glCtx.Driver.CompressedTexImage3D = ::CompressedTexImage3D; - glCtx.Driver.CompressedTexSubImage1D = ::CompressedTexSubImage1D; - glCtx.Driver.CompressedTexSubImage2D = ::CompressedTexSubImage2D; - glCtx.Driver.CompressedTexSubImage3D = ::CompressedTexSubImage3D; - glCtx.Driver.BindTexture = ::BindTexture; -// glCtx.Driver.CreateTexture = ::CreateTexture; - glCtx.Driver.DeleteTexture = ::DeleteTexture; - glCtx.Driver.IsTextureResident = ::IsTextureResident; - glCtx.Driver.PrioritizeTexture = ::PrioritizeTexture; - glCtx.Driver.ActiveTexture = ::ActiveTexture; - glCtx.Driver.UpdateTexturePalette = ::UpdateTexturePalette; - glCtx.Driver.CopyColorTable = ::CopyColorTable; - glCtx.Driver.CopyColorSubTable = ::CopyColorSubTable; - glCtx.Driver.CopyConvolutionFilter1D = ::CopyConvolutionFilter1D; - glCtx.Driver.CopyConvolutionFilter2D = ::CopyConvolutionFilter2D; - glCtx.Driver.AlphaFunc = ::AlphaFunc; - glCtx.Driver.BlendColor = ::BlendColor; - glCtx.Driver.BlendEquation = ::BlendEquation; - glCtx.Driver.BlendFunc = ::BlendFunc; - glCtx.Driver.BlendFuncSeparate = ::BlendFuncSeparate; - glCtx.Driver.ClearColor = ::ClearColor; - glCtx.Driver.ClearDepth = ::ClearDepth; - glCtx.Driver.ClearIndex = ::ClearIndex; - glCtx.Driver.ClearStencil = ::ClearStencil; - glCtx.Driver.ClipPlane = ::ClipPlane; - glCtx.Driver.ColorMask = ::ColorMask; - glCtx.Driver.ColorMaterial = ::ColorMaterial; - glCtx.Driver.CullFace = ::CullFace; - glCtx.Driver.FrontFace = ::FrontFace; - glCtx.Driver.DepthFunc = ::DepthFunc; - glCtx.Driver.DepthMask = ::DepthMask; - glCtx.Driver.DepthRange = ::DepthRange; - glCtx.Driver.Enable = ::Enable; - glCtx.Driver.Fogfv = ::Fogfv; - glCtx.Driver.Hint = ::Hint; - glCtx.Driver.IndexMask = ::IndexMask; - glCtx.Driver.Lightfv = ::Lightfv; - glCtx.Driver.LightModelfv = ::LightModelfv; - glCtx.Driver.LineStipple = ::LineStipple; - glCtx.Driver.LineWidth = ::LineWidth; - glCtx.Driver.LogicOpcode = ::LogicOpcode; - glCtx.Driver.PointParameterfv = ::PointParameterfv; - glCtx.Driver.PointSize = ::PointSize; - glCtx.Driver.PolygonMode = ::PolygonMode; - glCtx.Driver.PolygonOffset = ::PolygonOffset; - glCtx.Driver.PolygonStipple = ::PolygonStipple; - glCtx.Driver.RenderMode = ::RenderMode; - glCtx.Driver.Scissor = ::Scissor; - glCtx.Driver.ShadeModel = ::ShadeModel; - glCtx.Driver.StencilFunc = ::StencilFunc; - glCtx.Driver.StencilMask = ::StencilMask; - glCtx.Driver.StencilOp = ::StencilOp; - glCtx.Driver.ActiveStencilFace = ::ActiveStencilFace; - glCtx.Driver.TexGen = ::TexGen; - glCtx.Driver.TexEnv = ::TexEnv; - glCtx.Driver.TexParameter = ::TexParameter; - glCtx.Driver.TextureMatrix = ::TextureMatrix; - glCtx.Driver.Viewport = ::Viewport; - glCtx.Driver.VertexPointer = ::VertexPointer; - glCtx.Driver.NormalPointer = ::NormalPointer; - glCtx.Driver.ColorPointer = ::ColorPointer; - glCtx.Driver.FogCoordPointer = ::FogCoordPointer; - glCtx.Driver.IndexPointer = ::IndexPointer; - glCtx.Driver.SecondaryColorPointer = ::SecondaryColorPointer; - glCtx.Driver.TexCoordPointer = ::TexCoordPointer; - glCtx.Driver.EdgeFlagPointer = ::EdgeFlagPointer; - glCtx.Driver.VertexAttribPointer = ::VertexAttribPointer; - glCtx.Driver.GetBooleanv = ::GetBooleanv; - glCtx.Driver.GetDoublev = ::GetDoublev; - glCtx.Driver.GetFloatv = ::GetFloatv; - glCtx.Driver.GetIntegerv = ::GetIntegerv; - glCtx.Driver.GetPointerv = ::GetPointerv; - glCtx.Driver.ValidateTnlModule = ::ValidateTnlModule; - glCtx.Driver.FlushVertices = ::FlushVertices; - glCtx.Driver.LightingSpaceChange = ::LightingSpaceChange; - glCtx.Driver.NewList = ::NewList; - glCtx.Driver.EndList = ::EndList; - glCtx.Driver.BeginCallList = ::BeginCallList; - glCtx.Driver.EndCallList = ::EndCallList; - glCtx.Driver.MakeCurrent = ::MakeCurrent; - glCtx.Driver.LockArraysEXT = ::LockArraysEXT; - glCtx.Driver.UnlockArraysEXT = ::UnlockArraysEXT; + // Set the driver callback functions + Driver.GetString = ::GetString; + Driver.UpdateState = ::UpdateState; + Driver.Clear = ::Clear; + Driver.DrawBuffer = ::DrawBuffer; + Driver.ReadBuffer = ::ReadBuffer; + Driver.GetBufferSize = ::GetBufferSize; + Driver.ResizeBuffers = ::ResizeBuffers; + Driver.Finish = ::Finish; + Driver.Flush = ::Flush; + Driver.Error = ::Error; + Driver.Accum = ::Accum; + Driver.DrawPixels = ::DrawPixels; + Driver.ReadPixels = ::ReadPixels; + Driver.CopyPixels = ::CopyPixels; + Driver.Bitmap = ::Bitmap; + Driver.ChooseTextureFormat = ::ChooseTextureFormat; + Driver.TexImage1D = ::TexImage1D; + Driver.TexImage2D = ::TexImage2D; + Driver.TexImage3D = ::TexImage3D; + Driver.TexSubImage1D = ::TexSubImage1D; + Driver.TexSubImage2D = ::TexSubImage2D; + Driver.TexSubImage3D = ::TexSubImage3D; + Driver.CopyTexImage1D = ::CopyTexImage1D; + Driver.CopyTexImage2D = ::CopyTexImage2D; + Driver.CopyTexSubImage1D = ::CopyTexSubImage1D; + Driver.CopyTexSubImage2D = ::CopyTexSubImage2D; + Driver.CopyTexSubImage3D = ::CopyTexSubImage3D; + Driver.TestProxyTexImage = ::TestProxyTexImage; + Driver.CompressedTexImage1D = ::CompressedTexImage1D; + Driver.CompressedTexImage2D = ::CompressedTexImage2D; + Driver.CompressedTexImage3D = ::CompressedTexImage3D; + Driver.CompressedTexSubImage1D = ::CompressedTexSubImage1D; + Driver.CompressedTexSubImage2D = ::CompressedTexSubImage2D; + Driver.CompressedTexSubImage3D = ::CompressedTexSubImage3D; + Driver.BindTexture = ::BindTexture; + Driver.DeleteTexture = ::DeleteTexture; + Driver.IsTextureResident = ::IsTextureResident; + Driver.PrioritizeTexture = ::PrioritizeTexture; + Driver.ActiveTexture = ::ActiveTexture; + Driver.UpdateTexturePalette = ::UpdateTexturePalette; + Driver.CopyColorTable = ::CopyColorTable; + Driver.CopyColorSubTable = ::CopyColorSubTable; + Driver.CopyConvolutionFilter1D = ::CopyConvolutionFilter1D; + Driver.CopyConvolutionFilter2D = ::CopyConvolutionFilter2D; + Driver.AlphaFunc = ::AlphaFunc; + Driver.BlendColor = ::BlendColor; + Driver.BlendEquation = ::BlendEquation; + Driver.BlendFunc = ::BlendFunc; + Driver.BlendFuncSeparate = ::BlendFuncSeparate; + Driver.ClearColor = ::ClearColor; + Driver.ClearDepth = ::ClearDepth; + Driver.ClearIndex = ::ClearIndex; + Driver.ClearStencil = ::ClearStencil; + Driver.ClipPlane = ::ClipPlane; + Driver.ColorMask = ::ColorMask; + Driver.ColorMaterial = ::ColorMaterial; + Driver.CullFace = ::CullFace; + Driver.FrontFace = ::FrontFace; + Driver.DepthFunc = ::DepthFunc; + Driver.DepthMask = ::DepthMask; + Driver.DepthRange = ::DepthRange; + Driver.Enable = ::Enable; + Driver.Fogfv = ::Fogfv; + Driver.Hint = ::Hint; + Driver.IndexMask = ::IndexMask; + Driver.Lightfv = ::Lightfv; + Driver.LightModelfv = ::LightModelfv; + Driver.LineStipple = ::LineStipple; + Driver.LineWidth = ::LineWidth; + Driver.LogicOpcode = ::LogicOpcode; + Driver.PointParameterfv = ::PointParameterfv; + Driver.PointSize = ::PointSize; + Driver.PolygonMode = ::PolygonMode; + Driver.PolygonOffset = ::PolygonOffset; + Driver.PolygonStipple = ::PolygonStipple; + Driver.RenderMode = ::RenderMode; + Driver.Scissor = ::Scissor; + Driver.ShadeModel = ::ShadeModel; + Driver.StencilFunc = ::StencilFunc; + Driver.StencilMask = ::StencilMask; + Driver.StencilOp = ::StencilOp; + Driver.ActiveStencilFace = ::ActiveStencilFace; + Driver.TexGen = ::TexGen; + Driver.TexEnv = ::TexEnv; + Driver.TexParameter = ::TexParameter; + Driver.TextureMatrix = ::TextureMatrix; + Driver.Viewport = ::Viewport; + Driver.VertexPointer = ::VertexPointer; + Driver.NormalPointer = ::NormalPointer; + Driver.ColorPointer = ::ColorPointer; + Driver.FogCoordPointer = ::FogCoordPointer; + Driver.IndexPointer = ::IndexPointer; + Driver.SecondaryColorPointer = ::SecondaryColorPointer; + Driver.TexCoordPointer = ::TexCoordPointer; + Driver.EdgeFlagPointer = ::EdgeFlagPointer; + Driver.VertexAttribPointer = ::VertexAttribPointer; + Driver.GetBooleanv = ::GetBooleanv; + Driver.GetDoublev = ::GetDoublev; + Driver.GetFloatv = ::GetFloatv; + Driver.GetIntegerv = ::GetIntegerv; + Driver.GetPointerv = ::GetPointerv; + Driver.ValidateTnlModule = ::ValidateTnlModule; + Driver.FlushVertices = ::FlushVertices; + Driver.LightingSpaceChange = ::LightingSpaceChange; + Driver.NewList = ::NewList; + Driver.EndList = ::EndList; + Driver.BeginCallList = ::BeginCallList; + Driver.EndCallList = ::EndCallList; + Driver.MakeCurrent = ::MakeCurrent; + Driver.LockArraysEXT = ::LockArraysEXT; + Driver.UnlockArraysEXT = ::UnlockArraysEXT; return true; } @@ -807,17 +815,18 @@ void Texture::image1D( GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ) { _mesa_store_teximage1d( - &context->glCtx, + (GLcontext *)context, target, level, internalFormat, width, border, format, type, - pixels, &context->glCtx.Unpack, - glTexObj, + pixels, + &context->Unpack, + (gl_texture_object *)this, (struct gl_texture_image *)image ); } @@ -831,18 +840,18 @@ void Texture::image2D( GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ) { _mesa_store_teximage2d( - &context->glCtx, + (GLcontext *)context, target, level, internalFormat, width, height, border, format, type, pixels, - &context->glCtx.Unpack, - glTexObj, + &context->Unpack, + (gl_texture_object *)this, image ); } @@ -856,18 +865,18 @@ void Texture::image3D( GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ) { _mesa_store_teximage3d( - &context->glCtx, + (GLcontext *)context, target, level, internalFormat, width, height, depth, border, format, type, pixels, - &context->glCtx.Unpack, - glTexObj, + &context->Unpack, + (gl_texture_object *)this, image ); } @@ -879,17 +888,17 @@ void Texture::subImage1D(Context *context, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ) { _mesa_store_texsubimage1d( - &context->glCtx, + (GLcontext *)context, target, level, xoffset, width, format, type, pixels, - &context->glCtx.Unpack, - glTexObj, + &context->Unpack, + (gl_texture_object *)this, image ); } @@ -902,17 +911,17 @@ void Texture::subImage2D( GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ) { _mesa_store_texsubimage2d( - &context->glCtx, + (GLcontext *)context, target, level, xoffset, yoffset, width, height, format, type, pixels, - &context->glCtx.Unpack, - glTexObj, + &context->Unpack, + (gl_texture_object *)this, image ); } @@ -925,17 +934,17 @@ void Texture::subImage3D( GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ) { _mesa_store_texsubimage3d( - &context->glCtx, + (GLcontext *)context, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, - &context->glCtx.Unpack, - glTexObj, + &context->Unpack, + (gl_texture_object *)this, image ); } diff --git a/src/mesa/drivers/dri/cxx/mesa.hxx b/src/mesa/drivers/dri/cxx/mesa.hxx index febc72f9ed..1c74a85916 100644 --- a/src/mesa/drivers/dri/cxx/mesa.hxx +++ b/src/mesa/drivers/dri/cxx/mesa.hxx @@ -6,10 +6,15 @@ */ +#include <cstring> + extern "C" { #include "context.h" +#include "mtypes.h" #include "texstore.h" +#include "texobj.h" +#include "teximage.h" #include "swrast/swrast.h" } @@ -29,27 +34,31 @@ extern "C" { namespace Mesa { //! Mesa texture image -typedef struct gl_texture_image Image; +class Image : public gl_texture_image { + public: + //! Constructor + Image(void) { + std::memset((gl_texture_image *)this, 0, sizeof(gl_texture_image)); + } + + //! Destructor + virtual ~Image() {} +} ; class Context; //! Mesa texture -class Texture { +class Texture : public gl_texture_object { public: - struct gl_texture_object *glTexObj; - - public: - Texture(void) { - glTexObj = NULL; - } - - void init(struct gl_texture_object *t) { - glTexObj = t; - glTexObj->DriverData = (void *)this; + //! Constructor + Texture(GLuint name, GLenum target) { + memset((gl_texture_object *)this, 0, sizeof(gl_texture_object)); + _mesa_initialize_texture_object((gl_texture_object *)this, name, target); } + //! Destructor virtual ~Texture() { - glTexObj->DriverData = NULL; + _mesa_free_texture_object_data((gl_texture_object *)this); } //! Determine if texture is loaded in texture memory @@ -72,7 +81,7 @@ class Texture { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ); //! Two-dimensional texture image @@ -85,7 +94,7 @@ class Texture { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ); //! Three-dimensional texture image @@ -98,7 +107,7 @@ class Texture { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ); //! One-dimensional texture subimage @@ -110,7 +119,7 @@ class Texture { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ); //! Two-dimensional texture subimage @@ -122,7 +131,7 @@ class Texture { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ); //! Three-dimensional texture subimage @@ -134,7 +143,7 @@ class Texture { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, - Image *image + Mesa::Image *image ); //@} @@ -149,7 +158,7 @@ class Texture { GLint border, GLenum format, GLsizei imageSize, const GLvoid *data, - Image *image + Mesa::Image *image ); //! Two-dimensional texture compressed image @@ -160,7 +169,7 @@ class Texture { GLint border, GLenum format, GLsizei imageSize, const GLvoid *data, - Image *image + Mesa::Image *image ); //! Three-dimensional texture compressed image @@ -171,7 +180,7 @@ class Texture { GLint border, GLenum format, GLsizei imageSize, const GLvoid *data, - Image *image + Mesa::Image *image ); //! One-dimensional texture compressed subimage @@ -182,7 +191,7 @@ class Texture { GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, - Image *image + Mesa::Image *image ); //! Two-dimensional texture compressed subimage @@ -193,7 +202,7 @@ class Texture { GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data, - Image *image + Mesa::Image *image ); //! Three-dimensional texture compressed subimage @@ -204,17 +213,14 @@ class Texture { GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data, - Image *image + Mesa::Image *image ); //@} } ; //! Visual -class Visual { - public: - GLvisual glVisual; - +class Visual /*: public GLvisual*/ { public: //! Initialize bool init( @@ -235,7 +241,7 @@ class Visual { GLint numSamples ) { return _mesa_initialize_visual( - &glVisual, + (GLvisual *)this, rgbFlag, dbFlag, stereoFlag, @@ -269,7 +275,7 @@ class Framebuffer : public GLframebuffer { ) { _mesa_initialize_framebuffer( (GLframebuffer *)this, - &visual->glVisual, + (GLvisual *)visual, swDepth, swStencil, swAccum, @@ -279,9 +285,7 @@ class Framebuffer : public GLframebuffer { } virtual ~Framebuffer() { - _mesa_free_framebuffer_data( - (GLframebuffer *)this - ); + _mesa_free_framebuffer_data((GLframebuffer *)this); } virtual void getSize(GLuint *width, GLuint *height) const = 0; @@ -298,23 +302,17 @@ class SoftwareRasterizer : public Rasterizer { //! Abstract TNL class TNL { - public: - - } ; //! Abstract Mesa context -class Context { - public: - GLcontext glCtx; - +class Context: public GLcontext { public: //! Initialize - bool init(const Visual *visual, Context *sharedCtx = NULL, bool direct = true); + bool init(const Mesa::Visual *visual, Context *sharedCtx = NULL, bool direct = true); //! Destructor virtual ~Context() { - _mesa_free_context_data(&glCtx); + _mesa_free_context_data((GLcontext *)this); } virtual void Error(GLenum error) {} @@ -329,7 +327,7 @@ class Context { //! Make context current void makeCurrent(Framebuffer *drawBuffer, Framebuffer *readBuffer) { _mesa_make_current2( - &glCtx, + (GLcontext *)this, (GLframebuffer *)drawBuffer, (GLframebuffer *)readBuffer ); @@ -337,23 +335,26 @@ class Context { //! Swap buffers void swapBuffers(void) { - _mesa_notifySwapBuffers( &glCtx ); + _mesa_notifySwapBuffers((GLcontext *)this); } - //! \name Texture object functions @{ - virtual Texture *AllocTexture(GLenum target) { - return new Texture; + virtual Mesa::Texture *NewTexture(GLuint name, GLenum target) { + return new Mesa::Texture(name, target); } - virtual void BindTexture(GLenum target, Texture *texture) {} + virtual void BindTexture(GLenum target, Mesa::Texture *texture) {} virtual void ActiveTexture(GLuint texUnitNumber) {} - virtual void UpdateTexturePalette(Texture *texture) {} + virtual void UpdateTexturePalette(Mesa::Texture *texture) {} //@} //! \name Texture image functions @{ + virtual Mesa::Image *NewImage() { + return new Mesa::Image; + } + virtual const struct gl_texture_format *ChooseTextureFormat(GLint internalFormat, GLenum srcFormat, GLenum srcType); virtual void CopyTexImage1D( @@ -366,7 +367,7 @@ class Context { GLint border ) { _swrast_copy_teximage1d( - &glCtx, + (GLcontext *)this, target, level, internalFormat, x, y, @@ -383,7 +384,7 @@ class Context { GLint border ) { _swrast_copy_teximage2d( - &glCtx, + (GLcontext *)this, target, level, internalFormat, x, y, @@ -399,7 +400,7 @@ class Context { GLsizei width ) { _swrast_copy_texsubimage1d( - &glCtx, + (GLcontext *)this, target, level, xoffset, x, y, @@ -414,7 +415,7 @@ class Context { GLsizei width, GLsizei height ) { _swrast_copy_texsubimage2d( - &glCtx, + (GLcontext *)this, target, level, xoffset, yoffset, x, y, @@ -429,7 +430,7 @@ class Context { GLsizei width, GLsizei height ) { _swrast_copy_texsubimage3d( - &glCtx, + (GLcontext *)this, target, level, xoffset, yoffset, zoffset, x, y, @@ -445,7 +446,7 @@ class Context { GLint border ) { return _mesa_test_proxy_teximage( - &glCtx, + (GLcontext *)this, target, level, internalFormat, format, type, @@ -577,3 +578,5 @@ class Driver { } ; } + +/* :vim: set sw=2 ts=2 noet : */ |